ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/CMakeLists.txt
Revision: 1.12
Committed: Fri Apr 18 20:51:49 2014 UTC (10 years, 3 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad4R2
Changes since 1.11: +3 -3 lines
Log Message:
Installation fix

File Contents

# Content
1 cmake_minimum_required(VERSION 2.8.4)
2 project("radiance")
3
4 enable_testing()
5 include(CTest)
6
7 option(BUILD_SHARED_LIBS "Build radiance using shared libraries?" OFF)
8 option(BUILD_HEADLESS "Build radiance without any GUI components?" OFF)
9
10 option(CPACK_NREL_SUPPORT "Include OpenStudio ToolFinder Help?" OFF)
11
12 if( CPACK_NREL_SUPPORT )
13 # find git so we can query for the current git tag
14 find_program(git git)
15 if (NOT git)
16 message(ERROR "Please specify the path to the git executable")
17 endif()
18
19 # call git log to get output containing the tag
20 execute_process(
21 COMMAND ${git} describe --tag --exact-match
22 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
23 OUTPUT_VARIABLE git_tag_output)
24
25 # create & install the source version .txt file
26 file(WRITE "NREL_ver.txt" "Radiance version ${git_tag_output}")
27 install(FILES NREL_ver.txt DESTINATION bin/..)
28 endif()
29
30 if(NOT WIN32)
31 set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1)
32 install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/man/ DESTINATION man)
33 set(qt_plugin_term "PLUGIN")
34 endif()
35
36 if (WIN32)
37 set(CPACK_NSIS_MODIFY_PATH 1)
38 set(qt_plugin_term "LIBRARY")
39
40 # Set RAYPATH on install
41 set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
42 "WriteRegExpandStr HKLM \\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\" RAYPATH '\\\$INSTDIR\\\\lib\\\;.'"
43 )
44
45 # Unset RAYPATH on uninstall
46 set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
47 "DeleteRegValue HKLM \\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\" RAYPATH"
48 )
49 endif()
50
51 if(UNIX)
52 set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local/radiance")
53 add_definitions(-Dlinux -D_FILE_OFFSET_BITS=64 -DNOSTEREO)
54 else()
55 set(CPACK_PACKAGING_INSTALL_PREFIX "/")
56 endif()
57
58 if(APPLE)
59 add_definitions(-DBSD -DNOSTEREO -Dfreebsd)
60 include_directories(/usr/X11R6/include)
61 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.6")
62 endif()
63
64 IF( BUILD_PACKAGE )
65 INCLUDE(radianceCPack.cmake )
66 ENDIF( BUILD_PACKAGE )
67
68 set(CPACK_PACKAGE_VERSION_MAJOR 4)
69 set(CPACK_PACKAGE_VERSION_MINOR 2)
70 set(CPACK_PACKAGE_VERSION_PATCH a)
71 set(CPACK_PACKAGE_INSTALL_DIRECTORY "Radiance")
72 SET(CPACK_RESOURCE_FILE_WELCOME "${radiance_SOURCE_DIR}/Welcome.txt")
73 SET(CPACK_RESOURCE_FILE_README "${radiance_SOURCE_DIR}/README.txt")
74 SET(CPACK_RESOURCE_FILE_LICENSE "${radiance_SOURCE_DIR}/License.txt")
75
76
77 include(CPack)
78
79 if(NOT BUILD_HEADLESS)
80 find_package(Qt4 COMPONENTS QtCore QtGui)
81 find_package(X11)
82 endif()
83
84 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
85
86 if(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
87 set(_INTEL_WINDOWS 1)
88 endif()
89 if(MSVC OR _INTEL_WINDOWS)
90 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
91 endif()
92 if(WIN32)
93 add_definitions(-DEZXML_NOMMAP -Dfseeko=fseek -Dstrcasecmp=_stricmp)
94 endif()
95
96 add_subdirectory("src")
97
98 set(test_dir ${CMAKE_CURRENT_SOURCE_DIR}/test/test\ data)
99 option(BUILD_TESTING "Download support tarball & enable testing?" ON)
100
101 if(BUILD_TESTING)
102 #download and extract radiance support files
103 include(ExternalProject)
104 set(base "${CMAKE_BINARY_DIR}/Downloads")
105 set_property(DIRECTORY PROPERTY EP_BASE ${base})
106 ExternalProject_Add(radiance_support
107 URL http://www.radiance-online.org/software/non-cvs/rad4R1supp.tar.gz
108 URL_MD5 efd82970e1d0747eede8eb64c01048f4
109 CONFIGURE_COMMAND ""
110 BUILD_COMMAND ""
111 INSTALL_COMMAND ""
112 )
113
114 #install support files.
115 set(lib_dir ${base}/Source/radiance_support/lib)
116 install(
117 FILES
118 ${lib_dir}/Earth.cal ${lib_dir}/He.cal ${lib_dir}/He3.cal
119 ${lib_dir}/adobe.cal ${lib_dir}/ball.cal ${lib_dir}/brick.cal
120 ${lib_dir}/brickweave.cal ${lib_dir}/carpet.cal ${lib_dir}/climit.cal
121 ${lib_dir}/corrug.cal ${lib_dir}/covelight.cal ${lib_dir}/cyl.cal
122 ${lib_dir}/dichroic.cal ${lib_dir}/dirt.cal ${lib_dir}/fisheye.cal
123 ${lib_dir}/fishgeom.cal ${lib_dir}/fprism.cal ${lib_dir}/globe.cal
124 ${lib_dir}/gloss.cal ${lib_dir}/grating.cal ${lib_dir}/jigglepic.cal
125 ${lib_dir}/lcp0.cal ${lib_dir}/limit.cal ${lib_dir}/marble.cal
126 ${lib_dir}/orange.cal ${lib_dir}/picture.cal ${lib_dir}/plink.cal
127 ${lib_dir}/prism.cal ${lib_dir}/retrorefl.cal ${lib_dir}/serraglaze.cal
128 ${lib_dir}/slate.cal ${lib_dir}/surf.cal ${lib_dir}/tim1.cal
129 ${lib_dir}/weave.cal ${lib_dir}/winxmit.cal ${lib_dir}/woodpat.cal
130 ${lib_dir}/woodtex.cal ${lib_dir}/wrinkle.cal
131 ${lib_dir}/page1.txt ${lib_dir}/page2.txt
132 ${lib_dir}/Pix.fnt
133 ${lib_dir}/PixOblique.fnt
134 ${lib_dir}/Veerdana.fnt
135 ${lib_dir}/VeerdanaBold.fnt
136 ${lib_dir}/VeerdanaBoldItalic.fnt
137 ${lib_dir}/VeerdanaItalic.fnt
138 ${lib_dir}/helvet.fnt
139 ${lib_dir}/hexbit4x1.fnt
140 ${test_dir}/model.oct
141 ${test_dir}/model.vp
142 DESTINATION lib
143 )
144
145 install(FILES ${lib_dir}/Earth.hdr DESTINATION lib RENAME Earth.pic)
146 install(FILES ${lib_dir}/EarthBig.hdr DESTINATION lib RENAME EarthBig.pic)
147 install(FILES ${lib_dir}/alberta.hdr DESTINATION lib RENAME alberta.pic)
148 install(FILES ${lib_dir}/brick.hdr DESTINATION lib RENAME brick.pic)
149 install(FILES ${lib_dir}/brickweave.hdr DESTINATION lib RENAME brickweave.pic)
150 install(FILES ${lib_dir}/cabin.hdr DESTINATION lib RENAME cabin.pic)
151 install(FILES ${lib_dir}/forestfl.hdr DESTINATION lib RENAME forestfl.pic)
152 install(FILES ${lib_dir}/oakfloor.hdr DESTINATION lib RENAME oakfloor.pic)
153 install(FILES ${lib_dir}/pine.hdr DESTINATION lib RENAME pine.pic)
154 install(FILES ${lib_dir}/pinebark.hdr DESTINATION lib RENAME pinebark.pic)
155 install(FILES ${lib_dir}/podlife.hdr DESTINATION lib RENAME podlife.pic)
156 install(FILES ${lib_dir}/richgrove.hdr DESTINATION lib RENAME richgrove.pic)
157 install(FILES ${lib_dir}/shingle.hdr DESTINATION lib RENAME shingle.pic)
158 install(FILES ${lib_dir}/summercab.hdr DESTINATION lib RENAME summercab.pic)
159 install(FILES ${lib_dir}/tulips.hdr DESTINATION lib RENAME tulips.pic)
160
161 add_subdirectory(cmake_tests)
162 endif()
163
164 install(
165 FILES
166 ${test_dir}/model.oct
167 ${test_dir}/model.vp
168 DESTINATION lib
169 )
170
171 include(InstallRequiredSystemLibraries)
172 add_subdirectory(InstallRules)