@@ -37,6 +37,9 @@ def get_ext_filename(self, ext_name):
3737 def conan_install (self , boost_version , conan_toolchain_path ):
3838 """Run the Conan"""
3939
40+ # Create default profile if it doesn't exist (Conan 2 requirement)
41+ check_call (["conan" , "profile" , "detect" , "--force" ])
42+
4043 # This modified conanfile.py for boost does not link libpython*.so
4144 # When building a platform wheel, we don't want to link libpython*.so.
4245 mod_conan_path = "conan_boost_mod"
@@ -47,72 +50,32 @@ def conan_install(self, boost_version, conan_toolchain_path):
4750 "conan" ,
4851 "export" ,
4952 f"{ mod_conan_path } /all/" ,
50- f"{ boost_version } @chris/mod_boost" ,
53+ f"--name=boost" ,
54+ f"--version={ boost_version } " ,
55+ f"--user=chris" ,
56+ f"--channel=mod_boost" ,
5157 ]
5258 )
5359
54- without_python_lib = "boost:without_python_lib=False"
55- boost_version_string = f"boost/{ boost_version } @chris/mod_boost"
56- without_stacktrace = "False"
57-
58- if sys .platform != "win32" :
59- # if no windows builds, compile boost without python lib.a/.so/.dylib
60- without_python_lib = "boost:without_python_lib=True"
61-
62- if "macosx_arm64" in os .environ ["CIBW_BUILD" ]:
63- # does not work on macos arm64 for some reason
64- without_stacktrace = "True"
65-
66- macos_libs = ""
67- if "macosx" in os .environ ["CIBW_BUILD" ]:
68- ## install these libraries to meet the development target
69- macos_libs = """
70- pixman/0.43.4
71- cairo/1.18.0
72- libpng/1.6.43
73- fontconfig/2.15.0
74- freetype/2.13.2
75- """
76-
77- conanfile = f"""\
78- [requires]
79- { boost_version_string }
80- { macos_libs }
81-
82- [generators]
83- deploy
84- CMakeDeps
85- CMakeToolchain
86- VirtualRunEnv
87-
88- [options]
89- boost:shared=True
90- boost:without_python=False
91- { without_python_lib }
92- boost:python_executable={ sys .executable }
93- boost:without_stacktrace={ without_stacktrace }
94- """
95- # boost:debug_level=1
96-
97- Path ("conanfile.txt" ).write_text (dedent (conanfile ))
98-
99- # run conan install
60+ # run conan install using conanfile.py
10061 cmd = [
10162 "conan" ,
10263 "install" ,
103- "conanfile.txt" ,
64+ "." , # Use current directory with conanfile.py
10465 # build all missing
10566 "--build=missing" ,
106- "-if " ,
67+ "--output-folder " ,
10768 f"{ conan_toolchain_path } " ,
69+ # copies files to output folder
70+ "--deployer=direct_deploy" ,
10871 ]
10972
11073 if sys .platform == "win32" :
111- cmd += ["-pr:b " , "default" ]
74+ cmd += ["--profile:build " , "default" ]
11275
11376 # but force build b2 on linux
11477 if "linux" in sys .platform :
115- cmd += ["--build=b2" , "-pr:b " , "default" ]
78+ cmd += ["--build=b2/* " , "--profile:build " , "default" ]
11679
11780 check_call (cmd )
11881
@@ -355,8 +318,8 @@ def to_win_path(pt: Path):
355318 # While repairing the wheels, the built libs need to be copied to the platform wheels
356319 # Also, the libs needs to be accessible for building the stubs
357320 rdkit_lib_path = rdkit_install_path / "lib"
358- boost_lib_path = conan_toolchain_path / "boost" / "lib"
359- boost_lib_path_bin_windows_only = conan_toolchain_path / "boost" / "bin"
321+ boost_lib_path = conan_toolchain_path / "direct_deploy" / " boost" / "lib"
322+ boost_lib_path_bin_windows_only = conan_toolchain_path / "direct_deploy" / " boost" / "bin"
360323
361324 cmds = []
362325 if "linux" in sys .platform :
@@ -407,6 +370,7 @@ def to_win_path(pt: Path):
407370 [copy_file (i , str (to_path )) for i in boost_lib_path .rglob ("*dylib" )]
408371
409372 # Build the RDKit stubs
373+
410374 cmds += [
411375 f"cmake --build build --config Release --target stubs -v" ,
412376 ]
0 commit comments