source: trunk/Mars/CMakeLists.txt@ 19844

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