-
Notifications
You must be signed in to change notification settings - Fork 344
/
CMakeLists.txt
146 lines (120 loc) · 5.16 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# ***** BEGIN LICENSE BLOCK *****
# This file is part of Natron <https://natrongithub.github.io/>,
# (C) 2018-2023 The Natron developers
# (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat
#
# Natron is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Natron is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
# ***** END LICENSE BLOCK *****
cmake_minimum_required(VERSION 3.16.7)
project(Natron
VERSION "2.6.0"
DESCRIPTION "Open Source Compositing Software"
HOMEPAGE_URL "https://natrongithub.github.io/"
LANGUAGES CXX C
)
set(CMAKE_CXX_STANDARD 17)
option(NATRON_SYSTEM_LIBS "use system versions of dependencies instead of bundled ones" OFF)
option(NATRON_BUILD_TESTS "build the Natron test suite" ON)
set(IS_DEBUG_BUILD OFF)
if(CMAKE_BUILD_TYPE MATCHES "^(debug|Debug|DEBUG)$")
set(IS_DEBUG_BUILD ON)
add_definitions(-DDEBUG)
if(WIN32)
# Debug builds need minimal optimizations to avoid excessive link times and link errors related to Eigen.
add_compile_options(-O)
endif()
else()
add_definitions(-DQT_NO_DEBUG_OUTPUT)
endif()
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE)
message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}' as none was specified.")
endif()
find_package(Boost COMPONENTS headers serialization)
if(WIN32)
# Prevent looking in the registry so that the MinGW python can be found.
set(Python3_FIND_REGISTRY NEVER)
endif()
find_package(Python3 COMPONENTS Interpreter Development)
find_package(Qt5 5.15 CONFIG REQUIRED COMPONENTS Core Gui Network Widgets Concurrent)
if(IS_DEBUG_BUILD AND WIN32)
# Explicitly setting SHIBOKEN_PYTHON_LIBRARIES variable to avoid PYTHON_DEBUG_LIBRARY-NOTFOUND
# link errors on Windows debug builds.
set(SHIBOKEN_PYTHON_LIBRARIES ${Python3_LIBRARIES})
endif()
find_package(Shiboken2 5.15 CONFIG REQUIRED COMPONENTS libshiboken2 shiboken2)
if(IS_DEBUG_BUILD AND WIN32)
# Remove NDEBUG from Shiboken2 INTERFACE_COMPILE_DEFINITIONS so it is not inherited in debug builds.
get_property(ShibokenInterfaceDefs TARGET Shiboken2::libshiboken PROPERTY INTERFACE_COMPILE_DEFINITIONS)
list(REMOVE_ITEM ShibokenInterfaceDefs NDEBUG)
set_property(TARGET Shiboken2::libshiboken PROPERTY INTERFACE_COMPILE_DEFINITIONS ShibokenInterfaceDefs)
endif()
find_package(PySide2 5.15 CONFIG REQUIRED COMPONENTS pyside2)
set(QT_VERSION_MAJOR 5)
get_target_property(PYSIDE_INCLUDE_DIRS PySide2::pyside2 INTERFACE_INCLUDE_DIRECTORIES)
string(REGEX REPLACE "(.*)QtCore$" "\\1" Qt5_INCLUDE_DIR ${Qt5Core_INCLUDE_DIRS})
set(QTCORE_INCLUDE_DIRS ${Qt5_INCLUDE_DIR} ${Qt5Core_INCLUDE_DIRS})
set(QTGUI_INCLUDE_DIRS ${Qt5Gui_INCLUDE_DIRS})
set(QTWIDGETS_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS})
#Since in Natron and OpenFX all strings are supposed UTF-8 and that the constructor
#for QString(const char*) assumes ASCII strings, we may run into troubles
add_compile_definitions(QT_NO_CAST_FROM_ASCII)
if (MSVC)
# Allow __cplusplus to properly reflect the c++ standard version.
add_compile_options(/Zc:__cplusplus)
add_compile_definitions(__STDC_LIMIT_MACROS WIN32_LEAN_AND_MEAN _USE_MATH_DEFINES)
else()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes" )
add_compile_options(-Wall -Wextra -Wmissing-declarations -Wno-multichar -Winit-self -Wno-long-long
-Wvla -Wdate-time -Wshift-overflow=2
-Wduplicated-cond -Wno-stringop-overflow -Wno-format-overflow
-Wno-deprecated-copy)
endif()
if(NATRON_SYSTEM_LIBS)
find_package(glog)
find_package(Ceres)
endif()
if(UNIX AND NOT APPLE)
find_package(ECM NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
find_package(X11 REQUIRED)
find_package(Wayland COMPONENTS Client Egl)
elseif(APPLE)
enable_language(OBJCXX)
elseif(WIN32)
enable_language(RC)
add_compile_definitions(WINDOWS WIN32 _UNICODE UNICODE NOMINMAX QHTTP_SERVER_STATIC)
add_compile_definitions(COMPILED_FROM_DSP XML_STATIC) # for expat
if (NOT MSVC)
add_compile_options(-mwindows -municode -mthreads)
add_link_options(-mwindows -municode)
set(CMAKE_RC_COMPILER_INIT windres)
set(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
endif()
endif()
include(GNUInstallDirs)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
enable_testing()
add_subdirectory(libs)
add_subdirectory(HostSupport)
add_subdirectory(Engine)
add_subdirectory(PythonBin)
add_subdirectory(Renderer)
add_subdirectory(Gui)
if(NATRON_BUILD_TESTS)
add_subdirectory(Tests)
endif()
add_subdirectory(App)