vcpkg/ports/pthreads/portfile.cmake

49 lines
1.7 KiB
CMake
Raw Normal View History

if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "${PORT} does not currently support UWP")
endif()
2017-08-30 02:41:08 +08:00
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pthreads-w32-2-9-1-release)
vcpkg_download_distfile(ARCHIVE
URLS "https://www.mirrorservice.org/sites/sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.tar.gz"
2017-08-30 02:41:08 +08:00
FILENAME "pthreads-w32-2-9-1-release.tar.gz"
SHA512 9c06e85310766834370c3dceb83faafd397da18a32411ca7645c8eb6b9495fea54ca2872f4a3e8d83cb5fdc5dea7f3f0464be5bb9af3222a6534574a184bd551
)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DPTW32_ARCH=${VCPKG_TARGET_ARCHITECTURE}
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(GLOB HEADERS "${CURRENT_PACKAGES_DIR}/include/*.h")
foreach(HEADER ${HEADERS})
file(READ "${HEADER}" _contents)
2017-08-30 03:15:35 +08:00
string(REPLACE "defined(_TIMESPEC_DEFINED)" "1" _contents "${_contents}")
string(REPLACE "defined(PTW32_RC_MSC)" "1" _contents "${_contents}")
2017-08-30 02:41:08 +08:00
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
string(REPLACE "!defined(PTW32_STATIC_LIB)" "0" _contents "${_contents}")
endif()
file(WRITE "${HEADER}" "${_contents}")
endforeach()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/pthreads RENAME copyright)
2017-10-17 09:44:37 +08:00
file(INSTALL
${CURRENT_PACKAGES_DIR}/lib/pthreadsVC2.lib
2017-10-18 06:31:24 +08:00
DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link
RENAME pthreads.lib
)
2017-10-17 09:49:13 +08:00
file(INSTALL
${CURRENT_PACKAGES_DIR}/debug/lib/pthreadsVC2d.lib
2017-10-18 06:31:24 +08:00
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link
2017-10-17 09:49:13 +08:00
RENAME pthreads.lib
)