[boost] fix emscripten build (#29481)

* Update CMakeLists.txt

* print lib prefix and suffix

* set extension to bc

* wip: wasm .bc copy workaround

* hack wasm32 boost libs copy

* rename bc to a

* remove status messages

* update port ver

* run addver cmd
This commit is contained in:
Leonid Pospelov 2023-02-08 06:07:34 +06:00 committed by GitHub
parent 6015f38db2
commit 1c48ec7f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 3 deletions

View File

@ -44,6 +44,8 @@ elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "mips64")
list(APPEND B2_OPTIONS architecture=mips64)
elseif("arm64" IN_LIST VCPKG_TARGET_ARCHITECTURE AND "x86_64" IN_LIST VCPKG_TARGET_ARCHITECTURE)
list(APPEND B2_OPTIONS architecture=arm+x86)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
# do nothing
else()
list(APPEND B2_OPTIONS architecture=x86)
endif()
@ -63,6 +65,8 @@ if(VCPKG_DETECTED_MSVC)
else()
math(EXPR USER_CONFIG_TOOLSET_VERSION "${VCPKG_DETECTED_MSVC_VERSION} / 10 - 50")
endif()
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
set(USER_CONFIG_TOOLSET emscripten)
elseif(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(USER_CONFIG_TOOLSET clang)
else()

View File

@ -53,7 +53,10 @@ function(boost_modular_build)
endif()
else()
set(BOOST_LIB_PREFIX lib)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
set(BOOST_LIB_RELEASE_SUFFIX .bc)
set(BOOST_LIB_DEBUG_SUFFIX .bc)
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(BOOST_LIB_RELEASE_SUFFIX .a)
set(BOOST_LIB_DEBUG_SUFFIX .a)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
@ -144,6 +147,30 @@ function(boost_modular_build)
"${CURRENT_PACKAGES_DIR}/debug/bin/*.pyd"
)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
# install .bc files
file(GLOB WASM_LIBS_RELEASE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/boost/build/*/${BOOST_LIB_PREFIX}*${BOOST_LIB_RELEASE_SUFFIX}")
file(GLOB WASM_LIBS_DEBUG "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/boost/build/*/${BOOST_LIB_PREFIX}*${BOOST_LIB_DEBUG_SUFFIX}")
file(COPY ${WASM_LIBS_RELEASE} DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(COPY ${WASM_LIBS_DEBUG} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
# rename .bc to .a
file(GLOB WASM_LIBS_RELEASE "${CURRENT_PACKAGES_DIR}/lib/*.bc")
file(GLOB WASM_LIBS_DEBUG "${CURRENT_PACKAGES_DIR}/debug/lib/*.bc")
foreach(LIB IN LISTS WASM_LIBS_RELEASE)
get_filename_component(OLD_FILENAME ${LIB} NAME)
get_filename_component(DIRECTORY_OF_LIB_FILE ${LIB} DIRECTORY)
string(REPLACE ".bc" ".a" NEW_FILENAME ${OLD_FILENAME})
file(RENAME ${LIB} ${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME})
endforeach()
foreach(LIB IN LISTS WASM_LIBS_DEBUG)
get_filename_component(OLD_FILENAME ${LIB} NAME)
get_filename_component(DIRECTORY_OF_LIB_FILE ${LIB} DIRECTORY)
string(REPLACE ".bc" ".a" NEW_FILENAME ${OLD_FILENAME})
file(RENAME ${LIB} ${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME})
endforeach()
endif()
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)

View File

@ -2,7 +2,7 @@
"$comment": "Automatically generated by scripts/boost/generate-ports.ps1",
"name": "boost-modular-build-helper",
"version": "1.81.0",
"port-version": 1,
"port-version": 2,
"description": "Internal vcpkg port used to build Boost libraries",
"license": "MIT",
"dependencies": [

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "99f9bc3d7c9ac2864942f3f8d80a3d8db4689794",
"version": "1.81.0",
"port-version": 2
},
{
"git-tree": "6e28e9a445dc3442e89761e500fbb8bb5e175c00",
"version": "1.81.0",

View File

@ -894,7 +894,7 @@
},
"boost-modular-build-helper": {
"baseline": "1.81.0",
"port-version": 1
"port-version": 2
},
"boost-move": {
"baseline": "1.81.0",