2021-03-27 03:55:34 +08:00
|
|
|
get_filename_component(BOOST_BUILD_INSTALLED_DIR "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
|
|
|
|
get_filename_component(BOOST_BUILD_INSTALLED_DIR "${BOOST_BUILD_INSTALLED_DIR}" DIRECTORY)
|
|
|
|
|
2017-12-06 05:00:50 +08:00
|
|
|
function(boost_modular_build)
|
2020-05-14 01:26:05 +08:00
|
|
|
cmake_parse_arguments(_bm "" "SOURCE_PATH;BOOST_CMAKE_FRAGMENT" "" ${ARGN})
|
2017-12-06 05:00:50 +08:00
|
|
|
|
|
|
|
if(NOT DEFINED _bm_SOURCE_PATH)
|
|
|
|
message(FATAL_ERROR "SOURCE_PATH is a required argument to boost_modular_build.")
|
|
|
|
endif()
|
2020-07-31 13:55:25 +08:00
|
|
|
|
2020-05-14 01:26:05 +08:00
|
|
|
# Next CMake variables may be overridden in the file specified in ${_bm_BOOST_CMAKE_FRAGMENT}
|
|
|
|
set(B2_OPTIONS)
|
|
|
|
set(B2_OPTIONS_DBG)
|
|
|
|
set(B2_OPTIONS_REL)
|
|
|
|
set(B2_REQUIREMENTS) # this variable is used in the Jamroot.jam
|
|
|
|
|
|
|
|
if(DEFINED _bm_BOOST_CMAKE_FRAGMENT)
|
|
|
|
message(STATUS "Including ${_bm_BOOST_CMAKE_FRAGMENT}")
|
|
|
|
include(${_bm_BOOST_CMAKE_FRAGMENT})
|
|
|
|
endif()
|
2017-12-06 05:00:50 +08:00
|
|
|
|
2021-03-27 03:55:34 +08:00
|
|
|
set(BOOST_BUILD_PATH "${BOOST_BUILD_INSTALLED_DIR}/tools/boost-build")
|
2017-12-06 05:00:50 +08:00
|
|
|
|
2018-03-12 14:01:33 +08:00
|
|
|
if(EXISTS "${BOOST_BUILD_PATH}/b2.exe")
|
|
|
|
set(B2_EXE "${BOOST_BUILD_PATH}/b2.exe")
|
|
|
|
elseif(EXISTS "${BOOST_BUILD_PATH}/b2")
|
|
|
|
set(B2_EXE "${BOOST_BUILD_PATH}/b2")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Could not find b2 in ${BOOST_BUILD_PATH}")
|
|
|
|
endif()
|
|
|
|
|
2017-12-06 05:00:50 +08:00
|
|
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS windows-api=store)
|
2017-12-06 05:00:50 +08:00
|
|
|
endif()
|
|
|
|
|
2021-03-27 03:55:34 +08:00
|
|
|
set(_bm_DIR ${BOOST_BUILD_INSTALLED_DIR}/share/boost-build)
|
2017-12-06 05:00:50 +08:00
|
|
|
|
2018-03-12 14:01:33 +08:00
|
|
|
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
|
|
|
set(BOOST_LIB_PREFIX)
|
2020-09-05 14:35:38 +08:00
|
|
|
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)
|
|
|
|
endif()
|
2018-03-12 14:01:33 +08:00
|
|
|
else()
|
|
|
|
set(BOOST_LIB_PREFIX lib)
|
2019-05-20 02:52:11 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
set(BOOST_LIB_RELEASE_SUFFIX .a)
|
|
|
|
set(BOOST_LIB_DEBUG_SUFFIX .a)
|
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
set(BOOST_LIB_RELEASE_SUFFIX .dylib)
|
|
|
|
set(BOOST_LIB_DEBUG_SUFFIX .dylib)
|
2020-09-28 09:41:34 +08:00
|
|
|
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
|
|
|
|
set(BOOST_LIB_RELEASE_SUFFIX .dll.a)
|
|
|
|
set(BOOST_LIB_DEBUG_SUFFIX .dll.a)
|
2019-05-20 02:52:11 +08:00
|
|
|
else()
|
|
|
|
set(BOOST_LIB_RELEASE_SUFFIX .so)
|
|
|
|
set(BOOST_LIB_DEBUG_SUFFIX .so)
|
|
|
|
endif()
|
2018-03-12 14:01:33 +08:00
|
|
|
endif()
|
2017-12-06 05:00:50 +08:00
|
|
|
|
|
|
|
if(EXISTS "${_bm_SOURCE_PATH}/build/Jamfile.v2")
|
|
|
|
file(READ ${_bm_SOURCE_PATH}/build/Jamfile.v2 _contents)
|
|
|
|
string(REGEX REPLACE
|
|
|
|
"\.\./\.\./([^/ ]+)/build//(boost_[^/ ]+)"
|
|
|
|
"/boost/\\1//\\2"
|
|
|
|
_contents
|
|
|
|
"${_contents}"
|
|
|
|
)
|
|
|
|
string(REGEX REPLACE " /boost//([^/ ]+)" " /boost/\\1//boost_\\1" _contents "${_contents}")
|
|
|
|
file(WRITE ${_bm_SOURCE_PATH}/build/Jamfile.v2 "${_contents}")
|
|
|
|
endif()
|
|
|
|
|
2020-08-11 08:36:10 +08:00
|
|
|
function(unix_build BOOST_LIB_SUFFIX BUILD_TYPE BUILD_LIB_PATH)
|
|
|
|
message(STATUS "Building ${BUILD_TYPE}...")
|
|
|
|
set(BOOST_LIB_SUFFIX ${BOOST_LIB_SUFFIX})
|
|
|
|
set(VARIANT ${BUILD_TYPE})
|
|
|
|
set(BUILD_LIB_PATH ${BUILD_LIB_PATH})
|
|
|
|
configure_file(${_bm_DIR}/Jamroot.jam ${_bm_SOURCE_PATH}/Jamroot.jam @ONLY)
|
2020-12-29 09:28:44 +08:00
|
|
|
|
2020-03-03 02:41:27 +08:00
|
|
|
set(configure_option)
|
2018-04-18 07:26:01 +08:00
|
|
|
if(DEFINED _bm_BOOST_CMAKE_FRAGMENT)
|
2020-03-03 02:41:27 +08:00
|
|
|
list(APPEND configure_option "-DBOOST_CMAKE_FRAGMENT=${_bm_BOOST_CMAKE_FRAGMENT}")
|
|
|
|
endif()
|
2021-07-07 05:05:13 +08:00
|
|
|
|
2018-03-12 14:01:33 +08:00
|
|
|
vcpkg_configure_cmake(
|
2021-03-27 03:55:34 +08:00
|
|
|
SOURCE_PATH ${BOOST_BUILD_INSTALLED_DIR}/share/boost-build
|
2018-03-12 14:01:33 +08:00
|
|
|
PREFER_NINJA
|
|
|
|
OPTIONS
|
2020-03-03 02:41:27 +08:00
|
|
|
"-DPORT=${PORT}"
|
2020-05-14 01:26:05 +08:00
|
|
|
"-DFEATURES=${FEATURES}"
|
2020-03-03 02:41:27 +08:00
|
|
|
"-DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR}"
|
2018-03-12 14:01:33 +08:00
|
|
|
"-DB2_EXE=${B2_EXE}"
|
|
|
|
"-DSOURCE_PATH=${_bm_SOURCE_PATH}"
|
|
|
|
"-DBOOST_BUILD_PATH=${BOOST_BUILD_PATH}"
|
2021-09-22 06:07:46 +08:00
|
|
|
"-DVCPKG_CRT_LINKAGE=${VCPKG_CRT_LINKAGE}"
|
2020-03-03 02:41:27 +08:00
|
|
|
${configure_option}
|
2018-03-12 14:01:33 +08:00
|
|
|
)
|
|
|
|
vcpkg_install_cmake()
|
2017-12-06 05:00:50 +08:00
|
|
|
|
2021-09-22 06:07:46 +08:00
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
endfunction()
|
2017-12-06 05:00:50 +08:00
|
|
|
|
2021-09-22 06:07:46 +08:00
|
|
|
set(build_flag 0)
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE)
|
|
|
|
set(build_flag 1)
|
|
|
|
set(VCPKG_BUILD_TYPE "release")
|
2017-12-06 05:00:50 +08:00
|
|
|
endif()
|
|
|
|
|
2021-09-22 06:07:46 +08:00
|
|
|
if(VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
unix_build(${BOOST_LIB_RELEASE_SUFFIX} "release" "lib/")
|
2017-12-06 05:00:50 +08:00
|
|
|
endif()
|
|
|
|
|
2021-09-22 06:07:46 +08:00
|
|
|
if(build_flag)
|
|
|
|
set(VCPKG_BUILD_TYPE "debug")
|
2017-12-20 14:19:18 +08:00
|
|
|
endif()
|
|
|
|
|
2021-09-22 06:07:46 +08:00
|
|
|
if(VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
unix_build(${BOOST_LIB_DEBUG_SUFFIX} "debug" "debug/lib/")
|
2017-12-20 14:19:18 +08:00
|
|
|
endif()
|
2017-12-06 05:00:50 +08:00
|
|
|
|
|
|
|
file(GLOB INSTALLED_LIBS ${CURRENT_PACKAGES_DIR}/debug/lib/*.lib ${CURRENT_PACKAGES_DIR}/lib/*.lib)
|
2021-09-22 06:07:46 +08:00
|
|
|
foreach(LIB IN LISTS INSTALLED_LIBS)
|
2017-12-06 05:00:50 +08:00
|
|
|
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
|
2019-01-26 10:11:08 +08:00
|
|
|
string(REPLACE "-vc142-" "-vc140-" NEW_FILENAME ${NEW_FILENAME}) # To merge VS2019 and VS2015 binaries
|
2021-07-24 12:05:45 +08:00
|
|
|
string(REPLACE "-vc143-" "-vc140-" NEW_FILENAME ${NEW_FILENAME}) # To merge VS2022 and VS2015 binaries
|
2017-12-06 05:00:50 +08:00
|
|
|
string(REPLACE "-sgd-" "-gd-" NEW_FILENAME ${NEW_FILENAME}) # For Debug libs
|
|
|
|
string(REPLACE "-sgyd-" "-gyd-" NEW_FILENAME ${NEW_FILENAME}) # For Debug libs
|
|
|
|
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
|
[boost] update to 1.76.0 (#17335)
* [boost] update generator script for boost 1.76
* [boost] update ports to 1.76.0 (run generator)
* [boost] fix windows build?
* [quantlib] update and fix mac build
* [symengine] update and fix build
* [avro-cpp] update to latest master and fix windows build
* [folly] update to 2021.05.31.00
* [fbthrift, fizz, wangle] update to v2021.05.31.00 and fix build
* [proxygen] update to version 2021.05.31.00
* [fizz, proxygen, fbthrift] fix sodium target
* [proxygen] also works on macOS
* [quantlib] use fix from upstream to fix mac build
* [symengine] minimize patch file and fix deprecation warning
* [folly,proxygen,wangle,fizz,fbthrift] update to 2021.06.14.00
* [fbthrift] remove unnecessary dependency rsocket
I couldn't find any information that this dependency exists. The term is used in the code, but not in the context of a dependency
* [fizz,fbthrift] fix zlib dependency
* [fbthrift] pass required flex executable to cmake configure
* add version files
* [boost] generate-ports.ps1: Apply code review
* [boost] changes from new version of generate-ports script
* update version files
* [boost] generate-ports.ps1: Apply code review
2021-07-08 03:31:06 +08:00
|
|
|
string(REPLACE "-1_76" "" NEW_FILENAME ${NEW_FILENAME}) # To enable CMake > 3.10 to locate the binaries
|
2018-01-18 14:08:48 +08:00
|
|
|
if("${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}" STREQUAL "${DIRECTORY_OF_LIB_FILE}/${OLD_FILENAME}")
|
2017-12-06 05:00:50 +08:00
|
|
|
# nothing to do
|
2018-01-18 14:08:48 +08:00
|
|
|
elseif(EXISTS ${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME})
|
2017-12-06 05:00:50 +08:00
|
|
|
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()
|
2018-02-02 05:49:59 +08:00
|
|
|
|
2020-07-16 05:44:01 +08:00
|
|
|
# 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")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/has_icu.lib")
|
|
|
|
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/has_icu.lib")
|
|
|
|
endif()
|
|
|
|
|
2021-09-22 06:07:46 +08:00
|
|
|
if(NOT EXISTS ${CURRENT_PACKAGES_DIR}/lib)
|
|
|
|
message(FATAL_ERROR "No libraries were produced. This indicates a failure while building the boost library.")
|
|
|
|
endif()
|
|
|
|
|
2021-03-27 03:55:34 +08:00
|
|
|
configure_file(${BOOST_BUILD_INSTALLED_DIR}/share/boost-build/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage COPYONLY)
|
2017-12-06 05:00:50 +08:00
|
|
|
endfunction()
|