-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
76 lines (64 loc) · 2.31 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
cmake_minimum_required(VERSION 3.17)
# set the project name and version
project("R-Type" VERSION 0.1.0)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# set project variables
set(VERSION 0.1.0)
set(CMAKE_DEBUG_FIND_MODE TRUE)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake)
# if(MSVC)
# message("++ Microsoft Development environment detected")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/x86-windows/share/asio/")
# list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/x86-windows/share/raylib/")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/x86-windows/share/nlohmann_json/")
# endif()
# if(UNIX)
# message("++ Linux Development environment detected")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/x64-linux/share/asio/")
# list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/x64-linux/share/raylib/")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/x64-linux/share/nlohmann_json/")
# endif()
#Generate the Doxygen documentation
option(DOXYGEN "Generate Doxygen documentation" OFF) #OFF by default
if(DOXYGEN)
add_subdirectory(Documentation/Doxygen)
endif(DOXYGEN)
unset(DOXYGEN CACHE) # Unset the cache variable
option(UNIT_TESTS "Build test with Criterion" OFF) #OFF by default
if(UNIT_TESTS)
message("++ Building unit tests with libcriterion")
add_subdirectory(Tests)
endif()
unset(UNIT_TESTS CACHE)
# Get all project files
file(GLOB_RECURSE
ALL_CXX_SOURCE_FILES
Source/*.[ch]pp
Libraries/*.[ch]pp
Server/*.[ch]pp
)
# Adding clang-format target if executable is found
find_program(CLANG_FORMAT "clang-format")
if(CLANG_FORMAT)
add_custom_target(
clang-format
COMMAND /usr/bin/clang-format
-i
-style=file
${ALL_CXX_SOURCE_FILES}
)
message("++ Formatted all .[ch]pp files using .clang-format instructions")
endif()
option(CLIENT "Generate R-Type Client" OFF)
option(SERVER "Generate R-Type Server" OFF)
add_subdirectory(Libraries)
if(CLIENT)
add_subdirectory(Client)
elseif(SERVER)
add_subdirectory(Server)
else()
add_subdirectory(Client)
add_subdirectory(Server)
endif()