-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
79 lines (73 loc) · 3.03 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
cmake_minimum_required(VERSION 3.27)
project(pq2)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Set(FETCHCONTENT_QUIET OFF)
if (MSVC)
add_compile_options(/W4 /WX)
else()
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_subdirectory(game)
add_subdirectory(utils)
add_subdirectory(gui)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
option(WINFORMS_ENABLED "Enable native Windows interface" ON)
set(COCOA_ENABLED OFF)
set(NCURSES_ENABLED OFF)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
option(COCOA_ENABLED "Enable native MacOS interface" ON)
option(NCURSES_ENABLED "Enable NCurses interface" ON)
set(WINFORMS_ENABLED OFF)
else()
option(NCURSES_ENABLED "Enable NCurses interface" ON)
set(WINFORMS_ENABLED OFF)
set(COCOA_ENABLED OFF)
endif ()
option(QT_ENABLED "Enable QT interface" ON)
option(GTK_ENABLED "Enable GTK interface" ON)
if (${QT_ENABLED})
add_subdirectory(qt)
add_executable(pq2-qt main.cpp)
set_target_properties(pq2-qt PROPERTIES OUTPUT_NAME pq2qt)
target_compile_definitions(pq2-qt PRIVATE QT_ENABLED)
target_link_libraries(pq2-qt pq2game pq2utils pq2gui pq2qt)
target_include_directories(pq2-qt PRIVATE pq2game pq2utils pq2gui pq2qt)
endif ()
if(${GTK_ENABLED})
add_subdirectory(gtk)
add_executable(pq2-gtk main.cpp)
set_target_properties(pq2-gtk PROPERTIES OUTPUT_NAME pq2gtk)
target_compile_definitions(pq2-gtk PRIVATE GTK_ENABLED)
target_link_libraries(pq2-gtk pq2game pq2utils pq2gui pq2gtk)
target_include_directories(pq2-gtk PRIVATE pq2game pq2utils pq2gui pq2gtk)
endif ()
if(${WINFORMS_ENABLED})
# add_subdirectory(win)
# add_executable(pq2-win main.cpp)
# set_target_properties(pq2-win PROPERTIES OUTPUT_NAME pq2win)
# target_compile_definitions(pq2-win PRIVATE WINFORMS_ENABLED)
# target_link_libraries(pq2-win pq2game pq2utils pq2gui pq2win)
# target_include_directories(pq2-win PRIVATE pq2game pq2utils pq2gui pq2win)
endif ()
if(${COCOA_ENABLED})
# add_subdirectory(mac)
# add_executable(pq2-mac main.cpp)
# set_target_properties(pq2-mac PROPERTIES OUTPUT_NAME pq2mac)
# target_compile_definitions(pq2-mac PRIVATE COCOA_ENABLED)
# target_link_libraries(pq2-mac pq2game pq2utils pq2gui pq2mac)
# target_include_directories(pq2-mac PRIVATE pq2game pq2utils pq2gui pq2mac)
endif ()
if(${NCURSES_ENABLED})
add_subdirectory(ncurses)
add_executable(pq2-ncurses main.cpp)
set_target_properties(pq2-ncurses PROPERTIES OUTPUT_NAME pq2ncurses)
target_compile_definitions(pq2-ncurses PRIVATE NCURSES_ENABLED)
target_link_libraries(pq2-ncurses pq2game pq2utils pq2gui pq2ncurses)
target_include_directories(pq2-ncurses PRIVATE pq2game pq2utils pq2gui pq2ncurses)
endif ()