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

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