-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
92 lines (75 loc) · 3.44 KB
/
CMakeLists.txt
File metadata and controls
92 lines (75 loc) · 3.44 KB
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
# Copyright (c) - Graphical Playground. All rights reserved.
# For more information, see https://graphical-playground/legal
# mailto:support AT graphical-playground DOT com
cmake_minimum_required(VERSION 3.21.0)
# Project Definition
project(GraphicalPlayground
VERSION 0.1.0
LANGUAGES CXX C
DESCRIPTION "Graphical Playground Engine, learning and prototyping platform for graphics programming."
)
# Enforce C++23 globally
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) # Forces standard C++ (no GCC extensions)
# If not specified, build type is Release
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "[GP] Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# If not specified, export compile commands for IDEs
if(NOT CMAKE_EXPORT_COMPILE_COMMANDS)
message(STATUS "[GP] Enabling export of compile commands for IDEs.")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Export compile commands." FORCE)
endif()
# Build Shared Libraries (DLLs) by default?
# Set to OFF for Monolithic builds (Static Linking)
option(GP_BUILD_SHARED "Build Engine as DLLs" ON)
if(GP_BUILD_SHARED)
set(BUILD_SHARED_LIBS ON)
add_compile_definitions(GP_BUILD_DLL) # Global define for DLL logic
endif()
# Output Directories (Clean bin/ folder structure)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/binaries/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/binaries/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/binaries/bin)
# Enable Position Independent Code (PIC) for static libraries to allow linking into shared libraries on all platforms
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Put Debug/Release in subfolders (Bin/Debug, Bin/Release)
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_SOURCE_DIR}/binaries/bin/${OUTPUTCONFIG})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_SOURCE_DIR}/binaries/lib/${OUTPUTCONFIG})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_SOURCE_DIR}/binaries/lib/${OUTPUTCONFIG})
endforeach()
# Include the module creation function
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# Option to run tests on the Build Tool
option(GP_TEST_BUILD_TOOL "Run tests for the Build Tool" OFF)
# Option for engine features
option(GP_ENABLE_PROFILING "Enable Tracy Profiler integration" ON)
# Target options
option(GP_BUILD_TESTS "Build test targets" ON)
option(GP_BUILD_BENCHMARKS "Build benchmark targets" ON)
option(GP_BUILD_EXAMPLES "Build example targets" ON)
option(GP_BUILD_EDITOR "Build engine tools and offline compilers" ON)
# Graphics API Options
option(GP_USE_VULKAN "Enable Vulkan support" ON)
option(GP_USE_OPENGL "Enable OpenGL support" ON)
option(GP_USE_METAL "Enable Metal support" ON)
option(GP_USE_D3D12 "Enable D3D12 support" ON)
option(GP_USE_D3D11 "Enable D3D11 support" ON)
if (GP_TEST_BUILD_TOOL)
include(gp-build-tool/tests/gp-all.tests)
return()
endif()
# Enable testing if tests are enabled for any target
if(GP_BUILD_TESTS)
enable_testing()
endif()
# Add Subdirectories
add_subdirectory(thirdparty)
add_subdirectory(source)
add_subdirectory(examples)