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

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