# ********************************* # ************ cmake ************** # ********************************* CMAKE_MINIMUM_REQUIRED(VERSION 3.5) CMAKE_POLICY(SET CMP0043 NEW) CMAKE_POLICY(SET CMP0048 NEW) # Enable debug symbols by default # must be done before project() statement SET(CMAKE_BUILD_TYPE_INIT Release) # (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Debug) # Enable CLANG as default compilers, to change this use # cmake -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ # Note that if compilers are switched on the fly, # the cache is deleted IF(NOT DEFINED CMAKE_C_COMPILER) FIND_PROGRAM(CMAKE_C_COMPILER NAMES $ENV{CC} clang gcc cc PATHS ENV PATH NO_DEFAULT_PATH DOC "C Compiler") ENDIF() IF(NOT DEFINED CMAKE_CXX_COMPILER) FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES $ENV{CXX} clang++ g++ c++ PATHS ENV PATH NO_DEFAULT_PATH DOC "C++ Compiler") ENDIF() #SET(CMAKE_VERBOSE_MAKEFILE ON) # ********************************* # ************ Project ************ # ********************************* STRING(TIMESTAMP VERSION %y.%U.%w.%H UTC) MESSAGE(STATUS "FACT++ V${VERSION}") PROJECT(fact++ VERSION ${VERSION}) INCLUDE(GNUInstallDirs) # ======== For config.h.in ========= SET(PACKAGE_MAINTAINER "Thomas Bretz") SET(PACKAGE_BUGREPORT "tbretz@physik.rwth-aachen.de") SET(PACKAGE_URL "https://www.fact-project.org") # ********************************* # ******** FAMOUS / IceACT ******** # ********************************* IF (NOT TOOLS_ONLY) IF(EXISTS "${CMAKE_SOURCE_DIR}/famous") MESSAGE(STATUS "Compilation of 'famous' enabled.") SET(FOUND_FAMOUS ON) ENDIF() IF(EXISTS "${CMAKE_SOURCE_DIR}/iceact") MESSAGE(STATUS "Compilation of 'iceact' enabled.") SET(FOUND_ICEACT ON) ENDIF() ENDIF(NOT TOOLS_ONLY) # ********************************* # ********* Requirements ********** # ********************************* # Inlclude the main source AND build dir itself SET(CMAKE_INCLUDE_CURRENT_DIR ON) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) # =========== pkg-config ============ FIND_PACKAGE(PkgConfig) FIND_PACKAGE(PackageHandleStandardArgs) # ========== executables ========== FIND_PROGRAM(HELP2MAN_EXECUTABLE help2man) FIND_PROGRAM(ROFF2HTML_EXECUTABLE roff2html) FIND_PROGRAM(ROFF2PDF_EXECUTABLE roff2pdf) FIND_PROGRAM(GROFF_EXECUTABLE groff) FIND_PACKAGE_HANDLE_STANDARD_ARGS(help2man DEFAULT_MSG HELP2MAN_EXECUTABLE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(roff2html DEFAULT_MSG ROFF2HTML_EXECUTABLE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(roff2pdf DEFAULT_MSG ROFF2PDF_EXECUTABLE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(groff DEFAULT_MSG GROFF_EXECUTABLE) IF (NOT HELP2MAN_EXECUTABLE OR NOT ROFF2HTML_EXECUTABLE OR NOT ROFF2PDF_EXECUTABLE OR NOT GROFF_EXECUTABLE) MESSAGE(STATUS "Documentation turned off (some executables missing).") ENDIF() IF (NOT TOOLS_ONLY) FIND_PROGRAM(JSDOC_EXECUTABLE jsdoc) FIND_PROGRAM(MAILX_EXECUTABLE mailx) FIND_PROGRAM(CURL_EXECUTABLE curl) FIND_PACKAGE_HANDLE_STANDARD_ARGS(curl DEFAULT_MSG CURL_EXECUTABLE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(mailx DEFAULT_MSG MAILX_EXECUTABLE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(jsdoc DEFAULT_MSG JSDOC_EXECUTABLE) ENDIF (NOT TOOLS_ONLY) #IF(NOT SOME_COND) # MESSAGE(FATAL_ERROR "At least one required executable was not found") #ENDIF() # =========== libraries ============= SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) # FIXME: Need to check which package finders accept REQUIERED. For all others implement checks FIND_PACKAGE(Threads REQUIRED) # Threads::Threads FIND_PACKAGE(ZLIB REQUIRED) # ZLIB::ZLIB SET(CURSES_NEED_NCURSES ON) FIND_PACKAGE(Curses REQUIRED) # CURSES_FOUND # FIXME : Require panel IF(NOT TOOLS_ONLY) FIND_PACKAGE(OpenGL REQUIRED) # OpenGL::GL OpenGL::GLU / OPENGL_FOUND OPENGL_GLU_FOUND # FIND_PACKAGE(DBus) => skaypeclient # FIND_PACKAGE(Motif) => did # MOTIF_FOUND FIND_PACKAGE(Readline REQUIRED) FIND_PACKAGE(Panel REQUIRED) FIND_PACKAGE(V8 REQUIRED) FIND_PACKAGE(Cfitsio REQUIRED) FIND_PACKAGE(CCfits REQUIRED) ENDIF(NOT TOOLS_ONLY) FIND_PACKAGE(Nova REQUIRED) FIND_PACKAGE(OpenSSL REQUIRED) # Required for boost::asio::ssl #INCLUDE_DIRECTORIES("/usr/include/mysql") # dbus-1 dbus-glib-1 # doxygen #MESSAGE("") #MESSAGE(${V8_LIBRARY}) #MESSAGE(${MYSQLPP_LIBRARY}) #MESSAGE(${PANEL_LIBRARY}) #MESSAGE(${CURSES_LIBRARIES}) #MESSAGE(${CCFITS_LIBRARY}) #MESSAGE(${CFITSIO_LIBRARY}) #MESSAGE(${MYSQL_LIBRARY}) #MESSAGE(${NOVA_LIBRARY}) #MESSAGE(${READLINE_LIBRARY}) #MESSAGE(${OPENSSL_SSL_LIBRARY}) #MESSAGE("") # =============== MySQL ============ INCLUDE(GetPrerequisites) FIND_PACKAGE(MySQL++ REQUIRED) IF(NOT DEFINED MYSQL_LIBRARY AND NOT CMAKE_VERSION VERSION_LESS 3.6) GET_PREREQUISITES(${MYSQLPP_LIBRARY} MYSQL_LIBRARY 0 0 "" "") LIST(FILTER MYSQL_LIBRARY INCLUDE REGEX .*mysqlclient.*) IF (DEFINED MYSQL_LIBRARY) MESSAGE(STATUS "MySQL++ links to " ${MYSQL_LIBRARY}) ENDIF() ENDIF() FIND_PACKAGE(MySQL REQUIRED) INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR} ${MYSQLPP_INCLUDE_DIR}) # =============== BOOST ============ # 1.47.0 is the newest version available at ISDC FIND_PACKAGE(Boost 1.47.0 REQUIRED date_time filesystem program_options regex system thread) IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND Boost_VERSION LESS 106000 AND NOT NO_BOOST_HACK) MESSAGE(STATUS " BOOST_REGEX_NO_EXTERNAL_TEMPLATES") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_REGEX_NO_EXTERNAL_TEMPLATES=1") ENDIF() # At least print some information for reference FIND_PACKAGE_HANDLE_STANDARD_ARGS(Boost FOUND_VAR Boost_FOUND REQUIRED_VARS Boost_INCLUDE_DIR) # =============== QT4 ============== IF(NOT TOOLS_ONLY) FIND_PACKAGE(Qt4 REQUIRED QtCore QtGui QtOpenGL QtSql QtXml) FIND_PACKAGE(Qwt REQUIRED) ENDIF(NOT TOOLS_ONLY) # =========== Enable C++11 =========== SET(CMAKE_CXX_STANDARD 11) #ADD_DEFINITIONS(-D__CMAKE__) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Winit-self -Wpointer-arith \ -Wcast-align -Wformat=2 -Woverloaded-virtual \ -Wnon-virtual-dtor -Wshadow -Wno-unknown-pragmas") # -Wextra # -D__MARS__ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ -D_REENTRANT -D__LINUX__ \ -DHAVE_ZLIB -DHAVE_ROOT -DHAVE_V8 -DHAVE_SQL -DHAVE_NOVA -DHAVE_FITS \ -DMARSVER=\\\"${VERSION}\\\" \ -DPACKAGE_VERSION=\\\"${VERSION}\\\" \ -DREVISION=\\\"${REVISION}\\\" \ -DPACKAGE_NAME=\\\"FACT++\\\" \ -DPACKAGE_STRING=\\\"FACT++\\\" \ -DPACKAGE_URL=\\\"${PACKAGE_URL}\\\" \ -DPACKAGE_BUGREPORT=\\\"${PACKAGE_BUGREPORT}\\\"" ) # -DBOOST_DISABLE_ASSERTS \ # -DBOOST_NO_STD_LOCALE=1 \ # -DBOOST_REXEG_NO_FWD=1 \ # -DBOOST_NO_MEMBER_TEMPLATES=1 \ # -DBOOST_HAS_ABI_HEADERS=1 \ # Flags required for Dim SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -DMIPSEL -DPROTOCOL=1 -Dunix -Dlinux") # --------- ROOT ------------- # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways: # - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake # - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake") #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS) IF (DEFINED TOOLS_ONLY) FIND_PACKAGE(ROOT REQUIRED COMPONENTS) ELSE() FIND_PACKAGE(ROOT REQUIRED COMPONENTS GQt) ENDIF() IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE) FIND_PACKAGE_MESSAGE(RootFound "Found ROOT: ${ROOT_INCLUDE_DIRS}" "[${ROOT_INCLUDE_DIRS}][${ROOT_LIBRARY_DIR}]") ENDIF() #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY) IF(DEFINED ROOT_USE_FILE) FIND_PACKAGE_MESSAGE(RootInclude "Setup ROOT: ${ROOT_USE_FILE}" "[${ROOT_USE_FILE}]") INCLUDE(${ROOT_USE_FILE}) ELSE() # From RootUseFile.cmake (root 6) INCLUDE_DIRECTORIES(${ROOT_INCLUDE_DIRS}) LINK_DIRECTORIES(${ROOT_LIBRARY_DIR}) ADD_DEFINITIONS(${ROOT_DEFINITIONS}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ROOT_C_FLAGS}") SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ROOT_fortran_FLAGS}") ENDIF() # -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree # -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread # -lASImage -lMinuit -lHistPainter -lThread #MESSAGE("INCL_DIRS: ${ROOT_INCLUDE_DIRS}") #MESSAGE("LIBS: ${ROOT_LIBRARIES}") #MESSAGE("DEFS: ${ROOT_DEFINITIONS}") #MESSAGE("CXXFLAGS: ${ROOT_CXX_FLAGS}") #MESSAGE("CXFLAGS: ${ROOT_CC_FLAGS}") #MESSAGE("FOUND: ${ROOT_FOUND}") #MESSAGE("FILE: ${ROOT_USE_FILE}") #MESSAGE("DIR: ${CMAKE_CURRENT_SOURCE_DIR}") #ROOT__LIBRARY PATH Full path for each of the ROOT libraries listed in COMPONENTS #ROOT__CMD PATH Full path for each ROOT executable (rootcling, root, hadd, etc.) #ROOT_