forked from thirddegree/Hatchit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
157 lines (118 loc) · 6.57 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
cmake_minimum_required(VERSION 3.5)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
project(Hatchit)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Version info
set (HatchitEngine_VERSION_MAJOR 0)
set (HatchitEngine_VERSION_MINOR 1)
set (HatchitEngine_VERSION_BUILD 1)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/build/")
find_package(Vulkan REQUIRED)
include_directories("HatchitCore/include"
"HatchitCore/include/windows"
"HatchitCore/source/inline"
"HatchitGraphics/include"
"HatchitGraphics/include/vulkan"
"HatchitNetwork/include"
"HatchitGame/include"
"HatchitGame/include/glfw"
"HatchitGame/source/inline"
SYSTEM
"ThirdParty/inih"
"ThirdParty/cppformat/cppformat"
"ThirdParty/json/src"
"ThirdParty/stb"
"ThirdParty/glfw/include"
${VULKAN_INCLUDE_DIR})
link_directories("ThirdParty/lib/glfw/lib/$(Configuration)")
# Collect all Hatchit Core source and include
file(GLOB HT_CORE_INC HatchitCore/include/*.h)
file(GLOB HT_CORE_INL HatchitCore/source/inline/*.inl)
file(GLOB HT_CORE_SRC HatchitCore/source/*.cpp HatchitCore/source/windows/*.cpp ThirdParty/inih/*.c ThirdParty/cppformat/cppformat/*.cc)
#Create source groups
source_group("Source Files\\inline" FILES ${HT_CORE_INL})
# Collect all Hatchit Graphics source and include
file(GLOB HT_GRAPHICS_INC HatchitGraphics/include/*.h)
file(GLOB HT_GRAPHICS_SRC HatchitGraphics/source/*.cpp)
file(GLOB HT_GRAPHICS_VULKAN_INC HatchitGraphics/include/vulkan/*.h)
file(GLOB HT_GRAPHICS_VULKAN_SRC HatchitGraphics/source/vulkan/*.cpp)
#Create source groups
source_group("Header Files\\vulkan" FILES ${HT_GRAPHICS_VULKAN_INC})
source_group("Source Files\\vulkan" FILES ${HT_GRAPHICS_VULKAN_SRC})
set(HT_GRAPHICS_INC_GLOB ${HT_GRAPHICS_INC} ${HT_GRAPHICS_VULKAN_INC})
set(HT_GRAPHICS_SRC_GLOB ${HT_GRAPHICS_SRC} ${HT_GRAPHICS_VULKAN_SRC})
# Collect all Hatchit Game source and include
file(GLOB HT_GAME_INC HatchitGame/include/*.h)
file(GLOB HT_GAME_SRC HatchitGame/source/*.cpp)
file(GLOB HT_GAME_GLFW_INC HatchitGame/include/glfw/*.h)
file(GLOB HT_GAME_GLFW_SRC HatchitGame/source/glfw/*.cpp)
#Create source groups
source_group("Header Files\\glfw" FILES ${HT_GAME_GLFW_INC})
source_group("Source Files\\glfw" FILES ${HT_GAME_GLFW_SRC})
set(HT_GAME_INC_GLOB ${HT_GAME_INC} ${HT_GAME_GLFW_INC})
set(HT_GAME_SRC_GLOB ${HT_GAME_SRC} ${HT_GAME_GLFW_SRC})
#Collect all Hatchit Network source and include
file(GLOB HT_NETWORK_INC HatchitNetwork/include/*.h)
file(GLOB HT_NETWORK_SRC HatchitNetwork/source/*.cpp)
add_library(HatchitCore SHARED ${HT_CORE_INC} ${HT_CORE_SRC} ${HT_CORE_INL})
add_library(HatchitGraphics SHARED ${HT_GRAPHICS_INC_GLOB} ${HT_GRAPHICS_SRC_GLOB})
add_library(HatchitGame SHARED ${HT_GAME_INC_GLOB} ${HT_GAME_SRC_GLOB})
add_library(HatchitNetwork SHARED ${HT_NETWORK_INC} ${HT_NETWORK_SRC})
target_link_libraries(HatchitGraphics HatchitCore ${VULKAN_LIBRARY})
target_link_libraries(HatchitNetwork HatchitCore Ws2_32)
target_link_libraries(HatchitGame HatchitCore HatchitGraphics HatchitNetwork glfw ${VULKAN_LIBRARY})
target_compile_definitions(HatchitCore PRIVATE FMT_EXPORT)
add_definitions(-DHT_NONCLIENT_BUILD)
set_target_properties(HatchitCore HatchitGraphics HatchitGame HatchitNetwork
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
add_subdirectory(HatchitTest)
else()
message( FATAL_ERROR "Please run setup.bat to build required dependencies and initialize build system." )
endif()
elseif(UNIX)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLFW REQUIRED glfw3)
find_package(Vulkan REQUIRED)
include_directories("HatchitCore/include"
"HatchitCore/include/linux"
"HatchitCore/source/inline"
"HatchitGraphics/include"
"HatchitGraphics/include/vulkan"
"HatchitGame/include"
"HatchitGame/include/glfw"
"HatchitNetwork/include"
SYSTEM
"ThirdParty/inih/"
"ThirdParty/cppformat/cppformat"
"ThirdParty/json/src/"
"ThirdParty/stb"
${VULKAN_INCLUDE_DIR}
${GLFW_INCLUDE_DIR})
# Collect all Hatchit Core source and include
file(GLOB HT_CORE_INC HatchitCore/include/*.h)
file(GLOB HT_CORE_SRC HatchitCore/source/*.cpp HatchitCore/source/linux/*.cpp ThirdParty/inih/*.c ThirdParty/cppformat/cppformat/*.cc)
# Collect all Hatchit Graphics source and include
file(GLOB HT_GRAPHICS_INC HatchitGraphics/include/*.h HatchitGraphics/include/vulkan/*.h)
file(GLOB HT_GRAPHICS_SRC HatchitGraphics/source/*.cpp HatchitGraphics/source/vulkan/*.cpp)
# Collect all Hatchit Game source and include
file(GLOB HT_GAME_INC HatchitGame/include/*.h HatchitGame/include/glfw/*.h)
file(GLOB HT_GAME_SRC HatchitGame/source/*.cpp HatchitGame/source/glfw/*.cpp)
#Collect all Hatchit Network source and include
file(GLOB HT_NETWORK_INC HatchitNetwork/include/*.h)
file(GLOB HT_NETWORK_SRC HatchitNetwork/source/*.cpp)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
add_library(HatchitCore SHARED ${HT_CORE_INC} ${HT_CORE_SRC})
add_library(HatchitGraphics SHARED ${HT_GRAPHICS_INC} ${HT_GRAPHICS_SRC})
add_library(HatchitGame SHARED ${HT_GAME_INC} ${HT_GAME_SRC})
add_library(HatchitNetwork SHARED ${HT_NETWORK_INC} ${HT_NETWORK_SRC})
target_compile_definitions(HatchitCore PRIVATE FMT_EXPORT)
target_link_libraries(HatchitCore pthread)
target_link_libraries(HatchitGraphics HatchitCore ${VULKAN_LIBRARY})
target_link_libraries(HatchitGame HatchitCore HatchitGraphics ${GLFW_LIBRARIES})
add_subdirectory(HatchitTest)
install (TARGETS HatchitCore HatchitGraphics HatchitGame HatchitNetwork DESTINATION lib)
endif()