[SDL2_xxx]: Add CMake targets for SDL2 addons (#5754)

* Add SDL2 image target

* Add SDL2_mixer target

* Add SDL2_ttf target

* Add SDL2_net target

* Fix missing source file for SDL2_image

* Disable harfbuzz for freetype properly

* Use both include dirs for freetype in SDL2-tff
This commit is contained in:
Helco 2019-03-26 17:57:16 +01:00 committed by Victor Romero
parent 252ba6a04f
commit 95785e1b40
13 changed files with 62 additions and 9 deletions

View File

@ -26,6 +26,7 @@ vcpkg_configure_cmake(
-DFT_WITH_BZIP2=ON
-DFT_WITH_PNG=ON
-DFT_WITH_HARFBUZZ=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE
)
vcpkg_install_cmake()

View File

@ -48,6 +48,15 @@ add_library(SDL2_image
version.rc
)
if (APPLE)
target_sources(SDL2_image PRIVATE
IMG_ImageIO.m
)
target_compile_options(SDL2_image BEFORE PRIVATE
"-x" "objective-c"
)
endif()
set_target_properties(SDL2_image PROPERTIES DEFINE_SYMBOL SDL2_EXPORTS)
foreach(FORMAT ${SUPPORTED_FORMATS})
@ -94,12 +103,19 @@ endif()
install(TARGETS SDL2_image
EXPORT SDL2_image
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
install(FILES SDL_image.h DESTINATION include/SDL2 CONFIGURATIONS Release)
install(EXPORT SDL2_image
DESTINATION share/sdl2-image/
FILE sdl2-image-config.cmake
NAMESPACE SDL2::
)
message(STATUS "Link-time dependencies:")
message(STATUS " " ${SDL_LIBRARY})

View File

@ -1,5 +1,5 @@
Source: sdl2-image
Version: 2.0.4
Version: 2.0.4-1
Build-Depends: sdl2, libpng
Description: SDL_image is an image file loading library. It loads images as SDL surfaces and textures, and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV

View File

@ -44,6 +44,9 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH "share/sdl2-image")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2-image)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/sdl2-image/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/sdl2-image/copyright)

View File

@ -78,18 +78,25 @@ add_library(SDL2_mixer
if(WIN32)
list(APPEND SDL_MIXER_DEFINES MUSIC_MID_NATIVE)
target_sources(SDL2_mixer PRIVATE music_nativemidi.c native_midi/native_midi_common.c native_midi/native_midi_win32.c)
target_link_libraries(SDL2_mixer ${SDL_MIXER_LIBRARIES} Winmm)
endif()
set_target_properties(SDL2_mixer PROPERTIES DEFINE_SYMBOL SDL2_EXPORTS)
target_compile_definitions(SDL2_mixer PRIVATE ${SDL_MIXER_DEFINES})
target_include_directories(SDL2_mixer PRIVATE ${SDL_MIXER_INCLUDES} ./native_midi)
target_link_libraries(SDL2_mixer ${SDL_MIXER_LIBRARIES} Winmm)
install(TARGETS SDL2_mixer
EXPORT SDL2_mixer
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
install(EXPORT SDL2_mixer
DESTINATION share/sdl2-mixer/
FILE sdl2-mixer-config.cmake
NAMESPACE SDL2::
)
if(NOT SDL_MIXER_SKIP_HEADERS)
install(FILES SDL_mixer.h DESTINATION include/SDL2)
endif()

View File

@ -1,5 +1,5 @@
Source: sdl2-mixer
Version: 2.0.4
Version: 2.0.4-1
Description: Multi-channel audio mixer library for SDL.
Build-Depends: sdl2

View File

@ -54,5 +54,8 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH "share/sdl2-mixer")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2-mixer)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/sdl2-mixer/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/sdl2-mixer/copyright)

View File

@ -13,13 +13,23 @@ add_library(SDL2_net SDLnet.c SDLnetselect.c SDLnetTCP.c SDLnetUDP.c version.rc)
set_target_properties(SDL2_net PROPERTIES DEFINE_SYMBOL SDL2_EXPORTS)
target_compile_definitions(SDL2_net PRIVATE _WINSOCK_DEPRECATED_NO_WARNINGS)
target_include_directories(SDL2_net PRIVATE ${SDL_INCLUDE_DIR}/SDL2)
target_link_libraries(SDL2_net ${SDL_LIBRARY} ws2_32 iphlpapi)
if (WIN32)
target_link_libraries(SDL2_net ${SDL_LIBRARY} ws2_32 iphlpapi)
endif()
install(TARGETS SDL2_net
EXPORT SDL2_net
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
install(EXPORT SDL2_net
DESTINATION "share/sdl2-net"
FILE sdl2-net-config.cmake
NAMESPACE SDL2::
)
if(NOT DEFINED SDL_NET_SKIP_HEADERS)
install(FILES SDL_net.h DESTINATION include/SDL2)
endif()

View File

@ -1,4 +1,4 @@
Source: sdl2-net
Version: 2.0.1-4
Version: 2.0.1-5
Description: Networking library for SDL
Build-Depends: sdl2

View File

@ -18,5 +18,8 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH "share/sdl2-net")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2-net)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/sdl2-net/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/sdl2-net/copyright)

View File

@ -8,18 +8,25 @@ find_package(Freetype REQUIRED)
add_library(SDL2_ttf SDL_ttf.c version.rc)
set_target_properties(SDL2_ttf PROPERTIES DEFINE_SYMBOL SDL2_EXPORTS)
target_include_directories(SDL2_ttf PRIVATE ${SDL_INCLUDE_DIR}/SDL2 ${FREETYPE_INCLUDE_DIR_ft2build})
target_link_libraries(SDL2_ttf ${SDL_LIBRARY} ${FREETYPE_LIBRARY})
target_include_directories(SDL2_ttf PRIVATE ${SDL_INCLUDE_DIR}/SDL2 ${FREETYPE_INCLUDE_DIRS})
target_link_libraries(SDL2_ttf ${SDL_LIBRARY} ${FREETYPE_LIBRARIES})
install(TARGETS SDL2_ttf
EXPORT SDL2_ttf
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
INSTALL(EXPORT SDL2_ttf
DESTINATION "share/sdl2-ttf"
FILE sdl2-ttf-config.cmake
NAMESPACE SDL2::
)
if(NOT DEFINED SDL_TTF_SKIP_HEADERS)
install(FILES SDL_ttf.h DESTINATION include/SDL2)
endif()
message(STATUS "Link-time dependencies:")
message(STATUS " " ${SDL_LIBRARY})
message(STATUS " " ${FREETYPE_LIBRARY})
message(STATUS " " ${FREETYPE_LIBRARIES})

View File

@ -1,4 +1,4 @@
Source: sdl2-ttf
Version: 2.0.15
Version: 2.0.15-1
Description: A library for rendering TrueType fonts with SDL
Build-Depends: sdl2, freetype

View File

@ -25,5 +25,8 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH "share/sdl2-ttf")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2-ttf)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/sdl2-ttf/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/sdl2-ttf/copyright)