source: trunk/FACT++/CMakeLists.txt@ 20059

Last change on this file since 20059 was 20045, checked in by tbretz, 4 years ago
Set C standard, issue a message whenever it is clear what library links mysqlpp, improved finding v8.
File size: 42.6 KB
Line 
1# *********************************
2# ************ cmake **************
3# *********************************
4CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR)
5CMAKE_POLICY(SET CMP0043 NEW)
6CMAKE_POLICY(SET CMP0048 NEW)
7IF(POLICY CMP0072)
8 CMAKE_POLICY(SET CMP0072 NEW) # OpenGL vs OpenGLVND
9ENDIF()
10
11# Enable debug symbols by default
12# must be done before project() statement
13SET(CMAKE_BUILD_TYPE_INIT Release)
14# (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Debug)
15
16# Enable CLANG as default compilers, to change this use
17# cmake -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++
18# Note that if compilers are switched on the fly,
19# the cache is deleted
20IF(NOT DEFINED CMAKE_C_COMPILER)
21 FIND_PROGRAM(CMAKE_C_COMPILER NAMES $ENV{CC} clang gcc cc PATHS ENV PATH NO_DEFAULT_PATH DOC "C Compiler")
22ENDIF()
23IF(NOT DEFINED CMAKE_CXX_COMPILER)
24 FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES $ENV{CXX} clang++ g++ c++ PATHS ENV PATH NO_DEFAULT_PATH DOC "C++ Compiler")
25ENDIF()
26
27
28#SET(CMAKE_VERBOSE_MAKEFILE ON)
29
30MESSAGE(STATUS "CMake Version " ${CMAKE_VERSION})
31
32# *********************************
33# ************ Project ************
34# *********************************
35
36STRING(TIMESTAMP VERSION %y.%U.%w.%H UTC)
37
38MESSAGE(STATUS "FACT++ V${VERSION}")
39
40PROJECT(fact++ VERSION ${VERSION})
41
42INCLUDE(GNUInstallDirs)
43
44IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
45 SET(GCC_MIN 4.4.7)
46 IF (CMAKE_C_COMPILER_VERSION VERSION_LESS GCC_MIN OR
47 CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_MIN)
48 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}.")
49 ENDIF()
50ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
51 SET(CLANG_MIN 3.8)
52 IF (CMAKE_C_COMPILER_VERSION VERSION_LESS CLANG_MIN OR
53 CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_MIN)
54 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}.")
55 ENDIF()
56ELSE()
57 MESSAGE(WARNING "You are using an unsupported compiler! Compilation has only been tested only with clang/clang++ and gcc/g++.")
58ENDIF()
59
60# ===== Check for Anaconda =====
61# Anacoda installation sometimes believe that they are the master of everything
62# and change the users environment such that the build system or the executable
63# loads, for example, anconda's libz rather than the system library. This might
64# work but usually creates serious troubles either during linking or during
65# execution.
66
67STRING(REPLACE ":" ";" PATHENV "$ENV{PATH}")
68FOREACH (DIR ${PATHENV})
69 IF(LDIR MATCHES .*anaconda.*)
70 MESSAGE(WARNING "\n WARNING: Anaconda is altering your PATH environent: " ${DIR} "\n CMake, make or execution might fail, as non-system\n libraries might be mistaken for system libraries!\n Please make sure that there is no interference!")
71 BREAK()
72 ENDIF()
73ENDFOREACH()
74
75
76# ======== For config.h.in =========
77SET(PACKAGE_MAINTAINER "Thomas Bretz")
78SET(PACKAGE_BUGREPORT "tbretz@physik.rwth-aachen.de")
79SET(PACKAGE_URL "https://www.fact-project.org")
80
81FIND_PROGRAM(LSB_RELEASE_EXE NAMES lsb_release)
82IF (DEFINED LSB_RELEASE_EXE)
83 EXECUTE_PROCESS(COMMAND ${LSB_RELEASE_EXE} -d OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
84 MESSAGE(STATUS ${LSB_RELEASE})
85ENDIF()
86
87# *********************************
88# ******** FAMOUS / IceACT ********
89# *********************************
90
91#SET(OBSERVATORY "ORM" CACHE STRING "Select the observatory location (ORM, HAWC, SPM, RWTH: see nova.h)")
92
93IF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY)
94
95IF(EXISTS "${CMAKE_SOURCE_DIR}/famous")
96 MESSAGE(STATUS "Compilation of 'famous' enabled.")
97 SET(FOUND_FAMOUS ON)
98ENDIF()
99
100IF(EXISTS "${CMAKE_SOURCE_DIR}/iceact")
101 MESSAGE(STATUS "Compilation of 'iceact' enabled.")
102 SET(FOUND_ICEACT ON)
103ENDIF()
104
105ENDIF(NOT TOOLS_ONLY AND NOT VIEWER_ONLY)
106
107
108# *********************************
109# ********* Requirements **********
110# *********************************
111
112# =========== pkg-config ============
113FIND_PACKAGE(PkgConfig)
114FIND_PACKAGE(PackageHandleStandardArgs)
115
116
117# ========== executables ==========
118FIND_PROGRAM(HELP2MAN_EXECUTABLE help2man)
119FIND_PROGRAM(ROFF2HTML_EXECUTABLE roff2html)
120FIND_PROGRAM(ROFF2PDF_EXECUTABLE roff2pdf)
121FIND_PROGRAM(GROFF_EXECUTABLE groff)
122
123FIND_PACKAGE_HANDLE_STANDARD_ARGS(help2man DEFAULT_MSG HELP2MAN_EXECUTABLE)
124FIND_PACKAGE_HANDLE_STANDARD_ARGS(roff2html DEFAULT_MSG ROFF2HTML_EXECUTABLE)
125FIND_PACKAGE_HANDLE_STANDARD_ARGS(roff2pdf DEFAULT_MSG ROFF2PDF_EXECUTABLE)
126FIND_PACKAGE_HANDLE_STANDARD_ARGS(groff DEFAULT_MSG GROFF_EXECUTABLE)
127
128IF (NOT HELP2MAN_EXECUTABLE OR NOT ROFF2HTML_EXECUTABLE OR NOT ROFF2PDF_EXECUTABLE OR NOT GROFF_EXECUTABLE)
129MESSAGE(STATUS "Documentation turned off (some executables missing).")
130ENDIF()
131
132IF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY)
133
134FIND_PROGRAM(JSDOC_EXECUTABLE jsdoc)
135FIND_PROGRAM(MAILX_EXECUTABLE mailx)
136FIND_PROGRAM(CURL_EXECUTABLE curl)
137
138FIND_PACKAGE_HANDLE_STANDARD_ARGS(curl DEFAULT_MSG CURL_EXECUTABLE)
139FIND_PACKAGE_HANDLE_STANDARD_ARGS(mailx DEFAULT_MSG MAILX_EXECUTABLE)
140FIND_PACKAGE_HANDLE_STANDARD_ARGS(jsdoc DEFAULT_MSG JSDOC_EXECUTABLE)
141
142IF (curl_FOUND)
143 ADD_DEFINITIONS(-DHAVE_CURL)
144ENDIF()
145IF (mailx_FOUND)
146 ADD_DEFINITIONS(-DHAVE_MAILX)
147ENDIF()
148
149ENDIF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY)
150
151#IF(NOT SOME_COND)
152# MESSAGE(FATAL_ERROR "At least one required executable was not found")
153#ENDIF()
154
155# =========== libraries =============
156
157SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
158
159# FIXME: Need to check which package finders accept REQUIERED. For all others implement checks
160
161FIND_PACKAGE(Threads REQUIRED) # Threads::Threads
162FIND_PACKAGE(ZLIB REQUIRED) # ZLIB::ZLIB
163
164SET(CURSES_NEED_NCURSES ON)
165FIND_PACKAGE(Curses REQUIRED) # CURSES_FOUND
166# Newer boost versions use timeout which is defined in ncurses.h
167# see for example: https://stackoverflow.com/questions/55265851/getting-errors-when-trying-to-compile-program-using-boost-and-ncurses-libraries
168ADD_DEFINITIONS(-DNCURSES_NOMACROS)
169# FIXME : Require panel
170
171IF(NOT TOOLS_ONLY OR VIEWER_ONLY)
172FIND_PACKAGE(OpenGL REQUIRED) # OpenGL::GL OpenGL::GLU / OPENGL_FOUND OPENGL_GLU_FOUND
173ENDIF(NOT TOOLS_ONLY OR VIEWER_ONLY)
174
175IF(NOT TOOLS_ONLY)
176
177# FIND_PACKAGE(DBus) => skaypeclient
178# FIND_PACKAGE(Motif) => did # MOTIF_FOUND
179
180FIND_PACKAGE(Readline REQUIRED)
181FIND_PACKAGE(Panel REQUIRED)
182FIND_PACKAGE(V8 REQUIRED)
183FIND_PACKAGE(CCfits REQUIRED) # First as Cfitsio is a dependency
184FIND_PACKAGE(Cfitsio REQUIRED)
185FIND_PACKAGE(OpenSSL REQUIRED) # Required for boost::asio::ssl
186
187ENDIF(NOT TOOLS_ONLY)
188
189FIND_PACKAGE(Nova REQUIRED)
190
191FIND_PACKAGE(Highlight)
192IF (HIGHLIGHT_FOUND)
193 ADD_DEFINITIONS(-DHAVE_HIGHLIGHT)
194ENDIF()
195
196
197#INCLUDE_DIRECTORIES("/usr/include/mysql")
198# dbus-1 dbus-glib-1
199# doxygen
200
201#MESSAGE("")
202#MESSAGE(${V8_LIBRARY})
203#MESSAGE(${MYSQLPP_LIBRARY})
204#MESSAGE(${PANEL_LIBRARY})
205#MESSAGE(${CURSES_LIBRARIES})
206#MESSAGE(${CCFITS_LIBRARY})
207#MESSAGE(${CFITSIO_LIBRARY})
208#MESSAGE(${MYSQL_LIBRARY})
209#MESSAGE(${NOVA_LIBRARY})
210#MESSAGE(${READLINE_LIBRARY})
211#MESSAGE(${OPENSSL_SSL_LIBRARY})
212#MESSAGE("")
213
214# =============== MySQL ============
215
216INCLUDE(GetPrerequisites)
217
218# Deprecated since version 3.16: Use file(GET_RUNTIME_DEPENDENCIES) instead.
219
220FIND_PACKAGE(MySQL++ REQUIRED)
221
222IF(NOT DEFINED MYSQL_LIBRARY AND NOT CMAKE_VERSION VERSION_LESS 3.6)
223 GET_PREREQUISITES(${MYSQLPP_LIBRARY} MYSQL_LIBRARY 0 0 "" "")
224 LIST(FILTER MYSQL_LIBRARY INCLUDE REGEX .*mysqlclient.*)
225 IF (MYSQL_LIB1RARY)
226 FIND_PACKAGE_MESSAGE(MysqlLib "MySQL++ links to ${MYSQL_LIBRARY}" "[${MYSQL_LIBRARY}]")
227 ELSE()
228 UNSET(MYSQL_LIBRARY)
229 ENDIF()
230ELSE()
231 FIND_PACKAGE_MESSAGE(MysqlLib "MySQL++ links to ${MYSQL_LIBRARY}" "[${MYSQL_LIBRARY}]")
232ENDIF()
233
234FIND_PACKAGE(MySQL REQUIRED)
235
236INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR} ${MYSQLPP_INCLUDE_DIR})
237
238
239# =============== BOOST ============
240# 1.47.0 is the newest version available at ISDC
241FIND_PACKAGE(Boost 1.47.0 REQUIRED
242 date_time
243 filesystem
244 program_options
245 regex
246 system
247 thread)
248
249IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND Boost_VERSION LESS 106000 AND NOT NO_BOOST_HACK)
250 MESSAGE(STATUS "Setting BOOST_REGEX_NO_EXTERNAL_TEMPLATES")
251 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_REGEX_NO_EXTERNAL_TEMPLATES=1")
252ENDIF()
253
254# At least print some information for reference
255FIND_PACKAGE_HANDLE_STANDARD_ARGS(Boost FOUND_VAR Boost_FOUND REQUIRED_VARS Boost_INCLUDE_DIR Boost_LIBRARIES)
256
257# =============== Qt4/Qt5 ==============
258IF(NOT TOOLS_ONLY OR VIEWER_ONLY)
259
260 IF (NOT FORCE_QT5)
261 FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtOpenGL QtSql QtXml QUIET)
262 ENDIF()
263
264 IF(Qt4_FOUND)
265 FIND_PACKAGE_MESSAGE(Qt4Found "Found Qt4 [Core Gui OpenGL Sql Xml]" "[${Qt4_FOUND}]")
266 SET(Qt Qt4)
267 SET(QtCore QtCore)
268 SET(QtGui QtGui)
269 SET(QtOpenGL QtOpenGL)
270 SET(QtSql QtSql)
271 SET(QtXml QtXml)
272 ADD_DEFINITIONS(-DHAVE_QT4)
273 ELSE()
274 IF (NOT FORCE_QT5)
275 FIND_PACKAGE_MESSAGE(Qt4NotFound "Qt4 [or one of: Core Gui OpenGL Sql Xml] NOT found, trying Qt5!" "[${Qt4_FOUND}]")
276 ENDIF()
277 FIND_PACKAGE(Qt5 QUIET)
278 IF(DEFINED Qt5_DIR AND NOT Qt5_DIR)
279 MESSAGE(WARNING " You need Qt5 but it seems that the development package\n with the cmake module file is missing.")
280 ELSE()
281 FIND_PACKAGE(Qt5 COMPONENTS Core Gui OpenGL Sql Xml REQUIRED)
282 ENDIF()
283 FIND_PACKAGE_MESSAGE(Qt5Found2 "Found Qt5: fact GUI will be disabled" "[${Qt5_FOUND}]")
284 SET(Qt Qt5)
285 SET(QtCore Core)
286 SET(QtGui Gui)
287 SET(QtOpenGL OpenGL)
288 SET(QtSql Sql)
289 SET(QtXml Xml)
290 ENDIF()
291
292 FIND_PACKAGE(Qwt REQUIRED)
293
294ENDIF(NOT TOOLS_ONLY OR VIEWER_ONLY)
295
296# ============== ROOT ================
297
298IF(NOT NO_ROOT AND NOT VIEWER_ONLY)
299
300 FIND_PROGRAM(ROOTCONFIG_EXECUTABLE NAMES root-config)
301 FIND_PACKAGE_HANDLE_STANDARD_ARGS(root-config DEFAULT_MSG ROOTCONFIG_EXECUTABLE)
302 IF(NOT ROOTCONFIG_EXECUTABLE)
303 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")
304 ENDIF()
305
306 # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
307 # - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
308 # - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
309 IF(EXISTS $ENV{ROOTSYS}/ROOTConfig.cmake)
310 IF(NOT DEFINED ENV{CMAKE_PREFIX_PATH})
311 LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
312 ENDIF()
313 ENDIF()
314 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
315
316 #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
317 # SET(ROOT_CONFIG_DEBUG 1)
318 FIND_PACKAGE(ROOT REQUIRED COMPONENTS TreePlayer OPTIONAL_COMPONENTS GQt)
319
320 IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE)
321 FIND_PACKAGE_MESSAGE(RootFound "Found ROOT: ${ROOT_INCLUDE_DIRS}" "[${ROOT_INCLUDE_DIRS}][${ROOT_LIBRARY_DIR}][${ROOT_VERSION}]")
322 ENDIF()
323
324 IF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY AND NOT ROOT_GQt_LIBRARY)
325 IF(ROOT_VERSION VERSION_LESS 6.18)
326 MESSAGE(FATAL_ERROR "Root version [${ROOT_VERSION}] less than 6.18, but component GQt not found.")
327 ELSE()
328 MESSAGE(WARNING "Root version [${ROOT_VERSION}] does not support GQt, GUI [fact] turned off.")
329 ENDIF()
330 ENDIF()
331
332 #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
333 FIND_PACKAGE_MESSAGE(RootInclude "Setup ROOT: [${ROOT_VERSION}] ${ROOT_USE_FILE}" "[${ROOT_VERSION}][${ROOT_USE_FILE}]")
334 IF(DEFINED ROOT_USE_FILE)
335 INCLUDE(${ROOT_USE_FILE})
336 ELSE()
337 # From RootUseFile.cmake (root 6)
338 INCLUDE_DIRECTORIES(${ROOT_INCLUDE_DIRS})
339 LINK_DIRECTORIES(${ROOT_LIBRARY_DIR})
340 ADD_DEFINITIONS(${ROOT_DEFINITIONS})
341 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
342 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ROOT_C_FLAGS}")
343 SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ROOT_fortran_FLAGS}")
344 ENDIF()
345
346 # Is this is a local or a global installation?
347 IF(DEFINED ENV{ROOTSYS})
348 IF(ROOTSYS AND NOT ROOTSYS STREQUAL "$ENV{ROOTSYS}")
349 MESSAGE(WARNING
350 " \n"
351 " ROOT Location changed!\n"
352 " Present ROOTSYS: $ENV{ROOTSYS}\n"
353 " Previous ROOTSYS: ${ROOTSYS}")
354 FILE(REMOVE thisroot.sh)
355 ENDIF()
356
357 SET(ROOTSYS $ENV{ROOTSYS} CACHE INTERNAL "Internal variable to check for consistency in ROOTSYS")
358
359 # For convenience and easy tracking
360 ADD_CUSTOM_COMMAND(OUTPUT thisroot.sh COMMAND ln -sf ${ROOTSYS}/bin/thisroot.sh VERBATIM)
361 ADD_CUSTOM_TARGET(thisroot ALL DEPENDS thisroot.sh)
362 ENDIF()
363
364 IF(ROOTVER AND NOT ROOTVER VERSION_EQUAL ROOT_VERSION)
365 MESSAGE(WARNING
366 " \n"
367 " ROOT Version changed!\n"
368 " Present: ${ROOT_VERSION}\n"
369 " Previous: ${ROOTVER}")
370 ENDIF()
371
372 SET(ROOTVER ${ROOT_VERSION} CACHE INTERNAL "Internal variable to check for consistency of root version")
373
374 ADD_DEFINITIONS(-DHAVE_ROOT)
375
376ENDIF(NOT NO_ROOT AND NOT VIEWER_ONLY)
377
378# Note that in root 5.34/38 (and maybe others?) the ROOT_xxx_FOUND macros are broken
379IF (NOT ROOT_GQt_FOUND)
380 FIND_LIBRARY(ROOT_GQt_LIBRARY NAMES GQt PATHS ${ROOT_LIBRARY_DIR})
381 IF (ROOT_GQt_LIBRARY)
382 FIND_PACKAGE_MESSAGE(RootQGtLib "Found libGQt: ${ROOT_GQt_LIBRARY}" "[${ROOT_GQt_LIBRARY}]")
383 SET(ROOT_GQt_FOUND 1)
384 ELSE()
385 FIND_PACKAGE_MESSAGE(RootQGt "ROOT: libGQt not found, fact GUI disabled!" "[${ROOT_GQt_FOUND}]")
386 ENDIF()
387ENDIF()
388
389# -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree
390# -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread
391# -lASImage -lMinuit -lHistPainter -lThread
392
393#MESSAGE("INCL_DIRS: ${ROOT_INCLUDE_DIRS}")
394#MESSAGE("LIBS: ${ROOT_LIBRARIES}")
395#MESSAGE("DEFS: ${ROOT_DEFINITIONS}")
396#MESSAGE("CXXFLAGS: ${ROOT_CXX_FLAGS}")
397#MESSAGE("CXFLAGS: ${ROOT_CC_FLAGS}")
398#MESSAGE("FOUND: ${ROOT_FOUND}")
399#MESSAGE("FILE: ${ROOT_USE_FILE}")
400#MESSAGE("DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
401#ROOT_<library>_LIBRARY PATH Full path for each of the ROOT libraries listed in COMPONENTS
402#ROOT_<command>_CMD PATH Full path for each ROOT executable (rootcling, root, hadd, etc.)
403#ROOT_<option>_FOUND BOOL True for each enabled build option (e.g. cocoa, python, xrootd, etc.)
404
405# function ROOT_GENERATE_DICTIONARY( dictionary
406# header1 header2 ...
407# LINKDEF linkdef1 ...
408# OPTIONS opt1...)
409
410# *********************************
411# ********** Observatory **********
412# *********************************
413
414SET(OBSERVATORY "ORM" CACHE STRING "Select the observatory location (ORM, HAWC, SPM, RWTH: see nova.h)")
415
416IF(NOT OBSERVATORY STREQUAL "ORM" AND
417 NOT OBSERVATORY STREQUAL "HAWC" AND
418 NOT OBSERVATORY STREQUAL "SPM" AND
419 NOT OBSERVATORY STREQUAL "RWTH")
420 MESSAGE(FATAL_ERROR "OBSERVATORY=${OBSERVATORY} invalid. Only ORM, HAWC, SPM and RWTH allowd!")
421ENDIF()
422
423FIND_PACKAGE_MESSAGE(PresetObservatory "Preset Observatory: ${OBSERVATORY}" "[${OBSERVATORY}]")
424
425# *********************************
426# *********** Compiler ************
427# *********************************
428
429SET(CMAKE_CXX_STANDARD 11)
430SET(CMAKE_C_STANDARD 99)
431
432#ADD_DEFINITIONS(-D__CMAKE__)
433
434SET(CMAKE_CXX_FLAGS
435 "${CMAKE_CXX_FLAGS} -Wall -Winit-self -Wpointer-arith \
436 -Wcast-align -Wformat=2 -Woverloaded-virtual \
437 -Wnon-virtual-dtor -Wshadow -Wno-unknown-pragmas") # -Wextra
438
439# -D__MARS__
440SET(CMAKE_CXX_FLAGS
441 "${CMAKE_CXX_FLAGS} \
442 -D_REENTRANT -D__LINUX__ \
443 -DHAVE_ZLIB -DHAVE_V8 -DHAVE_SQL -DHAVE_NOVA -DHAVE_FITS -DPRESET_OBSERVATORY=k${OBSERVATORY} \
444 -DMARSVER=\\\"${VERSION}\\\" \
445 -DPACKAGE_VERSION=\\\"${VERSION}\\\" \
446 -DREVISION=\\\"${REVISION}\\\" \
447 -DPACKAGE_NAME=\\\"FACT++\\\" \
448 -DPACKAGE_STRING=\\\"FACT++\\\" \
449 -DPACKAGE_URL=\\\"${PACKAGE_URL}\\\" \
450 -DPACKAGE_BUGREPORT=\\\"${PACKAGE_BUGREPORT}\\\""
451 )
452
453# -DBOOST_DISABLE_ASSERTS \
454# -DBOOST_NO_STD_LOCALE=1 \
455# -DBOOST_REXEG_NO_FWD=1 \
456# -DBOOST_NO_MEMBER_TEMPLATES=1 \
457# -DBOOST_HAS_ABI_HEADERS=1 \
458
459# Flags required for Dim
460SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -DMIPSEL -DPROTOCOL=1 -Dunix -Dlinux")
461
462
463# -------------------------------------------------------
464# Inlclude the main source AND build dir itself
465SET(CMAKE_INCLUDE_CURRENT_DIR ON)
466SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
467
468INCLUDE_DIRECTORIES(pal)
469INCLUDE_DIRECTORIES(erfa/src)
470INCLUDE_DIRECTORIES(dim/dim)
471INCLUDE_DIRECTORIES(externals)
472INCLUDE_DIRECTORIES(src)
473
474# ********************************************************
475# ********************** Libraries ***********************
476# ********************************************************
477IF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY)
478
479# =================== libPointing.so ======================
480ADD_LIBRARY(Pointing SHARED
481 pal/pal.h
482 pal/palDtt.c pal/palDat.c pal/palMappa.c
483 pal/palPrenut.c pal/palEvp.c pal/palAoppa.c
484 pal/palAoppat.c pal/palRefco.c pal/palRefro.c
485 pal/pal1Atmt.c pal/palDrange.c pal/palOne2One.c
486 pal/pal1Atms.c pal/palMapqkz.c pal/palAopqk.c
487 pal/palRefz.c pal/palAmpqk.c pal/palRdplan.c
488 pal/palDt.c pal/palPvobs.c pal/palNut.c
489 pal/palDmoon.c pal/palPlanet.c pal/palNutc.c
490 pal/palDeuler.c
491 erfa/src/gd2gc.c erfa/src/p06e.c erfa/src/c2s.c
492 erfa/src/eform.c erfa/src/s2c.c erfa/src/pas.c
493 erfa/src/pmat06.c erfa/src/epv00.c erfa/src/plan94.c
494 erfa/src/anpm.c erfa/src/obl06.c erfa/src/dat.c
495 erfa/src/af2a.c erfa/src/rxr.c erfa/src/gmst06.c
496 erfa/src/sepp.c erfa/src/rz.c erfa/src/zp.c
497 erfa/src/rxpv.c erfa/src/pn.c erfa/src/cr.c
498 erfa/src/seps.c erfa/src/ry.c erfa/src/pdp.c
499 erfa/src/pnm06a.c erfa/src/hfk5z.c erfa/src/epj2jd.c
500 erfa/src/pv2s.c erfa/src/tf2a.c erfa/src/pm.c
501 erfa/src/sxp.c erfa/src/a2af.c erfa/src/rxp.c
502 erfa/src/pxp.c erfa/src/fk5hip.c erfa/src/fw2m.c
503 erfa/src/rx.c erfa/src/tf2d.c erfa/src/cal2jd.c
504 erfa/src/cp.c erfa/src/nut06a.c erfa/src/rm2v.c
505 erfa/src/nut00a.c erfa/src/ee06a.c erfa/src/fk5hz.c
506 erfa/src/epb2jd.c erfa/src/refco.c erfa/src/a2tf.c
507 erfa/src/fapa03.c erfa/src/gst06a.c erfa/src/faf03.c
508 erfa/src/faur03.c erfa/src/faju03.c erfa/src/fal03.c
509 erfa/src/fasa03.c erfa/src/fame03.c erfa/src/fave03.c
510 erfa/src/fama03.c erfa/src/faom03.c erfa/src/gst06.c
511 erfa/src/jd2cal.c erfa/src/gd2gce.c erfa/src/anp.c
512 erfa/src/fae03.c erfa/src/ir.c erfa/src/pfw06.c
513 erfa/src/bpn2xy.c erfa/src/eors.c erfa/src/s06.c
514 erfa/src/trxp.c erfa/src/era00.c erfa/src/epj.c
515 erfa/src/d2tf.c erfa/src/epb.c erfa/src/rv2m.c
516 erfa/src/pap.c erfa/src/fad03.c erfa/src/pmp.c
517 erfa/src/tr.c erfa/src/falp03.c)
518TARGET_LINK_LIBRARIES(Pointing PUBLIC m)
519
520# ======================= libDim.so ======================
521ADD_LIBRARY(Dim SHARED
522# dim/dim/dic.h
523# dim/dim/dim_common.h
524# dim/dim/dim.h
525# dim/dim/dim_tcpip.h
526# dim/dim/dis.h
527 dim/src/dic.c
528 dim/src/dis.c
529 dim/src/dna.c
530 dim/src/sll.c
531 dim/src/dll.c
532 dim/src/hash.c
533 dim/src/swap.c
534 dim/src/copy_swap.c
535 dim/src/open_dns.c
536 dim/src/conn_handler.c
537 dim/src/tcpip.c
538 dim/src/dtq.c
539 dim/src/dim_thr.c
540 dim/src/utilities.c)
541
542# ================= libDimExtension.so ===================
543ADD_LIBRARY(DimExtension SHARED
544# src/DimSetup.h
545 src/DimSetup.cc)
546TARGET_LINK_LIBRARIES(DimExtension PUBLIC
547 Boost::system)
548
549# ===================== libDim++.so ======================
550ADD_LIBRARY(Dim++ SHARED
551# dim/dim/dic.hxx
552# dim/dim/dis.hxx
553# dim/dim/dim_core.hxx
554# dim/dim/dim.hxx
555# dim/dim/dim_tcpip.h
556# dim/dim/dllist.hxx
557# dim/dim/sllist.hxx
558# dim/dim/tokenstring.hxx
559# src/Dim.h
560 dim/src/diccpp.cxx
561 dim/src/dimcpp.cxx
562 dim/src/discpp.cxx
563 dim/src/tokenstring.cxx)
564TARGET_LINK_LIBRARIES(Dim++ PUBLIC Dim)
565
566# ================= libStateMachine.so ===================
567ADD_LIBRARY(StateMachine SHARED
568 src/WindowLog.h src/WindowLog.cc
569 src/Readline.h src/Readline.cc
570 src/ReadlineColor.h src/ReadlineColor.cc
571 src/ReadlineWindow.h src/ReadlineWindow.cc
572 src/Console.h src/Console.cc
573 src/Shell.h src/Shell.cc
574 src/EventImp.h src/EventImp.cc
575 src/Event.h src/Event.cc
576 src/State.h src/State.cc
577 src/Description.h src/Description.cc
578 src/MessageImp.h src/MessageImp.cc
579 src/Converter.h src/Converter.cc
580 src/StateMachineImp.h src/StateMachineImp.cc
581 src/StateMachine.h src/StateMachine.cc
582 src/EventDim.h
583 src/MessageDim.h src/MessageDim.cc
584 src/StateMachineDim.h src/StateMachineDim.cc
585 src/DimServerList.h src/DimServerList.cc
586 src/DimServiceInfoList.h src/DimServiceInfoList.cc
587# src/DimNetworkList.h src/DimNetwork.cc
588 src/ServiceList.h src/ServiceList.cc
589 src/DimErrorRedirecter.h
590 src/DimErrorRedirecter.cc
591 src/DimDescriptionService.h
592 src/DimDescriptionService.cc
593 src/Connection.h src/Connection.cc
594 src/ConnectionUSB.h src/ConnectionUSB.cc
595 src/ConnectionSSL.h src/ConnectionSSL.cc
596# FACT.h ByteOrder.h
597 src/DimWriteStatistics.h src/DimWriteStatistics.cc)
598TARGET_LINK_LIBRARIES(StateMachine PUBLIC
599 readline ${CURSES_LIBRARIES} panel
600 Tools Time Dim++
601 Boost::regex
602 Boost::thread
603 Boost::filesystem
604 OpenSSL::SSL)
605
606ENDIF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY)
607
608# ================= libConfiguration.so ==================
609ADD_LIBRARY(Configuration SHARED
610 src/Configuration.h src/Configuration.cc
611 src/FACT.h src/FACT.cc)
612TARGET_LINK_LIBRARIES(Configuration PUBLIC
613 Boost::regex
614 Boost::system
615 Boost::filesystem
616 Boost::program_options
617 ${MYSQL_LIBRARY} ${MYSQLPP_LIBRARY})
618
619# ===================== libTime.so =======================
620ADD_LIBRARY(Time SHARED
621 src/Time.h src/Time.cc)
622TARGET_LINK_LIBRARIES(Time PUBLIC ${NOVA_LIBRARY})
623
624# ===================== libTools.so ======================
625ADD_LIBRARY(Tools SHARED
626 src/tools.h src/tools.cc)
627
628
629
630# ********************************************************
631# ********************** Manuals *************************
632# ********************************************************
633
634IF (NOT VIEWER_ONLY)
635
636FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/man1)
637FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/html)
638FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/pdf)
639
640MACRO(MANPAGE program description)
641 # https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/
642 IF (HELP2MAN_EXECUTABLE AND ROFF2HTML_EXECUTABLE AND ROFF2PDF_EXECUTABLE AND GROFF_EXECUTABLE)
643 ADD_CUSTOM_COMMAND(
644 OUTPUT
645 man1/${program}.1
646 DEPENDS
647 ${program}
648 COMMAND
649 ${HELP2MAN_EXECUTABLE}
650 ${PROJECT_BINARY_DIR}/${program}
651 -n "${description}"
652 --no-info
653 --output=man1/${program}.1
654 COMMAND
655 ${GROFF_EXECUTABLE}
656 -mandoc man1/${program}.1
657 -T html > html/${program}.html
658 COMMAND
659 ${GROFF_EXECUTABLE}
660 -mandoc man1/${program}.1
661 -T pdf > pdf/${program}.pdf
662 COMMENT
663 "Generating man-page ${program}.1"
664 VERBATIM)
665
666 ADD_CUSTOM_TARGET(${program}.man ALL DEPENDS man1/${program}.1)
667
668 INSTALL(FILES ${PROJECT_BINARY_DIR}/man1/${program}.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
669 ENDIF()
670ENDMACRO()
671
672
673# ********************************************************
674# ********************* Resources ************************
675# ********************************************************
676
677FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/res)
678
679FUNCTION(ADD_RESOURCES)
680 FOREACH(resource ${ARGV})
681 STRING(MAKE_C_IDENTIFIER ${resource} identifier)
682 ADD_CUSTOM_COMMAND(
683 OUTPUT "${PROJECT_BINARY_DIR}/res/${identifier}.o"
684 COMMAND ${CMAKE_LINKER} --relocatable --format binary --output "${PROJECT_BINARY_DIR}/res/${identifier}.o" ${resource}
685 DEPENDS ${resource}
686 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
687 )
688 ENDFOREACH()
689ENDFUNCTION()
690
691
692
693# ********************************************************
694# *********************** Helpers ************************
695# ********************************************************
696
697SET(HELP++LIBS Tools Configuration Time)
698
699# --------------------------------------------------------
700
701#ADD_EXECUTABLE(fitsloader src/fitsloader.cc)
702#TARGET_LINK_LIBRARIES(fitsloader ${HELP++LIBS})
703#MANPAGE(fitsloader "")
704
705#ADD_EXECUTABLE(fitscheck src/fitscheck.cc)
706#TARGET_LINK_LIBRARIES(fitscheck ${HELP++LIBS} ZLIB::ZLIB)
707#MANPAGE(fitscheck "")
708
709#ADD_EXECUTABLE(fitsCompressor src/fitsCompressor.cc)
710#TARGET_LINK_LIBRARIES(fitsCompressor ${HELP++LIBS} ZLIB::ZLIB)
711#MANPAGE(fitsCompressor "")
712
713#ADD_EXECUTABLE(fitsselect src/fitsselect.cc)
714#TARGET_LINK_LIBRARIES(fitsselect ${HELP++LIBS} ZLIB::ZLIB)
715#MANPAGE(fitsselect "")
716
717#ADD_EXECUTABLE(readfits src/readfits.cc)
718#TARGET_LINK_LIBRARIES(readfits ${HELP++LIBS} ZLIB::ZLIB)
719#MANPAGE(readfits "")
720
721IF(NOT NO_ROOT)
722 ADD_EXECUTABLE(fitsdump src/fitsdump.cc)
723 TARGET_LINK_LIBRARIES(fitsdump ${HELP++LIBS} ${ROOT_LIBRARIES} ZLIB::ZLIB)
724 MANPAGE(fitsdump "FACT++ - fitsdump - Read and dump contents of a FITStable")
725
726 ADD_EXECUTABLE(rootifysql src/rootifysql.cc)
727 TARGET_LINK_LIBRARIES(rootifysql ${HELP++LIBS} OpenSSL::SSL ${ROOT_LIBRARIES})
728 MANPAGE(rootifysql "FACT++ - rootifysql - Write result of a SQL query into a root-file")
729 ADD_EXECUTABLE(root2sql src/root2sql.cc)
730 TARGET_LINK_LIBRARIES(root2sql ${HELP++LIBS} OpenSSL::SSL ${MYSQLPP_LIBRARY} ${ROOT_LIBRARIES})
731 MANPAGE(root2sql "FACT++ - root2sql - Fill contents of a root-tree into a MySQL database")
732
733 ADD_EXECUTABLE(root2csv src/root2csv.cc)
734 TARGET_LINK_LIBRARIES(root2csv ${HELP++LIBS} ${ROOT_LIBRARIES})
735 MANPAGE(root2csv "FACT++ - root2csv - Convert a root-tree to a csv file")
736
737 ADD_EXECUTABLE(csv2root src/csv2root.cc)
738 TARGET_LINK_LIBRARIES(csv2root ${HELP++LIBS} ${ROOT_LIBRARIES})
739 MANPAGE(csv2root "FACT++ - csv2root - Convert a csv file to a root-tree")
740ENDIF()
741
742ADD_EXECUTABLE(fits2sql src/fits2sql.cc)
743TARGET_LINK_LIBRARIES(fits2sql ${HELP++LIBS} ZLIB::ZLIB)
744MANPAGE(fits2sql "FACT++ - fits2sql - Fill contents of a FITS table into a MySQL database")
745
746ADD_EXECUTABLE(corsika2sql src/corsika2sql.cc)
747TARGET_LINK_LIBRARIES(corsika2sql ${HELP++LIBS})
748MANPAGE(corsika2sql "Fills a Corsika Input Card into a SQL table")
749
750ADD_EXECUTABLE(showlog src/showlog.cc src/WindowLog.cc)
751TARGET_LINK_LIBRARIES(showlog Threads::Threads ${HELP++LIBS} ${CURSES_LIBRARIES})
752MANPAGE(showlog "")
753
754ADD_EXECUTABLE(zfits src/zfits.cc)
755TARGET_LINK_LIBRARIES(zfits ${HELP++LIBS} ZLIB::ZLIB)
756MANPAGE(zfits "")
757
758IF(NOT NO_ROOT)
759 ADD_EXECUTABLE(calcsource src/calcsource.cc)
760 TARGET_LINK_LIBRARIES(calcsource ${HELP++LIBS} ${ROOT_LIBRARIES})
761 MANPAGE(calcsource "")
762
763 ADD_EXECUTABLE(calcsourcemc src/calcsourcemc.cc)
764 TARGET_LINK_LIBRARIES(calcsourcemc ${HELP++LIBS} ${ROOT_LIBRARIES})
765 MANPAGE(calcsourcemc "")
766ENDIF()
767
768ADD_EXECUTABLE(spectrum src/spectrum.cc src/WindowLog.cc res/spectrum_data_sql.o res/spectrum_simulation_sql.o res/spectrum_analysis_sql.o res/spectrum_spectrum_sql.o res/spectrum_summary_sim_sql.o res/spectrum_summary_est_sql.o)
769TARGET_LINK_LIBRARIES(spectrum Threads::Threads ${CURSES_LIBRARIES} ${HIGHLIGHT_LIBRARY} ${HELP++LIBS} ${ROOT_LIBRARIES})
770ADD_RESOURCES(spectrum/analysis.sql spectrum/data.sql spectrum/simulation.sql spectrum/spectrum.sql spectrum/summary-est.sql spectrum/summary-sim.sql)
771MANPAGE(spectrum "")
772
773ADD_EXECUTABLE(getevent src/getevent.cc)
774TARGET_LINK_LIBRARIES(getevent ${HELP++LIBS} ZLIB::ZLIB)
775MANPAGE(getevent "")
776
777ENDIF(NOT VIEWER_ONLY)
778
779IF (NOT TOOLS_ONLY AND NOT VIEWER_ONLY)
780
781IF(NOT NO_ROOT)
782 ADD_EXECUTABLE(makeplots src/makeplots.cc)
783 TARGET_LINK_LIBRARIES(makeplots ${HELP++LIBS} ${ROOT_LIBRARIES})
784 MANPAGE(makeplots "")
785ENDIF()
786
787ADD_EXECUTABLE(makedata src/makedata.cc)
788TARGET_LINK_LIBRARIES(makedata ${HELP++LIBS})
789MANPAGE(makedata "")
790
791ADD_EXECUTABLE(makeschedule src/makeschedule.cc)
792TARGET_LINK_LIBRARIES(makeschedule ${HELP++LIBS})
793MANPAGE(makeschedule "")
794
795ADD_EXECUTABLE(moon src/moon.cc)
796TARGET_LINK_LIBRARIES(moon ${HELP++LIBS})
797MANPAGE(moon "")
798
799# ********************************************************
800# ********************* Operation ************************
801# ********************************************************
802
803SET(FACT++LIBS StateMachine Configuration DimExtension)
804
805# --------------------------------------------------------
806
807ADD_EXECUTABLE(dns src/dns.c)
808TARGET_LINK_LIBRARIES(dns ${FACT++LIBS})
809MANPAGE(dns "")
810
811ADD_EXECUTABLE(agilentctrl src/agilentctrl.cc)
812TARGET_LINK_LIBRARIES(agilentctrl ${FACT++LIBS})
813MANPAGE(agilentctrl "")
814
815ADD_EXECUTABLE(biasctrl src/biasctrl.cc)
816TARGET_LINK_LIBRARIES(biasctrl ${FACT++LIBS})
817MANPAGE(biasctrl "")
818
819ADD_EXECUTABLE(biastemp src/biastemp.cc)
820TARGET_LINK_LIBRARIES(biastemp ${FACT++LIBS})
821MANPAGE(biastemp "")
822
823ADD_EXECUTABLE(gudectrl src/gudectrl.cc)
824TARGET_LINK_LIBRARIES(gudectrl ${FACT++LIBS})
825MANPAGE(gudectrl "")
826
827ADD_EXECUTABLE(gtcdust src/gtcdust.cc)
828TARGET_LINK_LIBRARIES(gtcdust ${FACT++LIBS})
829MANPAGE(gtcdust "")
830
831ADD_EXECUTABLE(chatserv src/chatserv.cc)
832TARGET_LINK_LIBRARIES(chatserv ${FACT++LIBS}) # does not require libpanel
833MANPAGE(chatserv "")
834
835ADD_EXECUTABLE(chatclient src/chatclient.cc)
836TARGET_LINK_LIBRARIES(chatclient ${FACT++LIBS}) # does not require libpanel
837MANPAGE(chatclient "")
838
839#ADD_EXECUTABLE(cosyctrl src/cosyctrl.cc)# src/LocalControl.h
840#TARGET_LINK_LIBRARIES(cosyctrl
841# StateMachine Tools Configuration Time Dim++ Dim DimExtension
842# ${Boost_LIBRARIES} readline ${CURSES_LIBRARIES})
843
844ADD_EXECUTABLE(datalogger src/datalogger.cc
845 src/DimState.cc
846 src/FitsFile.cc src/Fits.cc)
847TARGET_LINK_LIBRARIES(datalogger ${FACT++LIBS} cfitsio CCfits)
848MANPAGE(datalogger "")
849
850ADD_EXECUTABLE(dimctrl src/dimctrl.cc
851 src/StateMachineDimControl.cc
852 src/RemoteControl.cc
853 src/InterpreterV8.cc
854 src/DimState.cc)
855TARGET_LINK_LIBRARIES(dimctrl ${FACT++LIBS} Pointing ZLIB::ZLIB v8)
856MANPAGE(dimctrl "")
857
858ADD_CUSTOM_TARGET(dimserver ALL
859 COMMAND ln -sf dimctrl dimserver
860 COMMENT "Creating symlink for dimserver"
861 DEPENDS dimctrl)
862
863ADD_EXECUTABLE(drivectrl src/drivectrl.cc)
864TARGET_LINK_LIBRARIES(drivectrl ${FACT++LIBS} Pointing)
865MANPAGE(drivectrl "")
866
867ADD_EXECUTABLE(evtserver src/evtserver.cc)
868TARGET_LINK_LIBRARIES(evtserver ${FACT++LIBS} ZLIB::ZLIB)
869MANPAGE(evtserver "")
870
871ADD_EXECUTABLE(fadctrl src/fadctrl.cc src/HeadersFAD.cc
872 src/EventBuilder.cc
873 src/FitsFile.cc
874 src/DataCalib.cc
875 src/DataWriteRaw.cc
876 src/DataWriteFits.cc
877 src/DataWriteFits2.cc
878 src/DataProcessorImp.cc)
879TARGET_LINK_LIBRARIES(fadctrl ${FACT++LIBS} cfitsio CCfits ZLIB::ZLIB)
880MANPAGE(fadctrl "")
881
882ADD_EXECUTABLE(feedback src/feedback.cc)
883TARGET_LINK_LIBRARIES(feedback ${FACT++LIBS})
884MANPAGE(feedback "")
885
886ADD_EXECUTABLE(fscctrl src/fscctrl.cc src/HeadersFTM.cc)
887TARGET_LINK_LIBRARIES(fscctrl ${FACT++LIBS})
888MANPAGE(fscctrl "")
889
890ADD_EXECUTABLE(ftmctrl src/ftmctrl.cc src/HeadersFTM.cc)
891TARGET_LINK_LIBRARIES(ftmctrl ${FACT++LIBS})
892MANPAGE(ftmctrl "")
893
894ADD_EXECUTABLE(gcn src/gcn.cc)
895TARGET_LINK_LIBRARIES(gcn ${FACT++LIBS} ${Qt}::${QtXml})
896MANPAGE(gcn "")
897
898ADD_EXECUTABLE(scheduler src/scheduler.cc)
899TARGET_LINK_LIBRARIES(scheduler ${FACT++LIBS})
900MANPAGE(scheduler "")
901
902ADD_EXECUTABLE(gpsctrl src/gpsctrl.cc)
903TARGET_LINK_LIBRARIES(gpsctrl ${FACT++LIBS})
904MANPAGE(gpsctrl "")
905
906ADD_EXECUTABLE(lidctrl src/lidctrl.cc)
907TARGET_LINK_LIBRARIES(lidctrl ${FACT++LIBS} ${Qt}::${QtXml})
908MANPAGE(lidctrl "")
909
910ADD_EXECUTABLE(magiclidar src/magiclidar.cc)
911TARGET_LINK_LIBRARIES(magiclidar ${FACT++LIBS})
912MANPAGE(magiclidar "")
913
914ADD_EXECUTABLE(magicweather src/magicweather.cc)
915TARGET_LINK_LIBRARIES(magicweather ${FACT++LIBS})
916MANPAGE(magicweather "")
917
918ADD_EXECUTABLE(mcp src/mcp.cc)
919TARGET_LINK_LIBRARIES(mcp ${FACT++LIBS})
920MANPAGE(mcp "")
921
922ADD_EXECUTABLE(pfminictrl src/pfminictrl.cc)
923TARGET_LINK_LIBRARIES(pfminictrl ${FACT++LIBS})
924MANPAGE(pfminictrl "")
925
926ADD_EXECUTABLE(pwrctrl src/pwrctrl.cc src/HeadersPower.cc)
927TARGET_LINK_LIBRARIES(pwrctrl ${FACT++LIBS} ${Qt}::${QtXml})
928MANPAGE(pwrctrl "")
929
930ADD_EXECUTABLE(rainsensor src/rainsensor.cc)
931TARGET_LINK_LIBRARIES(rainsensor ${FACT++LIBS})
932MANPAGE(rainsensor "")
933
934ADD_EXECUTABLE(ratecontrol src/ratecontrol.cc)
935TARGET_LINK_LIBRARIES(ratecontrol ${FACT++LIBS})
936MANPAGE(ratecontrol "")
937
938ADD_EXECUTABLE(ratescan src/ratescan.cc)
939TARGET_LINK_LIBRARIES(ratescan ${FACT++LIBS})
940MANPAGE(ratescan "")
941
942#ADD_EXECUTABLE(scheduler src/scheduler.cc)
943#TARGET_LINK_LIBRARIES(scheduler ${FACT++LIBS})
944#MANPAGE(scheduler "")
945
946#ADD_EXECUTABLE(skypeclient src/skypeclient.cc)
947#TARGET_LINK_LIBRARIES(skypeclient ${FACT++LIBS})
948#MANPAGE(skypeclient "")
949
950ADD_EXECUTABLE(sqmctrl src/sqmctrl.cc)
951TARGET_LINK_LIBRARIES(sqmctrl ${FACT++LIBS})
952MANPAGE(sqmctrl "")
953
954ADD_EXECUTABLE(smartfact src/smartfact.cc)
955TARGET_LINK_LIBRARIES(smartfact ${FACT++LIBS}) # HAVE_NOVA
956MANPAGE(smartfact "")
957
958ADD_EXECUTABLE(temperature src/temperature.cc)
959TARGET_LINK_LIBRARIES(temperature ${FACT++LIBS})
960MANPAGE(temperature "")
961
962ADD_EXECUTABLE(timecheck src/timecheck.cc)
963TARGET_LINK_LIBRARIES(timecheck ${FACT++LIBS})
964MANPAGE(timecheck "")
965
966ADD_EXECUTABLE(tngweather src/tngweather.cc)
967TARGET_LINK_LIBRARIES(tngweather ${FACT++LIBS} ${Qt}::${QtXml})
968MANPAGE(tngweather "")
969
970#ADD_EXECUTABLE(triggerschedule src/triggerschedule.cc)
971#TARGET_LINK_LIBRARIES(triggerschedule ${FACT++LIBS})
972#MANPAGE(triggerschedule "")
973
974ENDIF(NOT TOOLS_ONLY AND NOT VIEWER_ONLY)
975
976# ********************************************************
977# ****************** GUI Applications ********************
978# ********************************************************
979
980IF (NOT TOOLS_ONLY OR VIEWER_ONLY)
981
982INCLUDE_DIRECTORIES(${QWT_INCLUDE_DIR} gui gui/RawEventsViewer)
983
984# --------------------------------------------------------
985
986IF(QT4_FOUND)
987 QT4_WRAP_UI(VIEWER_QT_HEADERS gui/RawEventsViewer/viewer.ui)
988 QT4_WRAP_CPP(VIEWER_QT_SOURCES
989 gui/RawEventsViewer/RawEventsViewer.h
990 gui/BasicGlCamera.h
991 gui/QCameraWidget.h
992 gui/Q3DCameraWidget.h)
993ELSE()
994 QT5_WRAP_UI(VIEWER_QT_HEADERS gui/RawEventsViewer/viewer.ui)
995 QT5_WRAP_CPP(VIEWER_QT_SOURCES
996 gui/RawEventsViewer/RawEventsViewer.h
997 gui/BasicGlCamera.h
998 gui/QCameraWidget.h
999 gui/Q3DCameraWidget.h)
1000ENDIF()
1001
1002ADD_EXECUTABLE(viewer
1003 gui/RawEventsViewer/RawEventsViewer.cc
1004 gui/BasicGlCamera.cc
1005 gui/QCameraWidget.cc
1006 gui/Q3DCameraWidget.cc
1007 ${VIEWER_QT_HEADERS}
1008 ${VIEWER_QT_SOURCES})
1009
1010TARGET_LINK_LIBRARIES(viewer
1011 ${Boost_LIBRARIES} Configuration
1012 ${Qt}::${QtGui} ${Qt}::${QtOpenGL}
1013 ${OPENGL_LIBRARIES} # OpenGL::GL OpenGL::GLU
1014 ${QWT_LIBRARY} ZLIB::ZLIB)
1015
1016#ENDIF(NOT TOOLS_ONLY OR VIEWER_ONLY)
1017
1018# --------------------------------------------------------
1019
1020IF(NOT VIEWER_ONLY AND ROOT_GQt_FOUND AND Qt4_FOUND)
1021
1022QT4_ADD_RESOURCES(FACT_QT_RESOURCES gui/design.qrc)
1023
1024QT4_WRAP_UI(FACT_QT_HEADERS gui/design.ui)
1025
1026QT4_WRAP_CPP(FACT_QT_SOURCES
1027 gui/DockWindow.h
1028 gui/MainWindow.h
1029 gui/QCameraWidget.h
1030 gui/BasicGlCamera.h)
1031
1032ADD_EXECUTABLE(fact gui/fact.cc
1033 gui/DockWindow.cc
1034 gui/MainWindow.cc
1035 gui/QCameraWidget.cc
1036 gui/BasicGlCamera.cc
1037 gui/HtmlDelegate.cc
1038 gui/CheckBoxDelegate.cc
1039 src/DimNetwork.cc
1040 ${FACT_QT_HEADERS}
1041 ${FACT_QT_SOURCES}
1042 ${FACT_QT_RESOURCES})
1043
1044TARGET_LINK_LIBRARIES(fact
1045 ${FACT++LIBS}
1046 ${ROOT_LIBRARIES}
1047 ${Qt}::${QtGui} ${Qt}::${QtOpenGL} ${Qt}::${QtSql}
1048 ${OPENGL_LIBRARIES} # OpenGL::GL OpenGL::GLU
1049 ${QWT_LIBRARY} ZLIB::ZLIB)
1050
1051
1052#dclient5_SOURCES = src/dclient5.cc src/LocalControl.h
1053#dclient5_LDADD = libDim++.la libDim.la libStateMachine.la libTime.la libTools.la \
1054# libConfiguration.la
1055
1056#argv_SOURCES = src/argv.cc
1057#argv_LDADD = libConfiguration.la
1058
1059#time_SOURCES = src/time.cc
1060#time_LDADD = libTime.la
1061
1062#test_SOURCES = src/test.cc
1063#test_LDADD = libStateMachine.la libTools.la libTime.la libDim++.la libDim.la libConfiguration.la
1064
1065ENDIF(NOT VIEWER_ONLY AND ROOT_GQt_FOUND AND Qt4_FOUND)
1066ENDIF(NOT TOOLS_ONLY OR VIEWER_ONLY)
1067
1068
1069# ********************************************************
1070# ********************** FAMOUS **************************
1071# ********************************************************
1072
1073IF(FOUND_FAMOUS)
1074 INCLUDE_DIRECTORIES(famous/ui)
1075 INCLUDE_DIRECTORIES(famous/src)
1076
1077 ADD_EXECUTABLE(famousbias famous/src/famousbias.cc)
1078 TARGET_LINK_LIBRARIES(famousbias ${FACT++LIBS})
1079 MANPAGE(famousbias "")
1080
1081 ADD_EXECUTABLE(famousui famous/ui/famousui.cc)
1082 TARGET_LINK_LIBRARIES(famousui ${FACT++LIBS})
1083 MANPAGE(famousui "")
1084
1085 ADD_EXECUTABLE(ftuctrl famous/src/ftuctrl.cc)
1086 TARGET_LINK_LIBRARIES(ftuctrl ${FACT++LIBS})
1087 MANPAGE(ftuctrl "")
1088
1089 ADD_EXECUTABLE(miniftmctrl famous/src/miniftmctrl.cc)
1090 TARGET_LINK_LIBRARIES(miniftmctrl ${FACT++LIBS})
1091 MANPAGE(miniftmctrl "")
1092
1093 ADD_EXECUTABLE(fpgaftmctrl famous/src/fpgaftmctrl.cc)
1094 TARGET_LINK_LIBRARIES(fpgaftmctrl ${FACT++LIBS})
1095 MANPAGE(fpgaftmctrl "")
1096
1097 ADD_EXECUTABLE(famousrate famous/src/famousrate.cc)
1098 TARGET_LINK_LIBRARIES(famousrate ${FACT++LIBS})
1099 MANPAGE(famousrate "")
1100
1101 ADD_EXECUTABLE(famousscan famous/src/famousscan.cc)
1102 TARGET_LINK_LIBRARIES(famousscan ${FACT++LIBS})
1103 MANPAGE(famousscan "")
1104
1105 ADD_EXECUTABLE(beaglectrl famous/src/beaglectrl.cc)
1106 TARGET_LINK_LIBRARIES(beaglectrl ${FACT++LIBS} ${Qt}::${QtXml})
1107 MANPAGE(beaglectrl "")
1108ENDIF()
1109
1110
1111
1112# ********************************************************
1113# ********************** IceACT **************************
1114# ********************************************************
1115
1116IF(FOUND_ICEACT)
1117 ADD_EXECUTABLE(iceactpsu iceact/src/psuctrl.cc)
1118 TARGET_LINK_LIBRARIES(iceactpsu ${FACT++LIBS})
1119 MANPAGE(iceactpsu "")
1120
1121 ADD_EXECUTABLE(tmonctrl iceact/src/tmonctrl.cc)
1122 TARGET_LINK_LIBRARIES(tmonctrl ${FACT++LIBS})
1123 MANPAGE(tmonctrl "")
1124ENDIF()
1125
1126
1127# *********************************
1128# ********** Installation *********
1129# *********************************
1130
1131# ======== Setup directories ======
1132
1133# MESSAGE("")
1134# MESSAGE("PREFIX: "${CMAKE_INSTALL_PREFIX})
1135# MESSAGE("")
1136# MESSAGE("BINDIR: "${CMAKE_INSTALL_FULL_BINDIR})
1137# MESSAGE("SBINDIR: "${CMAKE_INSTALL_FULL_SBINDIR})
1138# MESSAGE("LIBEXECDIR: "${CMAKE_INSTALL_FULL_LIBEXECDIR})
1139# MESSAGE("SHAREDSTATEDIR: "${CMAKE_INSTALL_FULL_SHAREDSTATEDIR})
1140# MESSAGE("LOCALSTATEDIR: "${CMAKE_INSTALL_FULL_LOCALSTATEDIR})
1141# MESSAGE("RUNSTATEDIR: "${CMAKE_INSTALL_FULL_RUNSTATEDIR})
1142# MESSAGE("LIBDIR: "${CMAKE_INSTALL_FULL_LIBDIR})
1143# MESSAGE("INCLUDEDIR: "${CMAKE_INSTALL_FULL_INCLUDEDIR})
1144# MESSAGE("DATAROOTDIR: "${CMAKE_INSTALL_FULL_DATAROOTDIR})
1145# MESSAGE("DATADIR: "${CMAKE_INSTALL_FULL_DATADIR})
1146# MESSAGE("INFODIR: "${CMAKE_INSTALL_FULL_INFODIR})
1147# MESSAGE("LOCALDIR: "${CMAKE_INSTALL_FULL_LOCALDIR})
1148# MESSAGE("MANDIR: "${CMAKE_INSTALL_FULL_MANDIR})
1149# MESSAGE("DOCDIR: "${CMAKE_INSTALL_FULL_DOCDIR})
1150# MESSAGE("")
1151# MESSAGE("BINDIR: "${CMAKE_INSTALL_BINDIR})
1152# MESSAGE("SBINDIR: "${CMAKE_INSTALL_SBINDIR})
1153# MESSAGE("LIBEXECDIR: "${CMAKE_INSTALL_LIBEXECDIR})
1154# MESSAGE("SHAREDSTATEDIR: "${CMAKE_INSTALL_SHAREDSTATEDIR})
1155# MESSAGE("LOCALSTATEDIR: "${CMAKE_INSTALL_LOCALSTATEDIR})
1156# MESSAGE("RUNSTATEDIR: "${CMAKE_INSTALL_RUNSTATEDIR})
1157# MESSAGE("LIBDIR: "${CMAKE_INSTALL_LIBDIR})
1158# MESSAGE("INCLUDEDIR: "${CMAKE_INSTALL_INCLUDEDIR})
1159# MESSAGE("DATAROOTDIR: "${CMAKE_INSTALL_DATAROOTDIR})
1160# MESSAGE("DATADIR: "${CMAKE_INSTALL_DATADIR})
1161# MESSAGE("INFODIR: "${CMAKE_INSTALL_INFODIR})
1162# MESSAGE("LOCALDIR: "${CMAKE_INSTALL_LOCALDIR})
1163# MESSAGE("MANDIR: "${CMAKE_INSTALL_MANDIR})
1164# MESSAGE("DOCDIR: "${CMAKE_INSTALL_DOCDIR})
1165# MESSAGE("")
1166
1167SET(PKG_SHARE "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}")
1168SET(PKG_APPS "${CMAKE_INSTALL_DATAROOTDIR}/applications")
1169SET(PKG_PIXMAPS "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps")
1170
1171# ====== Installation targets =====
1172
1173IF (NOT VIEWER_ONLY)
1174
1175 INSTALL(TARGETS fits2sql DESTINATION "${CMAKE_INSTALL_BINDIR}")
1176 INSTALL(TARGETS zfits DESTINATION "${CMAKE_INSTALL_BINDIR}")
1177 INSTALL(TARGETS showlog DESTINATION "${CMAKE_INSTALL_BINDIR}")
1178
1179 IF(NOT NO_ROOT)
1180 INSTALL(TARGETS rootifysql DESTINATION "${CMAKE_INSTALL_BINDIR}")
1181 INSTALL(TARGETS root2sql DESTINATION "${CMAKE_INSTALL_BINDIR}")
1182 INSTALL(TARGETS root2csv DESTINATION "${CMAKE_INSTALL_BINDIR}")
1183 INSTALL(TARGETS csv2root DESTINATION "${CMAKE_INSTALL_BINDIR}")
1184 INSTALL(TARGETS fitsdump DESTINATION "${CMAKE_INSTALL_BINDIR}")
1185 INSTALL(TARGETS calcsource DESTINATION "${CMAKE_INSTALL_BINDIR}")
1186 INSTALL(TARGETS calcsourcemc DESTINATION "${CMAKE_INSTALL_BINDIR}")
1187 ENDIF()
1188
1189ENDIF(NOT VIEWER_ONLY)
1190
1191INSTALL(TARGETS Configuration DESTINATION "${CMAKE_INSTALL_LIBDIR}")
1192INSTALL(TARGETS Time DESTINATION "${CMAKE_INSTALL_LIBDIR}")
1193INSTALL(TARGETS Tools DESTINATION "${CMAKE_INSTALL_LIBDIR}")
1194
1195
1196#INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/html DESTINATION "${PKG_SHARE}" FILES_MATCHING PATTERN "*.html")
1197#INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/pdf DESTINATION "${PKG_SHARE}" FILES_MATCHING PATTERN "*.pdf")
1198
1199# *********************************
1200# ************ Packaging **********
1201# *********************************
1202
1203# ======== General packaging ======
1204# https://cmake.org/cmake/help/latest/module/CPack.html
1205
1206INCLUDE(InstallRequiredSystemLibraries)
1207
1208# SET(CPACK_STRIP_FILES ON) # Strip debug sysmbold from files
1209
1210SET(CPACK_PACKAGE_VERSION "${fact++_VERSION}")
1211SET(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
1212SET(CPACK_PACKAGE_MAINTAINER "${PACKAGE_MAINTAINER}")
1213SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
1214#SET(CPACK_PACKAGE_VENDOR "Me, myself, and I")
1215
1216
1217SET(CPACK_SOURCE_IGNORE_FILES "/old/;/build/;/[.].*/;/autom4te[.]cache/;.*~;.log$")
1218
1219# Maybe the text displayed in synaptic?
1220SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
1221SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "FACT++ - Toolset")
1222#CPACK_RESOURCE_FILE_README ReadMe file to be embedded in the installer.
1223
1224SET(CPACK_GENERATOR TBZ2 DEB) # TGZ
1225SET(CPACK_SOURCE_GENERATOR TBZ2) # TGZ
1226#SET(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/cmake/Package.txt)
1227#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
1228
1229
1230# ======== Debian packaging =======
1231# https://cmake.org/cmake/help/latest/module/CPackDeb.html
1232# https://www.debian.org/doc/debian-policy
1233
1234#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)")
1235SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS 1) # generate better (atomatic?) dependecies
1236SET(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
1237SET(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
1238SET(CPACK_DEBIAN_PACKAGE_SECTION utils)
1239SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${PACKAGE_URL}")
1240SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION
1241"${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
1242 This package contains some tools which are part of FACT++ to deal with databases, fits files and root-files.")
1243#indent the long description with spaces
1244
1245#CPACK_INSTALL_CMAKE_PROJECTS
1246#List of four values that specify what project to install. Build directory, Project Name, Project Component, Directory.
1247
1248INCLUDE(CPack)
Note: See TracBrowser for help on using the repository browser.