source: trunk/Mars/CMakeLists.txt@ 19950

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