diff --git a/recipes/boost/all/conanfile.py b/recipes/boost/all/conanfile.py index 92d9a6e0d377c3..359e4a39d7c2dc 100644 --- a/recipes/boost/all/conanfile.py +++ b/recipes/boost/all/conanfile.py @@ -238,8 +238,8 @@ def config_options(self): if "without_{}".format(opt_name) not in self.options: raise ConanException("{} has the configure options {} which is not available in conanfile.py".format(self._dependency_filename, opt_name)) - # libbacktrace cannot be built on Visual Studio - if self.settings.compiler == "Visual Studio": + # stacktrace_backtrace not supported on Windows + if self.settings.os == "Windows": del self.options.with_stacktrace_backtrace # nowide requires a c++11-able compiler + movable std::fstream: change default to not build on compiler with too old default c++ standard or too low compiler.cppstd @@ -307,7 +307,7 @@ def _shared(self): @property def _stacktrace_addr2line_available(self): - return not self.options.header_only and not self.options.without_stacktrace and self.settings.compiler != "Visual Studio" + return not self.options.header_only and not self.options.without_stacktrace and self.settings.os != "Windows" def configure(self): if self.options.header_only: @@ -457,10 +457,9 @@ def requirements(self): if self._with_lzma: self.requires("xz_utils/5.2.5") if self._with_zstd: - self.requires("zstd/1.4.9") + self.requires("zstd/1.5.0") if self._with_stacktrace_backtrace: self.requires("libbacktrace/cci.20210118") - self.requires("libunwind/1.5.0") if self._with_icu: self.requires("icu/68.2") @@ -481,8 +480,8 @@ def package_id(self): self.info.options.python_version = self._python_version def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("boost_%s" % self.version.replace(".", "_"), self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) @@ -740,7 +739,7 @@ def build(self): "/* thread_local */", "thread_local", strict=False) tools.replace_in_file(os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "/* static __thread */", "static __thread", strict=False) - if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) < 6: + if self.settings.compiler == "apple-clang" or (self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) < 6): tools.replace_in_file(os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "thread_local", "/* thread_local */") tools.replace_in_file(os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), @@ -1137,9 +1136,8 @@ def create_library_config(deps_name, name): asflags = tools.get_env("ASFLAGS", "") + " " if self._with_stacktrace_backtrace: - for l in ("libbacktrace", "libunwind"): - cppflags += " ".join("-I{}".format(p) for p in self.deps_cpp_info[l].include_paths) + " " - ldflags += " ".join("-L{}".format(p) for p in self.deps_cpp_info[l].lib_paths) + " " + cppflags += " ".join("-I{}".format(p) for p in self.deps_cpp_info["libbacktrace"].include_paths) + " " + ldflags += " ".join("-L{}".format(p) for p in self.deps_cpp_info["libbacktrace"].lib_paths) + " " if cxxflags.strip(): contents += '"%s" ' % cxxflags.strip() @@ -1238,7 +1236,7 @@ def package(self): if dll_pdbs: tools.mkdir(os.path.join(self.package_folder, "bin")) for bin_file in dll_pdbs: - os.rename(bin_file, os.path.join(self.package_folder, "bin", os.path.basename(bin_file))) + tools.rename(bin_file, os.path.join(self.package_folder, "bin", os.path.basename(bin_file))) tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") @@ -1407,7 +1405,7 @@ def filter_transform_module_libraries(names): for name in names: if name in ("boost_stacktrace_windbg", "boost_stacktrace_windbg_cached") and self.settings.os != "Windows": continue - if name in ("boost_stacktrace_addr2line", "boost_stacktrace_backtrace", "boost_stacktrace_basic",) and self.settings.compiler == "Visual Studio": + if name in ("boost_stacktrace_addr2line", "boost_stacktrace_backtrace", "boost_stacktrace_basic",) and self.settings.os == "Windows": continue if not self.options.get_safe("numa") and "_numa" in name: continue @@ -1473,17 +1471,17 @@ def filter_transform_module_libraries(names): if self._with_stacktrace_backtrace: self.cpp_info.components["stacktrace_backtrace"].defines.append("BOOST_STACKTRACE_USE_BACKTRACE") - self.cpp_info.components["stacktrace_backtrace"].system_libs.append("dl") - self.cpp_info.components["stacktrace_backtrace"].requires.extend([ - "libunwind::libunwind", - "libbacktrace::libbacktrace", - ]) + self.cpp_info.components["stacktrace_backtrace"].requires.append("libbacktrace::libbacktrace") self.cpp_info.components["stacktrace_noop"].defines.append("BOOST_STACKTRACE_USE_NOOP") if self.settings.os == "Windows": self.cpp_info.components["stacktrace_windb"].defines.append("BOOST_STACKTRACE_USE_WINDBG") + self.cpp_info.components["stacktrace_windb"].system_libs.extend(["ole32", "dbgeng"]) self.cpp_info.components["stacktrace_windb_cached"].defines.append("BOOST_STACKTRACE_USE_WINDBG_CACHED") + self.cpp_info.components["stacktrace_windb_cached"].system_libs.extend(["ole32", "dbgeng"]) + elif tools.is_apple_os(self.settings.os): + self.cpp_info.components["stacktrace"].defines.append("BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED") if not self.options.without_python: pyversion = tools.Version(self._python_version) diff --git a/recipes/boost/all/test_package/CMakeLists.txt b/recipes/boost/all/test_package/CMakeLists.txt index 5ef223512573fd..d9fcc60a94ace3 100644 --- a/recipes/boost/all/test_package/CMakeLists.txt +++ b/recipes/boost/all/test_package/CMakeLists.txt @@ -78,15 +78,9 @@ if(NOT HEADER_ONLY) if(WITH_STACKTRACE) find_package(Boost COMPONENTS stacktrace REQUIRED) - if(NOT MSVC) - add_executable(stacktrace_basic_exe stacktrace.cpp) - target_compile_definitions(stacktrace_basic_exe PRIVATE TEST_STACKTRACE_IMPL=3) - target_link_libraries(stacktrace_basic_exe PRIVATE Boost::stacktrace_basic) - endif() - - add_executable(stacktrace_noop_exe stacktrace.cpp) - target_compile_definitions(stacktrace_noop_exe PRIVATE TEST_STACKTRACE_IMPL=4) - target_link_libraries(stacktrace_noop_exe PRIVATE Boost::stacktrace_noop) + add_executable(stacktrace_noop_exe stacktrace.cpp) + target_compile_definitions(stacktrace_noop_exe PRIVATE TEST_STACKTRACE_IMPL=4) + target_link_libraries(stacktrace_noop_exe PRIVATE Boost::stacktrace_noop) if(WIN32) add_executable(stacktrace_windbg_exe stacktrace.cpp) @@ -96,6 +90,10 @@ if(NOT HEADER_ONLY) add_executable(stacktrace_windbg_cached_exe stacktrace.cpp) target_compile_definitions(stacktrace_windbg_cached_exe PRIVATE TEST_STACKTRACE_IMPL=6) target_link_libraries(stacktrace_windbg_cached_exe PRIVATE Boost::stacktrace_windbg_cached) + else() + add_executable(stacktrace_basic_exe stacktrace.cpp) + target_compile_definitions(stacktrace_basic_exe PRIVATE TEST_STACKTRACE_IMPL=3) + target_link_libraries(stacktrace_basic_exe PRIVATE Boost::stacktrace_basic) endif() endif() diff --git a/recipes/boost/all/test_package/conanfile.py b/recipes/boost/all/test_package/conanfile.py index 3836803096b48f..9dfea8ad218ac0 100644 --- a/recipes/boost/all/test_package/conanfile.py +++ b/recipes/boost/all/test_package/conanfile.py @@ -71,13 +71,13 @@ def test(self): self.run("{} {}".format(self.options["boost"].python_executable, os.path.join(self.source_folder, "python.py")), run_environment=True) self.run(os.path.join("bin", "numpy_exe"), run_environment=True) if not self.options["boost"].without_stacktrace: - if self.settings.compiler != "Visual Studio": - self.run(os.path.join("bin", "stacktrace_basic_exe"), run_environment=True) self.run(os.path.join("bin", "stacktrace_noop_exe"), run_environment=True) if str(self.deps_user_info["boost"].stacktrace_addr2line_available) == "True": self.run(os.path.join("bin", "stacktrace_addr2line_exe"), run_environment=True) if self.settings.os == "Windows": self.run(os.path.join("bin", "stacktrace_windbg_exe"), run_environment=True) self.run(os.path.join("bin", "stacktrace_windbg_cached_exe"), run_environment=True) + else: + self.run(os.path.join("bin", "stacktrace_basic_exe"), run_environment=True) if self._boost_option("with_stacktrace_backtrace", False): self.run(os.path.join("bin", "stacktrace_backtrace_exe"), run_environment=True)