vcpkg/ports/sdl2/portfile.cmake

72 lines
2.5 KiB
CMake
Raw Normal View History

2016-09-19 11:50:08 +08:00
include(vcpkg_common_functions)
set(SDL2_VERSION 2.0.6)
set(SDL2_HASH ad4dad5663834ee0ffbdca1b531d753449b260c9256df2c48da7261aacd9795d91eef1286525cf914f6b92ba5985de7798f041557574b5d978b8224f10041830)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2-${SDL2_VERSION})
2016-09-19 11:50:08 +08:00
vcpkg_download_distfile(ARCHIVE_FILE
URLS "http://libsdl.org/release/SDL2-${SDL2_VERSION}.tar.gz"
FILENAME "SDL2-${SDL2_VERSION}.tar.gz"
SHA512 ${SDL2_HASH}
2016-09-19 11:50:08 +08:00
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
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
2016-12-29 08:00:43 +08:00
)
if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
2016-09-19 11:50:08 +08:00
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj
2016-09-19 11:50:08 +08:00
)
file(COPY
${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Debug/SDL-UWP/SDL2.dll
${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Debug/SDL-UWP/SDL2.pdb
2016-09-19 11:50:08 +08:00
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
file(COPY
${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Release/SDL-UWP/SDL2.dll
${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Release/SDL-UWP/SDL2.pdb
2016-09-19 11:50:08 +08:00
DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
file(COPY ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Debug/SDL-UWP/SDL2.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Release/SDL-UWP/SDL2.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
2016-09-19 11:50:08 +08:00
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/include)
file(COPY ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR}/include)
2016-09-19 11:50:08 +08:00
file(RENAME ${CURRENT_PACKAGES_DIR}/include/include ${CURRENT_PACKAGES_DIR}/include/SDL2)
else()
2016-12-11 21:04:59 +08:00
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(SDL_STATIC_LIB ON)
set(SDL_SHARED_LIB OFF)
else()
set(SDL_STATIC_LIB OFF)
set(SDL_SHARED_LIB ON)
endif()
if(VCPKG_CRT_LINKAGE STREQUAL static)
set(SDL_STATIC_CRT ON)
else()
set(SDL_STATIC_CRT OFF)
endif()
2016-09-19 11:50:08 +08:00
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
2016-09-19 11:50:08 +08:00
OPTIONS
2016-12-11 21:04:59 +08:00
-DSDL_STATIC=${SDL_STATIC_LIB}
-DSDL_SHARED=${SDL_SHARED_LIB}
-DFORCE_STATIC_VCRT=${SDL_STATIC_CRT}
2016-12-20 21:52:13 +08:00
-DLIBC=ON
2016-09-19 11:50:08 +08:00
)
vcpkg_install_cmake()
2016-09-19 11:50:08 +08:00
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
vcpkg_fixup_cmake_targets(CONFIG_PATH "cmake")
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()