-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
63 lines (52 loc) · 2.56 KB
/
CMakeLists.txt
File metadata and controls
63 lines (52 loc) · 2.56 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
# 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")
# Add Subdirectories
add_subdirectory(thirdparty)
add_subdirectory(source)
# add_subdirectory(examples)