forked from SpadesX/SpadesX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
86 lines (69 loc) · 2.06 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
81
82
83
84
85
86
cmake_minimum_required(VERSION 3.16)
# SpadesX
project(SpadesX)
# Find pthread
find_package(Threads REQUIRED)
find_package(PkgConfig)
pkg_check_modules(PC_enet QUIET enet)
find_path(enet_INCLUDE_DIR
NAMES enet/enet.h
PATHS ${PC_enet_INCLUDE_DIRS} ../../deps
PATH_SUFFIXES enet
)
find_library(enet_LIBRARY
NAMES enet
PATHS ${PC_enet_LIBRARY_DIRS} ../../deps
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(enet
FOUND_VAR enet_FOUND
REQUIRED_VARS
enet_LIBRARY
enet_INCLUDE_DIR
)
set(CMAKE_EXPORT_COMPILE_COMMANDS On)
# Add third party libraries
add_subdirectory(Extern)
# Add main target
add_compile_options(-Wall -Wextra -Werror -Wpedantic -Wno-error=unused-but-set-parameter -Wno-error=pedantic -std=gnu11)
add_executable(SpadesX "")
if (enet_FOUND)
add_library(enet::enet STATIC IMPORTED)
set_target_properties(enet::enet PROPERTIES
IMPORTED_LOCATION ${enet_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${enet_INCLUDE_DIR}
)
if (WIN32)
set_target_properties(enet::enet PROPERTIES
INTERFACE_LINK_LIBRARIES "ws2_32;winmm"
)
endif (WIN32)
endif (enet_FOUND)
target_link_libraries(SpadesX
PRIVATE
Server
Util
enet::enet
mapvxl
m
json-c
readline
Threads::Threads
)
if (UNIX)
target_link_libraries(SpadesX PRIVATE bsd)
endif()
add_subdirectory(Source)
set_target_properties(SpadesX Util Server
PROPERTIES
INTERPROCEDURAL_OPTIMIZATION true
)
if (NOT EXISTS ${CMAKE_BINARY_DIR}/config.json)
configure_file(${PROJECT_SOURCE_DIR}/Resources/config.json ${CMAKE_BINARY_DIR}/config.json COPYONLY)
endif()
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Border_Hallway.vxl)
configure_file(${PROJECT_SOURCE_DIR}/Resources/Border_Hallway.vxl ${CMAKE_BINARY_DIR}/Border_Hallway.vxl COPYONLY)
endif()
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Border_Hallway.json)
configure_file(${PROJECT_SOURCE_DIR}/Resources/Border_Hallway.json ${CMAKE_BINARY_DIR}/Border_Hallway.json COPYONLY)
endif()