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-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
# Todo: this serves too similar a purpose as vcpkg_find_acquire_program()
2020-04-28 05:47:36 +08:00
if ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" )
set ( BOOST_BUILD_PATH "${CURRENT_INSTALLED_DIR}/../x64-linux/tools/boost-build" )
2020-06-06 03:28:42 +08:00
elseif ( CMAKE_HOST_WIN32 AND VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW" )
2017-12-06 05:00:50 +08:00
get_filename_component ( BOOST_BUILD_PATH "${CURRENT_INSTALLED_DIR}/../x86-windows/tools/boost-build" ABSOLUTE )
2018-03-12 14:01:33 +08:00
elseif ( NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" )
get_filename_component ( BOOST_BUILD_PATH "${CURRENT_INSTALLED_DIR}/../x86-windows/tools/boost-build" ABSOLUTE )
else ( )
set ( BOOST_BUILD_PATH "${CURRENT_INSTALLED_DIR}/tools/boost-build" )
2017-12-06 05:00:50 +08:00
endif ( )
if ( NOT EXISTS "${BOOST_BUILD_PATH}" )
2020-05-14 01:26:05 +08:00
if ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" )
2020-04-28 05:47:36 +08:00
message ( FATAL_ERROR "The x64 boost-build tools must be installed to build arm64 for Linux. Please run `vcpkg install boost-build:x64-linux`." )
2020-05-14 01:26:05 +08:00
else ( )
2020-04-28 05:47:36 +08:00
message ( FATAL_ERROR "The x86 boost-build tools must be installed to build for non-x86/x64 platforms. Please run `vcpkg install boost-build:x86-windows`." )
2020-05-14 01:26:05 +08:00
endif ( )
2017-12-06 05:00:50 +08:00
endif ( )
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 ( )
2018-01-18 14:08:48 +08:00
set ( _bm_DIR ${ CURRENT_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 )
set ( BOOST_LIB_RELEASE_SUFFIX -vc140-mt.lib )
set ( BOOST_LIB_DEBUG_SUFFIX -vc140-mt-gd.lib )
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 )
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 )
2018-04-18 06:18:09 +08:00
#string(REPLACE "import ../../predef/check/predef" "import predef/check/predef" _contents "${_contents}")
#string(REPLACE "import ../../config/checks/config" "import config/checks/config" _contents "${_contents}")
2017-12-06 05:00:50 +08:00
string ( REGEX REPLACE
" \ . \ . / \ . \ . / ( [ ^ / ] + ) / b u i l d / / ( b o o s t _ [ ^ / ] + ) "
" / b o o s t / \ \ 1 / / \ \ 2 "
_ c o n t e n t s
" $ { _ c o n t e n t s } "
)
string ( REGEX REPLACE " /boost//([^/ ]+)" " /boost/\\1//boost_\\1" _contents "${_contents}" )
file ( WRITE ${ _bm_SOURCE_PATH } /build/Jamfile.v2 "${_contents}" )
endif ( )
2018-03-12 14:01:33 +08:00
configure_file ( ${ _bm_DIR } /Jamroot.jam ${ _bm_SOURCE_PATH } /Jamroot.jam @ONLY )
2018-04-18 06:18:09 +08:00
# if(EXISTS "${CURRENT_INSTALLED_DIR}/share/boost-config/checks")
# file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${_bm_SOURCE_PATH}/build/config")
# endif()
# if(EXISTS "${CURRENT_INSTALLED_DIR}/share/boost-predef/check")
# file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-predef/check" DESTINATION "${_bm_SOURCE_PATH}/build/predef")
# endif()
2018-03-12 14:01:33 +08:00
2018-03-22 00:49:15 +08:00
if ( VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" )
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 ( )
2018-03-12 14:01:33 +08:00
vcpkg_configure_cmake (
S O U R C E _ P A T H $ { C U R R E N T _ I N S T A L L E D _ D I R } / s h a r e / b o o s t - b u i l d
P R E F E R _ N I N J A
O P T I O N S
2020-03-03 02:41:27 +08:00
" - D P O R T = $ { P O R T } "
2020-05-14 01:26:05 +08:00
" - D F E A T U R E S = $ { F E A T U R E S } "
2020-03-03 02:41:27 +08:00
" - D C U R R E N T _ I N S T A L L E D _ D I R = $ { C U R R E N T _ I N S T A L L E D _ D I R } "
2018-03-12 14:01:33 +08:00
" - D B 2 _ E X E = $ { B 2 _ E X E } "
" - D S O U R C E _ P A T H = $ { _ b m _ S O U R C E _ P A T H } "
" - D B O O S T _ B U I L D _ P A T H = $ { B O O S T _ B U I L D _ P A T H } "
2020-03-03 02:41:27 +08:00
$ { c o n f i g u r e _ o p t i o n }
2018-03-12 14:01:33 +08:00
)
vcpkg_install_cmake ( )
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 ( )
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
$ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - d b g
$ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l
)
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 $ { N U M B E R _ O F _ P R O C E S S O R S }
2017-12-06 05:00:50 +08:00
- - d e b u g - c o n f i g u r a t i o n
- - d e b u g - b u i l d i n g
- - d e b u g - g e n e r a t o r s
- - d i s a b l e - i c u
- - i g n o r e - s i t e - c o n f i g
- - h a s h
- q
2019-08-20 08:06:57 +08:00
" - s Z L I B _ I N C L U D E = $ { C U R R E N T _ I N S T A L L E D _ D I R } / i n c l u d e "
" - s B Z I P 2 _ I N C L U D E = $ { C U R R E N T _ I N S T A L L E D _ D I R } / i n c l u d e "
2020-01-17 07:10:15 +08:00
" - s L Z M A _ I N C L U D E = $ { C U R R E N T _ I N S T A L L E D _ D I R } / i n c l u d e "
" - s Z S T D _ I N C L U D E = $ { C U R R E N T _ I N S T A L L E D _ D I R } / i n c l u d e "
2017-12-06 05:00:50 +08:00
t h r e a d i n g = m u l t i
)
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-05-14 01:26:05 +08:00
set ( B2_OPTIONS_DBG
2018-01-17 05:26:13 +08:00
- s Z L I B _ B I N A R Y = z l i b d
2019-08-20 08:06:57 +08:00
" - s Z L I B _ L I B P A T H = $ { C U R R E N T _ I N S T A L L E D _ D I R } / d e b u g / l i b "
2018-01-17 05:26:13 +08:00
- s B Z I P 2 _ B I N A R Y = b z 2 d
2019-08-20 08:06:57 +08:00
" - s B Z I P 2 _ L I B P A T H = $ { C U R R E N T _ I N S T A L L E D _ D I R } / d e b u g / l i b "
2020-01-17 07:10:15 +08:00
- s L Z M A _ B I N A R Y = l z m a d
" - s L Z M A _ L I B P A T H = $ { C U R R E N T _ I N S T A L L E D _ D I R } / d e b u g / l i b "
- s Z S T D _ B I N A R Y = z s t d d
" - s Z S T D _ L I B P A T H = $ { C U R R E N T _ I N S T A L L E D _ D I R } / d e b u g / l i b "
2018-01-17 05:26:13 +08:00
)
2020-05-14 01:26:05 +08:00
set ( B2_OPTIONS_REL
2018-01-17 05:26:13 +08:00
- s Z L I B _ B I N A R Y = z l i b
2019-08-20 08:06:57 +08:00
" - s Z L I B _ L I B P A T H = $ { C U R R E N T _ I N S T A L L E D _ D I R } / l i b "
2018-01-17 05:26:13 +08:00
- s B Z I P 2 _ B I N A R Y = b z 2
2019-08-20 08:06:57 +08:00
" - s B Z I P 2 _ L I B P A T H = $ { C U R R E N T _ I N S T A L L E D _ D I R } / l i b "
2020-01-17 07:10:15 +08:00
- s L Z M A _ B I N A R Y = l z m a
" - s L Z M A _ L I B P A T H = $ { C U R R E N T _ I N S T A L L E D _ D I R } / l i b "
- s Z S T D _ B I N A R Y = z s t d
" - s Z S T D _ L I B P A T H = $ { C U R R E N T _ I N S T A L L E D _ D I R } / l i b "
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 )
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 )
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 ( )
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 )
2019-05-22 12:01:13 +08:00
if ( VCPKG_PLATFORM_TOOLSET MATCHES "v14." )
2020-05-14 01:26:05 +08:00
list ( APPEND B2_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 ( )
######################
# 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" )
set ( ENV{BOOST_BUILD_PATH} "${BOOST_BUILD_PATH}" )
vcpkg_execute_required_process (
C O M M A N D " $ { B 2 _ E X E } "
- - s t a g e d i r = $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / s t a g e
- - b u i l d - d i r = $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l
- - u s e r - c o n f i g = $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / u s e r - c o n f i g . j a m
2020-05-14 01:26:05 +08:00
$ { B 2 _ O P T I O N S }
$ { B 2 _ O P T I O N S _ R E L }
2017-12-20 14:19:18 +08:00
v a r i a n t = r e l e a s e
d e b u g - s y m b o l s = o n
2018-04-18 06:18:09 +08:00
W O R K I N G _ D I R E C T O R Y $ { _ b m _ S O U R C E _ P A T H } / b u i l d
2017-12-20 14:19:18 +08:00
L O G N A M E b u i l d - $ { T A R G E T _ T R I P L E T } - r e l
)
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" )
set ( ENV{BOOST_BUILD_PATH} "${BOOST_BUILD_PATH}" )
vcpkg_execute_required_process (
C O M M A N D " $ { B 2 _ E X E } "
- - s t a g e d i r = $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - d b g / s t a g e
- - b u i l d - d i r = $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - d b g
- - u s e r - c o n f i g = $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - d b g / u s e r - c o n f i g . j a m
2020-05-14 01:26:05 +08:00
$ { B 2 _ O P T I O N S }
$ { B 2 _ O P T I O N S _ D B G }
2017-12-20 14:19:18 +08:00
v a r i a n t = d e b u g
2018-04-18 06:18:09 +08:00
W O R K I N G _ D I R E C T O R Y $ { _ b m _ S O U R C E _ P A T H } / b u i l d
2017-12-20 14:19:18 +08:00
L O G N A M E b u i l d - $ { T A R G E T _ T R I P L E T } - d b g
)
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
$ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / b o o s t / b u i l d / * / * . l i b
$ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / b o o s t / b u i l d / * / * . a
$ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / b o o s t / b u i l d / * / * . s o
)
2017-12-20 14:19:18 +08:00
file ( COPY ${ REL_LIBS }
2018-03-12 14:01:33 +08:00
D E S T I N A T I O N $ { C U R R E N T _ P A C K A G E S _ D I R } / l i b )
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 }
D E S T I N A T I O N $ { C U R R E N T _ P A C K A G E S _ D I R } / b i n
F I L E S _ M A T C H I N G P A T T E R N " * . d l l " )
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
$ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - d b g / b o o s t / b u i l d / * / * . l i b
$ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - d b g / b o o s t / b u i l d / * / * . a
$ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - d b g / b o o s t / b u i l d / * / * . s o
)
2017-12-20 14:19:18 +08:00
file ( COPY ${ DBG_LIBS }
2018-03-12 14:01:33 +08:00
D E S T I N A T I O N $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / l i b )
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 }
D E S T I N A T I O N $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / b i n
F I L E S _ M A T C H I N G P A T T E R N " * . d l l " )
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
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
2020-05-14 01:26:05 +08:00
string ( REPLACE "-1_73" "" 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
vcpkg_copy_pdbs ( )
2017-12-06 05:00:50 +08:00
endfunction ( )