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}"
|
2020-03-03 02:41:27 +08:00
|
|
|
${configure_option}
|
2018-03-12 14:01:33 +08:00
|
|
|
)
|
|
|
|
vcpkg_install_cmake()
|
2020-08-11 08:36:10 +08:00
|
|
|
endfunction()
|
2020-12-29 09:28:44 +08:00
|
|
|
|
2020-08-11 08:36:10 +08:00
|
|
|
if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
2020-12-29 09:28:44 +08:00
|
|
|
set(build_flag 0)
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE)
|
|
|
|
set(build_flag 1)
|
|
|
|
set(VCPKG_BUILD_TYPE "release")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_BUILD_TYPE STREQUAL "release")
|
2020-08-11 08:36:10 +08:00
|
|
|
unix_build(${BOOST_LIB_RELEASE_SUFFIX} "release" "lib/")
|
|
|
|
endif()
|
|
|
|
|
2020-12-29 09:28:44 +08:00
|
|
|
if(build_flag)
|
|
|
|
set(VCPKG_BUILD_TYPE "debug")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_BUILD_TYPE STREQUAL "debug")
|
2020-08-11 08:36:10 +08:00
|
|
|
unix_build(${BOOST_LIB_DEBUG_SUFFIX} "debug" "debug/lib/")
|
|
|
|
endif()
|
2018-04-18 07:26:01 +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()
|
2020-11-14 05:38:59 +08:00
|
|
|
|
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)
|
2018-03-12 14:01:33 +08:00
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2017-12-06 05:00:50 +08:00
|
|
|
#####################
|
|
|
|
# Cleanup previous builds
|
|
|
|
######################
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
|
|
|
if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
|
|
|
# It is possible for a file in this folder to be locked due to antivirus or vctip
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
|
|
|
if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
|
|
|
message(FATAL_ERROR "Unable to remove directory: ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel\n Files are likely in use.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
|
|
|
if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
|
|
|
# It is possible for a file in this folder to be locked due to antivirus or vctip
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
|
|
|
if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
|
|
|
message(FATAL_ERROR "Unable to remove directory: ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg\n Files are likely in use.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(EXISTS ${CURRENT_PACKAGES_DIR}/debug)
|
|
|
|
message(FATAL_ERROR "Error: directory exists: ${CURRENT_PACKAGES_DIR}/debug\n The previous package was not fully cleared. This is an internal error.")
|
|
|
|
endif()
|
|
|
|
file(MAKE_DIRECTORY
|
|
|
|
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
|
|
|
|
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
|
|
|
|
)
|
|
|
|
|
2020-03-03 02:41:27 +08:00
|
|
|
include(ProcessorCount)
|
|
|
|
ProcessorCount(NUMBER_OF_PROCESSORS)
|
|
|
|
if(NOT NUMBER_OF_PROCESSORS)
|
|
|
|
set(NUMBER_OF_PROCESSORS 1)
|
2018-03-12 14:01:33 +08:00
|
|
|
endif()
|
|
|
|
|
2017-12-06 05:00:50 +08:00
|
|
|
######################
|
|
|
|
# Generate configuration
|
|
|
|
######################
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS
|
2018-03-12 14:01:33 +08:00
|
|
|
-j${NUMBER_OF_PROCESSORS}
|
2017-12-06 05:00:50 +08:00
|
|
|
--debug-configuration
|
|
|
|
--debug-building
|
|
|
|
--debug-generators
|
|
|
|
--disable-icu
|
|
|
|
--ignore-site-config
|
|
|
|
--hash
|
|
|
|
-q
|
2019-08-20 08:06:57 +08:00
|
|
|
"-sZLIB_INCLUDE=${CURRENT_INSTALLED_DIR}/include"
|
|
|
|
"-sBZIP2_INCLUDE=${CURRENT_INSTALLED_DIR}/include"
|
2020-01-17 07:10:15 +08:00
|
|
|
"-sLZMA_INCLUDE=${CURRENT_INSTALLED_DIR}/include"
|
|
|
|
"-sZSTD_INCLUDE=${CURRENT_INSTALLED_DIR}/include"
|
2017-12-06 05:00:50 +08:00
|
|
|
threading=multi
|
|
|
|
)
|
2018-03-12 14:01:33 +08:00
|
|
|
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS threadapi=win32)
|
2018-03-12 14:01:33 +08:00
|
|
|
else()
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS threadapi=pthread)
|
2018-03-12 14:01:33 +08:00
|
|
|
endif()
|
2020-12-29 04:23:45 +08:00
|
|
|
list(APPEND B2_OPTIONS_DBG
|
2018-01-17 05:26:13 +08:00
|
|
|
-sZLIB_BINARY=zlibd
|
2019-08-20 08:06:57 +08:00
|
|
|
"-sZLIB_LIBPATH=${CURRENT_INSTALLED_DIR}/debug/lib"
|
2018-01-17 05:26:13 +08:00
|
|
|
-sBZIP2_BINARY=bz2d
|
2019-08-20 08:06:57 +08:00
|
|
|
"-sBZIP2_LIBPATH=${CURRENT_INSTALLED_DIR}/debug/lib"
|
2020-01-17 07:10:15 +08:00
|
|
|
-sLZMA_BINARY=lzmad
|
|
|
|
"-sLZMA_LIBPATH=${CURRENT_INSTALLED_DIR}/debug/lib"
|
|
|
|
-sZSTD_BINARY=zstdd
|
|
|
|
"-sZSTD_LIBPATH=${CURRENT_INSTALLED_DIR}/debug/lib"
|
2018-01-17 05:26:13 +08:00
|
|
|
)
|
2020-07-31 13:55:25 +08:00
|
|
|
|
2020-12-29 04:23:45 +08:00
|
|
|
list(APPEND B2_OPTIONS_REL
|
2018-01-17 05:26:13 +08:00
|
|
|
-sZLIB_BINARY=zlib
|
2019-08-20 08:06:57 +08:00
|
|
|
"-sZLIB_LIBPATH=${CURRENT_INSTALLED_DIR}/lib"
|
2018-01-17 05:26:13 +08:00
|
|
|
-sBZIP2_BINARY=bz2
|
2019-08-20 08:06:57 +08:00
|
|
|
"-sBZIP2_LIBPATH=${CURRENT_INSTALLED_DIR}/lib"
|
2020-01-17 07:10:15 +08:00
|
|
|
-sLZMA_BINARY=lzma
|
|
|
|
"-sLZMA_LIBPATH=${CURRENT_INSTALLED_DIR}/lib"
|
|
|
|
-sZSTD_BINARY=zstd
|
|
|
|
"-sZSTD_LIBPATH=${CURRENT_INSTALLED_DIR}/lib"
|
2018-01-17 05:26:13 +08:00
|
|
|
)
|
|
|
|
|
2018-10-23 00:29:54 +08:00
|
|
|
# Properly handle compiler and linker flags passed by VCPKG
|
|
|
|
if(VCPKG_CXX_FLAGS)
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS "cxxflags=${VCPKG_CXX_FLAGS}")
|
2018-10-23 00:29:54 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_CXX_FLAGS_RELEASE)
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS_REL "cxxflags=${VCPKG_CXX_FLAGS_RELEASE}")
|
2018-10-23 00:29:54 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_CXX_FLAGS_DEBUG)
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS_DBG "cxxflags=${VCPKG_CXX_FLAGS_DEBUG}")
|
2018-10-23 00:29:54 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_C_FLAGS)
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS "cflags=${VCPKG_C_FLAGS}")
|
2018-10-23 00:29:54 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_C_FLAGS_RELEASE)
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS_REL "cflags=${VCPKG_C_FLAGS_RELEASE}")
|
2018-10-23 00:29:54 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_C_FLAGS_DEBUG)
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS_DBG "cflags=${VCPKG_C_FLAGS_DEBUG}")
|
2018-10-23 00:29:54 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_LINKER_FLAGS)
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS "linkflags=${VCPKG_LINKER_FLAGS}")
|
2018-10-23 00:29:54 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_LINKER_FLAGS_RELEASE)
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS_REL "linkflags=${VCPKG_LINKER_FLAGS_RELEASE}")
|
2018-10-23 00:29:54 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_LINKER_FLAGS_DEBUG)
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS_DBG "linkflags=${VCPKG_LINKER_FLAGS_DEBUG}")
|
2018-10-23 00:29:54 +08:00
|
|
|
endif()
|
|
|
|
|
2017-12-06 05:00:50 +08:00
|
|
|
# Add build type specific options
|
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS runtime-link=shared)
|
2017-12-06 05:00:50 +08:00
|
|
|
else()
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS runtime-link=static)
|
2017-12-06 05:00:50 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS link=shared)
|
2017-12-06 05:00:50 +08:00
|
|
|
else()
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS link=static)
|
2017-12-06 05:00:50 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS address-model=64 architecture=x86)
|
2017-12-06 05:00:50 +08:00
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS address-model=32 architecture=arm)
|
2019-04-29 16:49:47 +08:00
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS address-model=64 architecture=arm)
|
2020-07-31 13:55:25 +08:00
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "s390x")
|
|
|
|
list(APPEND B2_OPTIONS address-model=64 architecture=s390x)
|
2021-01-23 02:37:26 +08:00
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "ppc64le")
|
|
|
|
list(APPEND B2_OPTIONS address-model=64 architecture=power)
|
2017-12-06 05:00:50 +08:00
|
|
|
else()
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS address-model=32 architecture=x86)
|
2021-02-25 05:38:42 +08:00
|
|
|
|
|
|
|
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
|
|
|
list(APPEND B2_OPTIONS "asmflags=/safeseh")
|
|
|
|
endif()
|
|
|
|
|
2017-12-06 05:00:50 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
file(TO_CMAKE_PATH "${_bm_DIR}/nothing.bat" NOTHING_BAT)
|
2020-03-03 02:41:27 +08:00
|
|
|
set(TOOLSET_OPTIONS "<cxxflags>/EHsc <compileflags>-Zm800 <compileflags>-nologo")
|
2017-12-06 05:00:50 +08:00
|
|
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
2019-01-26 10:11:08 +08:00
|
|
|
if(NOT VCPKG_PLATFORM_TOOLSET MATCHES "v140")
|
2017-12-06 05:00:50 +08:00
|
|
|
find_path(PATH_TO_CL cl.exe)
|
|
|
|
find_path(PLATFORM_WINMD_DIR platform.winmd PATHS "${PATH_TO_CL}/../../../lib/x86/store/references" NO_DEFAULT_PATH)
|
|
|
|
if(PLATFORM_WINMD_DIR MATCHES "NOTFOUND")
|
2019-05-22 12:01:13 +08:00
|
|
|
message(FATAL_ERROR "Could not find `platform.winmd` in VS. Do you have the Universal Windows Platform development workload installed?")
|
2017-12-06 05:00:50 +08:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
find_path(PLATFORM_WINMD_DIR platform.winmd PATHS "$ENV{VS140COMNTOOLS}/../../VC/LIB/store/references")
|
|
|
|
if(PLATFORM_WINMD_DIR MATCHES "NOTFOUND")
|
|
|
|
message(FATAL_ERROR "Could not find `platform.winmd` in VS2015.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
file(TO_NATIVE_PATH "${PLATFORM_WINMD_DIR}" PLATFORM_WINMD_DIR)
|
2019-08-20 08:06:57 +08:00
|
|
|
string(REPLACE "\\" "/" PLATFORM_WINMD_DIR ${PLATFORM_WINMD_DIR}) # escape backslashes
|
2017-12-06 05:00:50 +08:00
|
|
|
|
2019-12-03 05:11:09 +08:00
|
|
|
set(TOOLSET_OPTIONS "${TOOLSET_OPTIONS} <cflags>-Zl <compileflags> /AI\"${PLATFORM_WINMD_DIR}\" <linkflags>WindowsApp.lib <cxxflags>/ZW <compileflags>-DVirtualAlloc=VirtualAllocFromApp <compileflags>-D_WIN32_WINNT=0x0A00")
|
2017-12-06 05:00:50 +08:00
|
|
|
endif()
|
|
|
|
|
2020-12-17 07:02:24 +08:00
|
|
|
set(MSVC_VERSION)
|
2021-07-24 12:05:45 +08:00
|
|
|
if(VCPKG_PLATFORM_TOOLSET MATCHES "v143")
|
|
|
|
list(APPEND _bm_OPTIONS toolset=msvc)
|
|
|
|
set(MSVC_VERSION 14.3)
|
|
|
|
elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v142")
|
2020-11-07 05:30:37 +08:00
|
|
|
list(APPEND _bm_OPTIONS toolset=msvc)
|
2020-12-17 07:02:24 +08:00
|
|
|
set(MSVC_VERSION 14.2)
|
|
|
|
elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v141")
|
|
|
|
list(APPEND _bm_OPTIONS toolset=msvc)
|
|
|
|
set(MSVC_VERSION 14.1)
|
|
|
|
elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v140")
|
2020-09-05 14:35:38 +08:00
|
|
|
list(APPEND _bm_OPTIONS toolset=msvc)
|
2020-12-17 07:02:24 +08:00
|
|
|
set(MSVC_VERSION 14.0)
|
2020-09-05 14:35:38 +08:00
|
|
|
elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v120")
|
|
|
|
list(APPEND _bm_OPTIONS toolset=msvc)
|
2018-03-12 14:01:33 +08:00
|
|
|
elseif(VCPKG_PLATFORM_TOOLSET MATCHES "external")
|
2020-05-14 01:26:05 +08:00
|
|
|
list(APPEND B2_OPTIONS toolset=gcc)
|
2017-12-06 05:00:50 +08:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unsupported value for VCPKG_PLATFORM_TOOLSET: '${VCPKG_PLATFORM_TOOLSET}'")
|
|
|
|
endif()
|
|
|
|
|
2020-12-17 07:02:24 +08:00
|
|
|
configure_file(${_bm_DIR}/user-config.jam ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/user-config.jam @ONLY)
|
|
|
|
configure_file(${_bm_DIR}/user-config.jam ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/user-config.jam @ONLY)
|
|
|
|
|
2017-12-06 05:00:50 +08:00
|
|
|
######################
|
|
|
|
# Perform build + Package
|
|
|
|
######################
|
2017-12-20 14:19:18 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
message(STATUS "Building ${TARGET_TRIPLET}-rel")
|
2020-08-11 08:36:10 +08:00
|
|
|
set(BOOST_LIB_SUFFIX ${BOOST_LIB_RELEASE_SUFFIX})
|
|
|
|
set(VARIANT "release")
|
|
|
|
set(BUILD_LIB_PATH "lib/")
|
|
|
|
configure_file(${_bm_DIR}/Jamroot.jam ${_bm_SOURCE_PATH}/Jamroot.jam @ONLY)
|
2017-12-20 14:19:18 +08:00
|
|
|
set(ENV{BOOST_BUILD_PATH} "${BOOST_BUILD_PATH}")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND "${B2_EXE}"
|
|
|
|
--stagedir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/stage
|
|
|
|
--build-dir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
|
|
|
|
--user-config=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/user-config.jam
|
2020-05-14 01:26:05 +08:00
|
|
|
${B2_OPTIONS}
|
|
|
|
${B2_OPTIONS_REL}
|
2017-12-20 14:19:18 +08:00
|
|
|
variant=release
|
|
|
|
debug-symbols=on
|
2018-04-18 06:18:09 +08:00
|
|
|
WORKING_DIRECTORY ${_bm_SOURCE_PATH}/build
|
2017-12-20 14:19:18 +08:00
|
|
|
LOGNAME build-${TARGET_TRIPLET}-rel
|
|
|
|
)
|
|
|
|
message(STATUS "Building ${TARGET_TRIPLET}-rel done")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
|
2020-08-11 08:36:10 +08:00
|
|
|
set(BOOST_LIB_SUFFIX ${BOOST_LIB_DEBUG_SUFFIX})
|
|
|
|
set(VARIANT debug)
|
|
|
|
set(BUILD_LIB_PATH "debug/lib/")
|
|
|
|
configure_file(${_bm_DIR}/Jamroot.jam ${_bm_SOURCE_PATH}/Jamroot.jam @ONLY)
|
2017-12-20 14:19:18 +08:00
|
|
|
set(ENV{BOOST_BUILD_PATH} "${BOOST_BUILD_PATH}")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND "${B2_EXE}"
|
|
|
|
--stagedir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/stage
|
|
|
|
--build-dir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
|
|
|
|
--user-config=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/user-config.jam
|
2020-05-14 01:26:05 +08:00
|
|
|
${B2_OPTIONS}
|
|
|
|
${B2_OPTIONS_DBG}
|
2017-12-20 14:19:18 +08:00
|
|
|
variant=debug
|
2018-04-18 06:18:09 +08:00
|
|
|
WORKING_DIRECTORY ${_bm_SOURCE_PATH}/build
|
2017-12-20 14:19:18 +08:00
|
|
|
LOGNAME build-${TARGET_TRIPLET}-dbg
|
|
|
|
)
|
|
|
|
message(STATUS "Building ${TARGET_TRIPLET}-dbg done")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
message(STATUS "Packaging ${TARGET_TRIPLET}-rel")
|
2018-03-12 14:01:33 +08:00
|
|
|
file(GLOB REL_LIBS
|
|
|
|
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/boost/build/*/*.lib
|
|
|
|
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/boost/build/*/*.a
|
|
|
|
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/boost/build/*/*.so
|
|
|
|
)
|
2017-12-20 14:19:18 +08:00
|
|
|
file(COPY ${REL_LIBS}
|
2018-03-12 14:01:33 +08:00
|
|
|
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
|
2017-12-20 14:19:18 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
|
|
file(GLOB REL_DLLS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/boost/build/*/*.dll)
|
|
|
|
file(COPY ${REL_DLLS}
|
|
|
|
DESTINATION ${CURRENT_PACKAGES_DIR}/bin
|
|
|
|
FILES_MATCHING PATTERN "*.dll")
|
|
|
|
endif()
|
|
|
|
message(STATUS "Packaging ${TARGET_TRIPLET}-rel done")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
message(STATUS "Packaging ${TARGET_TRIPLET}-dbg")
|
2018-03-12 14:01:33 +08:00
|
|
|
file(GLOB DBG_LIBS
|
|
|
|
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/boost/build/*/*.lib
|
|
|
|
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/boost/build/*/*.a
|
|
|
|
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/boost/build/*/*.so
|
|
|
|
)
|
2017-12-20 14:19:18 +08:00
|
|
|
file(COPY ${DBG_LIBS}
|
2018-03-12 14:01:33 +08:00
|
|
|
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
2017-12-20 14:19:18 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
|
|
file(GLOB DBG_DLLS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/boost/build/*/*.dll)
|
|
|
|
file(COPY ${DBG_DLLS}
|
|
|
|
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
|
|
|
|
FILES_MATCHING PATTERN "*.dll")
|
|
|
|
endif()
|
|
|
|
message(STATUS "Packaging ${TARGET_TRIPLET}-dbg done")
|
|
|
|
endif()
|
2017-12-06 05:00:50 +08:00
|
|
|
|
|
|
|
file(GLOB INSTALLED_LIBS ${CURRENT_PACKAGES_DIR}/debug/lib/*.lib ${CURRENT_PACKAGES_DIR}/lib/*.lib)
|
|
|
|
foreach(LIB ${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
|
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()
|
|
|
|
|
2018-02-02 05:49:59 +08:00
|
|
|
vcpkg_copy_pdbs()
|
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()
|