source: trunk/Mars/CMakeLists.txt@ 19775

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