-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmakelists.txt
126 lines (102 loc) · 3.91 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
cmake_minimum_required( VERSION 3.10 )
# Global Settings
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
#set_property( GLOBAL PROPERTY CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE )
#set_property( GLOBAL PROPERTY CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY TRUE )
# Solution
project( GameSolution VERSION 0.0.1 )
# Visual Studio Settings
if( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
# Program Database for Edit and Continue
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /ZI" )
# set( CMAKE_SHARED_LINKER_FLAGS "/SAFESEH:NO" )
# set( CMAKE_EXE_LINKER_FLAGS "/SAFESEH:NO" )
endif()
###################
# Box2D Library
###################
include(GNUInstallDirs)
add_subdirectory(Framework/Libraries/box2d/src)
set_target_properties( box2d PROPERTIES FOLDER "Physics Libraries" )
###################
# Bullet Libraries
###################
add_compile_options(/wd4244) # 'argument': conversion from 'double' to 'btScalar', possible loss of data
add_compile_options(/wd4267) # '=': conversion from 'size_t' to 'long', possible loss of data
add_compile_options(/wd4305) # 'initializing': truncation from 'double' to 'btScalar'
set( BULLET_VERSION 3.21 )
set( BULLET_PHYSICS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Framework/Libraries/bullet )
add_subdirectory( Framework/Libraries/bullet/src/BulletCollision )
add_subdirectory( Framework/Libraries/bullet/src/BulletDynamics )
add_subdirectory( Framework/Libraries/bullet/src/LinearMath )
set_target_properties( BulletCollision PROPERTIES FOLDER "Physics Libraries" )
set_target_properties( BulletDynamics PROPERTIES FOLDER "Physics Libraries" )
set_target_properties( LinearMath PROPERTIES FOLDER "Physics Libraries" )
add_compile_options(/w44244)
add_compile_options(/w44267)
add_compile_options(/w44305)
###################
# Framework Library
###################
# File Setup
file( GLOB_RECURSE FrameworkSourceFiles
Framework/Source/*.cpp
Framework/Source/*.h
Framework/Libraries/stb/*.h
Framework/Libraries/rapidjson/*.h
Framework/Libraries/pcg-cpp/include/*.hpp
)
file( GLOB FrameworkSourceFilesNonRecursive
Framework/Libraries/imgui/*.cpp
Framework/Libraries/imgui/*.h
)
list( APPEND FrameworkSourceFiles ${FrameworkSourceFilesNonRecursive} )
source_group( TREE ${CMAKE_CURRENT_SOURCE_DIR}/Framework FILES ${FrameworkSourceFiles} )
source_group( TREE ${CMAKE_CURRENT_SOURCE_DIR}/Framework FILES ${FrameworkSourceFiles} )
# Project Creation
add_library( Framework ${FrameworkSourceFiles} )
target_include_directories( Framework PUBLIC
Framework/Source
Framework/Libraries/bullet/src
)
# PCH Files
target_precompile_headers( Framework PRIVATE Framework/Source/CoreHeaders.h )
file( GLOB_RECURSE FrameworkPCHFiles ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cmake_pch.* )
source_group( "CMake PCH Files" FILES ${FrameworkPCHFiles} )
###################
# Game Project
###################
# File Setup
file( GLOB_RECURSE GameSourceFiles
Game/Source/*.cpp
Game/Source/*.h
Game/Data/Shaders/**.vert
Game/Data/Shaders/**.frag
GenerateProjectFiles.bat
)
source_group( TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${GameSourceFiles} )
# Project Creation
add_executable( GameProject WIN32 ${GameSourceFiles} )
target_include_directories( GameProject PUBLIC
Game/Source
Framework/Source
)
# PCH Files
target_precompile_headers( GameProject PRIVATE Framework/Source/Framework.h )
file( GLOB_RECURSE GamePCHFiles ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cmake_pch.* )
source_group( "CMake PCH Files" FILES ${GamePCHFiles} )
# Libraries to Link
target_link_libraries( GameProject
Framework
box2d
opengl32.lib
BulletCollision
BulletDynamics
LinearMath
)
# Visual Studio Settings
if( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
# Debug working directory and Startup Project
set_property( TARGET GameProject PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Game" )
set_property( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT GameProject )
endif()