breakhack/CMakeLists.txt

112 lines
2.2 KiB
CMake
Raw Normal View History

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)
include(cmake/FindSDL2_mixer.cmake)
2017-12-19 19:42:05 +01:00
if (NOT WIN32)
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(
${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}
${SDL2_MIXER_INCLUDE_DIR}
2017-12-05 12:40:37 +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
)
2017-12-19 22:51:00 +01:00
endif (NOT WIN32)
2017-11-30 21:00:47 +01:00
2018-02-03 23:39:49 +01:00
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
2018-02-03 13:02:39 +01:00
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
src/roommatrix
src/position
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
src/linkedlist
src/hashtable
src/gui
src/item
src/item_builder
2018-01-31 09:15:33 +01:00
src/pointer
src/gui_button
2018-02-03 23:39:49 +01:00
src/particle_engine
src/menu
src/collisions
src/keyboard
src/mixer
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}
${SDL2_MIXER_LIBRARY}
2017-11-30 21:00:47 +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)
2018-01-23 23:09:12 +01:00
add_executable(test_linkedlist test/check_linkedlist src/linkedlist src/util)
target_link_libraries(test_linkedlist ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
add_test(test_linkedlist test_linkedlist)
2018-01-23 23:09:12 +01:00
add_executable(test_hashtable test/check_hashtable src/hashtable src/util)
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)