source: trunk/Mars/CMakeLists.txt@ 20001

Last change on this file since 20001 was 19990, checked in by tbretz, 4 years ago
Option -p is deprecated in newer root versions but required in older versions. The no-cast-align is still required in 6.23 to suppress stupid warnings introduced by root.
File size: 20.5 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(DEFINED 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 FILE(REMOVE root)
197 ENDIF()
198
199 SET(ROOTSYS $ENV{ROOTSYS} CACHE INTERNAL "Internal variable to check for consistency in ROOTSYS")
200
201 # For convenience and easy tracking
202 ADD_CUSTOM_COMMAND(OUTPUT thisroot.sh COMMAND ln -sf ${ROOTSYS}/bin/thisroot.sh VERBATIM)
203 ADD_CUSTOM_COMMAND(OUTPUT root COMMAND ln -sf ${ROOTSYS}/bin/root VERBATIM)
204 ADD_CUSTOM_TARGET(thisroot ALL DEPENDS thisroot.sh)
205 ADD_CUSTOM_TARGET(lnroot ALL DEPENDS root)
206ENDIF()
207
208IF(ROOTVER AND NOT ROOTVER VERSION_EQUAL ROOT_VERSION)
209 MESSAGE(WARNING
210 " \n"
211 " ROOT Version changed!\n"
212 " Present: ${ROOT_VERSION}\n"
213 " Previous: ${ROOTVER}")
214ENDIF()
215
216SET(ROOTVER ${ROOT_VERSION} CACHE INTERNAL "Internal variable to check for consistency of root version")
217
218IF(ROOT_VERSION VERSION_LESS 6.20)
219 SET(ROOT_DICTIONARY_OPTION -p)
220ENDIF()
221
222
223
224# -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree
225# -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread
226# -lASImage -lMinuit -lHistPainter -lThread
227
228#MESSAGE("INCL_DIRS: ${ROOT_INCLUDE_DIRS}")
229#MESSAGE("LIBS: ${ROOT_LIBRARIES}")
230#MESSAGE("DEFS: ${ROOT_DEFINITIONS}")
231#MESSAGE("CXXFLAGS: ${ROOT_CXX_FLAGS}")
232#MESSAGE("CXFLAGS: ${ROOT_CC_FLAGS}")
233#MESSAGE("FOUND: ${ROOT_FOUND}")
234#MESSAGE("FILE: ${ROOT_USE_FILE}")
235#MESSAGE("DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
236#ROOT_<library>_LIBRARY PATH Full path for each of the ROOT libraries listed in COMPONENTS
237#ROOT_<command>_CMD PATH Full path for each ROOT executable (rootcling, root, hadd, etc.)
238#ROOT_<option>_FOUND BOOL True for each enabled build option (e.g. cocoa, python, xrootd, etc.)
239
240# function ROOT_GENERATE_DICTIONARY( dictionary
241# header1 header2 ...
242# LINKDEF linkdef1 ...
243# OPTIONS opt1...)
244
245# *********************************
246# ********** Observatory **********
247# *********************************
248
249SET(OBSERVATORY "ORM" CACHE STRING "Select the observatory location (ORM, HAWC, SPM, RWTH: see nova.h)")
250
251IF(NOT OBSERVATORY STREQUAL "ORM" AND
252 NOT OBSERVATORY STREQUAL "HAWC" AND
253 NOT OBSERVATORY STREQUAL "SPM" AND
254 NOT OBSERVATORY STREQUAL "RWTH")
255 MESSAGE(FATAL_ERROR "OBSERVATORY=${OBSERVATORY} invalid. Only ORM, HAWC, SPM and RWTH allowd!")
256ENDIF()
257
258FIND_PACKAGE_MESSAGE(PresetObservatory "Preset Observatory: ${OBSERVATORY}" "[${OBSERVATORY}]")
259
260
261# *********************************
262# *********** Compiler ************
263# *********************************
264
265SET(CMAKE_CXX_STANDARD 11)
266SET(CMAKE_CXX_FLAGS
267 "${CMAKE_CXX_FLAGS} -Wall -Winit-self -Wpointer-arith \
268 -Wcast-align -Wformat -Woverloaded-virtual \
269 -Wnon-virtual-dtor -Wshadow -fPIC") # -Wextra
270
271# /opt/root-6.18.04-bin/include/Bytes.h:72:6: warning: cast from 'char *' to 'UShort_t *'
272# (aka 'unsigned short *') increases required alignment from 1 to 2 [-Wcast-align]
273# *((UShort_t *)buf) = Rbswap_16(x);
274# ^~~~~~~~~~~~~~~
275
276IF(NOT ROOT_VERSION VERSION_LESS 6.18 AND ROOT_VERSION VERSION_LESS 6.23)
277 SET(CMAKE_CXX_FLAGS
278 "${CMAKE_CXX_FLAGS} -Wno-cast-align")
279ENDIF()
280
281SET(CMAKE_CXX_FLAGS
282 "${CMAKE_CXX_FLAGS} \
283 -DMARSVER=\\\"1.0\\\" -D_REENTRANT -D__MARS__ -D__LINUX__ \
284 -DPACKAGE_VERSION=\\\"1.0\\\" -DREVISION=\\\"1.0\\\" \
285 -DPACKAGE_NAME=\\\"MARS\\\" -DHAVE_ZLIB")
286
287CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/root.rc.in" "${PROJECT_BINARY_DIR}/.rootrc")
288CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/rootlogon.C.in" "${PROJECT_BINARY_DIR}/rootlogon.C")
289CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/dohtml.C.in" "${PROJECT_BINARY_DIR}/dohtml.C")
290
291# -------------------------------------------------------
292
293FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/dictionary)
294
295MACRO(SRCFILES subdir)
296
297 MESSAGE(STATUS "Reading source list from ${DIR}/Makefile")
298
299 EXECUTE_PROCESS(COMMAND
300 ${PROJECT_SOURCE_DIR}/Makefile.extract.sh ${subdir}
301 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${subdir}
302 OUTPUT_VARIABLE _HEADERS)
303
304 SEPARATE_ARGUMENTS(_HEADERS)
305
306 LIST(GET _HEADERS 0 _CINT)
307 LIST(REMOVE_AT _HEADERS 0)
308
309 SET(_SRCLIST ${_HEADERS})
310
311 STRING(REPLACE "${subdir}/" " " _HEADERS ${_HEADERS}) # Remove directory
312 STRING(REPLACE ".cc" ".h" _HEADERS ${_HEADERS}) # change extension
313 STRING(REPLACE ".cxx" ".hxx" _HEADERS ${_HEADERS}) # special for files in mmc
314
315 SEPARATE_ARGUMENTS(_HEADERS)
316
317 # - This adds the rule how the dictionary is created
318 ROOT_GENERATE_DICTIONARY(dictionary/${_CINT} ${_HEADERS} ${_CINT}Incl.h LINKDEF ${subdir}/${_CINT}LinkDef.h OPTIONS ${ROOT_DICTIONARY_OPTION} -D__MARS__ -DHAVE_ZLIB)
319 # - This makes sure that it is compiled
320 TARGET_SOURCES(mars PRIVATE dictionary/${_CINT}.cxx ${_SRCLIST})
321 SET_SOURCE_FILES_PROPERTIES(dictionary/${_CINT}.cxx PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
322
323 INSTALL(DIRECTORY ${subdir}/ DESTINATION "include" FILES_MATCHING PATTERN "*.h")
324
325 # This is a hack if somebody tries to run root from
326 # the compile directory rather than from a package
327 # install directory. In this case, the pcm files
328 # are not where the library is where they should be
329 IF(TARGET ${_CINT})
330 ADD_CUSTOM_COMMAND(TARGET ${_CINT} POST_BUILD
331 COMMAND test -f ../dictionary/${CINT}_rdict.pcm && ln -s ../dictionary/${_CINT}_rdict.pcm ${_CINT}_rdict.pcm || true
332 WORKING_DIRECTORY lib
333 VERBATIM)
334 ENDIF()
335
336ENDMACRO()
337
338# -------------------------------------------------------
339
340#SET(DIRECTORIES mmc)
341
342SET(DIRECTORIES
343 manalysis
344 mastro
345 mbadpixels
346 mbase
347 mcalib
348 mcamera
349 mcorsika
350 mdata
351 mdrs
352 melectronics
353 mextralgo
354 mfbase
355 mfileio
356 mfilter
357 mgeom
358 mgui
359 mhbase
360 mhcalib
361 mhflux
362 mhft
363 mhist
364 mhvstime
365 mimage
366 mjobs
367 mjoptim
368 mjtrain
369 mmain
370 mmc
371 mmovie
372 mmuon
373 mpedestal
374 mpointing
375 mranforest
376 mraw
377 mreport
378 msignal
379 msim
380 msimcamera
381 msimreflector
382 msql
383 mtools
384 mtrigger
385)
386
387INCLUDE_DIRECTORIES(${DIRECTORIES} mcore .)
388
389ROOT_GENERATE_DICTIONARY(dictionary/Core
390 mcore/factofits.h
391 mcore/factfits.h
392 mcore/DrsCalib.h
393 mcore/PixelMap.h
394 mcore/Interpolator2D.h
395 mcore/nova.h
396 mcore/Prediction.h
397 MIncl.h
398 LINKDEF MLinkDef.h
399 OPTIONS -p -D__MARS__ -DHAVE_ZLIB)
400
401ADD_LIBRARY(mars SHARED dictionary/Core.cxx) # CMAKE_POSITION_INDEPENDENT_CODE
402SET_SOURCE_FILES_PROPERTIES(dictionary/Core.cxx PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
403
404# This is a hack if somebody tries to run root from
405# the compile directory rather than from a package
406# install directory. In this case, the pcm files
407# are not where the library is where they should be
408IF(TARGET Core)
409 ADD_CUSTOM_COMMAND(TARGET Core POST_BUILD
410 COMMAND test -f ../dictionary/Core_rdict.pcm && ln -s ../dictionary/Core_rdict.pcm Core_rdict.pcm || true
411 WORKING_DIRECTORY lib
412 VERBATIM)
413ENDIF()
414
415
416TARGET_LINK_LIBRARIES(mars
417 ZLIB::ZLIB
418 ${NOVA_LIBRARY}
419 ${ROOT_LIBRARIES})
420
421ADD_EXECUTABLE(showplot showplot.cc)
422ADD_EXECUTABLE(showlog showplot.cc)
423ADD_EXECUTABLE(ceres ceres.cc)
424TARGET_LINK_LIBRARIES(showplot mars ${ROOT_LIBRARIES})
425TARGET_LINK_LIBRARIES(showlog mars ${ROOT_LIBRARIES})
426TARGET_LINK_LIBRARIES(ceres mars ${ROOT_LIBRARIES})
427
428
429FOREACH(DIR ${DIRECTORIES})
430 SRCFILES(${DIR})
431ENDFOREACH()
432
433# -------------------------------------------------------
434
435IF(FOUND_HEALPIX)
436 # https://github.com/akira-okumura/RootHealPix.git
437 # THealPixD de("name", "", 2); for (int i=0; i<100; i++) de.Fill(gRandom->Uniform()*90, gRandom->Uniform()*180); de.Draw("COLZ");
438
439 # INCLUDE_DIRECTORIES(${HEALPIX_PREFIX}/include)
440 # - The first one is required to make ROOT_GENERATE_DICTIONARY
441 # find absolute paths. The second one is required for
442 # compilation. Note that any later ROOT_GENERALE_DICTIONARY
443 # might find the LinkDef.h in RootHealPix/include
444 INCLUDE_DIRECTORIES(/ ${HEALPIX_PREFIX}/include)
445
446 ROOT_GENERATE_DICTIONARY(dictionary/HealPix
447 ${HEALPIX_PREFIX}/include/Healoption.h
448 ${HEALPIX_PREFIX}/include/THealAlm.h
449 ${HEALPIX_PREFIX}/include/THealFFT.h
450 ${HEALPIX_PREFIX}/include/THealPainter.h
451 ${HEALPIX_PREFIX}/include/THealPaletteAxis.h
452 ${HEALPIX_PREFIX}/include/THealPixCube.h
453 ${HEALPIX_PREFIX}/include/THealPix.h
454 ${HEALPIX_PREFIX}/include/THealUtil.h
455 ${HEALPIX_PREFIX}/include/TVirtualHealPainter.h
456 LINKDEF ${HEALPIX_PREFIX}/include/LinkDef.h OPTIONS -p)
457
458 # - Define the source files of the library
459 ADD_LIBRARY(RootHealPix SHARED dictionary/HealPix.cxx
460 ${HEALPIX_PREFIX}/src/THealAlm.cxx
461 ${HEALPIX_PREFIX}/src/THealFFT.cxx
462 ${HEALPIX_PREFIX}/src/THealPainter.cxx
463 ${HEALPIX_PREFIX}/src/THealPaletteAxis.cxx
464 ${HEALPIX_PREFIX}/src/THealPixCube.cxx
465 ${HEALPIX_PREFIX}/src/THealPix.cxx
466 ${HEALPIX_PREFIX}/src/THealUtil.cxx
467 ${HEALPIX_PREFIX}/src/TVirtualHealPainter.cxx)
468
469 # - Tweak some warnings
470 SET_TARGET_PROPERTIES(RootHealPix PROPERTIES COMPILE_FLAGS
471 "-Wno-unused-variable -Wno-unused-function -Wno-unneeded-internal-declaration -Wno-shadow")
472
473 # - Link with the root libraries for auto-loading
474 TARGET_LINK_LIBRARIES(mars RootHealPix)
475
476 # - Install the corresponding header files
477 INSTALL(DIRECTORY ${HEALPIX_PREFIX}/include/ DESTINATION "include" FILES_MATCHING PATTERN "*.h")
478
479 # - Install the library
480 INSTALL(TARGETS RootHealPix DESTINATION ".")
481ENDIF()
482
483
484# rootlogon.C finds the shared object only if the libmars.so is in the same directory than the dictionary files
485# 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
486#ADD_CUSTOM_COMMAND(TARGET mars POST_BUILD
487# COMMAND cp -f ${PROJECT_BINARY_DIR}/libmars.so ${PROJECT_BINARY_DIR}/dictionary/libmars.so
488# COMMENT "Copying libmars.so to ${PROJECT_BINARY_DIR}/dictionary")
489
490#---Create a shared library with geneated dictionary
491#ADD_LIBRARY(Event SHARED Event.cxx G__Event.cxx)
492#TARGET_LINK_LIBRARIES(Event ${ROOT_LIBRARIES})
493
494#---Create a main program using the library
495#ADD_EXECUTABLE(Main MainEvent.cxx)
496#TARGET_LINK_LIBRARIES(Main Event)
497
498
499# *********************************
500# ************ Packaging **********
501# *********************************
502
503#SET(PKG_SHARE "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}")
504#SET(PKG_APPS "${CMAKE_INSTALL_DATAROOTDIR}/applications")
505#SET(PKG_PIXMAPS "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps")
506
507# ====== Installation targets =====
508
509#INSTALL(TARGETS mars DESTINATION "${CMAKE_INSTALL_BINDIR}")
510INSTALL(TARGETS mars DESTINATION ".")
511INSTALL(TARGETS showplot DESTINATION ".")
512INSTALL(TARGETS showlog DESTINATION ".")
513INSTALL(TARGETS ceres DESTINATION ".")
514INSTALL(FILES .rootrc DESTINATION ".")
515INSTALL(DIRECTORY lib DESTINATION ".")
516INSTALL(DIRECTORY macros DESTINATION "." FILES_MATCHING PATTERN "*.C")
517INSTALL(DIRECTORY fact DESTINATION "." FILES_MATCHING PATTERN "*.C")
518INSTALL(DIRECTORY datacenter DESTINATION ".")
519INSTALL(DIRECTORY scripts DESTINATION ".")
520INSTALL(DIRECTORY resources DESTINATION "." FILES_MATCHING PATTERN "*.rc" PATTERN "*.txt")
521INSTALL(DIRECTORY resmc DESTINATION "." FILES_MATCHING PATTERN "*" )
522INSTALL(DIRECTORY mcore/ DESTINATION "include" FILES_MATCHING PATTERN "*.h")
523
524
525# ======== General packaging ======
526# https://cmake.org/cmake/help/latest/module/CPack.html
527
528INCLUDE(InstallRequiredSystemLibraries)
529
530# SET(CPACK_STRIP_FILES ON) # Strip debug sysmbold from files
531
532SET(CPACK_PACKAGE_VERSION "${mars_VERSION}")
533SET(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
534SET(CPACK_PACKAGE_MAINTAINER "${PACKAGE_MAINTAINER}")
535#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
536#SET(CPACK_PACKAGE_VENDOR "Me, myself, and I")
537
538
539SET(CPACK_SOURCE_IGNORE_FILES "/old/;/build/;/[.].*/;/autom4te[.]cache/;.*~;.log$")
540
541# Maybe the text displayed in synaptic?
542#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
543SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MARS - Environment")
544#CPACK_RESOURCE_FILE_README ReadMe file to be embedded in the installer.
545
546SET(CPACK_GENERATOR TBZ2) # TGZ DEB
547#SET(CPACK_SOURCE_GENERATOR TBZ2) # TGZ
548#SET(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/cmake/Package.txt)
549#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
550
551
552# ======== Debian packaging =======
553# https://cmake.org/cmake/help/latest/module/CPackDeb.html
554# https://www.debian.org/doc/debian-policy
555
556#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)")
557SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS 1) # generate better (atomatic?) dependecies
558SET(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
559SET(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
560SET(CPACK_DEBIAN_PACKAGE_SECTION utils)
561SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${PACKAGE_URL}")
562SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION
563"${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
564 This package contains the MARS Analysis Environment.")
565#indent the long description with spaces
566
567#CPACK_INSTALL_CMAKE_PROJECTS
568#List of four values that specify what project to install. Build directory, Project Name, Project Component, Directory.
569
570INCLUDE(CPack)
Note: See TracBrowser for help on using the repository browser.