-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
120 lines (92 loc) · 3.69 KB
/
CMakeLists.txt
File metadata and controls
120 lines (92 loc) · 3.69 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
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
cmake_minimum_required(VERSION 3.13.4)
project(VOID VERSION 0.4.0 LANGUAGES CXX)
# C++17 and Above
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g -O1 -fno-omit-frame-pointer")
# set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=address")
# USE CXX11 ABI
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
# For macOS, GL has been marked deprecated
# till we move to Metal specifically on apple, silence all of GL_DEPRECATION warnings
if (APPLE)
add_definitions(-DGL_SILENCE_DEPRECATION=1)
endif()
# An explicit option to allow compiling the GUI frameless or with Window borders
# it's a debate about whether the feature should be inbuilt and an option to switch to either
# but the frameless way at the moment does not look really nice in mac when mac pulls the menubar away and we're
# only left with the icon on the left side and window buttons on the right
# for now, let's have it enabled on compile if we need it or not, later this might change and we have a full frameless
# or a framed window
option(USE_FRAMED_WINDOW "Enable using Framed Window borders, which is native themed." OFF)
# Mac has it turned on by default unless we don't want it there as well
if(APPLE)
set(USE_FRAMED_WINDOW ON)
endif()
# Add Definition for the code to use the flag
if (USE_FRAMED_WINDOW)
message(STATUS "Compiling with Framed Window")
add_compile_definitions(USE_FRAMED_WINDOW)
endif()
# Core Depends on Qt5/Qt6 | OpenGL
# Supporting both Qt5 and Qt6 at the moment as they are mostly compatible with minor changes
# If we're at a point where the backwards compatibility is too much of a hassle, we could then drop support for qt5 but
# for now we're good
# Ensure we have atleast both of them present
# Find qt6 first
find_package(Qt6 QUIET COMPONENTS Widgets Gui Core OpenGLWidgets)
if (Qt6_FOUND)
set(QT_MAJOR_VERSION 6)
add_library(Qt::Core ALIAS Qt6::Core)
add_library(Qt::Gui ALIAS Qt6::Gui)
add_library(Qt::Widgets ALIAS Qt6::Widgets)
add_library(Qt::OpenGLWidgets ALIAS Qt6::OpenGLWidgets)
# Format c:\some\path\to\qt\cmake -> c:/some/path/to/qt/cmake
file(TO_CMAKE_PATH ${Qt6_DIR} QT_CMAKE_PATH)
else()
find_package(Qt5 REQUIRED COMPONENTS Widgets Gui Core)
# Message to indicate we're falling back
message(STATUS "Qt6 not found. Falling back to Qt5.")
set(QT_MAJOR_VERSION 5)
add_library(Qt::Core ALIAS Qt5::Core)
add_library(Qt::Gui ALIAS Qt5::Gui)
add_library(Qt::Widgets ALIAS Qt5::Widgets)
# Format c:\some\path\to\qt\cmake -> c:/some/path/to/qt/cmake
file(TO_CMAKE_PATH ${Qt5_DIR} QT_CMAKE_PATH)
endif()
# Multiprocessing
find_package(OpenMP REQUIRED)
# GL
find_package(OpenGL REQUIRED COMPONENTS OpenGL)
# GL Functions
find_package(GLEW REQUIRED)
# GL Maths
find_package(glm REQUIRED)
# Freetype for Font Rendering
find_package(Freetype REQUIRED)
# Core Readers
find_package(OpenImageIO REQUIRED)
find_package(OpenEXR REQUIRED)
find_package(Imath REQUIRED)
# Color
find_package(OpenColorIO REQUIRED)
# Serialization
find_package(RapidJSON REQUIRED)
# Python Execution/Bindings
find_package(Python REQUIRED COMPONENTS Interpreter Development)
find_package(pybind11 REQUIRED)
# Add Modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
# Try and find ffmpeg
find_package(FFMPEG REQUIRED COMPONENTS avcodec avformat avutil swscale swresample)
find_package(TurboJPEG REQUIRED)
# Used for Logging
find_package(spdlog REQUIRED)
# Definitions
# Enable Logging if we have spdlog present and we're on the debug build
if (CMAKE_BUILD_TYPE STREQUAL "debug")
add_definitions(-DVOID_ENABLE_LOGGING)
endif()
# Add the VOID Source
add_subdirectory(src)