Alpine3D

Alpine3D Svn Source Tree

Root/trunk/CMakeLists.txt

1CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4)
2LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/tools/cmake/")
3
4PROJECT(alpine3d)
5# Version of library
6SET(VERSION_MAJOR 3 CACHE INTERNAL "")
7SET(VERSION_MINOR 1 CACHE INTERNAL "")
8SET(VERSION_PATCH 0 CACHE INTERNAL "")
9
10SET(LIBPREFIX "lib") #make sure ALL plugins are libXXX for ALL plateforms
11SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") #for Visual C++ import libraries
12
13###########################################################
14#platform specific. First, compiler specific flags, then system specific flags
15OPTION(BUILD_SHARED_LIBS "Set to ON to build dynamic libraries" ON)
16IF(WIN32)
17SET(BUILD_STATIC_LIBS ON) #otherwise the lib files are not generated
18ELSE(WIN32)
19OPTION(BUILD_STATIC_LIBS "Set to ON to build static libraries" OFF)
20ENDIF(WIN32)
21
22###########################################################
23#set compiler flags according to the detected compiler and user options
24INCLUDE("${CMAKE_SOURCE_DIR}/tools/cmake/SetCompilerOptions.cmake")
25SET_COMPILER_OPTIONS()
26
27#The following pre-processor variables are automatically defined:
28# __linux, __GNUC__, __CYGWIN__, _WIN32, __MINGW32__, __APPLE__
29IF(UNIX)
30SET(LIB_DEST "lib")
31#set a full rpath for both build & install tree
32SET(CMAKE_SKIP_BUILD_RPATH FALSE)
33SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
34# add the automatically determined parts of the RPATH
35SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
36# the RPATH to be used when installing, but only if it's not a system directory
37LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
38IF("${isSystemDir}" STREQUAL "-1")
39SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
40ENDIF("${isSystemDir}" STREQUAL "-1")
41
42IF(APPLE)
43SET(DLL_EXT "dylib")
44SET(STAT_EXT "a")
45#set(CMAKE_OSX_SYSROOT iphoneos2.2.1) #for IOS
46#set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT)) #for IOS
47ELSE(APPLE)
48SET(DLL_EXT "so*")
49SET(STAT_EXT "a")
50ENDIF(APPLE)
51ELSE(UNIX)
52IF(WIN32)
53SET(LIB_DEST "bin") #since for Windows, dlls have to be alongside the exe
54#SET(PLATFORM "-D_WIN32 -U__STRICT_ANSI__")
55ADD_DEFINITIONS(-U__STRICT_ANSI__)
56SET(DLL_EXT "dll")
57SET(STAT_EXT "a")
58ENDIF(WIN32)
59ENDIF(UNIX)
60
61IF(NOT CMAKE_BUILD_TYPE)
62SET(CMAKE_BUILD_TYPE "release" CACHE STRING "Choose the type of build, options are: debug release coverage cxxflags" FORCE)
63SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
64ENDIF(NOT CMAKE_BUILD_TYPE)
65
66FIND_PACKAGE(MeteoIO REQUIRED)
67FIND_PACKAGE(Libsnowpack REQUIRED)
68
69###########################################################
70#plugins and applications
71SET(ALPINE3D_STANDALONE ON CACHE BOOL "Compilation Alpine3D standalone ON or OFF")
72SET(MPI OFF CACHE BOOL "Compile with MPI support ON or OFF")
73SET(OPENMP OFF CACHE BOOL "Compile with OPENMP support ON or OFF")
74SET(PETSC OFF CACHE BOOL "Compile with PETSc support ON or OFF")
75
76IF(PETSC)
77SET(PETSC_FLAGS "-DENABLE_PETSC")
78UNSET(MPI CACHE)
79SET (MPI ON CACHE BOOL "Compile with MPI support ON or OFF")
80ENDIF(PETSC)
81IF(MPI)
82SET(MPI_FLAGS "-DENABLE_MPI")
83ENDIF(MPI)
84IF(OPENMP)
85SET(OPENMP_FLAGS "-fopenmp")
86ENDIF(OPENMP)
87
88###########################################################
89#finally, SET compile flags
90SET(CMAKE_CXX_FLAGS "${PETSC_FLAGS} ${MPI_FLAGS} ${OPENMP_FLAGS} ${_VERSION} ${ARCH} ${CFLAGS} ${EXTRA}" CACHE STRING "" FORCE)
91SET(CMAKE_CXX_FLAGS_RELEASE "${OPTIM}" CACHE STRING "" FORCE)
92SET(CMAKE_CXX_FLAGS_DEBUG "${DEBUG} ${WARNINGS} ${EXTRA_WARNINGS}" CACHE STRING "" FORCE)
93SET(CMAKE_CXX_FLAGS_CXXFLAGS "$ENV{CXXFLAGS}" CACHE STRING "" FORCE)
94MARK_AS_ADVANCED(FORCE CMAKE_CXX_FLAGS_CXXFLAGS)
95
96#Add subdirectory, so they can inherit all variables defined above
97ADD_SUBDIRECTORY(alpine3d)
98
99IF(ALPINE3D_STANDALONE)
100#it seems that the only reliable way is to test-compile...
101INCLUDE (CheckCXXSourceCompiles)
102CHECK_CXX_SOURCE_COMPILES("
103#include <fenv.h>
104int main() {
105feenableexcept(FE_DIVBYZERO);
106return 0;
107}" HAVE_FEENABLE)
108
109IF(HAVE_FEENABLE)
110SET(DEBUG_ARITHM ON CACHE BOOL "Force-crash the application if doing an arithmetic exception")
111ENDIF(HAVE_FEENABLE)
112ENDIF(ALPINE3D_STANDALONE)
113
114###########################################################
115#for the install target
116FILE(GLOB hfiles_gen "alpine3d/*.h")
117FILE(GLOB hfiles_eb "alpine3d/ebalance/*.h")
118FILE(GLOB hfiles_rot "alpine3d/runoff/*.h")
119FILE(GLOB hfiles_drift "alpine3d/snowdrift/*.h")
120INSTALL(FILES ${hfiles_gen} DESTINATION include/alpine3d COMPONENT headers)
121INSTALL(FILES ${hfiles_eb} DESTINATION include/alpine3d/ebalance COMPONENT headers)
122INSTALL(FILES ${hfiles_rot} DESTINATION include/alpine3d/runoff COMPONENT headers)
123INSTALL(FILES ${hfiles_drift} DESTINATION include/alpine3d/snowdrift COMPONENT headers)
124
125ADD_CUSTOM_TARGET(distclean make clean
126COMMAND cmake -E remove *~ alpine3d/*~ alpine3d/ebalance/*~ alpine3d/runoff/*~ alpine3d/snowdrift/*~
127COMMAND cmake -E remove CMakeCache.txt cmake_install.cmake
128COMMAND cmake -E remove alpine3d/*.cmake alpine3d/ebalance/*.cmake alpine3d/runoff/*.cmake alpine3d/snowdrift/*.cmake
129COMMAND cmake -E remove_directory CMakeFiles
130COMMAND cmake -E remove_directory alpine3d/CMakeFiles
131COMMAND cmake -E remove_directory alpine3d/ebalance/CMakeFiles
132COMMAND cmake -E remove_directory alpine3d/runoff/CMakeFiles
133COMMAND cmake -E remove_directory alpine3d/snowdrift/CMakeFiles
134COMMAND cmake -E remove bin/*
135COMMAND cmake -E remove lib/*
136)
137
138ADD_CUSTOM_TARGET(deploy
139DEPENDS alpine3d.app
140COMMAND cp -Rf "${METEOIO_ROOT}/lib/libmeteo*" bin/
141COMMAND cp -Rf "${LIBSNOWPACK_ROOT}/lib/libsnowpac*" bin/
142)
143
144###########################################################
145#for the uninstall target
146CONFIGURE_FILE(
147"${PROJECT_SOURCE_DIR}/tools/cmake/cmake_uninstall.cmake.in"
148"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
149IMMEDIATE @ONLY)
150
151ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
152
153#Build the documentation if doxygen is found
154INCLUDE(FindDoxygen)
155FIND_PACKAGE(Doxygen)
156IF(DOXYGEN_FOUND)
157ADD_CUSTOM_TARGET(doc "doxygen" ${PROJECT_SOURCE_DIR}/alpine3d/config.dox)
158ENDIF(DOXYGEN_FOUND)
159#Install the documentation if the user desires it
160SET(INSTALL_DOC OFF CACHE BOOL "Install documentation ON or OFF")
161IF(INSTALL_DOC)
162IF(WIN32)
163SET(DOC_PATH "doc")
164ELSE(WIN32)
165SET(DOC_PATH "share/doc/${CMAKE_PROJECT_NAME}")
166ENDIF(WIN32)
167SET(DOC_FILES License.txt Readme.txt alpine3d/icons/icon.ico)
168IF (DOXYGEN_FOUND)
169INSTALL(DIRECTORY doc/html DESTINATION ${DOC_PATH} COMPONENT documentation)
170LIST(APPEND DOC_FILES doc/Alpine3D_doc.html)
171ELSE (DOXYGEN_FOUND)
172MESSAGE("Doxygen has not been found and is needed to build online documentation. Please either install doxygen or download a documentation-only package!")
173ENDIF (DOXYGEN_FOUND)
174
175INSTALL(FILES ${DOC_FILES} DESTINATION ${DOC_PATH} COMPONENT documentation)
176INSTALL(DIRECTORY doc/examples USE_SOURCE_PERMISSIONS DESTINATION ${DOC_PATH} COMPONENT examples PATTERN ".svn" EXCLUDE)
177ENDIF(INSTALL_DOC)
178
179###########################################################
180## CPACK section
181###########################################################
182SET(CPACK_BUNDLE_ALL OFF CACHE BOOL "Pack all necessary libs and tools for a standalone release")
183IF(CPACK_BUNDLE_ALL)
184#bundle MeteoIO
185FIND_PACKAGE(MeteoIO REQUIRED)
186IF(BUILD_SHARED_LIBS) #consider that if STATIC, we don't need the libs
187FILE(GLOB meteoio_libs "${METEOIO_ROOT}/lib/libmeteo*.${DLL_EXT}")
188IF(WIN32)
189INSTALL(FILES ${meteoio_libs} DESTINATION bin COMPONENT exe)
190ELSE(WIN32)
191INSTALL(FILES ${meteoio_libs} DESTINATION lib COMPONENT exe)
192ENDIF(WIN32)
193ENDIF(BUILD_SHARED_LIBS)
194#bundle Snwpack
195FIND_PACKAGE(Libsnowpack REQUIRED)
196IF(BUILD_SHARED_LIBS) #consider that if STATIC, we don't need the libs
197FILE(GLOB snowpack_libs "${LIBSNOWPACK_ROOT}/${LIB_DEST}/libsnowpack*.${DLL_EXT}")
198IF(WIN32)
199INSTALL(FILES ${snowpack_libs} DESTINATION bin COMPONENT exe)
200ELSE(WIN32)
201INSTALL(FILES ${snowpack_libs} DESTINATION lib COMPONENT exe)
202ENDIF(WIN32)
203ENDIF(BUILD_SHARED_LIBS)
204IF(INSTALL_DOC)
205#meteoio's documentation
206IF(WIN32)
207SET(METEOIO_INSTALLED_DOC "${METEOIO_ROOT}/doc")
208SET(METEOIO_DOC ${DOC_PATH}/meteoio)
209ELSE(WIN32)
210SET(METEOIO_INSTALLED_DOC "${METEOIO_ROOT}/share/doc/meteoio")
211SET(METEOIO_DOC ${DOC_PATH}/../meteoio)
212ENDIF(WIN32)
213IF(NOT IS_DIRECTORY "${METEOIO_INSTALLED_DOC}") #if we detected neighboring checked out version of MeteoIO
214SET(METEOIO_INSTALLED_DOC "${METEOIO_ROOT}/doc")
215ENDIF()
216INSTALL(DIRECTORY "${METEOIO_INSTALLED_DOC}/html" DESTINATION ${METEOIO_DOC} COMPONENT documentation)
217FILE(GLOB meteoio_docs "${METEOIO_INSTALLED_DOC}/*.*")
218INSTALL(FILES ${meteoio_docs} DESTINATION ${METEOIO_DOC} COMPONENT documentation)
219#snowpack's documentation
220IF(WIN32)
221SET(SNOWPACK_INSTALLED_DOC "${LIBSNOWPACK_ROOT}/doc")
222SET(SNOWPACK_DOC ${DOC_PATH}/snowpack)
223ELSE(WIN32)
224SET(SNOWPACK_INSTALLED_DOC "${LIBSNOWPACK_ROOT}/share/doc/snowpack")
225SET(SNOWPACK_DOC ${DOC_PATH}/../snowpack)
226ENDIF(WIN32)
227IF(NOT IS_DIRECTORY "${SNOWPACK_INSTALLED_DOC}") #if we detected neighboring checked out version of Snowpack
228SET(SNOWPACK_INSTALLED_DOC "${LIBSNOWPACK_ROOT}/doc")
229ENDIF()
230INSTALL(DIRECTORY "${SNOWPACK_INSTALLED_DOC}/html" DESTINATION ${SNOWPACK_DOC} COMPONENT documentation)
231FILE(GLOB snowpack_docs "${SNOWPACK_INSTALLED_DOC}/*.*")
232INSTALL(FILES ${snowpack_docs} DESTINATION ${SNOWPACK_DOC} COMPONENT documentation)
233ENDIF(INSTALL_DOC)
234
235#bundle inishell
236FILE(GLOB inishell "${CMAKE_SOURCE_DIR}/tools/inish*.jar")
237IF("${inishell}" STREQUAL "")
238MESSAGE("Inishell not found! Please copy inishell.jar into the tools directory")
239ENDIF("${inishell}" STREQUAL "")
240INSTALL(FILES ${inishell} DESTINATION bin COMPONENT exe)
241
242#bundle the grid viewer
243FILE(GLOB grid_view "${CMAKE_SOURCE_DIR}/tools/Interface/view.*")
244IF("${grid_view}" STREQUAL "")
245MESSAGE("View not found! Please copy view.jar into the tools directory")
246ENDIF("${grid_view}" STREQUAL "")
247INSTALL(FILES ${grid_view} DESTINATION bin COMPONENT exe)
248
249#bundle niViz
250SET(CPACK_BUNDLE_NIVIZ ON CACHE BOOL "Should niViz also be bundled?")
251IF(CPACK_BUNDLE_NIVIZ)
252SET(NIVIZ_DIST_PATH "../niViz" CACHE PATH "Path to niViz 'dist' subdirectory")
253FILE(GLOB niviz_html "${NIVIZ_DIST_PATH}/*.html")
254IF("${niviz_html}" STREQUAL "")
255MESSAGE("niViz not found! Please provide a proper path to niViz 'dist' and don't forget to run 'make dist'")
256ENDIF("${niviz_html}" STREQUAL "")
257INSTALL(DIRECTORY "${NIVIZ_DIST_PATH}/assets" DESTINATION bin/niviz COMPONENT exe)
258INSTALL(FILES ${niviz_html} DESTINATION bin/niviz COMPONENT exe)
259ENDIF(CPACK_BUNDLE_NIVIZ)
260ENDIF(CPACK_BUNDLE_ALL)
261
262SET(CPACK_PACKAGE_DESCRIPTION "Alpine3D")
263SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is the Alpine3D model distributed physical modeling of snow pack.")
264SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/Welcome.txt")
265SET(CPACK_PACKAGE_NAME "Alpine3D")
266SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Alpine3D")
267SET(CPACK_PACKAGE_CONTACT "Mathias Bavay <Mathias.Bavay@wsl.ch>")
268SET(CPACK_PACKAGE_VENDOR "WSL Institute for Snow and Avalanche Research")
269SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/alpine3d/icons\\\\icon.ico")
270SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/License.txt")
271SET(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/Welcome.txt")
272SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/Readme.txt")
273
274SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
275SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
276SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
277SET(VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
278SET(CPACK_ARCH "${CMAKE_SYSTEM_PROCESSOR}")
279SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}${PACKAGE_EXTRA}-${VERSION}-${CPACK_ARCH}")
280
281#installation by components for formats that support it
282#SET(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE 1)
283SET(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
284SET(CPACK_COMPONENTS_ALL documentation examples exe)
285SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Alpine3D static library")
286SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "The Alpine3D static library")
287SET(CPACK_COMPONENT_EXE_DISPLAY_NAME "Alpine3D application")
288SET(CPACK_COMPONENT_EXE_DESCRIPTION "The Alpine3D standalone model")
289SET(CPACK_COMPONENT_EXE_GROUP Runtime)
290SET(CPACK_COMPONENT_RUNTIME_GROUP "Runtime")
291SET(CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION "What you need to run an application based on Alpine3D")
292IF(INSTALL_DOC)
293SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
294SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Documentation of the Alpine3D usage")
295SET(CPACK_COMPONENT_DOCUMENTATION_GROUP Docs)
296SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples")
297SET(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Various simulations with their example data")
298SET(CPACK_COMPONENT_EXAMPLES_GROUP Docs)
299#SET(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries headers runtime)
300SET(CPACK_COMPONENT_DOCS_GROUP "Documentation")
301SET(CPACK_COMPONENT_GROUP_DOCS_DESCRIPTION "How to use Alpine3D")
302ENDIF(INSTALL_DOC)
303
304IF(UNIX)
305IF(APPLE)
306SET(CPACK_GENERATOR "DragNDrop")
307SET(CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_NAME}")
308SET(CPACK_DMG_FORMAT "UDBZ")
309#SET(CPACK_GENERATOR "Bundle")
310SET(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/tools/alpine3d.plist")
311SET(MACOSX_BUNDLE_INFO_STRING "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
312SET(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/alpine3d/icons/icon.icns")
313SET(MACOSX_BUNDLE_ICON_FILE "${CPACK_BUNDLE_ICON}")
314SET(MACOSX_BUNDLE_GUI_IDENTIFIER "${CPACK_PACKAGE_DESCRIPTION}")
315SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION}")
316SET(CPACK_BUNDLE_NAME "${CPACK_PACKAGE_NAME}")
317SET(MACOSX_BUNDLE_BUNDLE_NAME "${CPACK_PACKAGE_NAME}")
318SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION}")
319SET(MACOSX_BUNDLE_BUNDLE_VERSION "0")
320SET(MACOSX_BUNDLE_COPYRIGHT "${CPACK_PACKAGE_VENDOR}")
321#SET(CPACK_PACKAGING_INSTALL_PREFIX "/Applications/${CPACK_PACKAGE_NAME}")
322SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/alpine3d/icons/icon.icns")
323SET_SOURCE_FILES_PROPERTIES(${CPACK_BUNDLE_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
324INSTALL(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink bin/alpine3d /usr/bin/alpine3d)")
325ELSE(APPLE)
326SET(CPACK_ARCHIVE_COMPONENT_INSTALL OFF)
327SET(CPACK_GENERATOR "DEB;RPM;TGZ")
328SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
329SET(CPACK_DEBIAN_PACKAGE_NAME "alpine3d")
330SET(CPACK_DEBIAN_PACKAGE_SECTION "science")
331#objdump -p lib/libmeteoio.so | grep NEEDED | tr -s ' ' | cut -d' ' -f3 | tr '\n' ','
332IF(CPACK_BUNDLE_ALL OR BUILD_STATIC_LIBS)
333SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libstdc++6, libc6")
334ELSE(CPACK_BUNDLE_ALL OR BUILD_STATIC_LIBS)
335SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libstdc++, meteoio,snowpack")
336ENDIF(CPACK_BUNDLE_ALL OR BUILD_STATIC_LIBS)
337#SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386") #dpkg --print-architecture
338IF("${CPACK_ARCH}" STREQUAL "x86_64")
339SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
340ELSE("${CPACK_ARCH}" STREQUAL "x86_64")
341SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_ARCH}")
342ENDIF("${CPACK_ARCH}" STREQUAL "x86_64")
343SET(CPACK_RPM_PACKAGE_NAME "alpine3d")
344SET(CPACK_RPM_PACKAGE_LICENSE "LPGLv3")
345SET(CPACK_RPM_PACKAGE_REQUIRES "libstdc++6, meteoio,snowpack")
346SET(CPACK_RPM_PACKAGE_ARCHITECTURE "${CPACK_ARCH}")
347SET(CPACK_RPM_PACKAGE_GROUP "Applications/Science")
348ENDIF(APPLE)
349ELSE(UNIX)
350IF(WIN32)
351SET(CPACK_GENERATOR "NSIS")
352SET(CPACK_NSIS_MUI_ICON "${CPACK_PACKAGE_ICON}")
353SET(CPACK_PACKAGE_ICON "${CPACK_PACKAGE_ICON}")
354SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
355SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}")
356#SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${EnvVarUpdate} $0 \"LIB\" \"A\" \"HKLM\" \"C:\MyLib\"")
357SET(CPACK_NSIS_MODIFY_PATH ON)
358
359#Main links (they can get overwritten later)
360SET(MENU_LINKS_NIVIZ "http://niviz.org" "niViz online visualization" )
361SET(MENU_LINKS_ALPINE3D "https://models.slf.ch/p/alpine3d/" "Alpine3D Home page")
362IF(INSTALL_DOC)
363LIST(APPEND MENU_LINKS_ALPINE3D
364"${DOC_PATH}/Alpine3D_doc.html" "Alpine3D documentation"
365"${DOC_PATH}/examples" "Alpine3D examples"
366)
367ENDIF(INSTALL_DOC)
368
369#all other links: inishell, local niviz, meteoio
370IF(CPACK_BUNDLE_ALL)
371SET(MENU_LINKS_INISHELL "bin/inishell.jar" "Inishell")
372IF(CPACK_BUNDLE_NIVIZ)
373SET(MENU_LINKS_NIVIZ "bin/niviz/index.html" "NIVIZ visualization")
374ENDIF(CPACK_BUNDLE_NIVIZ)
375SET(MENU_LINKS_METEOIO "https://models.slf.ch/p/meteoio/" "MeteoIO Home page")
376IF(INSTALL_DOC)
377SET(MENU_LINKS_METEOIO
378"${METEOIO_DOC}/MeteoIO_doc.html" "MeteoIO documentation"
379"https://models.slf.ch/p/meteoio/" "MeteoIO Home page"
380)
381ENDIF(INSTALL_DOC)
382ENDIF(CPACK_BUNDLE_ALL)
383
384SET(CPACK_NSIS_MENU_LINKS ${MENU_LINKS_ALPINE3D} ${MENU_LINKS_INISHELL} ${MENU_LINKS_NIVIZ} ${MENU_LINKS_METEOIO})
385
386#info for the add/uninstall software administration
387SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_NAME}-${VERSION}")
388SET(CPACK_NSIS_INSTALLED_ICON_NAME "doc\\\\icon.ico")
389SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.slf.ch")
390SET(CPACK_NSIS_HELP_LINK "https://models.slf.ch/p/alpine3d")
391SET(CPACK_NSIS_CONTACT "${CPACK_PACKAGE_CONTACT}")
392SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
393ENDIF(WIN32)
394ENDIF(UNIX)
395
396
397SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${VERSION}" CACHE INTERNAL "tarball basename")
398SET(CPACK_SOURCE_GENERATOR TGZ)
399# The following components are regex's to match anywhere (unless anchored)
400# in absolute path + filename to find files or directories to be excluded
401# from source tarball.
402SET(CPACK_SOURCE_IGNORE_FILES
403"~$"
404"\\\\.svn/"
405"/CMakeFiles/"
406"/CMakeCache*"
407"/cmake_install\\\\.cmake$"
408"/cmake_uninstall\\\\.cmake$"
409"^_CPack_.*/"
410"/CPack*"
411"\\\\.o$"
412"/m4/"
413)
414
415INCLUDE(CPack)
416
417###########################################################
418## CTest section
419###########################################################
420OPTION(BUILD_TESTING "Build the tests" OFF)
421IF(BUILD_TESTING)
422# Special build type configuration for Coverage Testing.
423#Coverage testing only supported by GCC and a few commercial tools
424IF(CMAKE_COMPILER_IS_GNUCXX)
425OPTION(BUILD_TESTING_WITH_COVERAGE "Use gcc flags to make coverage tests" OFF)
426IF(BUILD_TESTING_WITH_COVERAGE)
427# force the correct flags to make coverage trought a build type
428SET(CMAKE_BUILD_TYPE coverage)
429SET(CMAKE_CXX_FLAGS_COVERAGE "${OPTIM} -ftest-coverage -fprofile-arcs" CACHE STRING "" FORCE)
430MARK_AS_ADVANCED(FORCE CMAKE_CXX_FLAGS_COVERAGE)
431# Force debug mode, so that no optimisation is made to get "Correct" results of coverage testing
432SET(CMAKE_BUILD_TYPE "coverage" CACHE STRING "Choose the type of build, options are: debug release coverage " FORCE)
433SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
434ENDIF(BUILD_TESTING_WITH_COVERAGE)
435ENDIF(CMAKE_COMPILER_IS_GNUCXX)
436
437INCLUDE(CTest) # This makes ENABLE_TESTING() and gives support for Dashboard
438ADD_SUBDIRECTORY(tests)
439ENDIF(BUILD_TESTING)

Archive Download this file

Revision: HEAD