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

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