2022-11-03 05:12:36 +08:00
vcpkg_minimum_required ( VERSION 2022-10-12 ) # for ${VERSION}
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-11-03 05:12:36 +08:00
R E F r e l e a s e - $ { V E R S I O N }
2023-01-09 17:12:09 +08:00
S H A 5 1 2 8 6 6 2 0 a 8 f 2 4 e 0 5 4 a 4 7 e 5 3 4 3 5 e d 6 2 0 b d e 2 c 7 f b 8 f f d 7 d b 9 9 d c d 8 a 9 1 b a c 7 0 e a 7 3 3 1 6 3 b 9 5 a e 3 b 7 7 b 0 4 d 1 e f 5 f 0 9 8 7 3 0 d f d 3 8 5 c f 4 b c f 8 5 f 4 5 d 5 2 3 4 c d d d 7 c 9 5 8 1 b 5 1 3 a f 4
2022-11-03 05:12:36 +08:00
H E A D _ R E F m a i n
2022-12-27 16:52:33 +08:00
P A T C H E S
d e p s . 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
2022-12-14 09:41:34 +08:00
x 1 1 S D L _ X 1 1
2022-11-29 03:12:32 +08:00
w a y l a n d S D L _ W A Y L A N D
2022-12-27 16:52:33 +08:00
s a m p l e r a t e S D L _ L I B S A M P L E R A T E
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-09-01 04:34:35 +08:00
- D S D L _ T E S T = O F F
2022-11-29 03:12:32 +08:00
- D S D L _ I B U S = O F F
- D S D L _ I N S T A L L _ C M A K E D I R = " c m a k e "
2022-12-27 16:52:33 +08:00
- D C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ G i t = O N
- D S D L _ L I B S A M P L E R A T E _ S H A R E D = O F F
2022-09-01 04:34:35 +08:00
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 ( )
2022-11-29 03:12:32 +08:00
vcpkg_cmake_config_fixup ( CONFIG_PATH cmake )
2018-03-12 14:41:51 +08:00
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 "
2022-12-27 16:52:33 +08:00
" $ { C U R R E N T _ P A C K A G E S _ D I R } / s h a r e / l i c e n s e s "
" $ { C U R R E N T _ P A C K A G E S _ D I R } / s h a r e / a c l o c a l "
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 " )
2022-11-29 03:12:32 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-lSDL2-static " "-lSDL2-staticd " )
2020-10-08 02:47:58 +08:00
endif ( )
2020-08-19 03:58:14 +08:00
2022-11-29 03:12:32 +08:00
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" 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-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" "-lSDL2-staticd " " " )
endif ( )
endif ( )
if ( VCPKG_TARGET_IS_UWP )
2022-09-01 04:34:35 +08:00
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release" )
2022-11-29 03:12:32 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/sdl2.pc" "$<$<CONFIG:Debug>:d>.lib" "" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/sdl2.pc" "-l-nodefaultlib:" "-nodefaultlib:" )
2022-09-01 04:34:35 +08:00
endif ( )
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" )
2022-11-29 03:12:32 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "$<$<CONFIG:Debug>:d>.lib" "d" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-l-nodefaultlib:" "-nodefaultlib:" )
2022-09-01 04:34:35 +08:00
endif ( )
endif ( )
2022-03-22 10:44:39 +08:00
vcpkg_fixup_pkgconfig ( )
2022-04-16 04:44:08 +08:00
2022-11-03 05:12:36 +08:00
file ( INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" )
2022-11-29 03:12:32 +08:00
vcpkg_install_copyright ( FILE_LIST "${SOURCE_PATH}/LICENSE.txt" )