Skip to content

Commit

Permalink
[boost-modular-build-helper] [boost-uninstall] use system layout
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalyster committed May 30, 2023
1 parent 1c5a340 commit c18f461
Showing 6 changed files with 23 additions and 59 deletions.
1 change: 1 addition & 0 deletions ports/boost-modular-build-helper/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.
58 changes: 5 additions & 53 deletions ports/boost-modular-build-helper/boost-modular-build.cmake
Original file line number Diff line number Diff line change
@@ -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")
12 changes: 12 additions & 0 deletions ports/boost-uninstall/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 3 additions & 4 deletions ports/boost-uninstall/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -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})
_find_package(${ARGS})
2 changes: 1 addition & 1 deletion versions/b-/boost-modular-build-helper.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"versions": [
{
"git-tree": "5c1a238cc20c885e785bc05a36b974deb5e02db7",
"git-tree": "935e62328eafb8241b30648660fa9546df3633b8",
"version": "1.82.0",
"port-version": 1
},
2 changes: 1 addition & 1 deletion versions/b-/boost-uninstall.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"versions": [
{
"git-tree": "d96807810fa612b038f9268c8df545d421fda1a6",
"git-tree": "743779ee6c55d462d8506e8bf065093d02e7bb18",
"version": "1.82.0",
"port-version": 1
},

0 comments on commit c18f461

Please sign in to comment.