From c18f4617fa225a85df878f723730fccd2b607376 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 9 Feb 2022 00:59:21 +0300 Subject: [PATCH] [boost-modular-build-helper] [boost-uninstall] use system layout --- .../boost-modular-build-helper/CMakeLists.txt | 1 + .../boost-modular-build.cmake | 58 ++----------------- ports/boost-uninstall/portfile.cmake | 12 ++++ .../boost-uninstall/vcpkg-cmake-wrapper.cmake | 7 +-- versions/b-/boost-modular-build-helper.json | 2 +- versions/b-/boost-uninstall.json | 2 +- 6 files changed, 23 insertions(+), 59 deletions(-) diff --git a/ports/boost-modular-build-helper/CMakeLists.txt b/ports/boost-modular-build-helper/CMakeLists.txt index 21902016e33bd3..0142391fce43ae 100644 --- a/ports/boost-modular-build-helper/CMakeLists.txt +++ b/ports/boost-modular-build-helper/CMakeLists.txt @@ -283,6 +283,7 @@ add_custom_target(boost ALL --debug-generators --ignore-site-config --hash + --layout=system -q debug-symbols=on # Enable debugging level 2. diff --git a/ports/boost-modular-build-helper/boost-modular-build.cmake b/ports/boost-modular-build-helper/boost-modular-build.cmake index bc9556e3c15fdd..a33ae517537a83 100644 --- a/ports/boost-modular-build-helper/boost-modular-build.cmake +++ b/ports/boost-modular-build-helper/boost-modular-build.cmake @@ -38,21 +38,13 @@ function(boost_modular_build) else() message(FATAL_ERROR "Could not find b2 in ${BOOST_BUILD_PATH}") endif() - + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(BOOST_LIB_PREFIX lib) + endif() if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - set(BOOST_LIB_PREFIX) - if(VCPKG_PLATFORM_TOOLSET MATCHES "v14.") - set(BOOST_LIB_RELEASE_SUFFIX -vc140-mt.lib) - set(BOOST_LIB_DEBUG_SUFFIX -vc140-mt-gd.lib) - elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v120") - set(BOOST_LIB_RELEASE_SUFFIX -vc120-mt.lib) - set(BOOST_LIB_DEBUG_SUFFIX -vc120-mt-gd.lib) - else() - set(BOOST_LIB_RELEASE_SUFFIX .lib) - set(BOOST_LIB_DEBUG_SUFFIX d.lib) - endif() + set(BOOST_LIB_RELEASE_SUFFIX .lib) + set(BOOST_LIB_DEBUG_SUFFIX .lib) else() - set(BOOST_LIB_PREFIX lib) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32") set(BOOST_LIB_RELEASE_SUFFIX .a) set(BOOST_LIB_DEBUG_SUFFIX .a) @@ -147,46 +139,6 @@ function(boost_modular_build) "${CURRENT_PACKAGES_DIR}/debug/bin/*.pyd" ) - file(GLOB INSTALLED_LIBS "${CURRENT_PACKAGES_DIR}/debug/lib/*.lib" "${CURRENT_PACKAGES_DIR}/lib/*.lib") - foreach(LIB IN LISTS INSTALLED_LIBS) - get_filename_component(OLD_FILENAME ${LIB} NAME) - get_filename_component(DIRECTORY_OF_LIB_FILE ${LIB} DIRECTORY) - string(REPLACE "libboost_" "boost_" NEW_FILENAME ${OLD_FILENAME}) - string(REPLACE "-s-" "-" NEW_FILENAME ${NEW_FILENAME}) # For Release libs - string(REPLACE "-vc141-" "-vc140-" NEW_FILENAME ${NEW_FILENAME}) # To merge VS2017 and VS2015 binaries - string(REPLACE "-vc142-" "-vc140-" NEW_FILENAME ${NEW_FILENAME}) # To merge VS2019 and VS2015 binaries - string(REPLACE "-vc143-" "-vc140-" NEW_FILENAME ${NEW_FILENAME}) # To merge VS2022 and VS2015 binaries - string(REPLACE "-sgd-" "-gd-" NEW_FILENAME ${NEW_FILENAME}) # For Debug libs - string(REPLACE "-sgyd-" "-gyd-" NEW_FILENAME ${NEW_FILENAME}) # For Debug libs - string(REPLACE "-gyd-" "-gd-" NEW_FILENAME ${NEW_FILENAME}) # For Debug libs with python debugging - string(REPLACE "-x32-" "-" NEW_FILENAME ${NEW_FILENAME}) # To enable CMake 3.10 and earlier to locate the binaries - string(REPLACE "-x64-" "-" NEW_FILENAME ${NEW_FILENAME}) # To enable CMake 3.10 and earlier to locate the binaries - string(REPLACE "-a32-" "-" NEW_FILENAME ${NEW_FILENAME}) # To enable CMake 3.10 and earlier to locate the binaries - string(REPLACE "-a64-" "-" NEW_FILENAME ${NEW_FILENAME}) # To enable CMake 3.10 and earlier to locate the binaries - string(REPLACE "-${BOOST_VERSION_ABI_TAG}" "" NEW_FILENAME ${NEW_FILENAME}) # To enable CMake > 3.10 to locate the binaries - if("${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}" STREQUAL "${DIRECTORY_OF_LIB_FILE}/${OLD_FILENAME}") - # nothing to do - elseif(EXISTS "${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}") - file(REMOVE "${DIRECTORY_OF_LIB_FILE}/${OLD_FILENAME}") - else() - file(RENAME "${DIRECTORY_OF_LIB_FILE}/${OLD_FILENAME}" "${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}") - endif() - endforeach() - # Similar for mingw - file(GLOB INSTALLED_LIBS "${CURRENT_PACKAGES_DIR}/debug/lib/*-mgw*-*.a" "${CURRENT_PACKAGES_DIR}/lib/*-mgw*-*.a") - foreach(LIB IN LISTS INSTALLED_LIBS) - get_filename_component(OLD_FILENAME "${LIB}" NAME) - get_filename_component(DIRECTORY_OF_LIB_FILE "${LIB}" DIRECTORY) - string(REGEX REPLACE "-mgw[0-9]+-.*[0-9](\\.dll\\.a|\\.a)$" "\\1" NEW_FILENAME "${OLD_FILENAME}") - if("${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}" STREQUAL "${DIRECTORY_OF_LIB_FILE}/${OLD_FILENAME}") - # nothing to do - elseif(EXISTS "${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}") - file(REMOVE "${DIRECTORY_OF_LIB_FILE}/${OLD_FILENAME}") - else() - file(RENAME "${DIRECTORY_OF_LIB_FILE}/${OLD_FILENAME}" "${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}") - endif() - endforeach() - # boost-regex[icu] and boost-locale[icu] generate has_icu.lib if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/has_icu.lib") file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/has_icu.lib") diff --git a/ports/boost-uninstall/portfile.cmake b/ports/boost-uninstall/portfile.cmake index 07fa297317943b..95b5dfd0bcc46c 100644 --- a/ports/boost-uninstall/portfile.cmake +++ b/ports/boost-uninstall/portfile.cmake @@ -3,4 +3,16 @@ set(VCPKG_POLICY_EMPTY_PACKAGE enabled) message(STATUS "\nPlease use the following command when you need to remove all boost ports/components:\n\ \"./vcpkg remove boost-uninstall:${TARGET_TRIPLET} --recurse\"\n") +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(BOOST_STATIC_LINKAGE OFF) +else() + set(BOOST_STATIC_LINKAGE ON) +endif() +if(VCPKG_CRT_LINKAGE STREQUAL dynamic) + set(BOOST_STATIC_CRT_LINKAGE OFF) +else() + set(BOOST_STATIC_CRT_LINKAGE ON) +endif() + + configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/boost/vcpkg-cmake-wrapper.cmake" @ONLY) \ No newline at end of file diff --git a/ports/boost-uninstall/vcpkg-cmake-wrapper.cmake b/ports/boost-uninstall/vcpkg-cmake-wrapper.cmake index d3e5109b2ad842..ee79c3e497b23c 100644 --- a/ports/boost-uninstall/vcpkg-cmake-wrapper.cmake +++ b/ports/boost-uninstall/vcpkg-cmake-wrapper.cmake @@ -1,11 +1,10 @@ -set(Boost_USE_STATIC_LIBS OFF) +set(Boost_USE_STATIC_LIBS @BOOST_STATIC_LINKAGE@) set(Boost_USE_MULTITHREADED ON) -unset(Boost_USE_STATIC_RUNTIME) set(Boost_NO_BOOST_CMAKE ON) -unset(Boost_USE_STATIC_RUNTIME CACHE) +set(Boost_USE_STATIC_RUNTIME @BOOST_STATIC_CRT_LINKAGE@) if("${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v120") set(Boost_COMPILER "-vc120") else() set(Boost_COMPILER "-vc140") endif() -_find_package(${ARGS}) \ No newline at end of file +_find_package(${ARGS}) diff --git a/versions/b-/boost-modular-build-helper.json b/versions/b-/boost-modular-build-helper.json index aa50616557fcf3..fe5401727d00f8 100644 --- a/versions/b-/boost-modular-build-helper.json +++ b/versions/b-/boost-modular-build-helper.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "5c1a238cc20c885e785bc05a36b974deb5e02db7", + "git-tree": "935e62328eafb8241b30648660fa9546df3633b8", "version": "1.82.0", "port-version": 1 }, diff --git a/versions/b-/boost-uninstall.json b/versions/b-/boost-uninstall.json index f17b69f4dba1ae..72ee830b5707c3 100644 --- a/versions/b-/boost-uninstall.json +++ b/versions/b-/boost-uninstall.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "d96807810fa612b038f9268c8df545d421fda1a6", + "git-tree": "743779ee6c55d462d8506e8bf065093d02e7bb18", "version": "1.82.0", "port-version": 1 },