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