2022-09-01 04:34:35 +08:00
set ( SDL2_VERSION 2.24.0 )
2021-08-19 08:19:15 +08:00
vcpkg_from_github (
2018-01-17 06:13:15 +08:00
O U T _ S O U R C E _ P A T H S O U R C E _ P A T H
2021-08-19 08:19:15 +08:00
R E P O l i b s d l - o r g / S D L
2022-09-01 04:34:35 +08:00
R E F 8 c 9 b e b 0 c 8 7 3 f 6 c a 5 e f b d 8 8 f 1 a d 2 6 4 8 b f c 7 9 3 b 2 a c #vrelease-2.24.0
S H A 5 1 2 7 9 3 6 f c 3 d e 9 9 2 0 e a f e 3 9 9 f 5 b 2 a f 7 b f 8 7 d 4 7 9 d 4 b a 8 c 4 a 7 9 5 7 d a 9 0 f 3 a 9 0 3 1 6 d c 7 a 6 b 8 6 1 9 f f d 7 a 2 c 1 9 8 d 2 9 8 d 3 9 0 e 1 2 3 5 e 0 0 f 9 b d 3 6 f e 3 f 0 4 1 0 2 b d f f 3 5 1 b 9 6 c 2 a d e 5 9 e
2021-08-19 08:19:15 +08:00
H E A D _ R E F m a s t e r
2016-12-29 08:00:43 +08:00
P A T C H E S
2021-01-06 04:33:13 +08:00
0 0 0 1 - s d l 2 - E n a b l e - c r e a t i o n - o f - p k g - c f g - f i l e - o n - w i n d o w s . p a t c h
0 0 0 2 - s d l 2 - s k i p - i b u s - o n - l i n u x . p a t c h
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
2020-03-03 02:05:47 +08:00
vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_OPTIONS
2021-04-08 03:31:03 +08:00
F E A T U R E S
2022-08-11 07:08:17 +08:00
v u l k a n S D L _ V U L K A N
x 1 1 S D L _ X 1 1 _ S H A R E D
w a y l a n d S D L _ W A Y L A N D _ S H A R E D
2020-03-03 02:05:47 +08:00
)
2019-02-27 03:08:53 +08:00
2021-11-12 05:47:51 +08:00
if ( "x11" IN_LIST FEATURES )
message ( WARNING "You will need to install Xorg dependencies to use feature x11:\nsudo apt install libx11-dev libxft-dev libxext-dev\n" )
endif ( )
2022-08-11 07:08:17 +08:00
if ( "wayland" IN_LIST FEATURES )
message ( WARNING "You will need to install Wayland dependencies to use feature wayland:\nsudo apt install libwayland-dev libxkbcommon-dev libegl1-mesa-dev\n" )
endif ( )
2021-11-12 05:47:51 +08:00
2022-04-28 09:12:48 +08:00
if ( VCPKG_TARGET_IS_UWP )
set ( configure_opts WINDOWS_USE_MSBUILD )
endif ( )
2021-11-12 05:47:51 +08:00
vcpkg_cmake_configure (
S O U R C E _ P A T H " $ { S O U R C E _ P A T H } "
2022-04-28 09:12:48 +08:00
$ { c o n f i g u r e _ o p t s }
2020-03-03 02:05:47 +08:00
O P T I O N S $ { F E A T U R E _ O P T I O N S }
2017-11-22 18:56:43 +08:00
- D S D L _ S T A T I C = $ { S D L _ S T A T I C }
- D S D L _ S H A R E D = $ { S D L _ S H A R E D }
2022-01-27 07:32:31 +08:00
- D S D L _ F O R C E _ S T A T I C _ V C R T = $ { F O R C E _ S T A T I C _ V C R T }
- D S D L _ L I B C = O N
2022-06-03 06:31:59 +08:00
- D S D L _ H I D A P I _ J O Y S T I C K = O N
2022-09-01 04:34:35 +08:00
- D S D L _ T E S T = O F F
M A Y B E _ U N U S E D _ V A R I A B L E S
S D L _ F O R C E _ S T A T I C _ V C R T
2017-11-22 18:56:43 +08:00
)
2016-09-19 11:50:08 +08:00
2021-11-12 05:47:51 +08:00
vcpkg_cmake_install ( )
2017-11-21 09:06:11 +08:00
2018-03-12 14:41:51 +08:00
if ( EXISTS "${CURRENT_PACKAGES_DIR}/cmake" )
2021-11-12 05:47:51 +08:00
vcpkg_cmake_config_fixup ( CONFIG_PATH cmake )
2018-03-12 14:41:51 +08:00
elseif ( EXISTS "${CURRENT_PACKAGES_DIR}/lib/cmake/SDL2" )
2021-11-12 05:47:51 +08:00
vcpkg_cmake_config_fixup ( CONFIG_PATH lib/cmake/SDL2 )
2018-03-12 14:41:51 +08:00
elseif ( EXISTS "${CURRENT_PACKAGES_DIR}/SDL2.framework/Resources" )
2021-11-12 05:47:51 +08:00
vcpkg_cmake_config_fixup ( CONFIG_PATH SDL2.framework/Resources )
2018-03-12 14:41:51 +08:00
endif ( )
file ( REMOVE_RECURSE
2021-11-12 05:47:51 +08:00
" $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / i n c l u d e "
" $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / s h a r e "
" $ { C U R R E N T _ P A C K A G E S _ D I R } / b i n / s d l 2 - c o n f i g "
" $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / b i n / s d l 2 - c o n f i g "
" $ { C U R R E N T _ P A C K A G E S _ D I R } / S D L 2 . f r a m e w o r k "
" $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / S D L 2 . f r a m e w o r k "
2018-03-12 14:41:51 +08:00
)
2016-09-19 11:50:08 +08:00
2021-11-12 05:47:51 +08:00
file ( GLOB BINS "${CURRENT_PACKAGES_DIR}/debug/bin/*" "${CURRENT_PACKAGES_DIR}/bin/*" )
2018-03-12 14:41:51 +08:00
if ( NOT BINS )
file ( REMOVE_RECURSE
2021-11-12 05:47:51 +08:00
" $ { C U R R E N T _ P A C K A G E S _ D I R } / b i n "
" $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / b i n "
2018-03-12 14:41:51 +08:00
)
endif ( )
2017-11-21 09:06:11 +08:00
2021-12-02 11:20:14 +08:00
if ( VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_UWP AND NOT VCPKG_TARGET_IS_MINGW )
2018-03-20 03:15:56 +08:00
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release" )
2021-11-12 05:47:51 +08:00
file ( MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/manual-link" )
file ( RENAME "${CURRENT_PACKAGES_DIR}/lib/SDL2main.lib" "${CURRENT_PACKAGES_DIR}/lib/manual-link/SDL2main.lib" )
2018-03-20 03:15:56 +08:00
endif ( )
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" )
2021-11-12 05:47:51 +08:00
file ( MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link" )
file ( RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/SDL2maind.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/SDL2maind.lib" )
2018-03-20 03:15:56 +08:00
endif ( )
2017-11-21 09:06:11 +08:00
2021-11-12 05:47:51 +08:00
file ( GLOB SHARE_FILES "${CURRENT_PACKAGES_DIR}/share/sdl2/*.cmake" )
2017-11-21 09:06:11 +08:00
foreach ( SHARE_FILE ${ SHARE_FILES } )
2021-01-25 15:21:41 +08:00
vcpkg_replace_string ( "${SHARE_FILE}" "lib/SDL2main" "lib/manual-link/SDL2main" )
2017-11-21 09:06:11 +08:00
endforeach ( )
2017-09-24 20:31:30 +08:00
endif ( )
2016-12-11 21:04:59 +08:00
2016-09-19 11:50:08 +08:00
vcpkg_copy_pdbs ( )
2020-08-19 03:58:14 +08:00
set ( DYLIB_COMPATIBILITY_VERSION_REGEX "set\\(DYLIB_COMPATIBILITY_VERSION (.+)\\)" )
set ( DYLIB_CURRENT_VERSION_REGEX "set\\(DYLIB_CURRENT_VERSION (.+)\\)" )
file ( STRINGS "${SOURCE_PATH}/CMakeLists.txt" DYLIB_COMPATIBILITY_VERSION REGEX ${ DYLIB_COMPATIBILITY_VERSION_REGEX } )
file ( STRINGS "${SOURCE_PATH}/CMakeLists.txt" DYLIB_CURRENT_VERSION REGEX ${ DYLIB_CURRENT_VERSION_REGEX } )
string ( REGEX REPLACE ${ DYLIB_COMPATIBILITY_VERSION_REGEX } "\\1" DYLIB_COMPATIBILITY_VERSION "${DYLIB_COMPATIBILITY_VERSION}" )
string ( REGEX REPLACE ${ DYLIB_CURRENT_VERSION_REGEX } "\\1" DYLIB_CURRENT_VERSION "${DYLIB_CURRENT_VERSION}" )
2020-10-08 02:47:58 +08:00
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" )
2021-01-25 15:21:41 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-lSDL2main" "-lSDL2maind" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-lSDL2 " "-lSDL2d " )
2020-10-08 02:47:58 +08:00
endif ( )
2020-08-19 03:58:14 +08:00
2022-09-01 04:34:35 +08:00
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "static" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW )
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/sdl2.pc" "-lSDL2 " "-lSDL2-static " )
endif ( )
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-lSDL2d " "-lSDL2-staticd " )
endif ( )
endif ( )
2022-03-22 10:44:39 +08:00
vcpkg_fixup_pkgconfig ( )
2022-04-16 04:44:08 +08:00
file ( INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright )