aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Katz <dhkatz.16@gmail.com>2019-12-23 15:52:14 -0800
committerdan-shaw <51385773+dan-shaw@users.noreply.github.com>2019-12-23 15:52:14 -0800
commit7ac7a463433c9e1d166b7e5951b6706dc88d3719 (patch)
tree39bdf03584be94e305b9617d7417ea09f4820fc6
parent6723668f7f2eaec5a93a1e43e510358204556e8c (diff)
downloadvcpkg-7ac7a463433c9e1d166b7e5951b6706dc88d3719.tar.gz
vcpkg-7ac7a463433c9e1d166b7e5951b6706dc88d3719.zip
[sdl2-gfx] Update CMake build and find_package support (#9319)
* [sdl2-gfx] Update CMake build and find_package support * Update build process to more closely mimic other SDL2 extensions * Bump CONTROL version number * Remove uneeded wrapper file * Remove uneeded wrapper file * [sdl2-gfx] Simplification. Add cmake find_dependency(SDL2). Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
-rw-r--r--ports/sdl2-gfx/CMakeLists.txt33
-rw-r--r--ports/sdl2-gfx/CONTROL2
-rw-r--r--ports/sdl2-gfx/portfile.cmake1
3 files changed, 29 insertions, 7 deletions
diff --git a/ports/sdl2-gfx/CMakeLists.txt b/ports/sdl2-gfx/CMakeLists.txt
index 1a63d7f8b..cceab96cf 100644
--- a/ports/sdl2-gfx/CMakeLists.txt
+++ b/ports/sdl2-gfx/CMakeLists.txt
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.0)
-project(SDL2_GFX C)
+project(SDL2_gfx VERSION 1.0.4 LANGUAGES C)
+
+set(CONFIG_NAME "sdl2-gfx")
find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
find_package(SDL2 CONFIG REQUIRED)
@@ -10,21 +12,40 @@ if(BUILD_SHARED_LIBS)
list(APPEND SDL_GFX_DEFINES DLL_EXPORT)
endif()
-add_library(SDL2_gfx
+add_library(${PROJECT_NAME}
SDL2_framerate.c
SDL2_gfxPrimitives.c
SDL2_imageFilter.c
SDL2_rotozoom.c)
-target_compile_definitions(SDL2_gfx PRIVATE ${SDL_GFX_DEFINES})
-target_include_directories(SDL2_gfx PRIVATE ${SDL_INCLUDE_DIR}/SDL2)
-target_link_libraries(SDL2_gfx PRIVATE SDL2::SDL2)
+target_include_directories(${PROJECT_NAME} PUBLIC
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:include>
+ $<INSTALL_INTERFACE:include/SDL2>
+)
+
+target_compile_definitions(${PROJECT_NAME} PRIVATE ${SDL_GFX_DEFINES})
+target_include_directories(${PROJECT_NAME} PRIVATE ${SDL_INCLUDE_DIR}/SDL2)
+target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2)
-install(TARGETS SDL2_gfx
+install(TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
+install(EXPORT ${PROJECT_NAME}
+ FILE ${CONFIG_NAME}-targets.cmake
+ NAMESPACE SDL2::
+ DESTINATION share/${CONFIG_NAME}/
+)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}-config.cmake
+"include(CMakeFindDependencyMacro)
+find_dependency(SDL2 CONFIG)
+include(\${CMAKE_CURRENT_LIST_DIR}/${CONFIG_NAME}-targets.cmake)"
+)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}-config.cmake DESTINATION share/${CONFIG_NAME})
+
if(NOT SDL_GFX_SKIP_HEADERS)
install(FILES SDL2_framerate.h SDL2_gfxPrimitives.h SDL2_imageFilter.h SDL2_rotozoom.h SDL2_gfxPrimitives_font.h DESTINATION include/SDL2)
endif()
diff --git a/ports/sdl2-gfx/CONTROL b/ports/sdl2-gfx/CONTROL
index 8b4af0e61..de1005b47 100644
--- a/ports/sdl2-gfx/CONTROL
+++ b/ports/sdl2-gfx/CONTROL
@@ -1,4 +1,4 @@
Source: sdl2-gfx
-Version: 1.0.4-2
+Version: 1.0.4-4
Build-Depends: sdl2
Description: Graphics primitives (line, circle, rectangle etc.) with AA support, rotozoomer and other drawing related support functions wrapped up in a C based add-on library for the Simple Direct Media (SDL) cross-platform API layer.
diff --git a/ports/sdl2-gfx/portfile.cmake b/ports/sdl2-gfx/portfile.cmake
index ce83fd21e..f547c1edd 100644
--- a/ports/sdl2-gfx/portfile.cmake
+++ b/ports/sdl2-gfx/portfile.cmake
@@ -23,6 +23,7 @@ vcpkg_configure_cmake(
)
vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets()
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2-gfx)