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

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