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

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