1 |
|
cmake_minimum_required(VERSION 2.8.4) |
2 |
|
project("radiance") |
3 |
|
|
4 |
+ |
if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.11") |
5 |
+ |
cmake_policy(SET CMP0020 NEW) |
6 |
+ |
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0") |
7 |
+ |
cmake_policy(SET CMP0042 NEW) |
8 |
+ |
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.1") |
9 |
+ |
cmake_policy(SET CMP0054 NEW) |
10 |
+ |
endif() |
11 |
+ |
endif() |
12 |
+ |
endif() |
13 |
+ |
|
14 |
|
enable_testing() |
15 |
|
include(CTest) |
16 |
|
|
17 |
|
option(BUILD_SHARED_LIBS "Build radiance using shared libraries?" OFF) |
18 |
+ |
option(BUILD_HEADLESS "Build radiance without any GUI components?" OFF) |
19 |
|
|
20 |
+ |
option(CPACK_NREL_SUPPORT "Include OpenStudio ToolFinder Help?" OFF) |
21 |
+ |
|
22 |
+ |
if( CPACK_NREL_SUPPORT ) |
23 |
+ |
# find git so we can query for the current git tag |
24 |
+ |
find_program(git git) |
25 |
+ |
if (NOT git) |
26 |
+ |
message(ERROR "Please specify the path to the git executable") |
27 |
+ |
endif() |
28 |
+ |
|
29 |
+ |
# call git log to get output containing the tag |
30 |
+ |
execute_process( |
31 |
+ |
COMMAND ${git} describe --tag --exact-match |
32 |
+ |
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
33 |
+ |
OUTPUT_VARIABLE git_tag_output) |
34 |
+ |
|
35 |
+ |
# create & install the source version .txt file |
36 |
+ |
file(WRITE "NREL_ver.txt" "Radiance version ${git_tag_output}") |
37 |
+ |
install(FILES NREL_ver.txt DESTINATION bin/..) |
38 |
+ |
endif() |
39 |
+ |
|
40 |
|
if(NOT WIN32) |
41 |
|
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1) |
42 |
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/man/ DESTINATION man) |
43 |
|
set(qt_plugin_term "PLUGIN") |
44 |
|
endif() |
45 |
|
|
15 |
– |
|
46 |
|
if (WIN32) |
47 |
< |
|
18 |
< |
set(CPACK_NSIS_MODIFY_PATH 0) |
19 |
< |
|
20 |
< |
set(CPACK_BINARY_ZIP 1) |
21 |
< |
|
22 |
< |
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "") |
47 |
> |
set(CPACK_NSIS_MODIFY_PATH 1) |
48 |
|
set(qt_plugin_term "LIBRARY") |
49 |
|
|
50 |
+ |
# Set RAYPATH on install |
51 |
+ |
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS |
52 |
+ |
"WriteRegExpandStr HKLM \\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\" RAYPATH '\\\$INSTDIR\\\\lib\\\;.'" |
53 |
+ |
) |
54 |
+ |
|
55 |
+ |
# Unset RAYPATH on uninstall |
56 |
+ |
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS |
57 |
+ |
"DeleteRegValue HKLM \\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\" RAYPATH" |
58 |
+ |
) |
59 |
|
endif() |
60 |
|
|
61 |
|
if(UNIX) |
75 |
|
INCLUDE(radianceCPack.cmake ) |
76 |
|
ENDIF( BUILD_PACKAGE ) |
77 |
|
|
78 |
< |
set(CPACK_PACKAGE_VERSION_MAJOR 4) |
79 |
< |
set(CPACK_PACKAGE_VERSION_MINOR 2) |
78 |
> |
set(CPACK_PACKAGE_VERSION_MAJOR 5) |
79 |
> |
set(CPACK_PACKAGE_VERSION_MINOR 0) |
80 |
|
set(CPACK_PACKAGE_VERSION_PATCH a) |
81 |
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Radiance") |
82 |
|
SET(CPACK_RESOURCE_FILE_WELCOME "${radiance_SOURCE_DIR}/Welcome.txt") |
86 |
|
|
87 |
|
include(CPack) |
88 |
|
|
89 |
< |
find_package(Qt4 COMPONENTS QtCore QtGui) |
90 |
< |
find_package(X11) |
89 |
> |
if(NOT BUILD_HEADLESS) |
90 |
> |
find_package(Qt5Widgets) |
91 |
> |
find_package(X11) |
92 |
> |
endif() |
93 |
|
|
94 |
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
95 |
|
|