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

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