vcpkg/ports/sdl2/portfile.cmake

54 lines
1.9 KiB
CMake
Raw Normal View History

2016-09-19 11:50:08 +08:00
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO SDL-Mirror/SDL
REF release-2.0.7
SHA512 3667c7299d007e0438de90c6dd1f19ad9f30cf155c35792c40267bc74f8fe8acd1046ac918a104690ccba3faa2dbd86b37821a38c6c389179359b903209e2eb7
HEAD_REF master
2016-09-19 11:50:08 +08:00
)
2016-12-29 08:00:43 +08:00
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
2017-07-21 19:01:00 +08:00
${CMAKE_CURRENT_LIST_DIR}/export-symbols-only-in-shared-build.patch
2017-11-22 18:56:43 +08:00
${CMAKE_CURRENT_LIST_DIR}/enable-winrt-cmake.patch
2016-12-29 08:00:43 +08:00
)
2017-11-22 18:56:43 +08:00
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SDL_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SDL_SHARED)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" FORCE_STATIC_VCRT)
2016-09-19 11:50:08 +08:00
2017-11-22 18:56:43 +08:00
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DSDL_STATIC=${SDL_STATIC}
-DSDL_SHARED=${SDL_SHARED}
-DVIDEO_VULKAN=OFF
-DFORCE_STATIC_VCRT=${FORCE_STATIC_VCRT}
-DLIBC=ON
)
2016-09-19 11:50:08 +08:00
2017-11-22 18:56:43 +08:00
vcpkg_install_cmake()
2017-11-22 18:56:43 +08:00
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
2016-09-19 11:50:08 +08:00
2017-11-22 18:56:43 +08:00
vcpkg_fixup_cmake_targets(CONFIG_PATH "cmake")
2017-11-22 18:56:43 +08:00
if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/SDL2main.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/SDL2main.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/SDL2maind.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/SDL2maind.lib)
file(GLOB SHARE_FILES ${CURRENT_PACKAGES_DIR}/share/sdl2/*.cmake)
foreach(SHARE_FILE ${SHARE_FILES})
file(READ "${SHARE_FILE}" _contents)
string(REPLACE "lib/SDL2main" "lib/manual-link/SDL2main" _contents "${_contents}")
file(WRITE "${SHARE_FILE}" "${_contents}")
endforeach()
endif()
2016-12-11 21:04:59 +08:00
file(INSTALL ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2 RENAME copyright)
2016-09-19 11:50:08 +08:00
vcpkg_copy_pdbs()