2017-05-20 16:58:30 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic AND VCPKG_CRT_LINKAGE STREQUAL static)
|
|
|
|
message(STATUS "Warning: Dynamic library with static CRT is not supported. Building static library.")
|
|
|
|
set(VCPKG_LIBRARY_LINKAGE static)
|
|
|
|
endif()
|
|
|
|
|
2018-01-05 00:55:01 +08:00
|
|
|
set(PYTHON_VERSION_MAJOR 3)
|
|
|
|
set(PYTHON_VERSION_MINOR 6)
|
|
|
|
set(PYTHON_VERSION_PATCH 4)
|
|
|
|
set(PYTHON_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH})
|
2017-05-20 05:31:04 +08:00
|
|
|
|
|
|
|
include(vcpkg_common_functions)
|
2018-04-21 08:53:57 +08:00
|
|
|
|
2017-05-20 05:31:04 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH TEMP_SOURCE_PATH
|
|
|
|
REPO python/cpython
|
2018-01-05 00:55:01 +08:00
|
|
|
REF v${PYTHON_VERSION}
|
2018-04-21 08:53:57 +08:00
|
|
|
SHA512 32cca5e344ee66f08712ab5533e5518f724f978ec98d985f7612d0bd8d7f5cac25625363c9eead192faf1806d4ea3393515f72ba962a2a0bed26261e56d8c637
|
2017-05-20 05:31:04 +08:00
|
|
|
HEAD_REF master
|
2018-03-18 19:31:30 +08:00
|
|
|
PATCHES
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/0004-Fix-iomodule-for-RS4-SDK.patch
|
2018-07-03 15:59:02 +08:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/0005-Fix-DefaultWindowsSDKVersion.patch
|
2019-01-26 10:11:08 +08:00
|
|
|
dev16.patch
|
|
|
|
Microsoft.VisualStudio.Setup.Configuration.Native.patch
|
2018-03-18 19:31:30 +08:00
|
|
|
)
|
|
|
|
|
2017-05-20 05:31:04 +08:00
|
|
|
# We need per-triplet directories because we need to patch the project files differently based on the linkage
|
2018-03-18 19:31:30 +08:00
|
|
|
# Because the patches patch the same file, they have to be applied in the correct order
|
2018-04-21 08:53:57 +08:00
|
|
|
set(SOURCE_PATH "${TEMP_SOURCE_PATH}-Lib-${VCPKG_LIBRARY_LINKAGE}-crt-${VCPKG_CRT_LINKAGE}")
|
|
|
|
file(REMOVE_RECURSE ${SOURCE_PATH})
|
|
|
|
file(RENAME "${TEMP_SOURCE_PATH}" ${SOURCE_PATH})
|
2017-05-20 05:31:04 +08:00
|
|
|
|
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PATCHES
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/0001-Static-library.patch
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if (VCPKG_CRT_LINKAGE STREQUAL static)
|
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PATCHES
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/0002-Static-CRT.patch
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
|
|
|
|
set(BUILD_ARCH "Win32")
|
|
|
|
set(OUT_DIR "win32")
|
|
|
|
elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
|
|
|
|
set(BUILD_ARCH "x64")
|
|
|
|
set(OUT_DIR "amd64")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_build_msbuild(
|
|
|
|
PROJECT_PATH ${SOURCE_PATH}/PCBuild/pythoncore.vcxproj
|
|
|
|
PLATFORM ${BUILD_ARCH})
|
2018-04-21 08:53:57 +08:00
|
|
|
|
2017-05-20 05:31:04 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PATCHES
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/0003-Fix-header-for-static-linkage.patch
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(GLOB HEADERS ${SOURCE_PATH}/Include/*.h)
|
2018-01-05 00:55:01 +08:00
|
|
|
file(COPY ${HEADERS} ${SOURCE_PATH}/PC/pyconfig.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
|
2017-05-20 05:31:04 +08:00
|
|
|
|
2018-01-05 00:55:01 +08:00
|
|
|
file(COPY ${SOURCE_PATH}/Lib DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR})
|
2017-05-20 16:58:30 +08:00
|
|
|
|
2018-01-05 00:55:01 +08:00
|
|
|
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
|
|
|
|
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
2019-02-07 09:21:23 +08:00
|
|
|
|
2017-05-20 05:31:04 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
2018-01-05 00:55:01 +08:00
|
|
|
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
|
|
|
|
file(COPY ${SOURCE_PATH}/PCBuild/${OUT_DIR}/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_d.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
|
2017-05-20 05:31:04 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Handle copyright
|
2018-01-05 00:55:01 +08:00
|
|
|
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR})
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/LICENSE ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/copyright)
|
2017-05-20 05:31:04 +08:00
|
|
|
|
2018-03-18 19:31:30 +08:00
|
|
|
vcpkg_copy_pdbs()
|