-
Notifications
You must be signed in to change notification settings - Fork 25
/
CMakeLists.txt
105 lines (80 loc) · 3.33 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
# ROOT PROJECT FILE
cmake_minimum_required(VERSION 3.14)
# Declare project
project(Inline-Engine)
# Project uses C and C++
enable_language(C)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 20)
# Configurations
set(CMAKE_CONFIGURATION_TYPES Debug RelWithDebInfo CACHE STRING "")
set(DEBUG_CONFIGURATIONS Debug)
# Set platform-specific properties
include(GetPlatform.cmake)
include(Paths.cmake)
include(CopyRuntime.cmake)
include(Utils.cmake)
include(WholeArchive.cmake)
if (TARGET_COMPILER_MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /MP /await /permissive-")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4638") # Ignore XML doc not found reference
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5033") # Register keyword is now deprecated but retarded Bullet uses it
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250") # Inheritence via dominance
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4099") # Missing PDB for libraries
add_definitions("-D_ENABLE_EXTENDED_ALIGNED_STORAGE")
# set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS} /PROFILE")
elseif (TARGET_COMPILER_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fcoroutines-ts /std:c++17")
endif()
if (TARGET_PLATFORM_WINDOWS)
if (DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
if (${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} VERSION_LESS "10.0.16299.0")
set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION 10.0.16299.0)
endif()
endif()
endif()
# Enable filter grouping of projects inside solution
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Properties applied to all targets
include_directories("${CMAKE_CURRENT_LIST_DIR}/Engine")
include_directories("${EXTERNALS_INCLUDE}/Bullet") # because Bullet is retarded...
# Add additional folders
add_subdirectory(Engine)
add_subdirectory(Test)
add_subdirectory(Executables)
# Add custom target containing global files
add_custom_target(Files SOURCES
CMakeLists.txt
Paths.cmake
GetPlatform.cmake
CopyRuntime.cmake
Utils.cmake
WholeArchive.cmake
.clang-format)
set_target_properties(Files PROPERTIES FOLDER Files)
# Add Mathter.natvis to all targets
get_all_targets(all_targets ${CMAKE_SOURCE_DIR})
foreach (tar IN ITEMS ${all_targets})
get_target_property(tar_type ${tar} TYPE)
if (tar_type MATCHES "(STATIC_LIBRARY|MODULE_LIBRARY|SHARED_LIBRARY|EXECUTABLE)")
target_sources(${tar} PRIVATE "${EXTERNALS_INCLUDE}/Mathter/Mathter.natvis")
endif()
endforeach()
source_group("" FILES "${EXTERNALS_INCLUDE}/Mathter/Mathter.natvis")
# Enable whole-archive on marked projects.
set_whole_archive_linkage(${CMAKE_SOURCE_DIR})
# Put projects in their folders
set_target_properties(BaseLibrary PROPERTIES FOLDER Modules)
if (TARGET_PLATFORM_WINDOWS)
set_target_properties(GraphicsApi_D3D12 PROPERTIES FOLDER Modules)
endif()
set_target_properties(GraphicsEngine_LL PROPERTIES FOLDER Modules)
set_target_properties(GraphicsFoundationLibrary PROPERTIES FOLDER Modules)
set_target_properties(AssetLibrary PROPERTIES FOLDER Modules)
set_target_properties(GuiEngine PROPERTIES FOLDER Modules)
set_target_properties(GameLogic PROPERTIES FOLDER Modules)
set_target_properties(GameFoundationLibrary PROPERTIES FOLDER Modules)
set_target_properties(Test_General PROPERTIES FOLDER Test)
set_target_properties(Test_Unit PROPERTIES FOLDER Test)
set_target_properties(Test_Game PROPERTIES FOLDER Test)
set_target_properties(NodeEditor PROPERTIES FOLDER Executables)