forked from JeanPhilippeKernel/RendererEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
112 lines (94 loc) · 3.41 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
cmake_minimum_required (VERSION 3.17 FATAL_ERROR)
project (RendererEngine
VERSION 1.0
DESCRIPTION "Renderer Engine is an open-source 2D - 3D rendering engine written in C/C++"
LANGUAGES CXX C
)
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
# Core invariants
#
get_filename_component (ENLISTMENT_ROOT "." ABSOLUTE CACHE)
get_filename_component (EXTERNAL_DIR "${ENLISTMENT_ROOT}/__externals" ABSOLUTE CACHE)
get_filename_component (EXTERNAL_NUGET_DIR "${ENLISTMENT_ROOT}/__externals/nuget" ABSOLUTE CACHE)
include(${ENLISTMENT_ROOT}/Scripts/CMake/NuGet.cmake)
include(${ENLISTMENT_ROOT}/Scripts/CMake/CppWinRT.cmake)
include(${ENLISTMENT_ROOT}/dependencies.cmake)
option (COPY_EXAMPLE_PROJECT "Copy example projects that show how to use Launcher" ON)
option (LAUNCHER_ONLY "Build Launcher only" OFF)
set (MACOSX_ARCHITECTURE_ARM64 OFF)
if (APPLE)
# Use uname to detect the macOS processor architecture
execute_process(
COMMAND uname -m
OUTPUT_VARIABLE MACOSX_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (MACOSX_ARCHITECTURE STREQUAL "arm64")
set (MACOSX_ARCHITECTURE_ARM64 ON)
endif ()
endif ()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
add_compile_definitions(_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING) # Fix Warning from VS 2022 +
endif()
# Externals dependencies
#
if (NOT LAUNCHER_ONLY)
add_subdirectory (${EXTERNAL_DIR}/fmt)
add_subdirectory (${EXTERNAL_DIR}/imgui)
add_subdirectory (${EXTERNAL_DIR}/glfw)
add_subdirectory (${EXTERNAL_DIR}/spdlog)
add_subdirectory (${EXTERNAL_DIR}/glm)
add_subdirectory (${EXTERNAL_DIR}/entt)
add_subdirectory (${EXTERNAL_DIR}/assimp)
add_subdirectory (${EXTERNAL_DIR}/stduuid)
add_subdirectory (${EXTERNAL_DIR}/yaml-cpp)
add_subdirectory (${EXTERNAL_DIR}/SPIRV-headers)
add_subdirectory (${EXTERNAL_DIR}/SPIRV-Tools)
add_subdirectory (${EXTERNAL_DIR}/glslang)
add_subdirectory (${EXTERNAL_DIR}/SPIRV-Cross)
add_subdirectory (${EXTERNAL_DIR}/gtest)
add_subdirectory (${EXTERNAL_DIR}/VulkanMemoryAllocator)
set (CMAKE_PREFIX_PATH
${CMAKE_PREFIX_PATH}
${EXTERNAL_DIR}/Vulkan-Headers/build/install/share/cmake
)
add_subdirectory (${EXTERNAL_DIR}/Vulkan-Loader)
# Core engine lib is here
#
add_subdirectory (ZEngine)
# Editor is here
#
add_subdirectory (Tetragrama)
endif ()
# Launcher is here
#
add_subdirectory (Panzerfaust)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set_property (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Panzerfaust)
endif ()
# Post build operation
#
set (SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set (SYSTEM_ARCHITECTURE "win-x64")
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (SYSTEM_ARCHITECTURE "linux-x64")
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
if (MACOSX_ARCHITECTURE_ARM64)
set (SYSTEM_ARCHITECTURE "osx-arm64")
else ()
set (SYSTEM_ARCHITECTURE "osx-x64")
endif ()
endif ()
add_custom_target (AssembleContent ALL
COMMENT "Copying assets and resources contents"
COMMAND pwsh ${CMAKE_CURRENT_SOURCE_DIR}/Scripts/PostBuild.ps1 -SystemName ${SYSTEM_NAME} -Architectures ${SYSTEM_ARCHITECTURE} -Configurations $<IF:$<CONFIG:Debug>,Debug,Release> $<$<BOOL:${LAUNCHER_ONLY}>:-LauncherOnly>
)
if (NOT LAUNCHER_ONLY)
add_dependencies(AssembleContent zEngineLib tetragrama)
endif ()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
add_dependencies(AssembleContent Panzerfaust-WinBuild)
else ()
add_dependencies(AssembleContent Panzerfaust)
endif ()