1 |
< |
cmake_minimum_required(VERSION 3.0) |
1 |
> |
cmake_minimum_required(VERSION 3.12) |
2 |
|
cmake_policy(SET CMP0020 NEW) |
3 |
|
cmake_policy(SET CMP0048 NEW) |
4 |
< |
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.1") |
5 |
< |
cmake_policy(SET CMP0054 NEW) |
4 |
> |
cmake_policy(SET CMP0054 NEW) |
5 |
> |
cmake_policy(SET CMP0074 NEW) |
6 |
> |
|
7 |
> |
# project-defined modules |
8 |
> |
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/resources/cmake/modules") |
9 |
> |
|
10 |
> |
set(SUPPORTED_LANGUAGES C CXX) |
11 |
> |
|
12 |
> |
# Get the project version. |
13 |
> |
set(VERSIONFILE "${CMAKE_CURRENT_LIST_DIR}/src/rt/VERSION") |
14 |
> |
if(EXISTS ${VERSIONFILE}) |
15 |
> |
file(READ ${VERSIONFILE} NAMEVERSION) |
16 |
> |
if(${NAMEVERSION} MATCHES "^([A-Za-z]+) +([0-9]+\\.[0-9]+)") |
17 |
> |
# project name must be lower case, or the CPack module fails |
18 |
> |
string(TOLOWER ${CMAKE_MATCH_1} PROGNAME) |
19 |
> |
project(${PROGNAME} VERSION ${CMAKE_MATCH_2} LANGUAGES ${SUPPORTED_LANGUAGES}) |
20 |
> |
endif() |
21 |
> |
else() |
22 |
> |
project(radiance LANGUAGES ${SUPPORTED_LANGUAGES}) |
23 |
|
endif() |
24 |
|
|
25 |
< |
project(radiance VERSION 5.2.0) |
25 |
> |
message("Project: " ${CMAKE_PROJECT_NAME} " " ${PROJECT_VERSION}) |
26 |
|
|
27 |
|
set(PROJECT_VERSION_TWEAK "Unknown" CACHE STRING "Commit Hash") |
28 |
|
find_package(Git) |
47 |
|
option(BUILD_HEADLESS "Build radiance without any GUI components?" OFF) |
48 |
|
option(BUILD_PABOPTO_UTILS "Build PABOpto Utilities?" OFF) |
49 |
|
option(BUILD_LIBTIFF "Build libtiff?" OFF) |
50 |
+ |
option(BUILD_QT "Build Qt related stuff?" OFF) |
51 |
|
|
52 |
|
if(NOT WIN32) |
53 |
|
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1) |
54 |
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/doc/man/" DESTINATION man) |
55 |
< |
# set(qt_plugin_term "PLUGIN") |
55 |
> |
if(BUILD_QT) |
56 |
> |
set(qt_plugin_term "PLUGIN") |
57 |
> |
endif() |
58 |
|
endif() |
59 |
|
|
60 |
|
if(WIN32) |
61 |
|
set(CPACK_NSIS_INSTALL_ROOT "C:") |
62 |
|
set(CPACK_NSIS_MODIFY_PATH 1) |
63 |
< |
set(qt_plugin_term "LIBRARY") |
63 |
> |
if(BUILD_QT) |
64 |
> |
set(qt_plugin_term "LIBRARY") |
65 |
> |
endif() |
66 |
|
|
67 |
|
# Set RAYPATH on install |
68 |
|
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS |
87 |
|
if(APPLE) |
88 |
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c11 -std=c++11 -stdlib=libc++") |
89 |
|
add_definitions(-DBSD -DNOSTEREO -Dfreebsd) |
90 |
< |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.7") |
90 |
> |
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13") |
91 |
|
endif() |
92 |
|
|
93 |
|
if(BUILD_LIBTIFF) |
140 |
|
include(CPack) |
141 |
|
|
142 |
|
if(NOT BUILD_HEADLESS) |
143 |
< |
# find_package(Qt5Widgets) |
144 |
< |
# get_target_property(QT_LIBRARY_DIR Qt5::Core LOCATION) |
145 |
< |
# get_filename_component(QT_LIBRARY_DIR ${QT_LIBRARY_DIR} PATH) |
146 |
< |
# get_filename_component(QT_LIBRARY_DIR "${QT_LIBRARY_DIR}/.." ABSOLUTE) |
143 |
> |
if(BUILD_QT) |
144 |
> |
find_package(Qt5Widgets) |
145 |
> |
get_target_property(QT_LIBRARY_DIR Qt5::Core LOCATION) |
146 |
> |
get_filename_component(QT_LIBRARY_DIR ${QT_LIBRARY_DIR} PATH) |
147 |
> |
get_filename_component(QT_LIBRARY_DIR "${QT_LIBRARY_DIR}/.." ABSOLUTE) |
148 |
> |
endif() |
149 |
> |
if(APPLE) |
150 |
> |
set(X11_ROOT "/opt/X11") |
151 |
> |
endif() |
152 |
|
find_package(X11) |
153 |
|
if(APPLE) |
154 |
|
include_directories(${X11_INCLUDE_DIR}) |
155 |
< |
endif() |
155 |
> |
endif() |
156 |
> |
if(APPLE AND X11_FOUND) |
157 |
> |
set(CMAKE_FIND_FRAMEWORK NEVER) |
158 |
> |
set(OpenGL_ROOT "/opt/X11") |
159 |
> |
find_package(OpenGL) |
160 |
> |
set(CMAKE_FIND_FRAMEWORK "") |
161 |
> |
else() |
162 |
> |
find_package(OpenGL) |
163 |
> |
endif() |
164 |
> |
|
165 |
|
endif() |
166 |
|
|
167 |
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |