2025-08-03 10:07:35 -04:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
2026-05-07 22:20:10 -04:00
|
|
|
project(akgl LANGUAGES C)
|
2025-08-03 10:07:35 -04:00
|
|
|
|
2025-08-03 14:06:40 -04:00
|
|
|
include(CTest)
|
|
|
|
|
|
2026-05-12 16:45:42 -04:00
|
|
|
add_subdirectory(deps/jansson EXCLUDE_FROM_ALL)
|
|
|
|
|
add_subdirectory(deps/libakerror EXCLUDE_FROM_ALL)
|
|
|
|
|
add_subdirectory(deps/libakstdlib EXCLUDE_FROM_ALL)
|
|
|
|
|
add_subdirectory(deps/SDL EXCLUDE_FROM_ALL)
|
|
|
|
|
add_subdirectory(deps/SDL_image EXCLUDE_FROM_ALL)
|
|
|
|
|
add_subdirectory(deps/SDL_mixer EXCLUDE_FROM_ALL)
|
|
|
|
|
add_subdirectory(deps/SDL_ttf EXCLUDE_FROM_ALL)
|
2025-08-03 10:07:35 -04:00
|
|
|
|
2026-05-07 22:20:10 -04:00
|
|
|
set(GAMECONTROLLERDB_H "include/akgl/SDL_GameControllerDB.h")
|
2026-05-05 20:39:58 -04:00
|
|
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
|
|
set(exec_prefix "\${prefix}")
|
|
|
|
|
set(libdir "\${exec_prefix}/lib")
|
|
|
|
|
set(includedir "\${prefix}/include")
|
2026-05-07 22:20:10 -04:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/akgl.pc.in ${CMAKE_CURRENT_BINARY_DIR}/akgl.pc @ONLY)
|
2025-08-09 13:53:37 -04:00
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT ${GAMECONTROLLERDB_H}
|
|
|
|
|
COMMAND ../mkcontrollermappings.sh
|
|
|
|
|
COMMENT "Generating controller mappings ..."
|
|
|
|
|
)
|
|
|
|
|
|
2025-08-03 10:07:35 -04:00
|
|
|
# Add include directories
|
|
|
|
|
include_directories(${SDL3_INCLUDE_DIRS})
|
2026-05-07 22:20:10 -04:00
|
|
|
add_library(akgl SHARED
|
2026-05-08 23:15:11 -04:00
|
|
|
deps/semver/semver.c
|
2025-08-03 10:07:35 -04:00
|
|
|
src/actor.c
|
|
|
|
|
src/actor_state_string_names.c
|
2026-05-06 11:12:42 -04:00
|
|
|
src/text.c
|
2025-08-03 10:07:35 -04:00
|
|
|
src/assets.c
|
|
|
|
|
src/character.c
|
|
|
|
|
src/draw.c
|
|
|
|
|
src/game.c
|
2025-08-03 21:42:12 -04:00
|
|
|
src/controller.c
|
2025-08-03 10:07:35 -04:00
|
|
|
src/heap.c
|
|
|
|
|
src/json_helpers.c
|
|
|
|
|
src/registry.c
|
|
|
|
|
src/sprite.c
|
|
|
|
|
src/staticstring.c
|
|
|
|
|
src/tilemap.c
|
|
|
|
|
src/util.c
|
2025-08-09 13:53:37 -04:00
|
|
|
${GAMECONTROLLERDB_H}
|
2025-08-03 10:07:35 -04:00
|
|
|
)
|
|
|
|
|
|
2025-08-09 13:53:37 -04:00
|
|
|
|
2025-08-04 21:37:36 -04:00
|
|
|
add_executable(charviewer util/charviewer.c)
|
2025-08-03 10:07:35 -04:00
|
|
|
add_executable(test_actor tests/actor.c)
|
|
|
|
|
add_executable(test_bitmasks tests/bitmasks.c)
|
|
|
|
|
add_executable(test_character tests/character.c)
|
|
|
|
|
add_executable(test_registry tests/registry.c)
|
|
|
|
|
add_executable(test_sprite tests/sprite.c)
|
|
|
|
|
add_executable(test_staticstring tests/staticstring.c)
|
|
|
|
|
add_executable(test_tilemap tests/tilemap.c)
|
|
|
|
|
add_executable(test_util tests/util.c)
|
2026-05-08 23:15:11 -04:00
|
|
|
add_executable(test_semver_unit deps/semver/semver_unit.c)
|
2025-08-03 10:07:35 -04:00
|
|
|
add_test(NAME actor COMMAND test_actor)
|
|
|
|
|
add_test(NAME bitmasks COMMAND test_bitmasks)
|
|
|
|
|
add_test(NAME character COMMAND test_character)
|
|
|
|
|
add_test(NAME registry COMMAND test_registry)
|
|
|
|
|
add_test(NAME sprite COMMAND test_sprite)
|
|
|
|
|
add_test(NAME staticstring COMMAND test_staticstring)
|
|
|
|
|
add_test(NAME tilemap COMMAND test_tilemap)
|
|
|
|
|
add_test(NAME util COMMAND test_util)
|
2026-05-08 23:15:11 -04:00
|
|
|
add_test(NAME semver_unit COMMAND test_semver_unit)
|
2025-08-03 10:07:35 -04:00
|
|
|
|
|
|
|
|
# Specify include directories for the library's headers (if applicable)
|
2026-05-07 22:20:10 -04:00
|
|
|
target_include_directories(akgl PUBLIC
|
2026-05-08 23:15:11 -04:00
|
|
|
include/
|
|
|
|
|
deps/semver/
|
2025-08-03 10:07:35 -04:00
|
|
|
)
|
|
|
|
|
|
2026-05-07 22:20:10 -04:00
|
|
|
target_link_libraries(akgl
|
2026-05-03 23:57:55 -04:00
|
|
|
PUBLIC
|
|
|
|
|
SDL3::SDL3
|
|
|
|
|
SDL3_image::SDL3_image
|
|
|
|
|
SDL3_mixer::SDL3_mixer
|
2026-05-06 11:12:42 -04:00
|
|
|
SDL3_ttf::SDL3_ttf
|
2026-05-10 00:03:45 -04:00
|
|
|
akstdlib::akstdlib
|
2026-05-12 16:45:42 -04:00
|
|
|
akerror::akerror
|
|
|
|
|
jansson::jansson
|
2026-05-03 23:57:55 -04:00
|
|
|
)
|
|
|
|
|
|
2026-05-12 16:45:42 -04:00
|
|
|
target_link_libraries(test_actor PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm)
|
|
|
|
|
target_link_libraries(test_bitmasks PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm)
|
|
|
|
|
target_link_libraries(test_character PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm)
|
|
|
|
|
target_link_libraries(test_registry PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm)
|
|
|
|
|
target_link_libraries(test_sprite PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm)
|
|
|
|
|
target_link_libraries(test_staticstring PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm)
|
|
|
|
|
target_link_libraries(test_tilemap PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm)
|
|
|
|
|
target_link_libraries(test_util PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm)
|
2025-08-03 10:07:35 -04:00
|
|
|
|
2026-05-12 16:45:42 -04:00
|
|
|
target_link_libraries(charviewer PRIVATE akstdlib::akstdlib akerror::akerror akgl SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image SDL3_mixer::SDL3_mixer jansson::jansson -lm)
|
2025-08-04 21:37:36 -04:00
|
|
|
|
2026-05-07 22:20:10 -04:00
|
|
|
set(main_lib_dest "lib/akgl-${MY_LIBRARY_VERSION}")
|
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/akgl.pc DESTINATION "lib/pkgconfig/")
|
|
|
|
|
install(TARGETS akgl DESTINATION "lib/")
|
2026-05-08 23:15:11 -04:00
|
|
|
install(FILES "deps/semver/semver.h" DESTINATION "include/")
|
2026-05-07 22:20:10 -04:00
|
|
|
install(FILES "include/akgl/actor.h" DESTINATION "include/akgl/")
|
2026-05-08 22:01:56 -04:00
|
|
|
install(FILES "include/akgl/types.h" DESTINATION "include/akgl/")
|
2026-05-07 22:20:10 -04:00
|
|
|
install(FILES "include/akgl/text.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/assets.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/character.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/error.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/draw.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/game.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/controller.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/heap.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/iterator.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/json_helpers.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/registry.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/sprite.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/staticstring.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/tilemap.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES "include/akgl/util.h" DESTINATION "include/akgl/")
|
|
|
|
|
install(FILES ${GAMECONTROLLERDB_H} DESTINATION "include/akgl/")
|