Alpine3D

Alpine3D Svn Source Tree

Root/trunk/CMakeLists.txt

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

Archive Download this file

Revision: HEAD