vcpkg/ports/mimalloc/portfile.cmake
myd7349 3c418f814d [mimalloc] Add new port (fix #6996) (#7011)
* [mimalloc] Add new port (fix #6996)

* [mimalloc] Fix x64-uwp build error

* [mimalloc] Fix interface include directory

* [mimalloc] Add features

* [mimalloc] Make the patch vcpkg friendly

* [mimalloc] Update to 2019-06-25

* [mimalloc] Use vcpkg_check_features

* [mimalloc] Clean
2019-07-22 11:16:02 -07:00

74 lines
2.0 KiB
CMake

include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO microsoft/mimalloc
REF c6c1d5fffd0cf8dcb2ab969cde8fd170af44fdef
SHA512 3b9ce5d7dd70dd5ea56b70833c842068312a739e6131d956fd733e9893441e7e3340b6734bea0b799ac292533b0082975c08facd963961062dac821ccc44f9a9
HEAD_REF master
PATCHES
fix-cmake.patch
)
vcpkg_check_features(
asm MI_SEE_ASM
secure MI_SECURE
override MI_OVERRIDE
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG
-DMI_CHECK_FULL=ON
OPTIONS_RELEASE
-DMI_CHECK_FULL=OFF
OPTIONS
-DMI_OVERRIDE=${MI_OVERRIDE}
-DMI_INTERPOSE=ON
-DMI_SEE_ASM=${MI_SEE_ASM}
-DMI_USE_CXX=OFF
-DMI_SECURE=${MI_SECURE}
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(GLOB lib_directories RELATIVE ${CURRENT_PACKAGES_DIR}/lib "${CURRENT_PACKAGES_DIR}/lib/${PORT}-*")
list(GET lib_directories 0 lib_install_dir)
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/${lib_install_dir}/cmake)
vcpkg_replace_string(
${CURRENT_PACKAGES_DIR}/share/${PORT}/mimalloc.cmake
"lib/${lib_install_dir}/"
""
)
file(COPY
${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}
)
file(COPY ${CURRENT_PACKAGES_DIR}/lib/${lib_install_dir}/include DESTINATION ${CURRENT_PACKAGES_DIR})
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/lib/${lib_install_dir}
${CURRENT_PACKAGES_DIR}/debug/share
${CURRENT_PACKAGES_DIR}/lib/${lib_install_dir}
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
vcpkg_replace_string(
${CURRENT_PACKAGES_DIR}/include/mimalloc.h
"!defined(MI_SHARED_LIB)"
"0 // !defined(MI_SHARED_LIB)"
)
endif()
# Handle copyright
configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
# CMake integration test
vcpkg_test_cmake(PACKAGE_NAME ${PORT})