source: trunk/Mars/CMakeLists.txt@ 19782

Last change on this file since 19782 was 19782, checked in by tbretz, 5 years ago
Same error message than for cmake itself.
File size: 19.3 KB
Line 
1# *********************************
2# ************ cmake **************
3# *********************************
4CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR)
5CMAKE_POLICY(SET CMP0043 NEW)
6CMAKE_POLICY(SET CMP0048 NEW)
7
8# Enable debug symbols by default
9# must be done before project() statement
10SET(CMAKE_BUILD_TYPE_INIT Release)
11# (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Release)
12
13# Enable CLANG as default compilers, to change this use
14# cmake -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++
15# Note that if compilers are switched on the fly,
16# the cache is deleted
17IF(NOT DEFINED CMAKE_C_COMPILER)
18 FIND_PROGRAM(CMAKE_C_COMPILER NAMES $ENV{CC} clang gcc cc PATHS ENV PATH NO_DEFAULT_PATH DOC "C Compiler")
19ENDIF()
20IF(NOT DEFINED CMAKE_CXX_COMPILER)
21 FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES $ENV{CXX} clang++ g++ c++ PATHS ENV PATH NO_DEFAULT_PATH DOC "C++ Compiler")
22ENDIF()
23
24#SET(CMAKE_VERBOSE_MAKEFILE ON)
25
26# To check for an include file you do this:
27#CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
28# To check the size of a primitive type:
29#CHECK_TYPE_SIZE("int" SIZEOF_INT)
30
31# *********************************
32# ************ Project ************
33# *********************************
34
35STRING(TIMESTAMP VERSION %y.%U.%w.%H UTC)
36
37MESSAGE(STATUS "Mars V${VERSION}")
38
39PROJECT(mars VERSION ${VERSION})
40
41INCLUDE(GNUInstallDirs)
42
43IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
44 SET(GCC_MIN 4.4.7)
45 IF (CMAKE_C_COMPILER_VERSION VERSION_LESS GCC_MIN OR
46 CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_MIN)
47 MESSAGE(FATAL_ERROR "gcc/g++ ${GCC_MIN} or higher is required. You are running version ${CMAKE_C_COMPILER_VERSION}/${CMAKE_CXX_COMPILER_VERSION}")
48 ENDIF()
49ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
50 SET(CLANG_MIN 3.8)
51 IF (CMAKE_C_COMPILER_VERSION VERSION_LESS 3.8 OR
52 CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.8)
53 MESSAGE(FATAL_ERROR "clang/clang++ ${CLANG_MIN} or higher is required. You are running version ${CMAKE_C_COMPILER_VERSION}/${CMAKE_CXX_COMPILER_VERSION}")
54 ENDIF()
55ELSE()
56 MESSAGE(WARNING "You are using an unsupported compiler! Compilation has only been tested only with clang/clang++ and gcc/g++.")
57ENDIF()
58
59# ======== For config.h.in =========
60SET(PACKAGE_MAINTAINER "Thomas Bretz")
61SET(PACKAGE_BUGREPORT "tbretz@physik.rwth-aachen.de")
62SET(PACKAGE_URL "https://www.fact-project.org")
63
64FIND_PROGRAM(LSB_RELEASE_EXE NAMES lsb_release)
65IF (DEFINED LSB_RELEASE_EXE)
66 EXECUTE_PROCESS(COMMAND ${LSB_RELEASE_EXE} -d OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
67 MESSAGE(STATUS ${LSB_RELEASE})
68ENDIF()
69
70# *********************************
71# ********* Requirements **********
72# *********************************
73
74# Inlclude the main source AND build dir itself
75#SET(CMAKE_INCLUDE_CURRENT_DIR ON)
76SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
77
78# =========== help2man ============
79FIND_PROGRAM(HELP2MAN_EXECUTABLE help2man)
80
81# =========== pkg-config ============
82FIND_PACKAGE(PkgConfig)
83FIND_PACKAGE(PackageHandleStandardArgs)
84
85
86# ============= libnova ==============
87
88PKG_CHECK_MODULES(Nova QUIET Nova)
89
90# Try to locate the package in the default path
91# and in the path provided by pkg-config
92FIND_PATH(NOVA_INCLUDE_DIR NAMES libnova/libnova.h PATHS ${NOVA_INCLUDE_DIRS})
93FIND_LIBRARY(NOVA_LIBRARY NAMES nova PATHS ${NOVA_LIBRARY_DIRS})
94
95# Check if NOVA_LIBARARY and NOVA_INCLUDE_DIR is set
96# Print a message otherwise
97FIND_PACKAGE_HANDLE_STANDARD_ARGS(Nova DEFAULT_MSG NOVA_LIBRARY NOVA_INCLUDE_DIR)
98
99# Mark those variables to be displayed as 'advanced' in the GUI
100MARK_AS_ADVANCED(NOVA_LIBRARY NOVA_INCLUDE_DIR)
101
102# handle success
103FIND_PACKAGE_MESSAGE(NovaInc "Found Nova headers in ${NOVA_INCLUDE_DIR}" "[${NOVA_LIBRARY}][${NOVA_INCLUDE_DIR}]")
104
105
106# ============== libz ================
107
108FIND_PACKAGE(ZLIB REQUIRED)
109
110# *********************************
111# ********** HEAL Pix **********
112# *********************************
113
114SET(HEALPIX_PREFIX "${CMAKE_SOURCE_DIR}/RootHealPix" CACHE FILEPATH "Base path to the RootHealPix code.")
115
116IF(EXISTS ${HEALPIX_PREFIX})
117 FIND_PACKAGE_MESSAGE(HealPixPrefix "RootHealPix prefix: ${HEALPIX_PREFIX}" "[${HEALPIX_PREFIX}]")
118 SET(FOUND_HEALPIX ON)
119ENDIF()
120
121# ============== ROOT ================
122
123FIND_PROGRAM(ROOTCONFIG_EXECUTABLE NAMES root-config)
124FIND_PACKAGE_HANDLE_STANDARD_ARGS(root-config DEFAULT_MSG ROOTCONFIG_EXECUTABLE)
125IF(NOT ROOTCONFIG_EXECUTABLE)
126 MESSAGE(FATAL_ERROR "Please make sure `root-config` is accessible in your path. In case of an installation from source, you might need to source\n . [path-to-root]/bin/thisroot.sh")
127ENDIF()
128
129# You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
130# - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
131# - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
132IF(EXISTS $ENV{ROOTSYS}/ROOTConfig.cmake)
133 IF(NOT DEFINED ENV{CMAKE_PREFIX_PATH})
134 LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
135 ENDIF()
136ENDIF()
137SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
138
139SET(ROOT_PACKAGES Gui Minuit ASImage HistPainter)
140IF(FOUND_HEALPIX)
141 SET(ROOT_PACKAGES ${ROOT_PACKAGES} FITSIO)
142ENDIF()
143
144#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
145#SET(ROOT_CONFIG_DEBUG 1)
146FIND_PACKAGE(ROOT REQUIRED COMPONENTS ${ROOT_PACKAGES})
147
148IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE)
149 FIND_PACKAGE_MESSAGE(RootFound "Found ROOT: ${ROOT_INCLUDE_DIRS}" "[${ROOT_INCLUDE_DIRS}][${ROOT_LIBRARY_DIR}][${ROOT_VERSION}]")
150ENDIF()
151
152#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
153FIND_PACKAGE_MESSAGE(RootInclude "Setup ROOT: [${ROOT_VERSION}] ${ROOT_USE_FILE}" "[${ROOT_VERSION}][${ROOT_USE_FILE}]")
154IF(DEFINED ROOT_USE_FILE)
155 INCLUDE(${ROOT_USE_FILE})
156ELSE()
157 # From RootUseFile.cmake (root 6)
158 INCLUDE_DIRECTORIES(${ROOT_INCLUDE_DIRS})
159 LINK_DIRECTORIES(${ROOT_LIBRARY_DIR})
160 ADD_DEFINITIONS(${ROOT_DEFINITIONS})
161 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
162 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ROOT_C_FLAGS}")
163 SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ROOT_fortran_FLAGS}")
164ENDIF()
165
166# Replace separators to make the version consistent
167# (older version might use the '/')
168STRING(REPLACE "/" "." ROOT_VERSION ${ROOT_VERSION})
169
170# This happens when root is used from its build directory
171# Create the version components manually
172IF(ROOT_VERSION AND NOT ROOT_VERSION_MAJOR)
173 # Create a list of components
174 STRING(REPLACE "." ";" ROOT_VERSION_LIST ${ROOT_VERSION})
175 # Split version string
176 LIST(GET ROOT_VERSION_LIST 0 ROOT_VERSION_MAJOR)
177 LIST(GET ROOT_VERSION_LIST 1 ROOT_VERSION_MINOR)
178 LIST(GET ROOT_VERSION_LIST 2 ROOT_VERSION_PATCH)
179 # Remove trailing 0's
180 STRING(REGEX REPLACE "0+([0-9]+)" "\\1" ROOT_VERSION_MINOR ${ROOT_VERSION_MINOR})
181 STRING(REGEX REPLACE "0+([0-9]+)" "\\1" ROOT_VERSION_PATCH ${ROOT_VERSION_PATCH})
182ENDIF()
183
184
185# -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree
186# -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread
187# -lASImage -lMinuit -lHistPainter -lThread
188
189#MESSAGE("INCL_DIRS: ${ROOT_INCLUDE_DIRS}")
190#MESSAGE("LIBS: ${ROOT_LIBRARIES}")
191#MESSAGE("DEFS: ${ROOT_DEFINITIONS}")
192#MESSAGE("CXXFLAGS: ${ROOT_CXX_FLAGS}")
193#MESSAGE("CXFLAGS: ${ROOT_CC_FLAGS}")
194#MESSAGE("FOUND: ${ROOT_FOUND}")
195#MESSAGE("FILE: ${ROOT_USE_FILE}")
196#MESSAGE("DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
197#ROOT_<library>_LIBRARY PATH Full path for each of the ROOT libraries listed in COMPONENTS
198#ROOT_<command>_CMD PATH Full path for each ROOT executable (rootcling, root, hadd, etc.)
199#ROOT_<option>_FOUND BOOL True for each enabled build option (e.g. cocoa, python, xrootd, etc.)
200
201# function ROOT_GENERATE_DICTIONARY( dictionary
202# header1 header2 ...
203# LINKDEF linkdef1 ...
204# OPTIONS opt1...)
205
206# *********************************
207# ********** Observatory **********
208# *********************************
209
210SET(OBSERVATORY "ORM" CACHE STRING "Select the observatory location (ORM, HAWC, SPM, RWTH: see nova.h)")
211
212IF(NOT OBSERVATORY STREQUAL "ORM" AND
213 NOT OBSERVATORY STREQUAL "HAWC" AND
214 NOT OBSERVATORY STREQUAL "SPM" AND
215 NOT OBSERVATORY STREQUAL "RWTH")
216 MESSAGE(FATAL_ERROR "OBSERVATORY=${OBSERVATORY} invalid. Only ORM, HAWC, SPM and RWTH allowd!")
217ENDIF()
218
219FIND_PACKAGE_MESSAGE(PresetObservatory "Preset Observatory: ${OBSERVATORY}" "[${OBSERVATORY}]")
220
221
222# *********************************
223# *********** Compiler ************
224# *********************************
225
226SET(CMAKE_CXX_STANDARD 11)
227SET(CMAKE_CXX_FLAGS
228 "${CMAKE_CXX_FLAGS} -Wall -Winit-self -Wpointer-arith \
229 -Wcast-align -Wformat -Woverloaded-virtual \
230 -Wnon-virtual-dtor -Wshadow -fPIC") # -Wextra
231
232# /opt/root-6.18.04-bin/include/Bytes.h:72:6: warning: cast from 'char *' to 'UShort_t *'
233# (aka 'unsigned short *') increases required alignment from 1 to 2 [-Wcast-align]
234# *((UShort_t *)buf) = Rbswap_16(x);
235# ^~~~~~~~~~~~~~~
236
237IF(ROOT_VERSION VERSION_GREATER_EQUAL 6.18 AND ROOT_VERSION VERSION_LESS 6.19)
238 SET(CMAKE_CXX_FLAGS
239 "${CMAKE_CXX_FLAGS} -Wno-cast-align")
240ENDIF()
241
242SET(CMAKE_CXX_FLAGS
243 "${CMAKE_CXX_FLAGS} \
244 -DMARSVER=\\\"1.0\\\" -D_REENTRANT -D__MARS__ -D__LINUX__ \
245 -DPACKAGE_VERSION=\\\"1.0\\\" -DREVISION=\\\"1.0\\\" \
246 -DPACKAGE_NAME=\\\"MARS\\\" -DHAVE_ZLIB")
247
248CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/root.rc.in" "${PROJECT_BINARY_DIR}/.rootrc")
249CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/rootlogon.C.in" "${PROJECT_BINARY_DIR}/rootlogon.C")
250CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/dohtml.C.in" "${PROJECT_BINARY_DIR}/dohtml.C")
251
252# -------------------------------------------------------
253
254FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/dictionary)
255
256MACRO(SRCFILES subdir)
257
258 MESSAGE(STATUS "Reading source list from ${DIR}/Makefile")
259
260 EXECUTE_PROCESS(COMMAND
261 ${PROJECT_SOURCE_DIR}/Makefile.extract.sh ${subdir}
262 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${subdir}
263 OUTPUT_VARIABLE _HEADERS)
264
265 SEPARATE_ARGUMENTS(_HEADERS)
266
267 LIST(GET _HEADERS 0 _CINT)
268 LIST(REMOVE_AT _HEADERS 0)
269
270 SET(_SRCLIST ${_HEADERS})
271
272 STRING(REPLACE "${subdir}/" " " _HEADERS ${_HEADERS}) # Remove directory
273 STRING(REPLACE ".cc" ".h" _HEADERS ${_HEADERS}) # change extension
274 STRING(REPLACE ".cxx" ".hxx" _HEADERS ${_HEADERS}) # special for files in mmc
275
276 SEPARATE_ARGUMENTS(_HEADERS)
277
278 # - This adds the rule how the dictionary is created
279 ROOT_GENERATE_DICTIONARY(dictionary/${_CINT} ${_HEADERS} ${_CINT}Incl.h LINKDEF ${subdir}/${_CINT}LinkDef.h OPTIONS -p -D__MARS__ -DHAVE_ZLIB)
280 # - This makes sure that it is compiled
281 TARGET_SOURCES(mars PRIVATE dictionary/${_CINT}.cxx ${_SRCLIST})
282 SET_SOURCE_FILES_PROPERTIES(dictionary/${_CINT}.cxx PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
283
284 INSTALL(DIRECTORY ${subdir}/ DESTINATION "include" FILES_MATCHING PATTERN "*.h")
285
286 # This is a hack if somebody tries to run root from
287 # the compile directory rather than from a package
288 # install directory. In this case, the pcm files
289 # are not where the library is where they should be
290 IF(TARGET ${_CINT})
291 ADD_CUSTOM_COMMAND(TARGET ${_CINT} POST_BUILD
292 COMMAND test -f ../dictionary/${CINT}_rdict.pcm && ln -s ../dictionary/${_CINT}_rdict.pcm ${_CINT}_rdict.pcm || true
293 WORKING_DIRECTORY lib
294 VERBATIM)
295 ENDIF()
296
297ENDMACRO()
298
299# -------------------------------------------------------
300
301#SET(DIRECTORIES mmc)
302
303SET(DIRECTORIES
304 manalysis
305 mastro
306 mbadpixels
307 mbase
308 mcalib
309 mcamera
310 mcorsika
311 mdata
312 mdrs
313 melectronics
314 mextralgo
315 mfbase
316 mfileio
317 mfilter
318 mgeom
319 mgui
320 mhbase
321 mhcalib
322 mhflux
323 mhft
324 mhist
325 mhvstime
326 mimage
327 mjobs
328 mjoptim
329 mjtrain
330 mmain
331 mmc
332 mmovie
333 mmuon
334 mpedestal
335 mpointing
336 mranforest
337 mraw
338 mreport
339 msignal
340 msim
341 msimcamera
342 msimreflector
343 msql
344 mtools
345 mtrigger
346)
347
348INCLUDE_DIRECTORIES(${DIRECTORIES} mcore .)
349
350ROOT_GENERATE_DICTIONARY(dictionary/Core
351 mcore/factofits.h
352 mcore/factfits.h
353 mcore/DrsCalib.h
354 mcore/PixelMap.h
355 mcore/Interpolator2D.h
356 mcore/nova.h
357 mcore/Prediction.h
358 MIncl.h
359 LINKDEF MLinkDef.h
360 OPTIONS -p -D__MARS__ -DHAVE_ZLIB)
361
362ADD_LIBRARY(mars SHARED dictionary/Core.cxx) # CMAKE_POSITION_INDEPENDENT_CODE
363SET_SOURCE_FILES_PROPERTIES(dictionary/Core.cxx PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
364
365# This is a hack if somebody tries to run root from
366# the compile directory rather than from a package
367# install directory. In this case, the pcm files
368# are not where the library is where they should be
369IF(TARGET Core)
370 ADD_CUSTOM_COMMAND(TARGET Core POST_BUILD
371 COMMAND test -f ../dictionary/Core_rdict.pcm && ln -s ../dictionary/Core_rdict.pcm Core_rdict.pcm || true
372 WORKING_DIRECTORY lib
373 VERBATIM)
374ENDIF()
375
376
377TARGET_LINK_LIBRARIES(mars
378 ZLIB::ZLIB
379 ${NOVA_LIBRARY}
380 ${ROOT_LIBRARIES})
381
382ADD_EXECUTABLE(showplot showplot.cc)
383ADD_EXECUTABLE(showlog showplot.cc)
384ADD_EXECUTABLE(ceres ceres.cc)
385TARGET_LINK_LIBRARIES(showplot mars ${ROOT_LIBRARIES})
386TARGET_LINK_LIBRARIES(showlog mars ${ROOT_LIBRARIES})
387TARGET_LINK_LIBRARIES(ceres mars ${ROOT_LIBRARIES})
388
389
390FOREACH(DIR ${DIRECTORIES})
391 SRCFILES(${DIR})
392ENDFOREACH()
393
394# -------------------------------------------------------
395
396IF(FOUND_HEALPIX)
397 # https://github.com/akira-okumura/RootHealPix.git
398 # THealPixD de("name", "", 2); for (int i=0; i<100; i++) de.Fill(gRandom->Uniform()*90, gRandom->Uniform()*180); de.Draw("COLZ");
399
400 # INCLUDE_DIRECTORIES(${HEALPIX_PREFIX}/include)
401 # - The first one is required to make ROOT_GENERATE_DICTIONARY
402 # find absolute paths. The second one is required for
403 # compilation. Note that any later ROOT_GENERALE_DICTIONARY
404 # might find the LinkDef.h in RootHealPix/include
405 INCLUDE_DIRECTORIES(/ ${HEALPIX_PREFIX}/include)
406
407 ROOT_GENERATE_DICTIONARY(dictionary/HealPix
408 ${HEALPIX_PREFIX}/include/Healoption.h
409 ${HEALPIX_PREFIX}/include/THealAlm.h
410 ${HEALPIX_PREFIX}/include/THealFFT.h
411 ${HEALPIX_PREFIX}/include/THealPainter.h
412 ${HEALPIX_PREFIX}/include/THealPaletteAxis.h
413 ${HEALPIX_PREFIX}/include/THealPixCube.h
414 ${HEALPIX_PREFIX}/include/THealPix.h
415 ${HEALPIX_PREFIX}/include/THealUtil.h
416 ${HEALPIX_PREFIX}/include/TVirtualHealPainter.h
417 LINKDEF ${HEALPIX_PREFIX}/include/LinkDef.h OPTIONS -p)
418
419 # - Define the source files of the library
420 ADD_LIBRARY(RootHealPix SHARED dictionary/HealPix.cxx
421 ${HEALPIX_PREFIX}/src/THealAlm.cxx
422 ${HEALPIX_PREFIX}/src/THealFFT.cxx
423 ${HEALPIX_PREFIX}/src/THealPainter.cxx
424 ${HEALPIX_PREFIX}/src/THealPaletteAxis.cxx
425 ${HEALPIX_PREFIX}/src/THealPixCube.cxx
426 ${HEALPIX_PREFIX}/src/THealPix.cxx
427 ${HEALPIX_PREFIX}/src/THealUtil.cxx
428 ${HEALPIX_PREFIX}/src/TVirtualHealPainter.cxx)
429
430 # - Tweak some warnings
431 SET_TARGET_PROPERTIES(RootHealPix PROPERTIES COMPILE_FLAGS
432 "-Wno-unused-variable -Wno-unused-function -Wno-unneeded-internal-declaration -Wno-shadow")
433
434 # - Link with the root libraries for auto-loading
435 TARGET_LINK_LIBRARIES(mars RootHealPix)
436
437 # - Install the corresponding header files
438 INSTALL(DIRECTORY ${HEALPIX_PREFIX}/include/ DESTINATION "include" FILES_MATCHING PATTERN "*.h")
439
440 # - Install the library
441 INSTALL(TARGETS RootHealPix DESTINATION ".")
442ENDIF()
443
444
445# rootlogon.C finds the shared object only if the libmars.so is in the same directory than the dictionary files
446# there is a way to create a map file with rootcling - but I haven#t yet fugured out how. Note that a link is not enough
447#ADD_CUSTOM_COMMAND(TARGET mars POST_BUILD
448# COMMAND cp -f ${PROJECT_BINARY_DIR}/libmars.so ${PROJECT_BINARY_DIR}/dictionary/libmars.so
449# COMMENT "Copying libmars.so to ${PROJECT_BINARY_DIR}/dictionary")
450
451#---Create a shared library with geneated dictionary
452#ADD_LIBRARY(Event SHARED Event.cxx G__Event.cxx)
453#TARGET_LINK_LIBRARIES(Event ${ROOT_LIBRARIES})
454
455#---Create a main program using the library
456#ADD_EXECUTABLE(Main MainEvent.cxx)
457#TARGET_LINK_LIBRARIES(Main Event)
458
459
460# *********************************
461# ************ Packaging **********
462# *********************************
463
464#SET(PKG_SHARE "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}")
465#SET(PKG_APPS "${CMAKE_INSTALL_DATAROOTDIR}/applications")
466#SET(PKG_PIXMAPS "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps")
467
468# ====== Installation targets =====
469
470#INSTALL(TARGETS mars DESTINATION "${CMAKE_INSTALL_BINDIR}")
471INSTALL(TARGETS mars DESTINATION ".")
472INSTALL(TARGETS showplot DESTINATION ".")
473INSTALL(TARGETS showlog DESTINATION ".")
474INSTALL(TARGETS ceres DESTINATION ".")
475INSTALL(FILES .rootrc DESTINATION ".")
476INSTALL(DIRECTORY lib DESTINATION ".")
477INSTALL(DIRECTORY macros DESTINATION "." FILES_MATCHING PATTERN "*.C")
478INSTALL(DIRECTORY fact DESTINATION "." FILES_MATCHING PATTERN "*.C")
479INSTALL(DIRECTORY datacenter DESTINATION ".")
480INSTALL(DIRECTORY scripts DESTINATION ".")
481INSTALL(DIRECTORY resources DESTINATION "." FILES_MATCHING PATTERN "*.rc" PATTERN "*.txt")
482INSTALL(DIRECTORY resmc DESTINATION "." FILES_MATCHING PATTERN "*" )
483INSTALL(DIRECTORY mcore/ DESTINATION "include" FILES_MATCHING PATTERN "*.h")
484
485
486# ======== General packaging ======
487# https://cmake.org/cmake/help/latest/module/CPack.html
488
489INCLUDE(InstallRequiredSystemLibraries)
490
491# SET(CPACK_STRIP_FILES ON) # Strip debug sysmbold from files
492
493SET(CPACK_PACKAGE_VERSION "${mars_VERSION}")
494SET(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
495SET(CPACK_PACKAGE_MAINTAINER "${PACKAGE_MAINTAINER}")
496#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
497#SET(CPACK_PACKAGE_VENDOR "Me, myself, and I")
498
499
500SET(CPACK_SOURCE_IGNORE_FILES "/old/;/build/;/[.].*/;/autom4te[.]cache/;.*~;.log$")
501
502# Maybe the text displayed in synaptic?
503#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
504SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MARS - Environment")
505#CPACK_RESOURCE_FILE_README ReadMe file to be embedded in the installer.
506
507SET(CPACK_GENERATOR TBZ2) # TGZ DEB
508#SET(CPACK_SOURCE_GENERATOR TBZ2) # TGZ
509#SET(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/cmake/Package.txt)
510#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
511
512
513# ======== Debian packaging =======
514# https://cmake.org/cmake/help/latest/module/CPackDeb.html
515# https://www.debian.org/doc/debian-policy
516
517#SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libao4 (>=1.0), libsfm-system2.3v5 (>=2.3), libsfml-graphicsv2.3v5 (>=2.3), libsfml-audio2.3v5 (>=2.3), libsfm-window2.3v5 (>2.3)")
518SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS 1) # generate better (atomatic?) dependecies
519SET(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
520SET(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
521SET(CPACK_DEBIAN_PACKAGE_SECTION utils)
522SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${PACKAGE_URL}")
523SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION
524"${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
525 This package contains the MARS Analysis Environment.")
526#indent the long description with spaces
527
528#CPACK_INSTALL_CMAKE_PROJECTS
529#List of four values that specify what project to install. Build directory, Project Name, Project Component, Directory.
530
531INCLUDE(CPack)
Note: See TracBrowser for help on using the repository browser.