99from conan import ConanFile
1010from conan .tools .build .flags import cppstd_flag
1111from conan .tools .env import Environment
12- from conan .tools .files import get , copy , collect_libs , files
12+ from conan .tools .files import get , copy , collect_libs , files , patch
1313from conan .tools .microsoft import is_msvc
1414from conan .tools .layout import basic_layout
1515from conan .tools .microsoft .visual import msvc_version_to_toolset_version
@@ -21,7 +21,7 @@ class ConanRecipe(ConanFile):
2121 name = "boost"
2222 display_name = "Boost"
2323 mli_name = "None"
24- version = "1.84 .0"
24+ version = "1.85 .0"
2525 homepage = "https://www.boost.org"
2626 description = "Boost provides free peer-reviewed portable C++ source libraries"
2727 license = "BSL-1.0"
@@ -68,11 +68,16 @@ def layout(self):
6868 basic_layout (self , src_folder = "src" )
6969
7070 def source (self ):
71- major , minor , patch = self .version .split ("." )[:3 ]
72- get (self ,
73- sha256 = "cc4b893acf645c9d4b698e9a0f08ca8846aa5d6c68275c14c3e7949c24109454" ,
74- url = f"https://boostorg.jfrog.io/artifactory/main/release/{ self .version } /source/boost_{ major } _{ minor } _{ patch } .tar.bz2" ,
75- strip_root = True
71+ get (
72+ self ,
73+ sha256 = "7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617" ,
74+ url = f"https://boostorg.jfrog.io/artifactory/main/release/{ self .version } /source/boost_{ self .version .replace ('.' ,'_' )} .tar.bz2" ,
75+ strip_root = True ,
76+ )
77+ patch (
78+ self ,
79+ patch_file = "patches/001-b2_update.patch" ,
80+ patch_description = "Update b2 to v5.2.1 for Boost 1.85.0 to fix build issues with newer MSVC versions" ,
7681 )
7782
7883 def build (self ):
@@ -81,12 +86,14 @@ def build(self):
8186 flags = self ._get_build_flags ()
8287 b2dir = self .source_path / "tools" / "build"
8388 b2exe = b2dir / ("b2.exe" if self .settings .os == "Windows" else "b2" )
84- b2 = (f'{ b2exe } { " " .join (flags )} '
85- f'-j{ os .cpu_count ()} '
86- f'--abbreviate-paths '
87- f'--debug-configuration '
88- f'--disable-icu '
89- f'--build-dir="{ self .build_folder } "' )
89+ b2 = (
90+ f'{ b2exe } { " " .join (flags )} '
91+ f"-j{ os .cpu_count ()} "
92+ f"--abbreviate-paths "
93+ f"--debug-configuration "
94+ f"--disable-icu "
95+ f'--build-dir="{ self .build_folder } "'
96+ )
9097
9198 # to locate user config jam (BOOST_BUILD_PATH)
9299 with files .chdir (self , self .source_folder ):
@@ -96,8 +103,7 @@ def build(self):
96103 self .run (b2 )
97104
98105 def package (self ):
99- copy (self , pattern = "*" , src = self .source_path / "boost" ,
100- dst = self .package_path / "include" / "boost" , excludes = "*/CMakeLists.txt" )
106+ copy (self , pattern = "*" , src = self .source_path / "boost" , dst = self .package_path / "include" / "boost" , excludes = "*/CMakeLists.txt" )
101107 copy (self , "LICENSE_1_0.txt" , src = self .source_path , dst = self .package_path / "licenses" )
102108
103109 out_lib_dir = self .source_path / "stage" / "lib"
@@ -134,8 +140,7 @@ def package_info(self):
134140
135141 self .cpp_info .components ["diagnostic_definitions" ].libs = []
136142 self .cpp_info .components ["diagnostic_definitions" ].defines = ["BOOST_LIB_DIAGNOSTIC" ]
137- self .cpp_info .components ["diagnostic_definitions" ].set_property (
138- "cmake_target_name" , f"Boost::diagnostic_definitions" )
143+ self .cpp_info .components ["diagnostic_definitions" ].set_property ("cmake_target_name" , f"Boost::diagnostic_definitions" )
139144
140145 # A target defined by CMake's original Boost find package and used by openvdb
141146 self .cpp_info .components ["disable_autolinking" ].libs = []
@@ -144,7 +149,7 @@ def package_info(self):
144149
145150 for lib in collect_libs (self ):
146151 # remove boost_ prefix and any suffix
147- comp = lib [lib .index ("_" ) + 1 :].split ('-' )[0 ]
152+ comp = lib [lib .index ("_" ) + 1 :].split ("-" )[0 ]
148153
149154 self .output .info (f"creating component { comp } " )
150155
@@ -242,9 +247,9 @@ def _get_build_flags(self):
242247 zlib_info = self .dependencies ["zlib" ].cpp_info
243248 zlib_name = "zlib" if self .settings .os == "Windows" else "z"
244249 debug_suffix = "_d" if self .settings .build_type == "Debug" else ""
245- flags .append ('-sZLIB_INCLUDE="%s"' % zlib_info .includedirs [0 ].replace (' \\ ' , '/' ))
246- flags .append ('-sZLIB_LIBPATH="%s"' % zlib_info .libdirs [0 ].replace (' \\ ' , '/' ))
247- flags .append (f' -sZLIB_BINARY={ zlib_name } { debug_suffix } ' )
250+ flags .append ('-sZLIB_INCLUDE="%s"' % zlib_info .includedirs [0 ].replace (" \\ " , "/" ))
251+ flags .append ('-sZLIB_LIBPATH="%s"' % zlib_info .libdirs [0 ].replace (" \\ " , "/" ))
252+ flags .append (f" -sZLIB_BINARY={ zlib_name } { debug_suffix } " )
248253
249254 flags .append ("boost.locale.iconv=on" )
250255 flags .append ("boost.locale.icu=off" )
0 commit comments