1 | # *********************************
|
---|
2 | # ************ cmake **************
|
---|
3 | # *********************************
|
---|
4 | CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR)
|
---|
5 | CMAKE_POLICY(SET CMP0043 NEW)
|
---|
6 | CMAKE_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
|
---|
12 | SET(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
|
---|
19 | IF(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")
|
---|
21 | ENDIF()
|
---|
22 | IF(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")
|
---|
24 | ENDIF()
|
---|
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 |
|
---|
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 | IF ("${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()
|
---|
51 | ELSEIF ("${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()
|
---|
57 | ELSE()
|
---|
58 | MESSAGE(WARNING "You are using an unsupported compiler! Compilation has only been tested only with clang/clang++ and gcc/g++.")
|
---|
59 | ENDIF()
|
---|
60 |
|
---|
61 | # ======== For config.h.in =========
|
---|
62 | SET(PACKAGE_MAINTAINER "Thomas Bretz")
|
---|
63 | SET(PACKAGE_BUGREPORT "tbretz@physik.rwth-aachen.de")
|
---|
64 | SET(PACKAGE_URL "https://www.fact-project.org")
|
---|
65 |
|
---|
66 | FIND_PROGRAM(LSB_RELEASE_EXE NAMES lsb_release)
|
---|
67 | IF (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})
|
---|
70 | ENDIF()
|
---|
71 |
|
---|
72 | # *********************************
|
---|
73 | # ********* Requirements **********
|
---|
74 | # *********************************
|
---|
75 |
|
---|
76 | # Inlclude the main source AND build dir itself
|
---|
77 | #SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
---|
78 | SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
---|
79 |
|
---|
80 | # =========== help2man ============
|
---|
81 | FIND_PROGRAM(HELP2MAN_EXECUTABLE help2man)
|
---|
82 |
|
---|
83 | # =========== pkg-config ============
|
---|
84 | FIND_PACKAGE(PkgConfig)
|
---|
85 | FIND_PACKAGE(PackageHandleStandardArgs)
|
---|
86 |
|
---|
87 |
|
---|
88 | # ============= libnova ==============
|
---|
89 |
|
---|
90 | PKG_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
|
---|
94 | FIND_PATH(NOVA_INCLUDE_DIR NAMES libnova/libnova.h PATHS ${NOVA_INCLUDE_DIRS})
|
---|
95 | FIND_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
|
---|
99 | FIND_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
|
---|
102 | MARK_AS_ADVANCED(NOVA_LIBRARY NOVA_INCLUDE_DIR)
|
---|
103 |
|
---|
104 | # handle success
|
---|
105 | FIND_PACKAGE_MESSAGE(NovaInc "Found Nova headers in ${NOVA_INCLUDE_DIR}" "[${NOVA_LIBRARY}][${NOVA_INCLUDE_DIR}]")
|
---|
106 |
|
---|
107 |
|
---|
108 | # ============== libz ================
|
---|
109 |
|
---|
110 | FIND_PACKAGE(ZLIB REQUIRED)
|
---|
111 |
|
---|
112 | # *********************************
|
---|
113 | # ********** HEAL Pix **********
|
---|
114 | # *********************************
|
---|
115 |
|
---|
116 | SET(HEALPIX_PREFIX "${CMAKE_SOURCE_DIR}/RootHealPix" CACHE FILEPATH "Base path to the RootHealPix code.")
|
---|
117 |
|
---|
118 | IF(EXISTS ${HEALPIX_PREFIX})
|
---|
119 | FIND_PACKAGE_MESSAGE(HealPixPrefix "RootHealPix prefix: ${HEALPIX_PREFIX}" "[${HEALPIX_PREFIX}]")
|
---|
120 | SET(FOUND_HEALPIX ON)
|
---|
121 | ENDIF()
|
---|
122 |
|
---|
123 | # ============== ROOT ================
|
---|
124 |
|
---|
125 | FIND_PROGRAM(ROOTCONFIG_EXECUTABLE NAMES root-config)
|
---|
126 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(root-config DEFAULT_MSG ROOTCONFIG_EXECUTABLE)
|
---|
127 | IF(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")
|
---|
129 | ENDIF()
|
---|
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
|
---|
134 | IF(EXISTS $ENV{ROOTSYS}/ROOTConfig.cmake)
|
---|
135 | IF(NOT DEFINED ENV{CMAKE_PREFIX_PATH})
|
---|
136 | LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
|
---|
137 | ENDIF()
|
---|
138 | ENDIF()
|
---|
139 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
|
---|
140 |
|
---|
141 | SET(ROOT_PACKAGES Gui Minuit ASImage HistPainter)
|
---|
142 | IF(FOUND_HEALPIX)
|
---|
143 | SET(ROOT_PACKAGES ${ROOT_PACKAGES} FITSIO)
|
---|
144 | ENDIF()
|
---|
145 |
|
---|
146 | #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
|
---|
147 | #SET(ROOT_CONFIG_DEBUG 1)
|
---|
148 | FIND_PACKAGE(ROOT REQUIRED COMPONENTS ${ROOT_PACKAGES})
|
---|
149 |
|
---|
150 | IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE)
|
---|
151 | FIND_PACKAGE_MESSAGE(RootFound "Found ROOT: ${ROOT_INCLUDE_DIRS}" "[${ROOT_INCLUDE_DIRS}][${ROOT_LIBRARY_DIR}][${ROOT_VERSION}]")
|
---|
152 | ENDIF()
|
---|
153 |
|
---|
154 | #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
|
---|
155 | FIND_PACKAGE_MESSAGE(RootInclude "Setup ROOT: [${ROOT_VERSION}] ${ROOT_USE_FILE}" "[${ROOT_VERSION}][${ROOT_USE_FILE}]")
|
---|
156 | IF(DEFINED ROOT_USE_FILE)
|
---|
157 | INCLUDE(${ROOT_USE_FILE})
|
---|
158 | ELSE()
|
---|
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}")
|
---|
166 | ENDIF()
|
---|
167 |
|
---|
168 | # Replace separators to make the version consistent
|
---|
169 | # (older version might use the '/')
|
---|
170 | STRING(REPLACE "/" "." ROOT_VERSION ${ROOT_VERSION})
|
---|
171 |
|
---|
172 | # This happens when root is used from its build directory
|
---|
173 | # Create the version components manually
|
---|
174 | IF(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})
|
---|
184 | ENDIF()
|
---|
185 |
|
---|
186 | # For convenience and easy tracking
|
---|
187 | ADD_CUSTOM_COMMAND(OUTPUT thisroot.sh COMMAND ln -sf $ENV{ROOTSYS}/bin/thisroot.sh VERBATIM)
|
---|
188 | ADD_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 |
|
---|
215 | SET(OBSERVATORY "ORM" CACHE STRING "Select the observatory location (ORM, HAWC, SPM, RWTH: see nova.h)")
|
---|
216 |
|
---|
217 | IF(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!")
|
---|
222 | ENDIF()
|
---|
223 |
|
---|
224 | FIND_PACKAGE_MESSAGE(PresetObservatory "Preset Observatory: ${OBSERVATORY}" "[${OBSERVATORY}]")
|
---|
225 |
|
---|
226 |
|
---|
227 | # *********************************
|
---|
228 | # *********** Compiler ************
|
---|
229 | # *********************************
|
---|
230 |
|
---|
231 | SET(CMAKE_CXX_STANDARD 11)
|
---|
232 | SET(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 |
|
---|
242 | IF(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")
|
---|
245 | ENDIF()
|
---|
246 |
|
---|
247 | SET(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 |
|
---|
253 | CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/root.rc.in" "${PROJECT_BINARY_DIR}/.rootrc")
|
---|
254 | CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/rootlogon.C.in" "${PROJECT_BINARY_DIR}/rootlogon.C")
|
---|
255 | CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/dohtml.C.in" "${PROJECT_BINARY_DIR}/dohtml.C")
|
---|
256 |
|
---|
257 | # -------------------------------------------------------
|
---|
258 |
|
---|
259 | FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/dictionary)
|
---|
260 |
|
---|
261 | MACRO(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 |
|
---|
302 | ENDMACRO()
|
---|
303 |
|
---|
304 | # -------------------------------------------------------
|
---|
305 |
|
---|
306 | #SET(DIRECTORIES mmc)
|
---|
307 |
|
---|
308 | SET(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 |
|
---|
353 | INCLUDE_DIRECTORIES(${DIRECTORIES} mcore .)
|
---|
354 |
|
---|
355 | ROOT_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 |
|
---|
367 | ADD_LIBRARY(mars SHARED dictionary/Core.cxx) # CMAKE_POSITION_INDEPENDENT_CODE
|
---|
368 | SET_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
|
---|
374 | IF(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)
|
---|
379 | ENDIF()
|
---|
380 |
|
---|
381 |
|
---|
382 | TARGET_LINK_LIBRARIES(mars
|
---|
383 | ZLIB::ZLIB
|
---|
384 | ${NOVA_LIBRARY}
|
---|
385 | ${ROOT_LIBRARIES})
|
---|
386 |
|
---|
387 | ADD_EXECUTABLE(showplot showplot.cc)
|
---|
388 | ADD_EXECUTABLE(showlog showplot.cc)
|
---|
389 | ADD_EXECUTABLE(ceres ceres.cc)
|
---|
390 | TARGET_LINK_LIBRARIES(showplot mars ${ROOT_LIBRARIES})
|
---|
391 | TARGET_LINK_LIBRARIES(showlog mars ${ROOT_LIBRARIES})
|
---|
392 | TARGET_LINK_LIBRARIES(ceres mars ${ROOT_LIBRARIES})
|
---|
393 |
|
---|
394 |
|
---|
395 | FOREACH(DIR ${DIRECTORIES})
|
---|
396 | SRCFILES(${DIR})
|
---|
397 | ENDFOREACH()
|
---|
398 |
|
---|
399 | # -------------------------------------------------------
|
---|
400 |
|
---|
401 | IF(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 ".")
|
---|
447 | ENDIF()
|
---|
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}")
|
---|
476 | INSTALL(TARGETS mars DESTINATION ".")
|
---|
477 | INSTALL(TARGETS showplot DESTINATION ".")
|
---|
478 | INSTALL(TARGETS showlog DESTINATION ".")
|
---|
479 | INSTALL(TARGETS ceres DESTINATION ".")
|
---|
480 | INSTALL(FILES .rootrc DESTINATION ".")
|
---|
481 | INSTALL(DIRECTORY lib DESTINATION ".")
|
---|
482 | INSTALL(DIRECTORY macros DESTINATION "." FILES_MATCHING PATTERN "*.C")
|
---|
483 | INSTALL(DIRECTORY fact DESTINATION "." FILES_MATCHING PATTERN "*.C")
|
---|
484 | INSTALL(DIRECTORY datacenter DESTINATION ".")
|
---|
485 | INSTALL(DIRECTORY scripts DESTINATION ".")
|
---|
486 | INSTALL(DIRECTORY resources DESTINATION "." FILES_MATCHING PATTERN "*.rc" PATTERN "*.txt")
|
---|
487 | INSTALL(DIRECTORY resmc DESTINATION "." FILES_MATCHING PATTERN "*" )
|
---|
488 | INSTALL(DIRECTORY mcore/ DESTINATION "include" FILES_MATCHING PATTERN "*.h")
|
---|
489 |
|
---|
490 |
|
---|
491 | # ======== General packaging ======
|
---|
492 | # https://cmake.org/cmake/help/latest/module/CPack.html
|
---|
493 |
|
---|
494 | INCLUDE(InstallRequiredSystemLibraries)
|
---|
495 |
|
---|
496 | # SET(CPACK_STRIP_FILES ON) # Strip debug sysmbold from files
|
---|
497 |
|
---|
498 | SET(CPACK_PACKAGE_VERSION "${mars_VERSION}")
|
---|
499 | SET(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
|
---|
500 | SET(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 |
|
---|
505 | SET(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")
|
---|
509 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MARS - Environment")
|
---|
510 | #CPACK_RESOURCE_FILE_README ReadMe file to be embedded in the installer.
|
---|
511 |
|
---|
512 | SET(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)")
|
---|
523 | SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS 1) # generate better (atomatic?) dependecies
|
---|
524 | SET(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
|
---|
525 | SET(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
|
---|
526 | SET(CPACK_DEBIAN_PACKAGE_SECTION utils)
|
---|
527 | SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${PACKAGE_URL}")
|
---|
528 | SET(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 |
|
---|
536 | INCLUDE(CPack)
|
---|