forked from BlueAlien99/genetic-tetris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
81 lines (64 loc) · 2.39 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
cmake_minimum_required(VERSION 3.15)
project(genetic-tetris)
set(CMAKE_CXX_STANDARD 17)
if (MSVC)
# warning level 4
add_compile_options(/W4 /O2)
else()
# lots of warnings and debugging
add_compile_options(-Wall -Wextra -pedantic -O2)
endif()
if (UNIX)
find_package(SFML 2.5 COMPONENTS graphics system window audio REQUIRED)
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
elseif (WIN32)
set(SFML_STATIC_LIBRARIES TRUE)
if (NOT CMAKE_CL_64)
set(SFML_DIR "lib/win/32bit/SFML-2.5.1/lib/cmake/SFML")
else()
set(SFML_DIR "lib/win/64bit/SFML-2.5.1/lib/cmake/SFML")
endif()
find_package(SFML 2.5.1 COMPONENTS graphics system window audio REQUIRED)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.67 COMPONENTS unit_test_framework REQUIRED)
message(STATUS "Boost include dir: ${Boost_INCLUDE_DIRS}")
include_directories(${Boost_INCLUDE_DIRS})
message(STATUS "Boost library dir: ${Boost_LIBRARY_DIRS}")
link_directories(${Boost_LIBRARY_DIRS})
endif()
include_directories(project/include)
include_directories(lib/common/include)
add_library(tetris-lib
project/src/tetris/tetris.cpp
project/src/tetris/tetromino.cpp
project/src/tetris/tetromino_generator.cpp
project/src/tetris/wall_kicks.cpp)
add_library(gui-lib
project/src/app.cpp
project/src/sound_manager.cpp
project/src/gui/gui.cpp
project/src/gui/gui_utils.cpp
project/src/gui/screen/game_screen.cpp
project/src/gui/screen/menu_screen.cpp
project/src/gui/screen/evolve_screen.cpp
project/src/controller/game_controller.cpp
project/src/controller/evolve_controller.cpp)
add_library(ai-lib
project/src/AI/evolutionary_algo.cpp
project/src/AI/move.cpp
project/src/AI/random_number_generator.cpp project/include/exception.hpp)
target_link_libraries(gui-lib sfml-system sfml-graphics sfml-window sfml-audio)
target_link_libraries(ai-lib tetris-lib)
add_subdirectory(tests)
add_executable(app project/src/main.cpp)
if (UNIX)
target_link_libraries(app gui-lib ai-lib pthread)
elseif (WIN32)
target_link_libraries(app gui-lib ai-lib)
endif ()
# copy /res folder to a folder containing binary
add_custom_command(TARGET app POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/res
$<TARGET_FILE_DIR:app>/res
)