source: trunk/Mars/CMakeLists.txt@ 19833

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