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

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