[sdl2] enable static build

This commit is contained in:
codicodi 2016-12-11 14:04:59 +01:00 committed by GitHub
parent 1726d62911
commit 48ca773907

View File

@ -1,7 +1,3 @@
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
message(STATUS "Warning: Static building not supported yet. Building dynamic.")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.5)
vcpkg_download_distfile(ARCHIVE_FILE
@ -32,10 +28,25 @@ if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
file(COPY ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(RENAME ${CURRENT_PACKAGES_DIR}/include/include ${CURRENT_PACKAGES_DIR}/include/SDL2)
else()
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()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DSDL_STATIC=OFF
-DSDL_STATIC=${SDL_STATIC_LIB}
-DSDL_SHARED=${SDL_SHARED_LIB}
-DFORCE_STATIC_VCRT=${SDL_STATIC_CRT}
)
vcpkg_install_cmake()
@ -43,5 +54,10 @@ else()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
endif()
file(COPY ${CURRENT_PACKAGES_DIR}/lib/SDL2main.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/SDL2main.lib)
file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/SDL2main.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/SDL2main.lib)
file(INSTALL ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2 RENAME copyright)
vcpkg_copy_pdbs()