-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
100 lines (75 loc) · 2.08 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
87
88
89
90
91
92
93
94
95
96
97
98
99
#
# Raig
#
# David Morton 2016
#
cmake_minimum_required(VERSION 2.8)
project(raig)
include(ExternalProject)
ExternalProject_Add(libsocket
PREFIX ${CMAKE_BINARY_DIR}/build/libsocket
GIT_REPOSITORY [email protected]:damorton/libsocket.git
GIT_TAG master
BINARY_DIR ${CMAKE_SOURCE_DIR}/lib/libsocket
SOURCE_DIR ${CMAKE_SOURCE_DIR}/lib/libsocket
INSTALL_COMMAND ""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
include_directories(
${CMAKE_SOURCE_DIR}/lib
${CMAKE_SOURCE_DIR}/src
)
set(HEADERS
src/ai/ai_manager.h
src/ai/pathfinding_astar.h
src/net/network_manager.h
src/base/game_world.h
src/base/vector3.h
src/base/search_cell.h
)
set(SOURCES
src/ai/ai_manager.cc
src/ai/pathfinding_astar.cc
src/net/network_manager.cc
src/base/game_world.cc
src/base/vector3.cc
src/base/game_world.cc
)
add_library(raig ${SOURCES} ${HEADERS})
add_dependencies(raig libsocket)
set_target_properties(raig
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib
)
# Link to the libsocket library
link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/libsocket/lib/
)
# Set executable name
set(EXECUTABLE RaigServer)
# Create binary
add_executable(${EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/raig/raig_server.cc)
target_link_libraries(${EXECUTABLE} raig socket)
set_target_properties(${EXECUTABLE}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin
)
# GTest
set(UNIT_TEST_EXECUTABLE runUnitTests)
add_subdirectory(lib/googletest)
enable_testing()
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
set(TEST_SOURCE_FILES
${CMAKE_SOURCE_DIR}/src/test/test_Vector3.cpp
)
add_executable(${UNIT_TEST_EXECUTABLE} ${TEST_SOURCE_FILES})
add_dependencies(${UNIT_TEST_EXECUTABLE} libsocket)
target_link_libraries(${UNIT_TEST_EXECUTABLE} raig socket gtest gtest_main)
add_test(NAME test COMMAND ${UNIT_TEST_EXECUTABLE})
set_target_properties(${UNIT_TEST_EXECUTABLE}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/test
)