2017-11-30 21:00:47 +01:00
|
|
|
cmake_minimum_required (VERSION 3.2.0)
|
|
|
|
|
|
|
|
SET(CMAKE_COLOR_MAKEFILE ON)
|
|
|
|
|
|
|
|
project(breakhack C)
|
|
|
|
|
2017-12-05 12:40:37 +01:00
|
|
|
include(FindLua)
|
2017-12-13 12:09:04 +01:00
|
|
|
include(cmake/FindSDL2.cmake)
|
|
|
|
include(cmake/FindSDL2_image.cmake)
|
|
|
|
include(cmake/FindSDL2_ttf.cmake)
|
2017-12-19 19:42:05 +01:00
|
|
|
|
|
|
|
if (NOT WIN32)
|
2017-12-19 21:00:02 +01:00
|
|
|
include(FindX11)
|
2017-12-19 19:42:05 +01:00
|
|
|
include(cmake/FindCheck.cmake)
|
|
|
|
endif (NOT WIN32)
|
2017-12-05 12:40:37 +01:00
|
|
|
|
2017-12-21 11:57:12 +01:00
|
|
|
configure_file(
|
|
|
|
"${PROJECT_SOURCE_DIR}/src/config.h.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/config.h"
|
|
|
|
)
|
|
|
|
|
2017-12-13 12:09:04 +01:00
|
|
|
include_directories(
|
2017-12-19 21:00:02 +01:00
|
|
|
${PROJECT_BINARY_DIR}
|
2017-12-05 12:51:09 +01:00
|
|
|
${LUA_INCLUDE_DIR}
|
2017-12-13 12:09:04 +01:00
|
|
|
${SDL2_INCLUDE_DIR}
|
|
|
|
${SDL2_IMAGE_INCLUDE_DIR}
|
|
|
|
${SDL2_TTF_INCLUDE_DIR}
|
2017-12-05 12:40:37 +01:00
|
|
|
)
|
|
|
|
|
2017-12-19 21:00:02 +01:00
|
|
|
if (NOT WIN32)
|
|
|
|
include_directories(
|
|
|
|
${X11_INCLUDE_DIR}
|
|
|
|
${CHECK_INCLUDE_DIR}
|
|
|
|
)
|
|
|
|
endif (NOT WIN32)
|
|
|
|
|
2017-12-19 22:51:00 +01:00
|
|
|
if (NOT WIN32)
|
|
|
|
add_definitions("-std=gnu11 -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes")
|
|
|
|
endif (NOT WIN32)
|
2017-11-30 21:00:47 +01:00
|
|
|
|
|
|
|
# PROGRAMS:
|
2017-12-01 16:03:19 +01:00
|
|
|
add_executable(breakhack
|
2017-11-30 21:00:47 +01:00
|
|
|
src/main
|
|
|
|
src/texture
|
|
|
|
src/screenresolution
|
|
|
|
src/sprite
|
|
|
|
src/util
|
|
|
|
src/player
|
2017-12-01 16:03:19 +01:00
|
|
|
src/map
|
2017-12-02 23:32:40 +01:00
|
|
|
src/map_lua
|
2017-12-01 16:03:19 +01:00
|
|
|
src/camera
|
2017-12-05 08:30:08 +01:00
|
|
|
src/timer
|
2017-12-05 15:03:20 +01:00
|
|
|
src/roommatrix
|
|
|
|
src/position
|
2017-12-13 14:26:30 +01:00
|
|
|
src/monster
|
2017-12-15 08:08:45 +01:00
|
|
|
src/stats
|
2017-12-15 15:03:29 +01:00
|
|
|
src/actiontext
|
2017-12-17 13:43:41 +01:00
|
|
|
src/random
|
2017-12-19 09:06:21 +01:00
|
|
|
src/linkedlist
|
|
|
|
src/hashtable
|
2017-12-22 15:15:40 +01:00
|
|
|
src/gui
|
2017-11-30 21:00:47 +01:00
|
|
|
)
|
|
|
|
|
2017-12-01 16:03:19 +01:00
|
|
|
target_link_libraries(breakhack
|
2017-12-13 12:09:04 +01:00
|
|
|
${LUA_LIBRARY}
|
|
|
|
${SDL2_LIBRARY}
|
|
|
|
${SDL2_IMAGE_LIBRARY}
|
|
|
|
${SDL2_TTF_LIBRARY}
|
2017-11-30 21:00:47 +01:00
|
|
|
)
|
|
|
|
|
2017-12-19 21:00:02 +01:00
|
|
|
if (NOT WIN32)
|
|
|
|
target_link_libraries(breakhack
|
|
|
|
${X11_LIBRARIES}
|
|
|
|
)
|
|
|
|
endif (NOT WIN32)
|
|
|
|
|
2017-11-30 21:00:47 +01:00
|
|
|
# TESTS:
|
2017-12-21 11:57:12 +01:00
|
|
|
IF (CHECK_FOUND AND NOT WIN32)
|
2017-12-13 12:18:20 +01:00
|
|
|
find_package(Threads REQUIRED)
|
2017-12-13 12:09:04 +01:00
|
|
|
enable_testing()
|
|
|
|
add_executable(test_util test/check_util src/util)
|
2017-12-13 12:18:20 +01:00
|
|
|
target_link_libraries(test_util ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
2017-12-13 12:09:04 +01:00
|
|
|
add_test(test_util test_util)
|
2017-12-19 09:06:21 +01:00
|
|
|
|
|
|
|
add_executable(test_linkedlist test/check_linkedlist src/linkedlist)
|
|
|
|
target_link_libraries(test_linkedlist ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
add_test(test_linkedlist test_linkedlist)
|
|
|
|
|
|
|
|
add_executable(test_hashtable test/check_hashtable src/hashtable)
|
|
|
|
target_link_libraries(test_hashtable ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
add_test(test_hashtable test_hashtable)
|
2017-12-21 11:57:12 +01:00
|
|
|
ENDIF (CHECK_FOUND AND NOT WIN32)
|