2017-07-06 15:22:58 +08:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
2019-12-24 07:52:14 +08:00
|
|
|
project(SDL2_gfx VERSION 1.0.4 LANGUAGES C)
|
|
|
|
|
|
|
|
set(CONFIG_NAME "sdl2-gfx")
|
2017-07-06 15:22:58 +08:00
|
|
|
|
|
|
|
find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
|
2019-05-02 04:36:57 +08:00
|
|
|
find_package(SDL2 CONFIG REQUIRED)
|
2017-07-06 15:22:58 +08:00
|
|
|
|
|
|
|
# builtin formats
|
2017-07-08 08:44:09 +08:00
|
|
|
set(SDL_GFX_DEFINES WIN32)
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
list(APPEND SDL_GFX_DEFINES DLL_EXPORT)
|
|
|
|
endif()
|
2017-07-06 15:22:58 +08:00
|
|
|
|
2019-12-24 07:52:14 +08:00
|
|
|
add_library(${PROJECT_NAME}
|
2017-07-06 15:22:58 +08:00
|
|
|
SDL2_framerate.c
|
|
|
|
SDL2_gfxPrimitives.c
|
|
|
|
SDL2_imageFilter.c
|
|
|
|
SDL2_rotozoom.c)
|
|
|
|
|
2019-12-24 07:52:14 +08:00
|
|
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
$<INSTALL_INTERFACE:include/SDL2>
|
|
|
|
)
|
|
|
|
|
2020-04-25 05:05:43 +08:00
|
|
|
if(WIN32)
|
|
|
|
add_compile_definitions(${SDL_GFX_DEFINES})
|
|
|
|
endif()
|
2019-12-24 07:52:14 +08:00
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE ${SDL_INCLUDE_DIR}/SDL2)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2)
|
2017-07-06 15:22:58 +08:00
|
|
|
|
2019-12-24 07:52:14 +08:00
|
|
|
install(TARGETS ${PROJECT_NAME}
|
|
|
|
EXPORT ${PROJECT_NAME}
|
2017-07-06 15:22:58 +08:00
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
LIBRARY DESTINATION lib)
|
|
|
|
|
2019-12-24 07:52:14 +08:00
|
|
|
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})
|
|
|
|
|
2017-07-06 15:22:58 +08:00
|
|
|
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()
|