source: trunk/Mars/CMakeLists.txt@ 19799

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