-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
83 lines (69 loc) · 2.48 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
cmake_minimum_required(VERSION 3.25)
project(CaveMUD)
# Find clang and clang++ compilers
find_program(CMAKE_C_COMPILER NAMES clang)
find_program(CMAKE_CXX_COMPILER NAMES clang++)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wpedantic -Wvla -Wextra-semi -Wnull-dereference -Wswitch-enum -Wno-unused-parameter -Wno-c++98-compat-pedantic")
set(BOOST_INCLUDE_LIBRARIES any)
set(BOOST_ENABLE_CMAKE ON)
include(FetchContent)
# Boost does not install correctly using VCPKG on MacOS so we need to use FetchContent
FetchContent_Declare(
Boost
GIT_REPOSITORY https://github.com/boostorg/boost.git
GIT_TAG boost-1.87.0
)
FetchContent_MakeAvailable(Boost)
# Packages from VCPKG
find_package(nlohmann_json CONFIG REQUIRED)
find_package(Protobuf CONFIG REQUIRED)
# Generate C++ code from protobuf files
file(GLOB PROTO_FILES ./CaveMUD-Protocol/src/*.proto)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES})
include_directories(
${Protobuf_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)
add_library(CaveMUD STATIC
Utils/Configuration/Configuration.cpp Utils/Configuration/Configuration.h
Utils/Logger/Logger.cpp Utils/Logger/Logger.h
Networking/Server/ServerListener.cpp Networking/Server/ServerListener.h
Networking/Server/ServerSocket.cpp Networking/Server/ServerSocket.h
Session/Session.cpp Session/Session.h
Session/Sessions.cpp Session/Sessions.h
Engine/GameLoop.cpp Engine/GameLoop.h
Engine/MasterClock.cpp Engine/MasterClock.h
Session/SessionHandler.cpp Session/SessionHandler.h
Engine/Views/View.h
Engine/StateMachines/StateMachine.h
Engine/StateMachines/Echo.cpp Engine/StateMachines/Echo.h
Engine/Views/EchoView.cpp Engine/Views/EchoView.h
Session/KV_Keys.h
Engine/StateMachines/ReverseEcho.cpp
Engine/StateMachines/ReverseEcho.h
Engine/StateMachines/StateMachine.cpp
${PROTO_SRCS}
${PROTO_HDRS}
)
target_link_libraries(
CaveMUD
${Protobuf_LIBRARIES}
Boost::any
${nlohmann_json_LIBRARIES}
)
add_executable(
CaveMUDServer
main.h main.cpp
)
set_target_properties(CaveMUDServer PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dist
)
target_link_libraries(
CaveMUDServer
CaveMUD
)
add_subdirectory(Tests)