vcpkg/ports/tbb/portfile.cmake

92 lines
3.3 KiB
CMake
Raw Normal View History

2016-10-27 10:52:31 +08:00
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
message(STATUS "Warning: Static building not supported yet. Building dynamic.")
set(VCPKG_LIBRARY_LINKAGE dynamic)
2016-10-27 10:52:31 +08:00
endif()
if (VCPKG_CRT_LINKAGE STREQUAL static)
message(FATAL_ERROR "TBB does not currently support static crt linkage")
endif()
2017-05-22 17:57:19 +08:00
include(vcpkg_common_functions)
2017-05-22 17:57:19 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO 01org/tbb
2017-12-15 17:59:11 +08:00
REF 2018_U2
SHA512 a94b55bcabec47424be1c2d4b7bf3502a545bc714250a260e152b00431420094dbab64c0355bd0004ee9ad10d85c7b920969bf4b6d9a30b3697c7c5202518841
HEAD_REF tbb_2018)
2017-05-22 17:57:19 +08:00
if(TRIPLET_SYSTEM_ARCH STREQUAL x86)
set(BUILD_ARCH Win32)
else()
set(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
endif()
2017-12-15 17:59:11 +08:00
set(TBB_MSBUILD_PROJECT_DIR ${SOURCE_PATH}/build/vs2013)
vcpkg_build_msbuild(PROJECT_PATH ${TBB_MSBUILD_PROJECT_DIR}/makefile.sln PLATFORM ${BUILD_ARCH})
# Installation
message(STATUS "Installing")
2016-10-19 08:14:54 +08:00
file(COPY
${SOURCE_PATH}/include/tbb
${SOURCE_PATH}/include/serial
DESTINATION ${CURRENT_PACKAGES_DIR}/include)
2017-12-15 17:59:11 +08:00
set(DEBUG_OUTPUT_PATH ${TBB_MSBUILD_PROJECT_DIR}/${BUILD_ARCH}/Debug)
set(RELEASE_OUTPUT_PATH ${TBB_MSBUILD_PROJECT_DIR}/${BUILD_ARCH}/Release)
2016-10-19 08:14:54 +08:00
file(COPY
2017-05-22 17:57:19 +08:00
${RELEASE_OUTPUT_PATH}/tbb.lib
${RELEASE_OUTPUT_PATH}/tbbmalloc.lib
${RELEASE_OUTPUT_PATH}/tbbmalloc_proxy.lib
2016-10-19 08:14:54 +08:00
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(COPY
2017-05-22 17:57:19 +08:00
${DEBUG_OUTPUT_PATH}/tbb_debug.lib
${DEBUG_OUTPUT_PATH}/tbbmalloc_debug.lib
${DEBUG_OUTPUT_PATH}/tbbmalloc_proxy_debug.lib
2016-10-19 08:14:54 +08:00
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY
2017-05-22 17:57:19 +08:00
${RELEASE_OUTPUT_PATH}/tbb.dll
${RELEASE_OUTPUT_PATH}/tbbmalloc.dll
${RELEASE_OUTPUT_PATH}/tbbmalloc_proxy.dll
2016-10-19 08:14:54 +08:00
DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
file(COPY
2017-05-22 17:57:19 +08:00
${DEBUG_OUTPUT_PATH}/tbb_debug.dll
${DEBUG_OUTPUT_PATH}/tbbmalloc_debug.dll
${DEBUG_OUTPUT_PATH}/tbbmalloc_proxy_debug.dll
2016-10-19 08:14:54 +08:00
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
2017-05-22 17:57:19 +08:00
vcpkg_copy_pdbs()
2017-06-08 01:33:21 +08:00
include(${SOURCE_PATH}/cmake/TBBMakeConfig.cmake)
tbb_make_config(TBB_ROOT ${CURRENT_PACKAGES_DIR}
CONFIG_DIR TBB_CONFIG_DIR # is set to ${CURRENT_PACKAGES_DIR}/cmake
SYSTEM_NAME "Windows"
CONFIG_FOR_SOURCE
TBB_RELEASE_DIR "\${_tbb_root}/bin"
TBB_DEBUG_DIR "\${_tbb_root}/debug/bin")
file(COPY ${TBB_CONFIG_DIR}/TBBConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/tbb)
file(COPY ${TBB_CONFIG_DIR}/TBBConfigVersion.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/tbb)
file(REMOVE_RECURSE ${TBB_CONFIG_DIR})
# make it work with our installation layout
file(READ ${CURRENT_PACKAGES_DIR}/share/tbb/TBBConfig.cmake TBB_CONFIG_CMAKE)
string(REPLACE
"get_filename_component(_tbb_root \"\${_tbb_root}\" PATH)"
"get_filename_component(_tbb_root \"\${_tbb_root}\" PATH)
get_filename_component(_tbb_root \"\${_tbb_root}\" PATH)" TBB_CONFIG_CMAKE "${TBB_CONFIG_CMAKE}")
string(REPLACE
"\${_tbb_root}/bin/\${_tbb_component}.lib"
"\${_tbb_root}/lib/\${_tbb_component}.lib" TBB_CONFIG_CMAKE "${TBB_CONFIG_CMAKE}")
string(REPLACE
"\${_tbb_root}/debug/bin/\${_tbb_component}_debug.lib"
"\${_tbb_root}/debug/lib/\${_tbb_component}_debug.lib" TBB_CONFIG_CMAKE "${TBB_CONFIG_CMAKE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/tbb/TBBConfig.cmake "${TBB_CONFIG_CMAKE}")
message(STATUS "Installing done")
# Handle copyright
2016-10-19 08:14:54 +08:00
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/tbb)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/tbb/LICENSE ${CURRENT_PACKAGES_DIR}/share/tbb/copyright)