diff --git a/.cmake-format.yaml b/.cmake-format.yaml new file mode 100644 index 0000000000..cdb5bbea52 --- /dev/null +++ b/.cmake-format.yaml @@ -0,0 +1,31 @@ +additional_commands: + foo: + flags: + - BAR + - BAZ + kwargs: + DEPENDS: '*' + HEADERS: '*' + SOURCES: '*' +algorithm_order: + - 0 + - 1 + - 2 + - 3 +always_wrap: [] +bullet_char: '*' +command_case: lower +dangle_parens: true +enable_markup: true +enum_char: . +fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$ +first_comment_is_literal: false +keyword_case: unchanged +line_ending: unix +line_width: 120 +literal_comment_pattern: null +max_subargs_per_line: 3 +ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$ +separate_ctrl_name_with_space: false +separate_fn_name_with_space: false +tab_size: 2 diff --git a/CMakeLists.txt b/CMakeLists.txt index d235e76181..7b221f1b3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,111 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.5.2 FATAL_ERROR) +# ---- CMake options ---- -### CMP0025 Compiler id for Apple Clang is now AppleClang. -### CMP0042 MACOSX_RPATH is enabled by default. +cmake_minimum_required(VERSION 3.5.2 FATAL_ERROR) -FOREACH (p - CMP0025 # CMake 3.0 - CMP0042 # CMake 3.0 - ) - IF (POLICY ${p}) - cmake_policy(SET ${p} NEW) - ENDIF () -endforeach () +# Set cmake policy by version: https://cmake.org/cmake/help/latest/manual/cmake-policies.7.html +if(${CMAKE_VERSION} VERSION_LESS 3.12) + cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) +else() + cmake_policy(VERSION 3.12) +endif() enable_testing() +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +include(CMakeParseArguments) +include(QCModulesUtils) + +# ---- Project ---- + +project( + QualityControl + VERSION + 0.6.2 # TODO update this automatically when there are new releases + DESCRIPTION + "O2 Quality Control" + LANGUAGES CXX +) + +set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib") +set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") +set(INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include") + +# ---- Compilation flags and build options ---- + +# Set the default build type to "RelWithDebInfo" +if(NOT CMAKE_BUILD_TYPE) + set( + CMAKE_BUILD_TYPE "RelWithDebInfo" + CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Coverage." + FORCE + ) +endif(NOT CMAKE_BUILD_TYPE) + +# Build targets with install rpath on Mac to dramatically speed up installation +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) +if("${isSystemDir}" STREQUAL "-1") + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CMAKE_INSTALL_RPATH "@loader_path/../lib") + endif() +endif() +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +endif() +unset(isSystemDir) + +# C++ standard +set(CMAKE_CXX_STANDARD 14) + +# Add compiler flags for warnings and (more importantly) fPIC and debug symbols +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra") + +# Set fPIC for all targets +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +# ---- Dependencies ---- + +find_package( + Boost 1.58 + COMPONENTS + container + unit_test_framework + program_options + system + log + signals +) +find_package(Git QUIET) +find_package(Configuration REQUIRED) +find_package(Monitoring REQUIRED) +find_package(MySQL REQUIRED) +find_package(Common REQUIRED) +find_package(InfoLogger REQUIRED) +find_package(DataSampling REQUIRED) +find_package(AliceO2 REQUIRED) +find_package(CURL REQUIRED) +find_package(ZeroMQ REQUIRED) +find_package(Arrow REQUIRED) +find_package(GLFW) +find_package(FairRoot REQUIRED) +find_package(FairMQ REQUIRED) +find_package(FairLogger REQUIRED) +find_package( + ROOT 6.06.02 + COMPONENTS + RHTTP + RMySQL + Gui + REQUIRED +) + +if(NOT MYSQL_FOUND) + message(WARNING "MySQL not found, the corresponding classes won't be built.") +endif() + +# ---- Subdirectories ---- + add_subdirectory(Framework) add_subdirectory(Modules) add_subdirectory(doc) diff --git a/Framework/CMakeLists.txt b/Framework/CMakeLists.txt index 9087aa53fc..d64bfbf8ca 100644 --- a/Framework/CMakeLists.txt +++ b/Framework/CMakeLists.txt @@ -1,281 +1,312 @@ -#################################### -# General project definition -#################################### - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # project specific cmake dir -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) - -project(QualityControl) - -# Load some basic macros which are needed later on -include(O2Utils) -include(QualityControlDependencies) +# ---- Files ---- + +set( + SRCS + src/TaskInterface.cxx + src/MonitorObject.cxx + src/Quality.cxx + src/ObjectsManager.cxx + src/Checker.cxx + src/CheckerDataProcessor.cxx + src/CheckerDataProcessorFactory.cxx + src/CheckInterface.cxx + src/DatabaseFactory.cxx + src/ClientDataProvider.cxx + src/AlfaReceiverForTests.cxx + src/TaskDevice.cxx + src/SpyDevice.cxx + src/SpyMainFrame.cxx + src/CcdbDatabase.cxx + src/InformationService.cxx + src/InformationServiceDump.cxx + src/TaskDataProcessor.cxx + src/TaskDataProcessorFactory.cxx + src/TaskInterfaceDPL.cxx + src/RepositoryBenchmark.cxx + src/HistoMerger.cxx +) -message(STATUS "ROOT ${ROOT_VERSION} found in '${ROOTSYS}'") -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ROOTSYS}/share/root/cmake/modules) -include(RootNewMacros) +set( + HEADERS # needed for the dictionary generation + include/QualityControl/MonitorObject.h + include/QualityControl/Quality.h + include/QualityControl/CheckInterface.h + include/QualityControl/CheckerDataProcessor.h + include/QualityControl/CheckerDataProcessorFactory.h + include/QualityControl/SpyMainFrame.h + include/QualityControl/DatabaseInterface.h + include/QualityControl/CcdbDatabase.h + include/QualityControl/TaskDataProcessor.h + include/QualityControl/TaskDataProcessorFactory.h + include/QualityControl/HistoMerger.h +) -# Set the default build type to "RelWithDebInfo" -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "RelWithDebInfo" - CACHE - STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Coverage." - FORCE) -endif (NOT CMAKE_BUILD_TYPE) +set( + SRCS_TOBJECT2JSON + src/TObject2Json.cxx + src/TObject2JsonServer.cxx + src/TObject2JsonWorker.cxx + src/TObject2JsonBackendFactory.cxx + src/TObject2JsonCcdb.cxx +) -# Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0) -set(VERSION_MAJOR "0") -set(VERSION_MINOR "0") -set(VERSION_PATCH "0") -set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) +if(MYSQL_FOUND) + list(APPEND SRCS src/MySqlDatabase.cxx) + list(APPEND SRCS_TOBJECT2JSON src/TObject2JsonMySql.cxx) +endif() -# Build targets with install rpath on Mac to dramatically speed up installation -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) -if ("${isSystemDir}" STREQUAL "-1") - if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(CMAKE_INSTALL_RPATH "@loader_path/../lib") - endif () -endif () -if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) -endif () -unset(isSystemDir) - -# C++14 -IF (CMAKE_VERSION VERSION_LESS 3.1) - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG(-std=c++14 COMPILER_SUPPORTS_CXX14) - if (COMPILER_SUPPORTS_CXX14) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") - else () - message(ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.") - endif () -ELSE () - set(CMAKE_CXX_STANDARD 14) # proper way in CMake >= 3.1 -ENDIF () - -# Add compiler flags for warnings and (more importantly) fPIC and debug symbols -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -fPIC") - -#################################### -# Module, library and executable definition -#################################### - -set(MODULE_NAME "QualityControl") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/TaskInterface.cxx - src/MonitorObject.cxx - src/Quality.cxx - src/ObjectsManager.cxx - src/Checker.cxx - src/CheckerDataProcessor.cxx - src/CheckerDataProcessorFactory.cxx - src/CheckInterface.cxx - src/DatabaseFactory.cxx - src/ClientDataProvider.cxx - src/AlfaReceiverForTests.cxx - src/TaskDevice.cxx - src/SpyDevice.cxx - src/SpyMainFrame.cxx - src/CcdbDatabase.cxx - src/InformationService.cxx - src/InformationServiceDump.cxx - src/TaskDataProcessor.cxx - src/TaskDataProcessorFactory.cxx - src/TaskInterfaceDPL.cxx - src/RepositoryBenchmark.cxx - src/HistoMerger.cxx - ) - -set(HEADERS # needed for the dictionary generation - include/QualityControl/MonitorObject.h - include/QualityControl/Quality.h - include/QualityControl/CheckInterface.h - include/QualityControl/CheckerDataProcessor.h - include/QualityControl/CheckerDataProcessorFactory.h - include/QualityControl/SpyMainFrame.h - include/QualityControl/DatabaseInterface.h - include/QualityControl/CcdbDatabase.h - include/QualityControl/TaskDataProcessor.h - include/QualityControl/TaskDataProcessorFactory.h - include/QualityControl/HistoMerger.h - ) - -set(SRCS_TOBJECT2JSON - src/TObject2Json.cxx - src/TObject2JsonServer.cxx - src/TObject2JsonWorker.cxx - src/TObject2JsonMySql.cxx - src/TObject2JsonBackendFactory.cxx - src/TObject2JsonCcdb.cxx - ) - -if (MYSQL_FOUND) - list(APPEND SRCS src/MySqlDatabase.cxx) -endif () - -#add_subdirectory(src/imgui) - -# Produce the final Version.h using template Version.h.in and substituting variables. -# We don't want to polute our source tree with it, thus putting it in binary tree. -configure_file("include/${MODULE_NAME}/Version.h.in" - "${CMAKE_CURRENT_BINARY_DIR}/include/${MODULE_NAME}/Version.h" - @ONLY - ) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/include +# Produce the final Version.h using template Version.h.in and substituting variables. We don't want to polute our source +# tree with it, thus putting it in binary tree. +configure_file( + "include/QualityControl/Version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/include/${MODULE_NAME}/Version.h" @ONLY ) -set(LIBRARY_NAME QualityControl) - -if (FAIRROOT_FOUND) - set(BUCKET_NAME o2_qualitycontrol_with_fairroot_bucket) -else () - set(BUCKET_NAME o2_qualitycontrol_bucket) -endif () +# ---- ROOT dictionary ---- + +# ROOT dictionary the following root macros expect include dirs to be set as directory property TODO how to generate +# this automatically ? ? ? +get_directory_property(include_dirs INCLUDE_DIRECTORIES) +list(APPEND include_dirs "${CMAKE_CURRENT_SOURCE_DIR}/include") +get_target_property(config_inc_dir Configuration::Configuration INTERFACE_INCLUDE_DIRECTORIES) +list(APPEND include_dirs "${config_inc_dir}") +get_target_property(arrow_inc_dir Arrow::Arrow INTERFACE_INCLUDE_DIRECTORIES) +list(APPEND include_dirs "${arrow_inc_dir}") +get_target_property(monitoring_inc_dir AliceO2::Monitoring INTERFACE_INCLUDE_DIRECTORIES) +list(APPEND include_dirs "${monitoring_inc_dir}") +get_target_property(infologger_inc_dir AliceO2::InfoLogger INTERFACE_INCLUDE_DIRECTORIES) +list(APPEND include_dirs "${infologger_inc_dir}") +get_target_property(o2_inc_dir AliceO2::AliceO2 INTERFACE_INCLUDE_DIRECTORIES) +list(APPEND include_dirs "${o2_inc_dir}") +get_target_property(common_inc_dir AliceO2::Common INTERFACE_INCLUDE_DIRECTORIES) +list(APPEND include_dirs "${common_inc_dir}") +get_target_property(boost_inc_dir Boost::container INTERFACE_INCLUDE_DIRECTORIES) +list(APPEND include_dirs "${boost_inc_dir}") +get_target_property(fairlogger_inc_dir FairLogger::FairLogger INTERFACE_INCLUDE_DIRECTORIES) +list(APPEND include_dirs "${fairlogger_inc_dir}") +list(APPEND include_dirs "${FAIRROOT_INCLUDE_DIR}") +list(APPEND include_dirs "${FairMQ_INCDIR}") +list(APPEND include_dirs "${FairMQ_INCDIR}/fairmq") +list(REMOVE_DUPLICATES include_dirs) +include_directories(${include_dirs}) + +set(dict "QualityControlDict") +set(dict_src ${CMAKE_CURRENT_BINARY_DIR}/${dict}.cxx) +set_source_files_properties(${dict_src} PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast") +set_source_files_properties(${dict_src} PROPERTIES GENERATED TRUE) + +root_generate_dictionary("${dict}" ${HEADERS} LINKDEF include/QualityControl/LinkDef.h) + +# TODO review how and what to install for dictionary +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${dict}_rdict.pcm ${CMAKE_CURRENT_BINARY_DIR}/lib${dict}.rootmap + DESTINATION lib +) -set(LINKDEF include/QualityControl/LinkDef.h) +# ---- Library ---- -O2_GENERATE_LIBRARY() +add_library(QualityControl SHARED ${SRCS} QualityControlDict.cxx) -# Task Launcher -O2_GENERATE_EXECUTABLE( - EXE_NAME qcTaskLauncher - SOURCES src/TaskDevice.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +target_include_directories( + QualityControl + PUBLIC $ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) -O2_GENERATE_EXECUTABLE( - EXE_NAME qcCheckerLauncher - SOURCES src/qcCheckerLauncher.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +target_link_libraries( + QualityControl + PUBLIC + Boost::boost + FairLogger::FairLogger + DataSampling::DataSampling + FairMQ::FairMQ + ROOT::Hist + AliceO2::Common + AliceO2::InfoLogger + AliceO2::Monitoring + Configuration::Configuration + ROOT::Net + AliceO2::AliceO2 + Boost::container + PRIVATE + Boost::system + $<$:MySQL::MySQL> + $<$:ROOT::RMySQL> + CURL::CURL + ROOT::Gui ) -O2_GENERATE_EXECUTABLE( - EXE_NAME qcSpy - SOURCES src/qcSpy.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +target_compile_definitions(QualityControl + PRIVATE + $<$:_WITH_MYSQL> ) -O2_GENERATE_EXECUTABLE( - EXE_NAME qcInfoService - SOURCES src/runInformationService.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +# ---- Executables ---- + +set( + EXE_SRCS + src/TaskDevice.cxx + src/qcCheckerLauncher.cxx + src/qcSpy.cxx + src/runInformationService.cxx + src/runInformationServiceDump.cxx + src/runTaskDPL.cxx + src/runReadoutChainTemplate.cxx + src/runMergerTest.cxx + src/runReadoutDataSampling.cxx + src/alfaTestReceiver.cxx + src/Consumer.cxx + src/runRepositoryBenchmark.cxx ) -O2_GENERATE_EXECUTABLE( - EXE_NAME qcInfoServiceDump - SOURCES src/runInformationServiceDump.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +set( + EXE_NAMES + qcTaskLauncher + qcCheckerLauncher + qcSpy + qcInfoService + qcInfoServiceDump + taskDPL + runReadoutChainTemplate + runMergerTest + runReadoutDataSampling + alfaTestReceiver + qcConsumer + repositoryBenchmark ) -O2_GENERATE_EXECUTABLE( - EXE_NAME taskDPL - SOURCES src/runTaskDPL.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +list(LENGTH EXE_SRCS count) +math(EXPR count "${count}-1") +foreach(i RANGE ${count}) + list(GET EXE_SRCS ${i} src) + list(GET EXE_NAMES ${i} name) + add_executable(${name} ${src}) + target_link_libraries(${name} PRIVATE QualityControl) +endforeach() + +# tobject2json +add_executable(tobject2json ${SRCS_TOBJECT2JSON}) +target_link_libraries(tobject2json PRIVATE QualityControl ZeroMQ::ZeroMQ $<$:MySQL::MySQL>) + +# ---- Gui ---- + +if(GLFW_FOUND) + set( + GUI_SRCS + src/imgui/imgui.cpp + src/imgui/imgui_draw.cpp + src/imgui/imgui_impl_glfw_gl3.cpp + src/imgui/gl3w.c + src/imgui/imgui_widgets.cpp + src/imgui/imgui_demo.cpp + src/imgui/BaseGui.cxx + src/DataDump.cxx + ) + + add_executable(dataDump ${GUI_SRCS}) + + target_link_libraries(dataDump PRIVATE QualityControl GLFW::GLFW) +else() + message(STATUS "GLFW not found, DataDump will not be built") +endif() + +# ---- Tests ---- + +set( + TEST_SRCS + test/testDbFactory.cxx + test/testMonitorObject.cxx + test/testPublisher.cxx + test/testQcInfoLogger.cxx + test/testQCTask.cxx + test/testQuality.cxx ) -O2_GENERATE_EXECUTABLE( - EXE_NAME runReadoutChainTemplate - SOURCES src/runReadoutChainTemplate.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) +foreach(test ${TEST_SRCS}) + get_filename_component(test_name ${test} NAME) + string(REGEX REPLACE ".cxx" "" test_name ${test_name}) -O2_GENERATE_EXECUTABLE( - EXE_NAME runMergerTest - SOURCES src/runMergerTest.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) + add_executable(${test_name} ${test}) + target_link_libraries(${test_name} PRIVATE QualityControl Boost::unit_test_framework ) + add_test(NAME ${test_name} COMMAND ${test_name}) + set_tests_properties(${test_name} PROPERTIES TIMEOUT 60) +endforeach() -O2_GENERATE_EXECUTABLE( - EXE_NAME runReadoutDataSampling - SOURCES src/runReadoutDataSampling.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) +# ---- Install ---- + +include(GNUInstallDirs) -O2_GENERATE_EXECUTABLE( - EXE_NAME alfaTestReceiver - SOURCES src/alfaTestReceiver.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +# Build targets with install rpath on Mac to dramatically speed up installation +# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + if("${isSystemDir}" STREQUAL "-1") + set(CMAKE_INSTALL_RPATH "@loader_path/../lib") + endif() + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +endif() +unset(isSystemDir) + +# Install library +install( + TARGETS QualityControl + EXPORT QualityControlTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -O2_GENERATE_EXECUTABLE( - EXE_NAME qcConsumer - SOURCES src/Consumer.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +# Create version file +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/cmake/QualityControlConfigVersion.cmake" + VERSION ${PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion ) -O2_GENERATE_EXECUTABLE( - EXE_NAME repositoryBenchmark - SOURCES src/runRepositoryBenchmark.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +# Install headers +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/QualityControl DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + +# Export targets +install( + EXPORT QualityControlTargets + FILE QualityControlTargets.cmake + NAMESPACE QualityControl:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QualityControl ) -set(TEST_SRCS - test/testDbFactory.cxx - test/testMonitorObject.cxx - test/testPublisher.cxx - test/testQcInfoLogger.cxx - test/testQCTask.cxx - test/testQuality.cxx - ) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} +# Configure and install Config files +configure_package_config_file( + ../cmake/QualityControlConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/cmake/QualityControlConfig.cmake + INSTALL_DESTINATION + "${CMAKE_INSTALL_LIBDIR}/cmake/QualityControl" + PATH_VARS + CMAKE_INSTALL_PREFIX ) -O2_GENERATE_EXECUTABLE( - EXE_NAME "tobject2json" - SOURCES ${SRCS_TOBJECT2JSON} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME "o2_qc_tobject2json" +install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/cmake/QualityControlConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/cmake/QualityControlConfigVersion.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QualityControl ) -if (GLFW_FOUND) - set(GUI_BACKEND - src/imgui/imgui.cpp - src/imgui/imgui_draw.cpp - src/imgui/imgui_impl_glfw_gl3.cpp - src/imgui/gl3w.c - src/imgui/imgui_widgets.cpp - src/imgui/imgui_demo.cpp - src/imgui/BaseGui.cxx - src/DataDump.cxx - ) - - O2_GENERATE_EXECUTABLE( - EXE_NAME dataDump - SOURCES src/runDataDump.cxx ${GUI_BACKEND} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME "dumpData_bucket" - ) -else () - message(STATUS "GLFW not found, DataDump will not be built") -endif () - - - -# Install extra scripts +# ---- Extra scripts ---- + install(PROGRAMS script/qcDatabaseSetup.sh DESTINATION bin) -install(FILES example-default.ini example-default.json alfa.json dataDump.json DESTINATION etc) -Install(FILES qcTaskDplConfig.ini qcTaskDplConfig.json readoutChainTemplate.json readoutDataSampling.json - DESTINATION etc/) +install( + FILES + example-default.ini + example-default.json + alfa.json + dataDump.json + DESTINATION etc +) +install( + FILES + qcTaskDplConfig.ini + qcTaskDplConfig.json + readoutChainTemplate.json + readoutDataSampling.json + DESTINATION etc +) diff --git a/Framework/include/QualityControl/Version.h.in b/Framework/include/QualityControl/Version.h.in index 058951d5fe..066b419589 100644 --- a/Framework/include/QualityControl/Version.h.in +++ b/Framework/include/QualityControl/Version.h.in @@ -14,16 +14,13 @@ namespace o2 { namespace quality_control { namespace core { /// The current major version. -#define QUALITYCONTROL_VERSION_MAJOR @VERSION_MAJOR@ +#define QUALITYCONTROL_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ /// The current minor version. -#define QUALITYCONTROL_VERSION_MINOR @VERSION_MINOR@ +#define QUALITYCONTROL_VERSION_MINOR @PROJECT_VERSION_MINOR@ /// The current patch level. -#define QUALITYCONTROL_VERSION_PATCH @VERSION_PATCH@ - -/// The current VCS revision. -#define QUALITYCONTROL_VCS_REVISION "@VCS_REVISION@" +#define QUALITYCONTROL_VERSION_PATCH @PROJECT_VERSION_PATCH@ /// True if the current version is newer than the given one. #define QUALITYCONTROL_VERSION_GT(MAJOR, MINOR, PATCH) \ diff --git a/Framework/src/Consumer.cxx b/Framework/src/Consumer.cxx index cc61890eff..974ffa6d7a 100644 --- a/Framework/src/Consumer.cxx +++ b/Framework/src/Consumer.cxx @@ -9,7 +9,7 @@ #include // O2 #include "Common/signalUtilities.h" -#include "QualityControl/Version.h" +//#include "QualityControl/Version.h" // boost #include #include @@ -74,14 +74,14 @@ int main(int argc, char *argv[]) std::cout << desc << std::endl; return EXIT_SUCCESS; } - if (vm.count("version")) { - std::cout << "quality_control version " << o2::quality_control::core::Version::getString() << std::endl; - return EXIT_SUCCESS; - } - if (vm.count("rev")) { - std::cout << "SVN revision : " << o2::quality_control::core::Version::getRevision() << std::endl; - return EXIT_SUCCESS; - } +// if (vm.count("version")) { +// std::cout << "quality_control version " << o2::quality_control::core::Version::getString() << std::endl; +// return EXIT_SUCCESS; +// } +// if (vm.count("rev")) { +// std::cout << "SVN revision : " << o2::quality_control::core::Version::getRevision() << std::endl; +// return EXIT_SUCCESS; +// } string configurationSource; if (vm.count("configuration")) { configurationSource = vm["configuration"].as(); diff --git a/Framework/src/TObject2Json.cxx b/Framework/src/TObject2Json.cxx index 84b9a81185..42c29ba4b8 100644 --- a/Framework/src/TObject2Json.cxx +++ b/Framework/src/TObject2Json.cxx @@ -17,6 +17,7 @@ // TObject2Json #include "TObject2JsonServer.h" #include +#include using o2::quality_control::tobject_to_json::TObject2JsonServer; diff --git a/Framework/src/TObject2JsonBackend.h b/Framework/src/TObject2JsonBackend.h index 65a55ee949..3267b5d9d9 100644 --- a/Framework/src/TObject2JsonBackend.h +++ b/Framework/src/TObject2JsonBackend.h @@ -17,10 +17,7 @@ #ifndef QC_TOBJECT2JSON_BACKEND_H #define QC_TOBJECT2JSON_BACKEND_H -// QualityControl -#include "QualityControl/MySqlDatabase.h" - -using o2::quality_control::repository::MySqlDatabase; +#include namespace o2 { namespace quality_control { diff --git a/Framework/src/TObject2JsonBackendFactory.cxx b/Framework/src/TObject2JsonBackendFactory.cxx index 100afebc43..7fc6e01263 100644 --- a/Framework/src/TObject2JsonBackendFactory.cxx +++ b/Framework/src/TObject2JsonBackendFactory.cxx @@ -15,7 +15,9 @@ #include "TObject2JsonBackendFactory.h" #include "TObject2JsonServer.h" +#ifdef _WITH_MYSQL #include "TObject2JsonMySql.h" +#endif #include "TObject2JsonCcdb.h" #include "external/UriParser.h" @@ -25,13 +27,14 @@ namespace o2 { namespace quality_control { namespace tobject_to_json { - +#ifdef _WITH_MYSQL auto getMySql(const http::url& uri) { int port = (uri.port == 0) ? 3306 : uri.port; std::string database = uri.path; database.erase(database.begin(), database.begin() + 1); return std::make_unique(uri.host, port, database, uri.user, uri.password); } +#endif auto getCcdb(const http::url& uri) { int port = (uri.port == 0) ? 3306 : uri.port; @@ -43,7 +46,9 @@ auto getCcdb(const http::url& uri) { std::unique_ptr TObject2JsonBackendFactory::Get(std::string url) { static const std::map(const http::url&)>> map = { +#ifdef _WITH_MYSQL {"mysql", getMySql}, +#endif {"ccdb", getCcdb} }; diff --git a/Framework/src/TObject2JsonServer.h b/Framework/src/TObject2JsonServer.h index 8afce45c46..438f408ccc 100644 --- a/Framework/src/TObject2JsonServer.h +++ b/Framework/src/TObject2JsonServer.h @@ -25,8 +25,6 @@ #include "TObject2JsonBackend.h" #include "zmq.h" -using o2::quality_control::repository::MySqlDatabase; - namespace o2 { namespace quality_control { namespace tobject_to_json { diff --git a/Framework/src/TObject2JsonWorker.cxx b/Framework/src/TObject2JsonWorker.cxx index 8cd2c057f9..813f1874ec 100644 --- a/Framework/src/TObject2JsonWorker.cxx +++ b/Framework/src/TObject2JsonWorker.cxx @@ -16,7 +16,6 @@ // TObject2Json #include "TObject2JsonWorker.h" -#include "TObject2JsonMySql.h" #include "QualityControl/QcInfoLogger.h" // ZMQ diff --git a/Framework/src/TObject2JsonWorker.h b/Framework/src/TObject2JsonWorker.h index b516dc703f..60b327876d 100644 --- a/Framework/src/TObject2JsonWorker.h +++ b/Framework/src/TObject2JsonWorker.h @@ -21,8 +21,6 @@ #include "TObject2JsonBackend.h" #include "zmq.h" -using o2::quality_control::repository::MySqlDatabase; - namespace o2 { namespace quality_control { namespace tobject_to_json { diff --git a/Framework/src/qcCheckerLauncher.cxx b/Framework/src/qcCheckerLauncher.cxx index 9cd7eee0d9..e6b46b24ba 100644 --- a/Framework/src/qcCheckerLauncher.cxx +++ b/Framework/src/qcCheckerLauncher.cxx @@ -28,7 +28,6 @@ #include #include "Common/signalUtilities.h" #include "QualityControl/Checker.h" -#include "QualityControl/Version.h" using namespace std; using namespace o2::quality_control::core; @@ -56,14 +55,14 @@ int main(int argc, char *argv[]) std::cout << desc << std::endl; return EXIT_SUCCESS; } - if (vm.count("version")) { - std::cout << "QualityControl version " << o2::quality_control::core::Version::getString() << std::endl; - return EXIT_SUCCESS; - } - if (vm.count("rev")) { - std::cout << "SVN revision : " << o2::quality_control::core::Version::getRevision() << std::endl; - return EXIT_SUCCESS; - } +// if (vm.count("version")) { +// std::cout << "QualityControl version " << o2::quality_control::core::Version::getString() << std::endl; +// return EXIT_SUCCESS; +// } +// if (vm.count("rev")) { +// std::cout << "SVN revision : " << o2::quality_control::core::Version::getRevision() << std::endl; +// return EXIT_SUCCESS; +// } if (vm.count("name")) { checkerName = vm["name"].as(); } else { diff --git a/Framework/test/testDbFactory.cxx b/Framework/test/testDbFactory.cxx index 40c6c9276e..83de407904 100644 --- a/Framework/test/testDbFactory.cxx +++ b/Framework/test/testDbFactory.cxx @@ -1,5 +1,5 @@ /// -/// \file Publisher_test.cpp +/// \file testDbFactory.cxx /// \author Barthelemy von Haller /// diff --git a/Modules/CMakeLists.txt b/Modules/CMakeLists.txt index 8e87b01ac3..f6cfbc1ad1 100644 --- a/Modules/CMakeLists.txt +++ b/Modules/CMakeLists.txt @@ -1,84 +1,7 @@ -#################################### -# General project definition -#################################### - -CMAKE_MINIMUM_REQUIRED(VERSION 3.5.2 FATAL_ERROR) - -### CMP0025 Compiler id for Apple Clang is now AppleClang. -### CMP0042 MACOSX_RPATH is enabled by default. - -FOREACH (p - CMP0025 # CMake 3.0 - CMP0042 # CMake 3.0 - ) - IF (POLICY ${p}) - cmake_policy(SET ${p} NEW) - ENDIF () -endforeach () - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) - -project(QualityControlModules) - -# Load some basic macros which are needed later on -include(O2Utils) -include(QualityControlDependencies) - -if(ROOT_FOUND) - message(STATUS "ROOT ${ROOT_VERSION} found in '${ROOTSYS}'") - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ROOTSYS}/share/root/cmake/modules) - include(RootNewMacros) -else() - message(WARNING "ROOT not found, we won't compile the QC modules (skip, no error)") - return() -endif() - -# Set the default build type to "RelWithDebInfo" -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "RelWithDebInfo" - CACHE - STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Coverage." - FORCE) -endif(NOT CMAKE_BUILD_TYPE) - -# Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0) -set(VERSION_MAJOR "0") -set(VERSION_MINOR "0") -set(VERSION_PATCH "0") -set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) - -# Build targets with install rpath on Mac to dramatically speed up installation -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) -if("${isSystemDir}" STREQUAL "-1") - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(CMAKE_INSTALL_RPATH "@loader_path/../lib") - endif() -endif() -if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) -endif() -unset(isSystemDir) - -# C++14 -IF (CMAKE_VERSION VERSION_LESS 3.1) - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG(-std=c++14 COMPILER_SUPPORTS_CXX14) - if (COMPILER_SUPPORTS_CXX14) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") - else () - message(ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.") - endif () -ELSE () - set(CMAKE_CXX_STANDARD 14) # proper way in CMake >= 3.1 -ENDIF () - -# Add compiler flags for warnings and (more importantly) fPIC and debug symbols -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -fPIC") +# ---- Module directories ---- add_subdirectory(Common) +add_subdirectory(Daq) add_subdirectory(Example) add_subdirectory(Skeleton) -add_subdirectory(Daq) -#add_subdirectory(ITS) add_subdirectory(SkeletonDPL) diff --git a/Modules/Common/CMakeLists.txt b/Modules/Common/CMakeLists.txt index e262abe8c3..d6b27cce51 100644 --- a/Modules/Common/CMakeLists.txt +++ b/Modules/Common/CMakeLists.txt @@ -1,34 +1,60 @@ set(MODULE_NAME "QcCommon") -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/NonEmpty.cxx - src/MeanIsAbove.cxx +# ---- Dependencies ---- + +find_package( + ROOT 6.06.02 + COMPONENTS + RHTTP + RMySQL + Gui + REQUIRED ) +find_package(Boost 1.58 COMPONENTS unit_test_framework) -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/include -) +# ---- Files ---- -set(HEADERS - include/Common/NonEmpty.h - include/Common/MeanIsAbove.h - ) +set(SRCS src/NonEmpty.cxx src/MeanIsAbove.cxx) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME o2_qcmodules_common) -set(LINKDEF include/Common/LinkDef.h) +set(HEADERS include/Common/NonEmpty.h include/Common/MeanIsAbove.h) -O2_GENERATE_LIBRARY() +# Produce the final Version.h using template Version.h.in and substituting variables. We don't want to polute our source +# tree with it, thus putting it in binary tree. +configure_file("include/Common/Version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/include/Common/Version.h" @ONLY) -set(TEST_SRCS - test/testMeanIsAbove.cxx - test/testNonEmpty.cxx -) +# ---- Library ---- -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} +add_library(${MODULE_NAME} SHARED ${SRCS} ${MODULE_NAME}Dict.cxx) + +target_include_directories( + ${MODULE_NAME} + PUBLIC $ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) + +target_link_libraries(${MODULE_NAME} PUBLIC QualityControl PRIVATE ROOT::Graf) + +# ---- ROOT dictionary ---- + +generate_root_dict(MODULE_NAME ${MODULE_NAME} LINKDEF "include/Common/LinkDef.h" DICT_CLASS "${MODULE_NAME}Dict") + +# ---- Tests ---- + +set(TEST_SRCS test/testMeanIsAbove.cxx test/testNonEmpty.cxx) + +foreach(test ${TEST_SRCS}) + get_filename_component(test_name ${test} NAME) + string( + REGEX + REPLACE + ".cxx" + "" + test_name + ${test_name} + ) + + add_executable(${test_name} ${test}) + target_link_libraries(${test_name} PRIVATE ${MODULE_NAME} Boost::unit_test_framework) + add_test(NAME ${test_name} COMMAND ${test_name}) + set_tests_properties(${test_name} PROPERTIES TIMEOUT 60) +endforeach() diff --git a/Modules/Daq/CMakeLists.txt b/Modules/Daq/CMakeLists.txt index 43a0c883b2..9d5ea9194b 100644 --- a/Modules/Daq/CMakeLists.txt +++ b/Modules/Daq/CMakeLists.txt @@ -1,33 +1,45 @@ set(MODULE_NAME "QcDaq") -O2_SETUP(NAME ${MODULE_NAME}) +# ---- Files ---- -set(SRCS - src/DaqTask.cxx - src/EverIncreasingGraph.cxx - ) +set( + SRCS + src/DaqTask.cxx + src/EverIncreasingGraph.cxx +) -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/include +set( + HEADERS + include/Daq/DaqTask.h + include/Daq/EverIncreasingGraph.h ) -set(HEADERS - include/Daq/DaqTask.h - include/Daq/EverIncreasingGraph.h - ) +# ---- Library ---- + +add_library(${MODULE_NAME} SHARED ${SRCS} ${MODULE_NAME}Dict.cxx) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME o2_qcmodules_base) -set(LINKDEF include/Daq/LinkDef.h) +target_include_directories( + ${MODULE_NAME} + PUBLIC $ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) -O2_GENERATE_LIBRARY() +target_link_libraries(${MODULE_NAME} PUBLIC QualityControl PRIVATE ROOT::Gpad) -set(TEST_SRCS - test/testQcDaq.cxx - ) +# ---- ROOT dictionary ---- -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +generate_root_dict(MODULE_NAME ${MODULE_NAME} LINKDEF "include/Daq/LinkDef.h" DICT_CLASS "${MODULE_NAME}Dict") + +# ---- Tests ---- + +set(TEST_SRCS test/testQcDaq.cxx) + +foreach(test ${TEST_SRCS}) + get_filename_component(test_name ${test} NAME) + string(REGEX REPLACE ".cxx" "" test_name ${test_name}) + + add_executable(${test_name} ${test}) + target_link_libraries(${test_name} PRIVATE ${MODULE_NAME} Boost::unit_test_framework) + add_test(NAME ${test_name} COMMAND ${test_name}) + set_tests_properties(${test_name} PROPERTIES TIMEOUT 60) +endforeach() diff --git a/Modules/Example/CMakeLists.txt b/Modules/Example/CMakeLists.txt index 84f10d5708..1f1a2ba314 100644 --- a/Modules/Example/CMakeLists.txt +++ b/Modules/Example/CMakeLists.txt @@ -1,36 +1,47 @@ set(MODULE_NAME "QcExample") -O2_SETUP(NAME ${MODULE_NAME}) +# ---- Files ---- -set(SRCS - src/BenchmarkTask.cxx - src/ExampleTask.cxx - src/FakeCheck.cxx - ) +set( + SRCS + src/BenchmarkTask.cxx + src/ExampleTask.cxx + src/FakeCheck.cxx +) -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/include +set( + HEADERS + include/Example/BenchmarkTask.h + include/Example/ExampleTask.h + include/Example/FakeCheck.h ) -set(HEADERS - include/Example/BenchmarkTask.h - include/Example/ExampleTask.h - include/Example/FakeCheck.h - ) +# ---- Library ---- + +add_library(${MODULE_NAME} SHARED ${SRCS} ${MODULE_NAME}Dict.cxx) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME o2_qcmodules_example) -set(LINKDEF include/Example/LinkDef.h) +target_include_directories( + ${MODULE_NAME} + PUBLIC $ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) -O2_GENERATE_LIBRARY() +target_link_libraries(${MODULE_NAME} PUBLIC QualityControl) -set(TEST_SRCS - test/testFactory.cxx - test/testQcExample.cxx - ) +# ---- ROOT dictionary ---- -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +generate_root_dict(MODULE_NAME ${MODULE_NAME} LINKDEF "include/Example/LinkDef.h" DICT_CLASS "${MODULE_NAME}Dict") + +# ---- Tests ---- + +set(TEST_SRCS test/testFactory.cxx test/testQcExample.cxx) + +foreach(test ${TEST_SRCS}) + get_filename_component(test_name ${test} NAME) + string(REGEX REPLACE ".cxx" "" test_name ${test_name}) + + add_executable(${test_name} ${test}) + target_link_libraries(${test_name} PRIVATE ${MODULE_NAME} Boost::unit_test_framework) + add_test(NAME ${test_name} COMMAND ${test_name}) + set_tests_properties(${test_name} PROPERTIES TIMEOUT 60) +endforeach() diff --git a/Modules/ITS/.gitignore b/Modules/ITS/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Modules/Skeleton/CMakeLists.txt b/Modules/Skeleton/CMakeLists.txt index 90d5e13285..f86ef85f11 100644 --- a/Modules/Skeleton/CMakeLists.txt +++ b/Modules/Skeleton/CMakeLists.txt @@ -1,33 +1,45 @@ set(MODULE_NAME "QcSkeleton") -O2_SETUP(NAME ${MODULE_NAME}) +# ---- Files ---- -set(SRCS - src/SkeletonTask.cxx - src/SkeletonCheck.cxx - ) +set( + SRCS + src/SkeletonTask.cxx + src/SkeletonCheck.cxx +) -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/include +set( + HEADERS + include/Skeleton/SkeletonTask.h + include/Skeleton/SkeletonCheck.h ) -set(HEADERS - include/Skeleton/SkeletonTask.h - include/Skeleton/SkeletonCheck.h - ) +# ---- Library ---- + +add_library(${MODULE_NAME} SHARED ${SRCS} ${MODULE_NAME}Dict.cxx) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME o2_qcmodules_base) -set(LINKDEF include/Skeleton/LinkDef.h) +target_include_directories( + ${MODULE_NAME} + PUBLIC $ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) -O2_GENERATE_LIBRARY() +target_link_libraries(${MODULE_NAME} PUBLIC QualityControl) -set(TEST_SRCS - test/testQcSkeleton.cxx - ) +# ---- ROOT dictionary ---- -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +generate_root_dict(MODULE_NAME ${MODULE_NAME} LINKDEF "include/Skeleton/LinkDef.h" DICT_CLASS "${MODULE_NAME}Dict") + +# ---- Tests ---- + +set(TEST_SRCS test/testQcSkeleton.cxx) + +foreach(test ${TEST_SRCS}) + get_filename_component(test_name ${test} NAME) + string(REGEX REPLACE ".cxx" "" test_name ${test_name}) + + add_executable(${test_name} ${test}) + target_link_libraries(${test_name} PRIVATE ${MODULE_NAME} Boost::unit_test_framework) + add_test(NAME ${test_name} COMMAND ${test_name}) + set_tests_properties(${test_name} PROPERTIES TIMEOUT 60) +endforeach() diff --git a/Modules/SkeletonDPL/CMakeLists.txt b/Modules/SkeletonDPL/CMakeLists.txt index 86e097397d..bba38364fd 100644 --- a/Modules/SkeletonDPL/CMakeLists.txt +++ b/Modules/SkeletonDPL/CMakeLists.txt @@ -1,33 +1,45 @@ set(MODULE_NAME "QcSkeletonDpl") -O2_SETUP(NAME ${MODULE_NAME}) +# ---- Files ---- -set(SRCS - src/SkeletonTaskDPL.cxx - src/SkeletonCheckDPL.cxx - ) +set( + SRCS + src/SkeletonTaskDPL.cxx + src/SkeletonCheckDPL.cxx +) -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/include +set( + HEADERS + include/SkeletonDPL/SkeletonTaskDPL.h + include/SkeletonDPL/SkeletonCheckDPL.h ) -set(HEADERS - include/SkeletonDPL/SkeletonTaskDPL.h - include/SkeletonDPL/SkeletonCheckDPL.h - ) +# ---- Library ---- + +add_library(${MODULE_NAME} SHARED ${SRCS} ${MODULE_NAME}Dict.cxx) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME o2_qcmodules_dpl) -set(LINKDEF include/SkeletonDPL/LinkDef.h) +target_include_directories( + ${MODULE_NAME} + PUBLIC $ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) -O2_GENERATE_LIBRARY() +target_link_libraries(${MODULE_NAME} PUBLIC QualityControl) -set(TEST_SRCS - test/testQcSkeletonDPL.cxx - ) +# ---- ROOT dictionary ---- -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +generate_root_dict(MODULE_NAME ${MODULE_NAME} LINKDEF "include/SkeletonDPL/LinkDef.h" DICT_CLASS "${MODULE_NAME}Dict") + +# ---- Tests ---- + +set(TEST_SRCS test/testQcSkeletonDPL.cxx) + +foreach(test ${TEST_SRCS}) + get_filename_component(test_name ${test} NAME) + string(REGEX REPLACE ".cxx" "" test_name ${test_name}) + + add_executable(${test_name} ${test}) + target_link_libraries(${test_name} PRIVATE ${MODULE_NAME} Boost::unit_test_framework) + add_test(NAME ${test_name} COMMAND ${test_name}) + set_tests_properties(${test_name} PROPERTIES TIMEOUT 60) +endforeach() diff --git a/cmake/FindAliceO2.cmake b/cmake/FindAliceO2.cmake index 5f8c05f75a..6b5d592e26 100644 --- a/cmake/FindAliceO2.cmake +++ b/cmake/FindAliceO2.cmake @@ -18,6 +18,7 @@ find_path(AliceO2_INCLUDE_DIR runDataProcessing.h # Remove the final "Headers" get_filename_component(AliceO2_INCLUDE_DIR ${AliceO2_INCLUDE_DIR} DIRECTORY) set(AliceO2_INCLUDE_DIRS ${AliceO2_INCLUDE_DIR}) +list(APPEND AliceO2_INCLUDE_DIRS ${MS_GSL_INCLUDE_DIR}) # find libraries find_library(AliceO2_LIBRARY_FRAMEWORK NAMES Framework HINTS ${O2_ROOT}/lib ENV LD_LIBRARY_PATH) @@ -34,6 +35,16 @@ find_package_handle_standard_args(AliceO2 "AliceO2 could not be found. Install if(${AliceO2_FOUND}) message(STATUS "AliceO2 found, libraries: ${AliceO2_LIBRARIES}") + + mark_as_advanced(AliceO2_INCLUDE_DIRS AliceO2_LIBRARIES) + + # add target + if(NOT TARGET AliceO2::AliceO2) + add_library(AliceO2::AliceO2 INTERFACE IMPORTED) + set_target_properties(AliceO2::AliceO2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${AliceO2_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${AliceO2_LIBRARIES}" + ) + endif() endif() -mark_as_advanced(AliceO2_INCLUDE_DIRS AliceO2_LIBRARIES) \ No newline at end of file diff --git a/cmake/FindArrow.cmake b/cmake/FindArrow.cmake index 3d5d37a909..b5475494f0 100644 --- a/cmake/FindArrow.cmake +++ b/cmake/FindArrow.cmake @@ -101,6 +101,14 @@ if (ARROW_FOUND) message(STATUS "Found the Arrow library: ${ARROW_LIB_PATH}") endif () endif () + # add target + if(NOT TARGET Arrow::Arrow) + add_library(Arrow::Arrow INTERFACE IMPORTED) + set_target_properties(Arrow::Arrow PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${ARROW_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${ARROW_LIB_PATH}" + ) + endif() else() if (NOT Arrow_FIND_QUIETLY) set(ARROW_ERR_MSG "Could not find the Arrow library. Looked for headers") diff --git a/cmake/FindCURL.cmake b/cmake/FindCURL.cmake new file mode 100644 index 0000000000..c102f36b5f --- /dev/null +++ b/cmake/FindCURL.cmake @@ -0,0 +1,67 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindCURL +# -------- +# +# Find curl +# +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``CURL::CURL``, if +# curl has been found. +# +# Find the native CURL headers and libraries. +# +# :: +# +# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc. +# CURL_LIBRARIES - List of libraries when using curl. +# CURL_FOUND - True if curl found. +# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8) + +# Look for the header file. +find_path(CURL_INCLUDE_DIR NAMES curl/curl.h) +mark_as_advanced(CURL_INCLUDE_DIR) + +# Look for the library (sorted from most current/relevant entry to least). +find_library(CURL_LIBRARY NAMES + curl + # Windows MSVC prebuilts: + curllib + libcurl_imp + curllib_static + # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): + libcurl +) +mark_as_advanced(CURL_LIBRARY) + +if(CURL_INCLUDE_DIR) + foreach(_curl_version_header curlver.h curl.h) + if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}") + file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"") + + string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}") + unset(curl_version_str) + break() + endif() + endforeach() +endif() + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL + REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR + VERSION_VAR CURL_VERSION_STRING) + +if(CURL_FOUND) + set(CURL_LIBRARIES ${CURL_LIBRARY}) + set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) + + if(NOT TARGET CURL::CURL) + add_library(CURL::CURL UNKNOWN IMPORTED) + set_target_properties(CURL::CURL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + set_property(TARGET CURL::CURL APPEND PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") + endif() +endif() diff --git a/cmake/FindCommon.cmake b/cmake/FindCommon.cmake index 6894dd8454..195abbbfba 100644 --- a/cmake/FindCommon.cmake +++ b/cmake/FindCommon.cmake @@ -31,6 +31,16 @@ find_package_handle_standard_args(Common "Common could not be found. Install pa if(${COMMON_FOUND}) message(STATUS "Common found : ${Common_LIBRARIES}") + + # add target + if(NOT TARGET AliceO2::Common) + add_library(AliceO2::Common INTERFACE IMPORTED) + set_target_properties(AliceO2::Common PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${COMMON_LIBRARY}" + ) + endif() + + mark_as_advanced(COMMON_INCLUDE_DIR COMMON_LIBRARY) endif() -mark_as_advanced(COMMON_INCLUDE_DIR COMMON_LIBRARY) diff --git a/cmake/FindConfiguration.cmake b/cmake/FindConfiguration.cmake index 2748e23801..7a83a43377 100644 --- a/cmake/FindConfiguration.cmake +++ b/cmake/FindConfiguration.cmake @@ -31,6 +31,15 @@ find_package_handle_standard_args(Configuration "Configuration could not be fou if(${CONFIGURATION_FOUND}) message(STATUS "Configuration found : ${Configuration_LIBRARIES}") + mark_as_advanced(CONFIGURATION_INCLUDE_DIR CONFIGURATION_LIBRARY) + + # add target + if(NOT TARGET Configuration::Configuration) + add_library(Configuration::Configuration INTERFACE IMPORTED) + set_target_properties(Configuration::Configuration PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Configuration_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${Configuration_LIBRARIES}" + ) + endif() endif() -mark_as_advanced(CONFIGURATION_INCLUDE_DIR CONFIGURATION_LIBRARY) diff --git a/cmake/FindDataSampling.cmake b/cmake/FindDataSampling.cmake index 49c1ccccd6..32c432560c 100644 --- a/cmake/FindDataSampling.cmake +++ b/cmake/FindDataSampling.cmake @@ -31,6 +31,15 @@ find_package_handle_standard_args(DataSampling "DataSampling could not be found if(${DataSampling_FOUND}) message(STATUS "DataSampling found : ${DataSampling_LIBRARIES}") -endif() -mark_as_advanced(DATASAMPLING_INCLUDE_DIR DATASAMPLING_LIBRARY) + # add target + if(NOT TARGET DataSampling::DataSampling) + add_library(DataSampling::DataSampling INTERFACE IMPORTED) + set_target_properties(DataSampling::DataSampling PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${DATASAMPLING_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${DataSampling_LIBRARIES}" + ) + endif() + + mark_as_advanced(DATASAMPLING_INCLUDE_DIR DATASAMPLING_LIBRARY) +endif() diff --git a/cmake/FindFairMQInFairRoot.cmake b/cmake/FindFairMQInFairRoot.cmake deleted file mode 100644 index 60aef797bf..0000000000 --- a/cmake/FindFairMQInFairRoot.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# DEPRECATED: Remove this file, once we require FairMQ 1.2+ -# -# Simple check for availability of FairMQ -# -# The FairMQ module of FairRoot might be disabled in the built of FairRoot -# due to missing dependencies, e.g ZeroMQ and boost. Those dependencies -# also have to be available in the required (minimal) version. -# - -if(FairRoot_DIR) - set(FAIRROOTPATH ${FairRoot_DIR}) -else() - set(FAIRROOTPATH $ENV{FAIRROOTPATH}) -endif(FairRoot_DIR) - -if(FAIRROOTPATH) - if(NOT FairMQInFairRoot_FIND_QUIETLY) - MESSAGE(STATUS "FairRoot ... - found ${FAIRROOTPATH}") - endif(NOT FairMQInFairRoot_FIND_QUIETLY) -else() - if(NOT FairMQInFairRoot_FIND_QUIETLY) - MESSAGE(FATAL_ERROR "FairRoot installation not found") - endif(NOT FairMQInFairRoot_FIND_QUIETLY) -endif(FAIRROOTPATH) - -set(FAIRMQ_REQUIRED_HEADERS FairMQDevice.h) -if(NOT FairMQInFairRoot_FIND_QUIETLY) - message(STATUS "Looking for FairMQ functionality in FairRoot ...") -endif(NOT FairMQInFairRoot_FIND_QUIETLY) - -find_path(FAIRMQ_INCLUDE_DIR NAMES ${FAIRMQ_REQUIRED_HEADERS} - PATHS ${FAIRROOTPATH}/include/fairmq - NO_DEFAULT_PATH -) - -# search once more in the system if not yet found -find_path(FAIRMQ_INCLUDE_DIR NAMES ${FAIRMQ_REQUIRED_HEADERS} -) - -if(FAIRMQ_INCLUDE_DIR) - if(NOT FairMQInFairRoot_FIND_QUIETLY) - message(STATUS "Looking for FairMQ functionality in FairRoot: yes") - endif(NOT FairMQInFairRoot_FIND_QUIETLY) - set(FAIRMQ_FOUND TRUE) - set(FairMQInFairRoot_FOUND TRUE) -else(FAIRMQ_INCLUDE_DIR) - if(FairMQInFairRoot_FIND_REQUIRED) - message(FATAL_ERROR "FairRoot is not built with FairMQ support") - else(FairMQInFairRoot_FIND_REQUIRED) - if(NOT FairMQInFairRoot_FIND_QUIETLY) - message(STATUS "Looking for FairMQ functionality in FairRoot: no") - endif(NOT FairMQInFairRoot_FIND_QUIETLY) - endif(FairMQInFairRoot_FIND_REQUIRED) -endif(FAIRMQ_INCLUDE_DIR) diff --git a/cmake/FindFairRoot.cmake b/cmake/FindFairRoot.cmake index dcb2a22f0f..b07856cd05 100644 --- a/cmake/FindFairRoot.cmake +++ b/cmake/FindFairRoot.cmake @@ -5,61 +5,61 @@ # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ -# Find FairRoot installation -# Check the environment variable "FAIRROOTPATH" + # Find FairRoot installation + # Check the environment variable "FAIRROOTPATH" -if(FairRoot_DIR) - set(FAIRROOTPATH ${FairRoot_DIR}) -else() - if(NOT DEFINED ENV{FAIRROOTPATH}) - set(user_message "You did not define the environment variable FAIRROOTPATH which is needed to find FairRoot.\ + if(FairRoot_DIR) + set(FAIRROOTPATH ${FairRoot_DIR}) + else() + if(NOT DEFINED ENV{FAIRROOTPATH}) + set(user_message "You did not define the environment variable FAIRROOTPATH which is needed to find FairRoot.\ Please set this variable and execute cmake again." ) - if(FairRoot_FIND_REQUIRED) - MESSAGE(FATAL_ERROR ${user_message}) - else(FairRoot_FIND_REQUIRED) - MESSAGE(WARNING ${user_message}) - return() - endif(FairRoot_FIND_REQUIRED) - endif(NOT DEFINED ENV{FAIRROOTPATH}) + if(FairRoot_FIND_REQUIRED) + MESSAGE(FATAL_ERROR ${user_message}) + else(FairRoot_FIND_REQUIRED) + MESSAGE(WARNING ${user_message}) + return() + endif(FairRoot_FIND_REQUIRED) + endif(NOT DEFINED ENV{FAIRROOTPATH}) - set(FAIRROOTPATH $ENV{FAIRROOTPATH}) -endif() + set(FAIRROOTPATH $ENV{FAIRROOTPATH}) + endif() -MESSAGE(STATUS "Setting FairRoot environment…") + MESSAGE(STATUS "Setting FairRoot environment…") -FIND_PATH(FAIRROOT_INCLUDE_DIR NAMES FairRun.h PATHS - ${FAIRROOTPATH}/include - NO_DEFAULT_PATH -) + FIND_PATH(FAIRROOT_INCLUDE_DIR NAMES FairRun.h PATHS + ${FAIRROOTPATH}/include + NO_DEFAULT_PATH + ) -FIND_PATH(FAIRROOT_LIBRARY_DIR NAMES libBase.so libBase.dylib PATHS - ${FAIRROOTPATH}/lib - NO_DEFAULT_PATH -) + FIND_PATH(FAIRROOT_LIBRARY_DIR NAMES libBase.so libBase.dylib PATHS + ${FAIRROOTPATH}/lib + NO_DEFAULT_PATH + ) -FIND_PATH(FAIRROOT_CMAKEMOD_DIR NAMES CMakeLists.txt PATHS - ${FAIRROOTPATH}/share/fairbase/cmake - NO_DEFAULT_PATH -) + FIND_PATH(FAIRROOT_CMAKEMOD_DIR NAMES CMakeLists.txt PATHS + ${FAIRROOTPATH}/share/fairbase/cmake + NO_DEFAULT_PATH + ) -# look for exported FairMQ targets and include them -find_file(_fairroot_fairmq_cmake - NAMES FairMQ.cmake - HINTS ${FAIRROOTPATH}/include/cmake -) -if(_fairroot_fairmq_cmake) - include(${_fairroot_fairmq_cmake}) -endif() + # look for exported FairMQ targets and include them + find_file(_fairroot_fairmq_cmake + NAMES FairMQ.cmake + HINTS ${FAIRROOTPATH}/include/cmake + ) + if(_fairroot_fairmq_cmake) + include(${_fairroot_fairmq_cmake}) + endif() -if(FAIRROOT_INCLUDE_DIR AND FAIRROOT_LIBRARY_DIR) - set(FAIRROOT_FOUND TRUE) - MESSAGE(STATUS "FairRoot ... - found ${FAIRROOTPATH}") - MESSAGE(STATUS "FairRoot Library directory : ${FAIRROOT_LIBRARY_DIR}") - MESSAGE(STATUS "FairRoot Include path… : ${FAIRROOT_INCLUDE_DIR}") - MESSAGE(STATUS "FairRoot Cmake Modules : ${FAIRROOT_CMAKEMOD_DIR}") + if(FAIRROOT_INCLUDE_DIR AND FAIRROOT_LIBRARY_DIR) + set(FAIRROOT_FOUND TRUE) + MESSAGE(STATUS "FairRoot ... - found ${FAIRROOTPATH}") + MESSAGE(STATUS "FairRoot Library directory : ${FAIRROOT_LIBRARY_DIR}") + MESSAGE(STATUS "FairRoot Include path… : ${FAIRROOT_INCLUDE_DIR}") + MESSAGE(STATUS "FairRoot Cmake Modules : ${FAIRROOT_CMAKEMOD_DIR}") -else(FAIRROOT_INCLUDE_DIR AND FAIRROOT_LIBRARY_DIR) - set(FAIRROOT_FOUND FALSE) - MESSAGE(FATAL_ERROR "FairRoot installation not found") -endif (FAIRROOT_INCLUDE_DIR AND FAIRROOT_LIBRARY_DIR) + else(FAIRROOT_INCLUDE_DIR AND FAIRROOT_LIBRARY_DIR) + set(FAIRROOT_FOUND FALSE) + MESSAGE(FATAL_ERROR "FairRoot installation not found") + endif (FAIRROOT_INCLUDE_DIR AND FAIRROOT_LIBRARY_DIR) diff --git a/cmake/FindGLFW.cmake b/cmake/FindGLFW.cmake index d761b65538..30ae99aec0 100644 --- a/cmake/FindGLFW.cmake +++ b/cmake/FindGLFW.cmake @@ -276,3 +276,12 @@ mark_as_advanced( GLFW_glfw_LIBRARY GLFW_cocoa_LIBRARY ) + +# add target +if(NOT TARGET GLFW::GLFW) + add_library(GLFW::GLFW INTERFACE IMPORTED) + set_target_properties(GLFW::GLFW PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GLFW_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${GLFW_LIBRARIES}" + ) +endif() \ No newline at end of file diff --git a/cmake/FindInfoLogger.cmake b/cmake/FindInfoLogger.cmake index 23c0b87244..e36ed59baa 100644 --- a/cmake/FindInfoLogger.cmake +++ b/cmake/FindInfoLogger.cmake @@ -31,6 +31,15 @@ find_package_handle_standard_args(InfoLogger "InfoLogger could not be found. In if(${InfoLogger_FOUND}) message(STATUS "InfoLogger found : ${InfoLogger_LIBRARIES}") + mark_as_advanced(INFOLOGGER_INCLUDE_DIR INFOLOGGER_LIBRARY) + + # add target + if(NOT TARGET AliceO2::InfoLogger) + add_library(AliceO2::InfoLogger INTERFACE IMPORTED) + set_target_properties(AliceO2::InfoLogger PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${INFOLOGGER_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${INFOLOGGER_LIBRARY}" + ) + endif() endif() -mark_as_advanced(INFOLOGGER_INCLUDE_DIR INFOLOGGER_LIBRARY) diff --git a/cmake/FindMonitoring.cmake b/cmake/FindMonitoring.cmake deleted file mode 100644 index 175d5d4702..0000000000 --- a/cmake/FindMonitoring.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# - Tries to find the O2 Monitoring package (include dir and library) -# Author: Barthelemy von Haller -# Author: Adam Wegrzynek -# -# -# This module will set the following non-cached variables: -# Monitoring_FOUND - states whether Monitoring package has been found -# Monitoring_INCLUDE_DIRS - Monitoring include directory -# Monitoring_LIBRARIES - Monitoring library filepath -# Monitoring_DEFINITIONS - Compiler definitions when comping code using Monitoring -# -# Also following cached variables, but not for general use, are defined: -# MONITORING_INCLUDE_DIR -# MONITORING_LIBRARY -# -# This module respects following variables: -# Monitoring_ROOT - Installation root directory (otherwise it goes through LD_LIBRARY_PATH and ENV) - -# Init -include(FindPackageHandleStandardArgs) - -# find includes -find_path(MONITORING_INCLUDE_DIR Monitoring.h - HINTS ${Monitoring_ROOT}/include ENV LD_LIBRARY_PATH PATH_SUFFIXES "../include/Monitoring" "../../include/Monitoring" ) - -# Remove the final "Monitoring" -get_filename_component(MONITORING_INCLUDE_DIR ${MONITORING_INCLUDE_DIR} DIRECTORY) -set(Monitoring_INCLUDE_DIRS ${MONITORING_INCLUDE_DIR}) - -# find library -find_library(MONITORING_LIBRARY NAMES Monitoring HINTS ${Monitoring_ROOT}/lib ENV LD_LIBRARY_PATH) -set(Monitoring_LIBRARIES ${MONITORING_LIBRARY}) - -# handle the QUIETLY and REQUIRED arguments and set Monitoring_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(Monitoring "Monitoring could not be found. Set Monitoring_ROOT as root installation directory." - MONITORING_LIBRARY MONITORING_INCLUDE_DIR) -if(${Monitoring_FOUND}) - set(Monitoring_DEFINITIONS "") - message(STATUS "Monitoring found : ${Monitoring_LIBRARIES}") -endif() - -mark_as_advanced(MONITORING_INCLUDE_DIR MONITORING_LIBRARY) diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake index 2445b33a01..b1bd25a383 100644 --- a/cmake/FindMySQL.cmake +++ b/cmake/FindMySQL.cmake @@ -34,6 +34,20 @@ ENDIF (MYSQL_INCLUDE_DIRS AND MYSQL_LIBRARY) IF (MYSQL_FOUND) MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARY}") + + MARK_AS_ADVANCED( + MYSQL_LIBRARY + MYSQL_INCLUDE_DIRS + ) + + # add target + if(NOT TARGET MySQL::MySQL) + add_library(MySQL::MySQL INTERFACE IMPORTED) + set_target_properties(MySQL::MySQL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${MYSQL_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${MYSQL_LIBRARY}" + ) + endif() ELSE (MYSQL_FOUND) IF (MYSQL_FIND_REQUIRED) MESSAGE(STATUS "Looked for MySQL libraries named ${MYSQL_NAMES}.") @@ -41,7 +55,4 @@ ELSE (MYSQL_FOUND) ENDIF (MYSQL_FIND_REQUIRED) ENDIF (MYSQL_FOUND) -MARK_AS_ADVANCED( - MYSQL_LIBRARY - MYSQL_INCLUDE_DIRS -) + diff --git a/cmake/FindROOT.cmake b/cmake/FindROOT.cmake index 094a89a975..598248d315 100644 --- a/cmake/FindROOT.cmake +++ b/cmake/FindROOT.cmake @@ -1,174 +1,38 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence version 3 (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ -# - Find ROOT instalation -# This module tries to find the ROOT installation on your system. -# It tries to find the root-config script which gives you all the needed -# information. -# If the system variable ROOTSYS is set this is straight forward. -# If not the module uses the pathes given in ROOT_CONFIG_SEARCHPATH. -# If you need an other path you should add this path to this varaible. -# The root-config script is then used to detect basically everything else. -# This module defines a number of key variables and macros. -# -# Variables defined by this module: -# -# ROOT_FOUND System has ROOT, this means the root-config -# executable was found. -# -# ROOT_INCLUDE_DIR ROOT include directories: not cached -# -# ROOT_INCLUDES Same as above, -# -# ROOT_LIBRARIES Link to these to use the ROOT libraries, not cached -# -# ROOT_LIBRARY_DIR The path to where the ROOT library files are. -# -# ROOT_VERSION_STRING The version string of the ROOT libraries which -# is reported by root-config -# -# ROOT_VERSION_MAJOR Major version number of ROOT -# ROOT_VERSION_MINOR Minor version number of ROOT -# ROOT_VERSION_PATCH Patch version number of ROOT -# -# ROOT_VERSION_NUMBER A unique version number which is calculated from -# major, minor and patch version found -# -# ROOT_CINT_EXECUTABLE The rootcint executable. -# -# RLIBMAP_EXECUTABLE The rlibmap executable. - -Message(STATUS "Looking for Root...") - -Set(ROOT_FOUND FALSE) -Set(ROOT_DEFINITIONS "") -Set(ROOT_INSTALLED_VERSION_TOO_OLD FALSE) -Set(ROOT_CONFIG_EXECUTABLE ROOT_CONFIG_EXECUTABLE-NOTFOUND) - -Find_Program(ROOT_CONFIG_EXECUTABLE NAMES root-config - HINTS ${ROOT_DIR} ${SIMPATH} ${ROOTSYS} $ENV{ROOTSYS} - PATH_SUFFIXES bin tools/root/bin - NO_DEFAULT_PATH -) - -If(ROOT_CONFIG_EXECUTABLE) - - String(REGEX REPLACE "(^.*)/bin/root-config" "\\1" test ${ROOT_CONFIG_EXECUTABLE}) - Set(ENV{ROOTSYS} ${test}) - Set(ROOTSYS ${test}) - - Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --version - OUTPUT_VARIABLE ROOT_VERSION_STRING - ) - Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix - OUTPUT_VARIABLE ROOT_INSTALL_DIR - ) - String(STRIP ${ROOT_VERSION_STRING} ROOT_VERSION_STRING) - String(STRIP ${ROOT_INSTALL_DIR} ROOT_INSTALL_DIR) - - - MESSAGE(STATUS "Looking for Root... - Found ${ROOT_INSTALL_DIR}/bin/root") - MESSAGE(STATUS "Looking for Root... - Found version is ${ROOT_VERSION_STRING} ") - - # extract major, minor, and patch versions from - # the version string given by root-config - String(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+.*" "\\1" ROOT_VERSION_MAJOR "${ROOT_VERSION_STRING}") - String(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" ROOT_VERSION_MINOR "${ROOT_VERSION_STRING}") - String(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+).*" "\\1" ROOT_VERSION_PATCH "${ROOT_VERSION_STRING}") - - # compute overall version numbers which can be compared at once - Math(EXPR req_vers "${ROOT_FIND_VERSION_MAJOR}*10000 + ${ROOT_FIND_VERSION_MINOR}*100 + ${ROOT_FIND_VERSION_PATCH}") - Math(EXPR found_vers "${ROOT_VERSION_MAJOR}*10000 + ${ROOT_VERSION_MINOR}*100 + ${ROOT_VERSION_PATCH}") - Math(EXPR ROOT_FOUND_VERSION "${ROOT_VERSION_MAJOR}*10000 + ${ROOT_VERSION_MINOR}*100 + ${ROOT_VERSION_PATCH}") - - Set(ROOT_Version ${found_vers}) - Set(ROOT_VERSION_NUMBER ${found_vers}) - - If(found_vers LESS req_vers) - Set(ROOT_FOUND FALSE) - Set(ROOT_INSTALLED_VERSION_TOO_OLD TRUE) - Else(found_vers LESS req_vers) - Set(ROOT_FOUND TRUE) - EndIf(found_vers LESS req_vers) - -Else(ROOT_CONFIG_EXECUTABLE) - Message(STATUS "Looking for Root... - Not found") - Message(WARNING "ROOT not installed in the searchpath and ROOTSYS is not set. Please set ROOTSYS or add the path to your ROOT installation in the Macro FindROOT.cmake in the subdirectory cmake/modules.") -Endif(ROOT_CONFIG_EXECUTABLE) - - -If(ROOT_FOUND) - - # ask root-config for the library dir - # Set ROOT_LIBRARY_DIR - Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --libdir - OUTPUT_VARIABLE ROOT_LIBRARY_DIR - ) - String(STRIP ${ROOT_LIBRARY_DIR} ROOT_LIBRARY_DIR) - - # ask root-config for the binary dir - Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --bindir - OUTPUT_VARIABLE ROOT_BINARY_DIR - ) - String(STRIP ${ROOT_BINARY_DIR} ROOT_BINARY_DIR) - - # ask root-config for the include dir - Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --incdir - OUTPUT_VARIABLE ROOT_INCLUDE_DIR - ) - String(STRIP ${ROOT_INCLUDE_DIR} ROOT_INCLUDE_DIR) - - # ask root-config for the library variables - Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --glibs - OUTPUT_VARIABLE ROOT_LIBRARIES - ) - String(STRIP ${ROOT_LIBRARIES} ROOT_LIBRARIES) - foreach(_cpt ${rootlibs} ${ROOT_FIND_COMPONENTS}) - find_library(ROOT_${_cpt}_LIBRARY ${_cpt} HINTS ${ROOT_LIBRARY_DIR}) - if(ROOT_${_cpt}_LIBRARY) - mark_as_advanced(ROOT_${_cpt}_LIBRARY) - list(APPEND ROOT_LIBRARIES ${ROOT_${_cpt}_LIBRARY}) - list(REMOVE_ITEM ROOT_FIND_COMPONENTS ${_cpt}) +################################################################################ +# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# # +# This software is distributed under the terms of the # +# GNU Lesser General Public Licence (LGPL) version 3, # +# copied verbatim in the file "LICENSE" # +################################################################################ + +# search ROOTConfig.cmake +find_package(ROOT QUIET CONFIG + HINTS ${ROOT_ROOT} $ENV{ROOT_ROOT} ${ROOTSYS} $ENV{ROOTSYS} ${SIMPATH} + ) + +# process results of above search +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ROOT CONFIG_MODE) + +# contains upstream ROOT_GENERATE_DICTIONARY and ROOT_LINKER_LIBRARY macros +include(${ROOT_USE_FILE}) + +get_filename_component(ROOTSYS ${ROOT_BINARY_DIR} DIRECTORY) + +# will be filled by add_fairroot_library +set_property(GLOBAL PROPERTY ROOT_INCLUDE_PATH "") + +if(ROOT_FOUND) + list(APPEND LD_LIBRARY_PATH ${ROOT_LIBRARY_DIR}) + + # Add missing include dirs TODO this should be done by upstream + foreach(t ROOT::vectorDict ROOT::listDict ROOT::forward_listDict ROOT::dequeDict ROOT::mapDict ROOT::map2Dict ROOT::unordered_mapDict ROOT::multimapDict ROOT::multimap2Dict ROOT::unordered_multimapDict ROOT::setDict ROOT::unordered_setDict ROOT::multisetDict ROOT::unordered_multisetDict ROOT::complexDict ROOT::valarrayDict ROOT::Cling ROOT::MultiProc ROOT::Rint ROOT::Thread ROOT::Imt ROOT::New ROOT::Core ROOT::rmkdepend ROOT::MathCore ROOT::MathMore ROOT::Matrix ROOT::Minuit ROOT::Minuit2 ROOT::Fumili ROOT::Physics ROOT::MLP ROOT::Quadp ROOT::Foam ROOT::Smatrix ROOT::SPlot ROOT::GenVector ROOT::Genetic ROOT::Hist ROOT::HistPainter ROOT::Spectrum ROOT::SpectrumPainter ROOT::Unfold ROOT::Hbook ROOT::Tree ROOT::TreePlayer ROOT::TreeViewer ROOT::RIO ROOT::SQLIO ROOT::XMLIO ROOT::XMLParser ROOT::Net ROOT::RootAuth ROOT::Krb5Auth ROOT::SrvAuth ROOT::rootd ROOT::Netx ROOT::NetxNG ROOT::RHTTP ROOT::Gpad ROOT::Graf ROOT::Postscript ROOT::mathtext ROOT::GX11 ROOT::GX11TTF ROOT::ASImage ROOT::ASImageGui ROOT::Graf3d ROOT::X3d ROOT::Eve ROOT::RGL ROOT::GLEW ROOT::FTGL ROOT::Gviz3d ROOT::Gui ROOT::Ged ROOT::FitPanel ROOT::GuiBld ROOT::GuiHtml ROOT::Recorder ROOT::SessionViewer ROOT::Proof ROOT::ProofPlayer ROOT::ProofDraw ROOT::ProofBench ROOT::proofd ROOT::XrdProofd ROOT::proofexecv ROOT::Proofx ROOT::pq2 ROOT::Html ROOT::EG ROOT::VMC ROOT::EGPythia6 ROOT::EGPythia8 ROOT::Geom ROOT::GeomBuilder ROOT::GeomPainter ROOT::Gdml ROOT::root ROOT::minicern ROOT::MemStat ROOT::RMySQL ROOT::rootn.exe ROOT::roots.exe ROOT::ssh2rpd ROOT::xpdtest ROOT::root.exe ROOT::proofserv.exe ROOT::hadd ROOT::rootnb.exe ROOT::g2root ROOT::h2root ROOT::rootcling ROOT::PyROOT ROOT::JupyROOT ROOT::PgSQL ROOT::RSQLite ROOT::TMVA ROOT::TMVAGui ROOT::RooFitCore ROOT::RooFit ROOT::RooStats ROOT::HistFactory ROOT::hist2workspace) + if(TARGET ${t}) + get_target_property(incdirs ${t} INTERFACE_INCLUDE_DIRECTORIES) + if(NOT incdirs) + set_target_properties(${t} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIRS}) + endif() endif() endforeach() - - # Make variables changeble to the advanced user - Mark_As_Advanced(ROOT_LIBRARY_DIR ROOT_INCLUDE_DIR ROOT_DEFINITIONS) - - # Set ROOT_INCLUDES - Set(ROOT_INCLUDES ${ROOT_INCLUDE_DIR}) - - Set(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${ROOT_LIBRARY_DIR}) - - ####################################### - # - # Check the executables of ROOT - # ( rootcint ) - # - ####################################### - - Find_Program(ROOT_CINT_EXECUTABLE - NAMES rootcint - PATHS ${ROOT_BINARY_DIR} - NO_DEFAULT_PATH - ) - - Find_Program(RLIBMAP_EXECUTABLE - NAMES rlibmap - PATHS ${ROOT_BINARY_DIR} - NO_DEFAULT_PATH - ) - - Include(ROOTMacros) - -Else(ROOT_FOUND) - - If(ROOT_FIND_REQUIRED) - Message(FATAL_ERROR "Stop here because ROOT not found.") - EndIf(ROOT_FIND_REQUIRED) - -Endif(ROOT_FOUND) +endif() diff --git a/cmake/FindZeroMQ.cmake b/cmake/FindZeroMQ.cmake index 8cb6f4f2fb..84bc49237b 100644 --- a/cmake/FindZeroMQ.cmake +++ b/cmake/FindZeroMQ.cmake @@ -125,6 +125,24 @@ if(ZeroMQ_FOUND) message(STATUS "Looking for ZeroMQ - Found ${ZeroMQ_INCLUDE_DIR}") message(STATUS "Looking for ZeroMQ - Found version ${ZeroMQ_VERSION}") endif(NOT ZeroMQ_FIND_QUIETLY) + + mark_as_advanced( + ZeroMQ_LIBRARIES + ZeroMQ_LIBRARY_SHARED + ZeroMQ_LIBRARY_STATIC + ZeroMQ_VERSION_MAJOR + ZeroMQ_VERSION_MINOR + ZeroMQ_VERSION_PATCH + ) + + # add target + if(NOT TARGET ZeroMQ::ZeroMQ) + add_library(ZeroMQ::ZeroMQ INTERFACE IMPORTED) + set_target_properties(ZeroMQ::ZeroMQ PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${ZeroMQ_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${ZeroMQ_LIBRARIES}" + ) + endif() else() if(ZeroMQ_FIND_REQUIRED) message(FATAL_ERROR "${ERROR_STRING}") @@ -138,11 +156,4 @@ endif() unset(ERROR_STRING) unset(ZEROMQ_ROOT) -mark_as_advanced( - ZeroMQ_LIBRARIES - ZeroMQ_LIBRARY_SHARED - ZeroMQ_LIBRARY_STATIC - ZeroMQ_VERSION_MAJOR - ZeroMQ_VERSION_MINOR - ZeroMQ_VERSION_PATCH -) + diff --git a/cmake/Findnanomsg.cmake b/cmake/Findnanomsg.cmake deleted file mode 100644 index ead85dd74c..0000000000 --- a/cmake/Findnanomsg.cmake +++ /dev/null @@ -1,52 +0,0 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence version 3 (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - - MESSAGE(STATUS "Looking for nanomsg...") - - find_path(NANOMSG_INCLUDE_DIR NAMES nanomsg/nn.h - HINTS ${NANOMSG_DIR}/include - HINTS ${AlFa_DIR}/include - HINTS ${SIMPATH}/include - DOC "Path to nanomsg include header files." - ) - - find_library(NANOMSG_LIBRARY_SHARED NAMES libnanomsg.dylib libnanomsg.so - HINTS ${NANOMSG_DIR}/lib - HINTS ${AlFa_DIR}/lib - HINTS ${SIMPATH}/lib - DOC "Path to libnanomsg.dylib libnanomsg.so." - ) - - if(NANOMSG_INCLUDE_DIR AND NANOMSG_LIBRARY_SHARED) - set(NANOMSG_FOUND true) - else(NANOMSG_INCLUDE_DIR AND NANOMSG_LIBRARY_SHARED) - set(NANOMSG_FOUND false) - endif(NANOMSG_INCLUDE_DIR AND NANOMSG_LIBRARY_SHARED) - - if(NANOMSG_FOUND) - set(NANOMSG_LIBRARIES "${NANOMSG_LIBRARY_SHARED}") - if(NOT NANOMSG_FIND_QUIETLY) - message(STATUS "Looking for nanomsg... - found ${NANOMSG_LIBRARIES}") - endif(NOT NANOMSG_FIND_QUIETLY) - - add_library(nanomsg SHARED IMPORTED) - set_target_properties(nanomsg PROPERTIES - IMPORTED_LOCATION ${NANOMSG_LIBRARY_SHARED} - INTERFACE_INCLUDE_DIRECTORIES ${NANOMSG_INCLUDE_DIR} - ) - else(NANOMSG_FOUND) - if(NOT NANOMSG_FIND_QUIETLY) - if(NANOMSG_FIND_REQUIRED) - message(FATAL_ERROR "Looking for nanomsg... - Not found") - else(NANOMSG_FIND_REQUIRED) - message(STATUS "Looking for nanomsg... - Not found") - endif(NANOMSG_FIND_REQUIRED) - endif(NOT NANOMSG_FIND_QUIETLY) - endif(NANOMSG_FOUND) - - mark_as_advanced(NANOMSG_INCLUDE_DIR NANOMSG_LIBRARIES NANOMSG_LIBRARY_SHARED) diff --git a/cmake/O2Utils.cmake b/cmake/O2Utils.cmake deleted file mode 100644 index ce34b88256..0000000000 --- a/cmake/O2Utils.cmake +++ /dev/null @@ -1,480 +0,0 @@ -include(CMakeParseArguments) - -#------------------------------------------------------------------------------ -# O2_SETUP -# The modules register themselves using this macro. -# Developer note : we use a macro because we want to access the variables of the caller. -# arg NAME - Module name -macro(O2_SETUP) - cmake_parse_arguments( - PARSED_ARGS - "" # bool args - "NAME" # mono-valued arguments - "" # multi-valued arguments - ${ARGN} # arguments - ) - CHECK_VARIABLE(PARSED_ARGS_NAME "You must provide a name") - set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib") - set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") - set(INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include") -endmacro() - -#------------------------------------------------------------------------------ -# O2_DEFINE_BUCKET -# arg NAME -# arg DEPENDENCIES # either libraries or buckets -# arg INCLUDE_DIRECTORIES # project include directories -# arg SYSTEMINCLUDE_DIRECTORIES # system include directories (no compiler warnings) -function(O2_DEFINE_BUCKET) - cmake_parse_arguments( - PARSED_ARGS - "" # bool args - "NAME" # mono-valued arguments - "DEPENDENCIES;INCLUDE_DIRECTORIES;SYSTEMINCLUDE_DIRECTORIES" # multi-valued arguments - ${ARGN} # arguments - ) - CHECK_VARIABLE(PARSED_ARGS_NAME "You must provide a name") - -# message(STATUS "o2_define_bucket : ${PARSED_ARGS_NAME}") -# foreach (library ${PARSED_ARGS_DEPENDENCIES}) -# message(STATUS " - ${library} (lib or bucket)") -# endforeach () -# foreach (inc_dir ${PARSED_ARGS_INCLUDE_DIRECTORIES}) -# message(STATUS " - ${inc_dir} (inc_dir)") -# endforeach () - - # Save this information - set("bucket_map_${PARSED_ARGS_NAME}" "${PARSED_ARGS_NAME}" PARENT_SCOPE) # emulation of a map - set("bucket_map_libs_${PARSED_ARGS_NAME}" "${PARSED_ARGS_DEPENDENCIES}" PARENT_SCOPE) # emulation of a map - set("bucket_map_inc_dirs_${PARSED_ARGS_NAME}" "${PARSED_ARGS_INCLUDE_DIRECTORIES}" PARENT_SCOPE) # emulation of a map - set("bucket_map_systeminc_dirs_${PARSED_ARGS_NAME}" "${PARSED_ARGS_SYSTEMINCLUDE_DIRECTORIES}" PARENT_SCOPE) # emulation of a map -endfunction() - -macro(INDENT NUMBER_SPACES INDENTATION) - foreach (i RANGE ${NUMBER_SPACES}) - set(${INDENTATION} "${${INDENTATION}} ") - endforeach () -endmacro() - -#------------------------------------------------------------------------------ -# GET_BUCKET_CONTENT -# Returns the list of libraries defined in the bucket, including the ones -# part of other buckets referenced by this one. -# We allow a maximum of 10 levels of recursion. -# arg BUCKET_NAME - -# arg RESULT_LIBS_VAR_NAME - Name of the variable in the parent scope that should be populated with list of libraries. -# arg RESULT_INC_DIRS_VAR_NAME - Name of the variable in the parent scope that should be populated with list of include directories. -# arg RESULT_SYSTEMINC_DIRS_VAR_NAME - Name of the variable in the parent scope that should be populated with list of system include directories. -# arg DEPTH - Use 0 when calling the first time (can be omitted). -function(GET_BUCKET_CONTENT - BUCKET_NAME - RESULT_LIBS_VAR_NAME - RESULT_INC_DIRS_VAR_NAME - RESULT_SYSTEMINC_DIRS_VAR_NAME - ) - INDENT(0 INDENTATION) -# message("${INDENTATION}Get content of bucket ${BUCKET_NAME} (from parent(s): ${RECURSIVE_BUCKETS})") -# message("${INDENTATION} RESULT_LIBS_VAR_NAME = ${RESULT_LIBS_VAR_NAME} ") -# message("${INDENTATION} RESULT_INC_DIRS_VAR_NAME = ${RESULT_INC_DIRS_VAR_NAME} ") -# message("${INDENTATION} RESULT_SYSTEMINC_DIRS_VAR_NAME = ${RESULT_SYSTEMINC_DIRS_VAR_NAME}") - - if (NOT DEFINED bucket_map_${BUCKET_NAME}) - message(FATAL_ERROR "${INDENTATION}bucket ${BUCKET_NAME} not defined. Use o2_define_bucket to define it.") - endif () - list (FIND RECURSIVE_BUCKETS ${BUCKET_NAME} _index) - if (${_index} GREATER -1) - message(FATAL_ERROR "circular dependency detected for bucket ${BUCKET_NAME} from parent(s):${RECURSIVE_BUCKETS}") - endif () - - # Fetch the content (recursively) - set(libs ${bucket_map_libs_${BUCKET_NAME}}) - set(inc_dirs ${bucket_map_inc_dirs_${BUCKET_NAME}}) - set(systeminc_dirs ${bucket_map_systeminc_dirs_${BUCKET_NAME}}) - set(LOCAL_VARIABLE_EXTENSION "_${BUCKET_NAME}") - set(LOCAL_RESULT_libs${LOCAL_VARIABLE_EXTENSION} "") - set(LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION} "") - set(LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION} "") - foreach (dependency ${libs}) -# message("${INDENTATION}- ${dependency} (lib or bucket)") - # if it is a bucket we call recursively - if (DEFINED bucket_map_${dependency}) - list(APPEND RECURSIVE_BUCKETS ${BUCKET_NAME}) - GET_BUCKET_CONTENT(${dependency} - LOCAL_RESULT_libs${LOCAL_VARIABLE_EXTENSION} - LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION} - LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION} - ) - list(REMOVE_ITEM RECURSIVE_BUCKETS ${BUCKET_NAME}) -# message(" ${INDENTATION}dependencies ${LOCAL_RESULT_libs${LOCAL_VARIABLE_EXTENSION}}") -# message(" ${INDENTATION}include ${LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION}}") -# message(" ${INDENTATION}systeminclude ${LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION}}") - else () - # else we add the dependency to the results - set(LOCAL_RESULT_libs${LOCAL_VARIABLE_EXTENSION} "${LOCAL_RESULT_libs${LOCAL_VARIABLE_EXTENSION}};${dependency}") - endif () - endforeach () - - if (DEFINED LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION} AND DEFINED inc_dirs) - set(LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION} "${LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION}};") - endif () - set(LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION} "${LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION}}${inc_dirs}") - if (DEFINED LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION} AND DEFINED systeminc_dirs) - set(LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION} "${LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION}};") - endif () - set(LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION} "${LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION}}${systeminc_dirs}") -# foreach (inc_dir ${inc_dirs}) -# message("${INDENTATION}- ${inc_dir} (inc_dir)") -# endforeach () -# foreach (inc_dir ${systeminc_dirs}) -# message("${INDENTATION}- ${inc_dir} (systeminc_dir)") -# endforeach () - - if (DEFINED LOCAL_RESULT_libs${LOCAL_VARIABLE_EXTENSION}) - set(${RESULT_LIBS_VAR_NAME} "${${RESULT_LIBS_VAR_NAME}};${LOCAL_RESULT_libs${LOCAL_VARIABLE_EXTENSION}}" PARENT_SCOPE) - endif () - if (DEFINED LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION}) - set(${RESULT_INC_DIRS_VAR_NAME} "${${RESULT_INC_DIRS_VAR_NAME}};${LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION}}" PARENT_SCOPE) - endif () - if (DEFINED LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION}) - set(${RESULT_SYSTEMINC_DIRS_VAR_NAME} "${${RESULT_SYSTEMINC_DIRS_VAR_NAME}};${LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION}}" PARENT_SCOPE) - endif () -endfunction() - -#------------------------------------------------------------------------------ -# O2_TARGET_LINK_BUCKET -# arg TARGET -# arg BUCKET -# arg EXE - true indicates that it is an executable. (not used for the time being/anymore) -# arg MODULE_LIBRARY_NAME - Only used for executables. It should indicate the library of the module. -function(O2_TARGET_LINK_BUCKET) - cmake_parse_arguments( - PARSED_ARGS - "EXE" # bool args - "TARGET;BUCKET;MODULE_LIBRARY_NAME" # mono-valued arguments - "" # multi-valued arguments - ${ARGN} # arguments - ) - # errors if missing arguments - CHECK_VARIABLE(PARSED_ARGS_TARGET "You must provide a target name") - CHECK_VARIABLE(PARSED_ARGS_BUCKET "You must provide a bucket name") - - # message(STATUS "Add dependency bucket for target ${PARSED_ARGS_TARGET} : ${PARSED_ARGS_BUCKET}") - - # find the bucket - if (NOT DEFINED bucket_map_libs_${PARSED_ARGS_BUCKET}) - message(FATAL_ERROR "bucket ${PARSED_ARGS_BUCKET} not defined. - Use o2_define_bucket to define it.") - endif () - - set(RESULT_libs "") - set(RESULT_inc_dirs "") - set(RESULT_systeminc_dirs "") - GET_BUCKET_CONTENT(${PARSED_ARGS_BUCKET} RESULT_libs RESULT_inc_dirs RESULT_systeminc_dirs) # RESULT_lib_dirs) -# message(STATUS "All dependencies of the bucket : ${RESULT_libs}") -# message(STATUS "All inc_dirs of the bucket ${PARSED_ARGS_BUCKET} : ${RESULT_inc_dirs}") - - # for each dependency in the bucket invoke target_link_library - # set(DEPENDENCIES ${bucket_map_libs_${PARSED_ARGS_BUCKET}}) - # message(STATUS " invoke target_link_libraries for target ${PARSED_ARGS_TARGET} : ${RESULT_libs} ${PARSED_ARGS_MODULE_LIBRARY_NAME}") - - target_link_libraries(${PARSED_ARGS_TARGET} ${RESULT_libs} ${PARSED_ARGS_MODULE_LIBRARY_NAME}) - - # Same thing for lib_dirs and inc_dirs - target_include_directories(${PARSED_ARGS_TARGET} PUBLIC ${RESULT_inc_dirs}) - target_include_directories(${PARSED_ARGS_TARGET} SYSTEM PUBLIC ${RESULT_systeminc_dirs}) -endfunction() - -#------------------------------------------------------------------------------ -# O2_GENERATE_LIBRARY -# TODO use arguments, do NOT modify the parent's scope variables. -# This macro -# - Generate a ROOT dictionary if LINKDEF is defined and install it, -# - Create the library named LIBRARY_NAME with sources SRCS using headers HEADERS and install it, -# - Install -macro(O2_GENERATE_LIBRARY) - - # cmake_parse_arguments( - # ARGS - # "" # bool args - # "LIBRARY_NAME;BUCKET_NAME;DICTIONARY;LINKDEF" # mono-valued arguments - # "SOURCES;NO_DICT_SOURCES;HEADERS;INCLUDE_DIRECTORIES" # multi-valued arguments - # ${ARGN} # arguments - # ) - - ############### Preparation - Arguments ##################### - - # CHECK_VARIABLE(ARGS_LIBRARY_NAME "You must provide the name of the library" ) - # CHECK_VARIABLE(ARGS_BUCKET_NAME "You must provide a bucket name" ) - - set(Int_LIB ${LIBRARY_NAME}) - Set(HeaderRuleName "${Int_LIB}_HEADER_RULES") - Set(DictName "G__${Int_LIB}Dict.cxx") - - if (NOT DICTIONARY) - Set(DICTIONARY ${CMAKE_CURRENT_BINARY_DIR}/${DictName}) - endif (NOT DICTIONARY) - if (IS_ABSOLUTE ${DICTIONARY}) - Set(Int_DICTIONARY ${DICTIONARY}) - else (IS_ABSOLUTE ${DICTIONARY}) - Set(Int_DICTIONARY ${CMAKE_CURRENT_SOURCE_DIR}/${DICTIONARY}) - endif (IS_ABSOLUTE ${DICTIONARY}) - - - Set(Int_SRCS ${SRCS}) - - # If headers are defined we use them otherwise we search for the headers - if (HEADERS) - set(HDRS ${HEADERS}) - else (HEADERS) - file(GLOB_RECURSE HDRS *.h) - endif (HEADERS) - - # ??? - if (IWYU_FOUND) - Set(_INCLUDE_DIRS ${INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRECTORIES}) - CHECK_HEADERS("${Int_SRCS}" "${_INCLUDE_DIRS}" ${HeaderRuleName}) - endif (IWYU_FOUND) - - ############### build the dictionary ##################### - if (LINKDEF) - if (IS_ABSOLUTE ${LINKDEF}) - Set(LINKDEF ${LINKDEF}) - else (IS_ABSOLUTE ${LINKDEF}) - Set(LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/${LINKDEF}) - endif (IS_ABSOLUTE ${LINKDEF}) - O2_ROOT_GENERATE_DICTIONARY() - SET(Int_SRCS ${Int_SRCS} ${Int_DICTIONARY}) - endif (LINKDEF) - - # ???? - set(Int_DEPENDENCIES) - foreach (d ${DEPENDENCIES}) - get_filename_component(_ext ${d} EXT) - if (NOT _ext MATCHES a$) - set(Int_DEPENDENCIES ${Int_DEPENDENCIES} ${d}) - else () - Message("Found Static library with extension ${_ext}") - get_filename_component(_lib ${d} NAME_WE) - set(Int_DEPENDENCIES ${Int_DEPENDENCIES} ${_lib}) - endif () - endforeach () - - ############### build the library ##################### - Add_Library(${Int_LIB} SHARED ${Int_SRCS} ${NO_DICT_SRCS} ${HDRS} ${LINKDEF}) - - ############### Add dependencies ###################### - o2_target_link_bucket(TARGET ${Int_LIB} BUCKET ${BUCKET_NAME}) - target_include_directories( - ${Int_LIB} - PUBLIC - # TODO retrofit to O2 - $ - $ # /include/mylib - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src # internal headers - ${CMAKE_CURRENT_SOURCE_DIR} # For the modules that generate a dictionary - ) - - ############### install the library ################### - # TODO remove ? keep ? - install(TARGETS ${Int_LIB} - EXPORT ${PROJECT_NAME}Targets # for downstream dependencies - DESTINATION lib) - - # Install all the public headers - # TODO retrofit to O2 - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/${MODULE_NAME}) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/${MODULE_NAME} - DESTINATION include) - endif() - -endmacro(O2_GENERATE_LIBRARY) - -#------------------------------------------------------------------------------ -# O2_GENERATE_EXECUTABLE -# arg EXE_NAME -# arg BUCKET_NAME -# arg SOURCES -# arg MODULE_LIBRARY_NAME - Name of the library of the module this executable belongs to. Optional. -# arg INSTALL - True to install (default), false otherwise. Optional. -function(O2_GENERATE_EXECUTABLE) - - cmake_parse_arguments( - PARSED_ARGS - "NO_INSTALL" # bool args - "EXE_NAME;BUCKET_NAME;MODULE_LIBRARY_NAME" # mono-valued arguments - "SOURCES" # multi-valued arguments - ${ARGN} # arguments - ) - - CHECK_VARIABLE(PARSED_ARGS_EXE_NAME "You must provide an executable name") - CHECK_VARIABLE(PARSED_ARGS_BUCKET_NAME "You must provide a bucket name") - CHECK_VARIABLE(PARSED_ARGS_SOURCES "You must provide the list of sources") -# CHECK_VARIABLE(PARSED_ARGS_MODULE_LIBRARY_NAME "You must provide the module library name this executable belongs to") - - ############### build the library ##################### - ADD_EXECUTABLE(${PARSED_ARGS_EXE_NAME} ${PARSED_ARGS_SOURCES}) - O2_TARGET_LINK_BUCKET( - TARGET ${PARSED_ARGS_EXE_NAME} - BUCKET ${PARSED_ARGS_BUCKET_NAME} - EXE TRUE - MODULE_LIBRARY_NAME ${PARSED_ARGS_MODULE_LIBRARY_NAME} - ) - - if (NOT ${PARSED_ARGS_NO_INSTALL}) - ############### install the executable ################# - install(TARGETS ${PARSED_ARGS_EXE_NAME} DESTINATION bin) - - ############### install the library ################### - install(TARGETS ${PARSED_ARGS_MODULE_LIBRARY_NAME} DESTINATION lib) - endif () - -endfunction(O2_GENERATE_EXECUTABLE) - - -#------------------------------------------------------------------------------ -# O2_GENERATE_TESTS -# Generate tests for all source files listed in TEST_SRCS -# arg BUCKET_NAME -# arg TEST_SRCS -# arg MODULE_LIBRARY_NAME - Name of the library of the module this executable belongs to. -function(O2_GENERATE_TESTS) - cmake_parse_arguments( - PARSED_ARGS - "" # bool args - "BUCKET_NAME;MODULE_LIBRARY_NAME;TIMEOUT" # mono-valued arguments - "TEST_SRCS;COMMAND_LINE_ARGS" # multi-valued arguments - ${ARGN} # arguments - ) - - # Note: the BUCKET_NAME and MODULE_LIBRARY_NAME are optional arguments - CHECK_VARIABLE(PARSED_ARGS_TEST_SRCS "You must provide the list of sources") - - foreach (test ${PARSED_ARGS_TEST_SRCS}) - string(REGEX REPLACE ".*/" "" test_name ${test}) - string(REGEX REPLACE "\\..*" "" test_name ${test_name}) - set(test_name test_${MODULE_NAME}_${test_name}) - - O2_GENERATE_EXECUTABLE( - EXE_NAME ${test_name} - SOURCES ${test} - MODULE_LIBRARY_NAME ${PARSED_ARGS_MODULE_LIBRARY_NAME} - BUCKET_NAME ${PARSED_ARGS_BUCKET_NAME} - NO_INSTALL FALSE - ) - target_link_libraries(${test_name} Boost::unit_test_framework) - add_test(NAME ${test_name} COMMAND ${test_name} ${PARSED_ARGS_COMMAND_LINE_ARGS}) - if (PARSED_ARGS_TIMEOUT) - set_tests_properties(${test_name} PROPERTIES TIMEOUT ${PARSED_ARGS_TIMEOUT}) - endif() - endforeach () -endfunction() - - - -#------------------------------------------------------------------------------ -# CHECK_VARIABLE -macro(CHECK_VARIABLE VARIABLE_NAME ERROR_MESSAGE) - if (NOT ${VARIABLE_NAME}) - message(FATAL_ERROR "${ERROR_MESSAGE}") - endif (NOT ${VARIABLE_NAME}) -endmacro(CHECK_VARIABLE) - -#------------------------------------------------------------------------------ -# O2_FORMAT -function(O2_FORMAT _output input prefix suffix) - - # DevNotes - input should be put in quotes or the complete list does not get passed to the function - set(format) - foreach (arg ${input}) - set(item ${arg}) - if (prefix) - string(REGEX MATCH "^${prefix}" pre ${arg}) - endif (prefix) - if (suffix) - string(REGEX MATCH "${suffix}$" suf ${arg}) - endif (suffix) - if (NOT pre) - set(item "${prefix}${item}") - endif (NOT pre) - if (NOT suf) - set(item "${item}${suffix}") - endif (NOT suf) - list(APPEND format ${item}) - endforeach (arg) - set(${_output} ${format} PARENT_SCOPE) - -endfunction(O2_FORMAT) - -#------------------------------------------------------------------------------ -# O2_ROOT_GENERATE_DICTIONARY -# TODO use arguments, do NOT modify the parent's scope variables. -macro(O2_ROOT_GENERATE_DICTIONARY) - - # All Arguments needed for this new version of the macro are defined - # in the parent scope, namely in the CMakeLists.txt of the submodule - set(Int_LINKDEF ${LINKDEF}) - set(Int_DICTIONARY ${DICTIONARY}) - set(Int_LIB ${LIBRARY_NAME}) - - set(Int_HDRS ${HDRS}) - set(Int_DEF ${DEFINITIONS}) - - # Convert the values of the variable to a semi-colon separated list - separate_arguments(Int_HDRS) - separate_arguments(Int_DEF) - - # Get the include directories (from the bucket and from the internal dependencies) - set(RESULT_libs "") - set(Int_INC "") - set(Int_SYSTEMINC "") - GET_BUCKET_CONTENT(${BUCKET_NAME} RESULT_libs Int_INC Int_SYSTEMINC) - set(Int_INC ${Int_INC} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include) - set(Int_INC ${Int_INC} ${CMAKE_CURRENT_SOURCE_DIR}/src) # internal headers - set(Int_INC ${Int_INC} ${GLOBAL_ALL_MODULES_INCLUDE_DIRECTORIES}) - set(Int_INC ${Int_INC} ${Int_SYSTEMINC}) - - # Format neccesary arguments - # Add -I and -D to include directories and definitions - O2_FORMAT(Int_INC "${Int_INC}" "-I" "") - O2_FORMAT(Int_DEF "${Int_DEF}" "-D" "") - - #---call rootcint / cling -------------------------------- - set(OUTPUT_FILES ${Int_DICTIONARY}) - set(EXTRA_DICT_PARAMETERS "") - set(Int_ROOTMAPFILE ${LIBRARY_OUTPUT_PATH}/lib${Int_LIB}.rootmap) - set(Int_PCMFILE G__${Int_LIB}Dict_rdict.pcm) - set(OUTPUT_FILES ${OUTPUT_FILES} ${Int_PCMFILE} ${Int_ROOTMAPFILE}) - set(EXTRA_DICT_PARAMETERS ${EXTRA_DICT_PARAMETERS} - -inlineInputHeader -rmf ${Int_ROOTMAPFILE} - -rml ${Int_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX}) - set_source_files_properties(${OUTPUT_FILES} PROPERTIES GENERATED TRUE) - if (CMAKE_SYSTEM_NAME MATCHES Linux) - # Note : ROOT_CINT_EXECUTABLE is ok with ROOT6 (rootcint == rootcling) - add_custom_command(OUTPUT ${OUTPUT_FILES} - COMMAND LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:${_intel_lib_dirs}:$ENV{LD_LIBRARY_PATH} ROOTSYS=${ROOTSYS} - ${ROOT_CINT_EXECUTABLE} -f ${Int_DICTIONARY} ${EXTRA_DICT_PARAMETERS} -c ${Int_DEF} ${Int_INC} ${Int_HDRS} ${Int_LINKDEF} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${Int_PCMFILE} ${LIBRARY_OUTPUT_PATH}/${Int_PCMFILE} - DEPENDS ${Int_HDRS} ${Int_LINKDEF} - ) - else (CMAKE_SYSTEM_NAME MATCHES Linux) - if (CMAKE_SYSTEM_NAME MATCHES Darwin) - add_custom_command(OUTPUT ${OUTPUT_FILES} - COMMAND DYLD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{DYLD_LIBRARY_PATH} ROOTSYS=${ROOTSYS} ${ROOT_CINT_EXECUTABLE} - -f ${Int_DICTIONARY} ${EXTRA_DICT_PARAMETERS} -c ${Int_DEF} ${Int_INC} ${Int_HDRS} ${Int_LINKDEF} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${Int_PCMFILE} ${LIBRARY_OUTPUT_PATH}/${Int_PCMFILE} - DEPENDS ${Int_HDRS} ${Int_LINKDEF} - ) - endif (CMAKE_SYSTEM_NAME MATCHES Darwin) - endif (CMAKE_SYSTEM_NAME MATCHES Linux) - install(FILES ${LIBRARY_OUTPUT_PATH}/${Int_PCMFILE} ${Int_ROOTMAPFILE} DESTINATION lib) - - if (CMAKE_COMPILER_IS_GNUCXX) - exec_program(${CMAKE_C_COMPILER} ARGS "-dumpversion" OUTPUT_VARIABLE _gcc_version_info) - string(REGEX REPLACE "^([0-9]+).*$" "\\1" GCC_MAJOR ${_gcc_version_info}) - if (${GCC_MAJOR} GREATER 4) - set_source_files_properties(${Int_DICTIONARY} PROPERTIES COMPILE_DEFINITIONS R__ACCESS_IN_SYMBOL) - endif () - endif () - -endmacro(O2_ROOT_GENERATE_DICTIONARY) diff --git a/cmake/QCModulesUtils.cmake b/cmake/QCModulesUtils.cmake new file mode 100644 index 0000000000..6d7f16ee4d --- /dev/null +++ b/cmake/QCModulesUtils.cmake @@ -0,0 +1,70 @@ +#------------------------------------------------------------------------------ +# CHECK_VARIABLE +macro(CHECK_VARIABLE VARIABLE_NAME ERROR_MESSAGE) + if (NOT ${VARIABLE_NAME}) + message(FATAL_ERROR "${ERROR_MESSAGE}") + endif (NOT ${VARIABLE_NAME}) +endmacro(CHECK_VARIABLE) + +#------------------------------------------------------------------------------ +# GENERATE_ROOT_DICT +# Generate ROOT dictionary. +# The bulk of the code is an ugly mess that will redeclare the dependencies +# because we need to set INCLUDE_DIRECTORIES. +# arg MODULE_NAME - Module name +# arg LINKDEF - Path to the linkdef +# arg DICT_CLASS - name of the class that is generated without extension +function(GENERATE_ROOT_DICT) + cmake_parse_arguments( + PARSED_ARGS + "" # bool args + "MODULE_NAME;LINKDEF;DICT_CLASS" # mono-valued arguments + "" # multi-valued arguments + ${ARGN} # arguments + ) + CHECK_VARIABLE(PARSED_ARGS_MODULE_NAME "You must provide a module name") + CHECK_VARIABLE(PARSED_ARGS_LINKDEF "You must provide a path to a linkdef") + CHECK_VARIABLE(PARSED_ARGS_DICT_CLASS "You must provide a name for the generated class") + # ROOT dictionary + # the following root macros expect include dirs to be set as directory property + # TODO how to generate this automatically ? ? ? + # https://gitlab.kitware.com/cmake/cmake/issues/12435 + # Maybe using this property ? + # get_target_property(asdf ${MODULE_NAME} INCLUDE_DIRECTORIES) + # message("test : ${asdf}") + get_directory_property(include_dirs INCLUDE_DIRECTORIES) + list(APPEND include_dirs "${CMAKE_CURRENT_SOURCE_DIR}/include") # this module + list(APPEND include_dirs "${CMAKE_CURRENT_SOURCE_DIR}/../../Framework/include") # the framework + get_target_property(qc_inc_dir QualityControl INTERFACE_INCLUDE_DIRECTORIES) + list(APPEND include_dirs "${qc_inc_dir}") + get_target_property(o2_inc_dir AliceO2::AliceO2 INTERFACE_INCLUDE_DIRECTORIES) + list(APPEND include_dirs "${o2_inc_dir}") + get_target_property(config_inc_dir Configuration::Configuration INTERFACE_INCLUDE_DIRECTORIES) + list(APPEND include_dirs "${config_inc_dir}") + list(APPEND include_dirs "${FAIRROOT_INCLUDE_DIR}") + list(APPEND include_dirs "${FairMQ_INCDIR}") + list(APPEND include_dirs "${FairMQ_INCDIR}/fairmq") + get_target_property(fairlogger_inc_dir FairLogger::FairLogger INTERFACE_INCLUDE_DIRECTORIES) + list(APPEND include_dirs "${fairlogger_inc_dir}") + get_target_property(arrow_inc_dir Arrow::Arrow INTERFACE_INCLUDE_DIRECTORIES) + list(APPEND include_dirs "${arrow_inc_dir}") + get_target_property(common_inc_dir AliceO2::Common INTERFACE_INCLUDE_DIRECTORIES) + list(APPEND include_dirs "${common_inc_dir}") + get_target_property(boost_inc_dir Boost::container INTERFACE_INCLUDE_DIRECTORIES) + list(APPEND include_dirs "${boost_inc_dir}") + list(REMOVE_DUPLICATES include_dirs) + include_directories(${include_dirs}) + + set(dict_src ${CMAKE_CURRENT_BINARY_DIR}/${PARSED_ARGS_DICT_CLASS}.cxx) + set_source_files_properties(${dict_src} PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast") + set_source_files_properties(${dict_src} PROPERTIES GENERATED TRUE) + + ROOT_GENERATE_DICTIONARY("${PARSED_ARGS_DICT_CLASS}" ${HEADERS} LINKDEF ${PARSED_ARGS_LINKDEF}) + + # TODO review how and what to install for dictionary + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${PARSED_ARGS_MODULE_NAME}Dict_rdict.pcm + ${CMAKE_CURRENT_BINARY_DIR}/lib${PARSED_ARGS_MODULE_NAME}Dict.rootmap + DESTINATION lib) + +endfunction() + diff --git a/cmake/QualityControlConfig.cmake b/cmake/QualityControlConfig.cmake deleted file mode 100644 index 838657ae20..0000000000 --- a/cmake/QualityControlConfig.cmake +++ /dev/null @@ -1 +0,0 @@ -include("${CMAKE_CURRENT_LIST_DIR}/QualityControlTargets.cmake") diff --git a/cmake/QualityControlConfig.cmake.in b/cmake/QualityControlConfig.cmake.in new file mode 100644 index 0000000000..669fc7d708 --- /dev/null +++ b/cmake/QualityControlConfig.cmake.in @@ -0,0 +1,19 @@ +@PACKAGE_INIT@ + +set(QualityControl_VERSION @PROJECT_VERSION@) + +get_filename_component(QualityControl_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +include(CMakeFindDependencyMacro) + +list(APPEND CMAKE_MODULE_PATH ${QualityControl_CMAKE_DIR}) +find_dependency(Boost) + +list(REMOVE_AT CMAKE_MODULE_PATH -1) + +if(NOT TARGET AliceO2::QualityControl) + include("${QualityControl_CMAKE_DIR}/QualityControlTargets.cmake") +endif() + +set(QualityControl_LIBRARIES AliceO2::QualityControl) + +message(STATUS "QualityControl ${QualityControl_VERSION} found") diff --git a/cmake/QualityControlDependencies.cmake b/cmake/QualityControlDependencies.cmake deleted file mode 100644 index f7419d5068..0000000000 --- a/cmake/QualityControlDependencies.cmake +++ /dev/null @@ -1,210 +0,0 @@ -find_package(Boost 1.58 COMPONENTS container unit_test_framework program_options system log signals ) -find_package(Git QUIET) -find_package(Configuration REQUIRED) -find_package(Monitoring REQUIRED) -find_package(MySQL REQUIRED) -find_package(Common REQUIRED) -find_package(InfoLogger REQUIRED) -find_package(DataSampling REQUIRED) -find_package(AliceO2 REQUIRED) -find_package(ROOT 6.06.02 COMPONENTS RHTTP RMySQL Gui REQUIRED) -find_package(CURL REQUIRED) -find_package(ZeroMQ REQUIRED) -find_package(nanomsg REQUIRED) -include_directories(${MS_GSL_INCLUDE_DIR}) -find_package(Arrow REQUIRED) -find_package(GLFW) - -# todo not sure why this is needed -if (BOOST_FOUND AND NOT Boost_FOUND) - set(BOOST_FOUND 1) - set(Boost_FOUND 1) -endif () - -find_package(FairRoot REQUIRED) -find_package(FairMQInFairRoot) # DEPRECATED: This looks for FairMQ embedded in old FairRoot versions, -# before FairMQ and FairLogger have moved to separate repos. -# Remove this line, once we require FairMQ 1.2+. -if(NOT FairMQInFairRoot_FOUND) # DEPRECATED: Remove this condition, once we require FairMQ 1.2+ - find_package(FairMQ REQUIRED) - find_package(FairLogger REQUIRED) -endif() - - -link_directories(${FAIRROOT_LIBRARY_DIR}) - -if (NOT MYSQL_FOUND) - message(WARNING "MySQL not found, the corresponding classes won't be built.") - #elseif(NOT ROOT_RMySQL_LIBRARY) - # message(WARNING "MySQL ROOT class not found, the corresponding classes won't be built.") -else () - add_definitions(-D_WITH_MYSQL) -# set(ROOT_LIBRARIES "${ROOT_LIBRARIES} -lRMySQL") -endif () - -get_target_property(_boost_incdir Boost::boost INTERFACE_INCLUDE_DIRECTORIES) - - -if(FairMQInFairRoot_FOUND) - # DEPRECATED: Remove this case, once we require FairMQ 1.2+ - get_target_property(_fairmq_incdir FairRoot::FairMQ INTERFACE_INCLUDE_DIRECTORIES) - o2_define_bucket(NAME fairmq_bucket - DEPENDENCIES FairRoot::FairMQ - INCLUDE_DIRECTORIES ${_boost_incdir} ${_fairmq_incdir} - ) -else() - get_target_property(_fairmq_incdir FairMQ::FairMQ INTERFACE_INCLUDE_DIRECTORIES) - get_target_property(_fairlogger_incdir FairLogger::FairLogger INTERFACE_INCLUDE_DIRECTORIES) - o2_define_bucket(NAME fairmq_bucket - DEPENDENCIES FairMQ::FairMQ - INCLUDE_DIRECTORIES ${_boost_incdir} ${_fairmq_incdir} ${_fairlogger_incdir} - ) - set(_fairlogger_incdir) -endif() - -o2_define_bucket( - NAME - o2_qualitycontrol_bucket - - DEPENDENCIES - ${Boost_LOG_LIBRARY} - ${Boost_THREAD_LIBRARY} - ${Boost_SYSTEM_LIBRARY} - ${Boost_PROGRAM_OPTIONS_LIBRARY} - ${Boost_CONTAINER_LIBRARY} - ${Common_LIBRARIES} - ${Configuration_LIBRARIES} - ${Monitoring_LIBRARIES} - ${ROOT_LIBRARIES} - ${Boost_LOG_DEBUG} - ${InfoLogger_LIBRARIES} - ${DataSampling_LIBRARIES} - ${CURL_LIBRARIES} - ${ZeroMQ_LIBRARY_SHARED} - ${NANOMSG_LIBRARIES} - ${AliceO2_LIBRARIES} - ${ARROW_SHARED_LIB} - - SYSTEMINCLUDE_DIRECTORIES - ${Boost_INCLUDE_DIRS} - ${ROOT_INCLUDE_DIR} - ${MYSQL_INCLUDE_DIRS} - ${Configuration_INCLUDE_DIRS} - ${Monitoring_INCLUDE_DIRS} - ${ZEROMQ_INCLUDE_DIR} - ${Common_INCLUDE_DIRS} - ${InfoLogger_INCLUDE_DIRS} - ${DataSampling_INCLUDE_DIRS} - ${CURL_INCLUDE_DIRS} - ${AliceO2_INCLUDE_DIRS} - ${MS_GSL_INCLUDE_DIR} - ${ARROW_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - o2_qualitycontrol_with_fairroot_bucket - - DEPENDENCIES - o2_qualitycontrol_bucket - fairmq_bucket - - SYSTEMINCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${FAIRROOT_INCLUDE_DIR}/fairmq -) - - -o2_define_bucket( - NAME - o2_qcmodules_base - - DEPENDENCIES - ${Boost_PROGRAM_OPTIONS_LIBRARY} - ${Monitoring_LIBRARIES} - ${InfoLogger_LIBRARIES} - ${Common_LIBRARIES} - ${ARROW_SHARED_LIB} - QualityControl - - SYSTEMINCLUDE_DIRECTORIES - ${Boost_INCLUDE_DIRS} - ${Monitoring_INCLUDE_DIRS} - ${InfoLogger_INCLUDE_DIRS} - ${Common_INCLUDE_DIRS} - ${ARROW_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Framework/include # another module's include dir -) - -o2_define_bucket( - NAME - o2_qcmodules_common - - DEPENDENCIES - o2_qcmodules_base -) - -o2_define_bucket( - NAME - o2_qcmodules_example - - DEPENDENCIES - o2_qcmodules_base - - SYSTEMINCLUDE_DIRECTORIES - ${Boost_INCLUDE_DIRS} - ${Configuration_INCLUDE_DIRS} -) - -o2_define_bucket( - NAME - o2_qc_tobject2json - - DEPENDENCIES - o2_qualitycontrol_bucket - ${ZeroMQ_LIBRARY_STATIC} - - SYSTEMINCLUDE_DIRECTORIES - ${ZeroMQ_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - o2_qcmodules_dpl - - DEPENDENCIES - o2_qcmodules_base - fairmq_bucket - ${AliceO2_LIBRARIES} - - SYSTEMINCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${FAIRROOT_INCLUDE_DIR}/fairmq - ${AliceO2_INCLUDE_DIRS} - ${MS_GSL_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - glfw_bucket - - DEPENDENCIES - ${GLFW_LIBRARIES} - - INCLUDE_DIRECTORIES - ${GLFW_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - headless_bucket -) - -o2_define_bucket( - NAME - dumpData_bucket - - DEPENDENCIES - o2_qualitycontrol_with_fairroot_bucket - glfw_bucket -) \ No newline at end of file diff --git a/cmake/ROOTMacros.cmake b/cmake/ROOTMacros.cmake deleted file mode 100644 index ac0c1029d6..0000000000 --- a/cmake/ROOTMacros.cmake +++ /dev/null @@ -1,367 +0,0 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence version 3 (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ -Function(Format _output input prefix suffix) - -# DevNotes - input should be put in quotes or the complete list does not get passed to the function - set(format) - foreach(arg ${input}) - set(item ${arg}) - if(prefix) - string(REGEX MATCH "^${prefix}" pre ${arg}) - endif(prefix) - if(suffix) - string(REGEX MATCH "${suffix}$" suf ${arg}) - endif(suffix) - if(NOT pre) - set(item "${prefix}${item}") - endif(NOT pre) - if(NOT suf) - set(item "${item}${suffix}") - endif(NOT suf) - list(APPEND format ${item}) - endforeach(arg) - set(${_output} ${format} PARENT_SCOPE) - -endfunction(Format) - - - ########################################### - # - # Macros for building ROOT dictionary - # - ########################################### -Macro(ROOT_GENERATE_DICTIONARY) - - # Macro to switch between the old implementation with parameters - # and the new implementation without parameters. - # For the new implementation some CMake variables has to be defined - # before calling the macro. - - If(${ARGC} EQUAL 0) -# Message("New Version") - ROOT_GENERATE_DICTIONARY_NEW() - Else(${ARGC} EQUAL 0) - If(${ARGC} EQUAL 4) -# Message("Old Version") - ROOT_GENERATE_DICTIONARY_OLD("${ARGV0}" "${ARGV1}" "${ARGV2}" "${ARGV3}") - Else(${ARGC} EQUAL 4) - Message(FATAL_ERROR "Has to be implemented") - EndIf(${ARGC} EQUAL 4) - EndIf(${ARGC} EQUAL 0) - -EndMacro(ROOT_GENERATE_DICTIONARY) - -Macro(ROOT_GENERATE_DICTIONARY_NEW) - - # All Arguments needed for this new version of the macro are defined - # in the parent scope, namely in the CMakeLists.txt of the submodule - set(Int_LINKDEF ${LINKDEF}) - set(Int_DICTIONARY ${DICTIONARY}) - set(Int_LIB ${LIBRARY_NAME}) - - set(Int_INC ${INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRECTORIES}) - set(Int_HDRS ${HDRS}) - set(Int_DEF ${DEFINITIONS}) - - # Convert the values of the variable to a semi-colon separated list - separate_arguments(Int_INC) - separate_arguments(Int_HDRS) - separate_arguments(Int_DEF) - - # Format neccesary arguments - # Add -I and -D to include directories and definitions - Format(Int_INC "${Int_INC}" "-I" "") - Format(Int_DEF "${Int_DEF}" "-D" "") - - #---call rootcint / cling -------------------------------- - set(OUTPUT_FILES ${Int_DICTIONARY}) - - If (CMAKE_SYSTEM_NAME MATCHES Linux) - Set(MY_LD_LIBRARY_PATH ${ROOT_LIBRARY_DIR}:${_intel_lib_dirs}:$ENV{LD_LIBRARY_PATH}) - ElseIf(CMAKE_SYSTEM_NAME MATCHES Darwin) - Set(MY_LD_LIBRARY_PATH ${ROOT_LIBRARY_DIR}:$ENV{DYLD_LIBRARY_PATH}) - EndIf() - - get_filename_component(script_name ${Int_DICTIONARY} NAME_WE) - String(REPLACE ";" " " Int_DEF_STR "${Int_DEF}") - String(REPLACE ";" " " Int_INC_STR "${Int_INC}") - String(REPLACE ";" " " Int_HDRS_STR "${Int_HDRS}") - - Set(EXTRA_DICT_PARAMETERS "") - If (ROOT_FOUND_VERSION GREATER 59999) - - Set(Int_ROOTMAPFILE ${LIBRARY_OUTPUT_PATH}/lib${Int_LIB}.rootmap) - Set(Int_PCMFILE G__${Int_LIB}Dict_rdict.pcm) - Set(OUTPUT_FILES ${OUTPUT_FILES} ${Int_PCMFILE} ${Int_ROOTMAPFILE}) - Set(EXTRA_DICT_PARAMETERS ${EXTRA_DICT_PARAMETERS} - -inlineInputHeader -rmf ${Int_ROOTMAPFILE} - -rml ${Int_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX}) - Set_Source_Files_Properties(${OUTPUT_FILES} PROPERTIES GENERATED TRUE) - String(REPLACE ";" " " EXTRA_DICT_PARAMETERS_STR "${EXTRA_DICT_PARAMETERS}") - - EndIf() - - # We need some environment variables which are present when running cmake at the - # time we run make. To pass the variables a script is created containing the - # correct values for the needed variables - - IF(FAIRROOTPATH) - Configure_File(${FAIRROOTPATH}/share/fairbase/cmake/scripts/generate_dictionary_root.sh.in - ${CMAKE_CURRENT_BINARY_DIR}/generate_dictionary_${script_name}.sh - ) - EXEC_PROGRAM(/bin/chmod ARGS "u+x ${CMAKE_CURRENT_BINARY_DIR}/generate_dictionary_${script_name}.sh") - ELSE(FAIRROOTPATH) - Configure_File(${PROJECT_SOURCE_DIR}/cmake/scripts/generate_dictionary_root.sh.in - ${CMAKE_CURRENT_BINARY_DIR}/generate_dictionary_${script_name}.sh - ) - ENDIF(FAIRROOTPATH) - - - If (ROOT_FOUND_VERSION GREATER 59999) - Add_Custom_Command(OUTPUT ${OUTPUT_FILES} - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/generate_dictionary_${script_name}.sh - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${Int_PCMFILE} ${LIBRARY_OUTPUT_PATH}/${Int_PCMFILE} - DEPENDS ${Int_HDRS} ${Int_LINKDEF} - ) - Install(FILES ${LIBRARY_OUTPUT_PATH}/${Int_PCMFILE} ${Int_ROOTMAPFILE} DESTINATION lib) - Else() - Add_Custom_Command(OUTPUT ${OUTPUT_FILES} - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/generate_dictionary_${script_name}.sh - DEPENDS ${Int_HDRS} ${Int_LINKDEF} - ) - EndIf() - -endmacro(ROOT_GENERATE_DICTIONARY_NEW) - - -MACRO (ROOT_GENERATE_DICTIONARY_OLD INFILES LINKDEF_FILE OUTFILE INCLUDE_DIRS_IN) - - set(INCLUDE_DIRS) - - foreach (_current_FILE ${INCLUDE_DIRS_IN}) - set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE}) - endforeach (_current_FILE ${INCLUDE_DIRS_IN}) - -# Message("Definitions: ${DEFINITIONS}") -# MESSAGE("INFILES: ${INFILES}") -# MESSAGE("OutFILE: ${OUTFILE}") -# MESSAGE("LINKDEF_FILE: ${LINKDEF_FILE}") -# MESSAGE("INCLUDE_DIRS: ${INCLUDE_DIRS}") - - STRING(REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" bla "${OUTFILE}") -# MESSAGE("BLA: ${bla}") - SET (OUTFILES ${OUTFILE} ${bla}) - - - if (CMAKE_SYSTEM_NAME MATCHES Linux) - ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES} - COMMAND LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:${_intel_lib_dirs} ROOTSYS=${ROOTSYS} ${ROOT_CINT_EXECUTABLE} - ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES} ${LINKDEF_FILE}) - else (CMAKE_SYSTEM_NAME MATCHES Linux) - if (CMAKE_SYSTEM_NAME MATCHES Darwin) - ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES} - COMMAND DYLD_LIBRARY_PATH=${ROOT_LIBRARY_DIR} ROOTSYS=${ROOTSYS} ${ROOT_CINT_EXECUTABLE} - ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES} ${LINKDEF_FILE}) - endif (CMAKE_SYSTEM_NAME MATCHES Darwin) - endif (CMAKE_SYSTEM_NAME MATCHES Linux) - -ENDMACRO (ROOT_GENERATE_DICTIONARY_OLD) - -MACRO (GENERATE_ROOT_TEST_SCRIPT SCRIPT_FULL_NAME) - - get_filename_component(path_name ${SCRIPT_FULL_NAME} PATH) - get_filename_component(file_extension ${SCRIPT_FULL_NAME} EXT) - get_filename_component(file_name ${SCRIPT_FULL_NAME} NAME_WE) - set(shell_script_name "${file_name}.sh") - - #MESSAGE("PATH: ${path_name}") - #MESSAGE("Ext: ${file_extension}") - #MESSAGE("Name: ${file_name}") - #MESSAGE("Shell Name: ${shell_script_name}") - - string(REPLACE ${PROJECT_SOURCE_DIR} - ${PROJECT_BINARY_DIR} new_path ${path_name} - ) - - #MESSAGE("New PATH: ${new_path}") - - file(MAKE_DIRECTORY ${new_path}/data) - - CONVERT_LIST_TO_STRING(${LD_LIBRARY_PATH}) - set(MY_LD_LIBRARY_PATH ${output}) - - CONVERT_LIST_TO_STRING(${ROOT_INCLUDE_PATH}) - set(MY_ROOT_INCLUDE_PATH ${output}) - - set(my_script_name ${SCRIPT_FULL_NAME}) - - IF(FAIRROOTPATH) - configure_file(${FAIRROOTPATH}/share/fairbase/cmake/scripts/root_macro.sh.in - ${new_path}/${shell_script_name} - ) - ELSE(FAIRROOTPATH) - configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/root_macro.sh.in - ${new_path}/${shell_script_name} - ) - ENDIF(FAIRROOTPATH) - - EXEC_PROGRAM(/bin/chmod ARGS "u+x ${new_path}/${shell_script_name}") - -ENDMACRO (GENERATE_ROOT_TEST_SCRIPT) - - -Macro(ROOT_GENERATE_ROOTMAP) - - # All Arguments needed for this new version of the macro are defined - # in the parent scope, namely in the CMakeLists.txt of the submodule - if (DEFINED LINKDEF) - foreach(l ${LINKDEF}) - If( IS_ABSOLUTE ${l}) - Set(Int_LINKDEF ${Int_LINKDEF} ${l}) - Else( IS_ABSOLUTE ${l}) - Set(Int_LINKDEF ${Int_LINKDEF} ${CMAKE_CURRENT_SOURCE_DIR}/${l}) - EndIf( IS_ABSOLUTE ${l}) - endforeach() - - foreach(d ${DEPENDENCIES}) - get_filename_component(_ext ${d} EXT) - If(NOT _ext MATCHES a$) - if(_ext) - set(Int_DEPENDENCIES ${Int_DEPENDENCIES} ${d}) - else() - set(Int_DEPENDENCIES ${Int_DEPENDENCIES} lib${d}.so) - endif() - Else() - Message("Found Static library with extension ${_ext}") - EndIf() - endforeach() - - set(Int_LIB ${LIBRARY_NAME}) - set(Int_OUTFILE ${LIBRARY_OUTPUT_PATH}/lib${Int_LIB}.rootmap) - - add_custom_command(OUTPUT ${Int_OUTFILE} - COMMAND ${RLIBMAP_EXECUTABLE} -o ${Int_OUTFILE} -l ${Int_LIB} - -d ${Int_DEPENDENCIES} -c ${Int_LINKDEF} - DEPENDS ${Int_LINKDEF} ${RLIBMAP_EXECUTABLE} ) - add_custom_target( lib${Int_LIB}.rootmap ALL DEPENDS ${Int_OUTFILE}) - set_target_properties(lib${Int_LIB}.rootmap PROPERTIES FOLDER RootMaps ) - #---Install the rootmap file------------------------------------ - #install(FILES ${Int_OUTFILE} DESTINATION lib COMPONENT libraries) - install(FILES ${Int_OUTFILE} DESTINATION lib) - endif(DEFINED LINKDEF) -EndMacro(ROOT_GENERATE_ROOTMAP) - -Macro(GENERATE_LIBRARY) - - set(Int_LIB ${LIBRARY_NAME}) - - Set(HeaderRuleName "${Int_LIB}_HEADER_RULES") - Set(DictName "G__${Int_LIB}Dict.cxx") - - If(NOT DICTIONARY) - Set(DICTIONARY ${CMAKE_CURRENT_BINARY_DIR}/${DictName}) - EndIf(NOT DICTIONARY) - - If( IS_ABSOLUTE ${DICTIONARY}) - Set(DICTIONARY ${DICTIONARY}) - Else( IS_ABSOLUTE ${DICTIONARY}) - Set(Int_DICTIONARY ${CMAKE_CURRENT_SOURCE_DIR}/${DICTIONARY}) - EndIf( IS_ABSOLUTE ${DICTIONARY}) - - Set(Int_SRCS ${SRCS}) - - If(HEADERS) - Set(HDRS ${HEADERS}) - Else(HEADERS) - CHANGE_FILE_EXTENSION(*.cxx *.h HDRS "${SRCS}") - EndIf(HEADERS) - - If(IWYU_FOUND) - Set(_INCLUDE_DIRS ${INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRECTORIES}) - CHECK_HEADERS("${Int_SRCS}" "${_INCLUDE_DIRS}" ${HeaderRuleName}) - EndIf(IWYU_FOUND) - - install(FILES ${HDRS} DESTINATION include) - - If(LINKDEF) - If( IS_ABSOLUTE ${LINKDEF}) - Set(Int_LINKDEF ${LINKDEF}) - Else( IS_ABSOLUTE ${LINKDEF}) - Set(Int_LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/${LINKDEF}) - EndIf( IS_ABSOLUTE ${LINKDEF}) - ROOT_GENERATE_DICTIONARY() - SET(Int_SRCS ${Int_SRCS} ${DICTIONARY}) - SET_SOURCE_FILES_PROPERTIES(${DICTIONARY} - PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast" - ) - EndIf(LINKDEF) - - - If (ROOT_FOUND_VERSION LESS 59999) - ROOT_GENERATE_ROOTMAP() - EndIf() - - set(Int_DEPENDENCIES) - foreach(d ${DEPENDENCIES}) - get_filename_component(_ext ${d} EXT) - If(NOT _ext MATCHES a$) - set(Int_DEPENDENCIES ${Int_DEPENDENCIES} ${d}) - Else() - Message("Found Static library with extension ${_ext}") - get_filename_component(_lib ${d} NAME_WE) - set(Int_DEPENDENCIES ${Int_DEPENDENCIES} ${_lib}) - EndIf() - endforeach() - - ############### build the library ##################### - If(${CMAKE_GENERATOR} MATCHES Xcode) - Add_Library(${Int_LIB} SHARED ${Int_SRCS} ${NO_DICT_SRCS} ${HDRS} ${LINKDEF}) - Else() - Add_Library(${Int_LIB} SHARED ${Int_SRCS} ${NO_DICT_SRCS} ${LINKDEF}) - EndIf() - target_link_libraries(${Int_LIB} ${Int_DEPENDENCIES}) - set_target_properties(${Int_LIB} PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES}) - - ############### install the library ################### - install(TARGETS ${Int_LIB} DESTINATION lib) - - Set(LIBRARY_NAME) - Set(DICTIONARY) - Set(LINKDEF) - Set(SRCS) - Set(HEADERS) - Set(NO_DICT_SRCS) - Set(DEPENDENCIES) - -EndMacro(GENERATE_LIBRARY) - - -Macro(GENERATE_EXECUTABLE) - -# If(IWYU_FOUND) -# Set(HeaderRuleName "${EXE_NAME}_HEADER_RULES") -# CHECK_HEADERS("${SRCS}" "${INCLUDE_DIRECTORIES}" ${HeaderRuleName}) -# EndIf(IWYU_FOUND) - - ############### build the library ##################### - Add_Executable(${EXE_NAME} ${SRCS}) - target_link_libraries(${EXE_NAME} ${DEPENDENCIES}) - - ############### install the library ################### - if(DEFINED BIN_DESTINATION) - install(TARGETS ${EXE_NAME} DESTINATION ${BIN_DESTINATION}) - else(DEFINED BIN_DESTINATION) - install(TARGETS ${EXE_NAME} DESTINATION bin) - endif(DEFINED BIN_DESTINATION) - - Set(EXE_NAME) - Set(SRCS) - Set(DEPENDENCIES) - -EndMacro(GENERATE_EXECUTABLE) - diff --git a/cmake/RootNewMacros.cmake b/cmake/RootNewMacros.cmake deleted file mode 100644 index 7c18921d26..0000000000 --- a/cmake/RootNewMacros.cmake +++ /dev/null @@ -1,862 +0,0 @@ -#--------------------------------------------------------------------------------------------------- -# RootNewMacros.cmake -#--------------------------------------------------------------------------------------------------- -cmake_policy(SET CMP0003 NEW) # See "cmake --help-policy CMP0003" for more details -cmake_policy(SET CMP0011 NEW) # See "cmake --help-policy CMP0011" for more details -cmake_policy(SET CMP0009 NEW) # See "cmake --help-policy CMP0009" for more details -if(CMAKE_VERSION VERSION_GREATER 2.8.12) - cmake_policy(SET CMP0022 OLD) # See "cmake --help-policy CMP0022" for more details -endif() - -set(lib lib) -set(bin bin) -if(WIN32) - set(ssuffix .bat) - set(scomment rem) - set(libprefix lib) - set(ld_library_path PATH) - set(libsuffix .dll) - set(runtimedir ${CMAKE_INSTALL_BINDIR}) -elseif(APPLE) - set(ld_library_path DYLD_LIBRARY_PATH) - set(ssuffix .csh) - set(scomment \#) - set(libprefix lib) - set(libsuffix .so) - set(runtimedir ${CMAKE_INSTALL_LIBDIR}) -else() - set(ld_library_path LD_LIBRARY_PATH) - set(ssuffix .csh) - set(scomment \#) - set(libprefix lib) - set(libsuffix .so) - set(runtimedir ${CMAKE_INSTALL_LIBDIR}) -endif() - -if(soversion) - set(ROOT_LIBRARY_PROPERTIES ${ROOT_LIBRARY_PROPERTIES} - VERSION ${ROOT_VERSION} - SOVERSION ${ROOT_MAJOR_VERSION} - SUFFIX ${libsuffix} - PREFIX ${libprefix} ) -else() - set(ROOT_LIBRARY_PROPERTIES ${ROOT_LIBRARY_PROPERTIES} - SUFFIX ${libsuffix} - PREFIX ${libprefix} - IMPORT_PREFIX ${libprefix} ) -endif() - -if(APPLE) - if(gnuinstall) - set(ROOT_LIBRARY_PROPERTIES ${ROOT_LIBRARY_PROPERTIES} - INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}" - BUILD_WITH_INSTALL_RPATH ON) - else() - set(ROOT_LIBRARY_PROPERTIES ${ROOT_LIBRARY_PROPERTIES} - INSTALL_NAME_DIR "@rpath" - BUILD_WITH_INSTALL_RPATH ON) - endif() -endif() - -#---Modify the behaviour for local and non-local builds-------------------------------------------- - -if(CMAKE_PROJECT_NAME STREQUAL ROOT) - set(rootcint_cmd rootcling_tmp) - set(rlibmap_cmd rlibmap) - set(genreflex_cmd genreflex) - set(ROOTCINTDEP rootcling_tmp) -else() - set(rootcint_cmd rootcling) - set(rlibmap_cmd rlibmap) - set(genreflex_cmd genreflex) - set(ROOTCINTDEP) -endif() - -set(CMAKE_VERBOSE_MAKEFILES OFF) -set(CMAKE_INCLUDE_CURRENT_DIR OFF) - -include(CMakeParseArguments) - -#--------------------------------------------------------------------------------------------------- -#---ROOT_GLOB_FILES( [REALTIVE path] [FILTER regexp] ...) -#--------------------------------------------------------------------------------------------------- -function(ROOT_GLOB_FILES variable) - CMAKE_PARSE_ARGUMENTS(ARG "" "RELATIVE;FILTER" "" ${ARGN}) - if(ARG_RELATIVE) - file(GLOB _sources RELATIVE ${ARG_RELATIVE} ${ARG_UNPARSED_ARGUMENTS}) - else() - file(GLOB _sources ${ARG_UNPARSED_ARGUMENTS}) - endif() - if(ARG_FILTER) - foreach(s ${_sources}) - if(s MATCHES ${ARG_FILTER}) - list(REMOVE_ITEM _sources ${s}) - endif() - endforeach() - endif() - set(${variable} ${_sources} PARENT_SCOPE) -endfunction() - -function(ROOT_GLOB_SOURCES variable) - ROOT_GLOB_FILES(_sources FILTER "(^|/)G__" ${ARGN}) - set(${variable} ${_sources} PARENT_SCOPE) -endfunction() - -function(ROOT_GLOB_HEADERS variable) - ROOT_GLOB_FILES(_sources FILTER "LinkDef" ${ARGN}) - set(${variable} ${_sources} PARENT_SCOPE) -endfunction() - -#--------------------------------------------------------------------------------------------------- -#---ROOT_GET_SOURCES( cwd ...) -#--------------------------------------------------------------------------------------------------- -function(ROOT_GET_SOURCES variable cwd ) - set(sources) - foreach( fp ${ARGN}) - if( IS_ABSOLUTE ${fp}) - file(GLOB files ${fp}) - else() - file(GLOB files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${cwd}/${fp}) - endif() - if(files) - foreach(s ${files}) - if(fp MATCHES "[*]" AND s MATCHES "(^|/)G__") # Eliminate G__* files - elseif(s MATCHES "${cwd}/G__") - set(sources ${fp} ${sources}) - else() - set(sources ${sources} ${s}) - endif() - endforeach() - else() - if(fp MATCHES "(^|/)G__") - set(sources ${fp} ${sources}) - else() - set(sources ${sources} ${fp}) - endif() - endif() - endforeach() - set(${variable} ${sources} PARENT_SCOPE) -endfunction() - - -#--------------------------------------------------------------------------------------------------- -#---ROOT_GENERATE_DICTIONARY( dictionary headerfiles MODULE module DEPENDENCIES dep1 dep2 -# STAGE1 LINKDEF linkdef OPTIONS opt1 opt2 ...) -#--------------------------------------------------------------------------------------------------- -function(ROOT_GENERATE_DICTIONARY dictionary) - CMAKE_PARSE_ARGUMENTS(ARG "STAGE1;MULTIDICT" "MODULE" "LINKDEF;OPTIONS;DEPENDENCIES;EXTRA_INC_DIRS" ${ARGN}) - - #---roottest compability--------------------------------- - if(CMAKE_ROOTTEST_DICT) - set(CMAKE_INSTALL_LIBDIR ${CMAKE_CURRENT_BINARY_DIR}) - set(libprefix "") - endif() - - #---Get the list of header files------------------------- - set(headerfiles) - foreach(fp ${ARG_UNPARSED_ARGUMENTS}) - file(GLOB files inc/${fp}) - if(files) - foreach(f ${files}) - if(NOT f MATCHES LinkDef) - set(headerfiles ${headerfiles} ${f}) - endif() - endforeach() - else() - set(headerfiles ${headerfiles} ${fp}) - endif() - endforeach() - string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/inc/" "" rheaderfiles "${headerfiles}") - string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/../include/" "" rheaderfiles "${headerfiles}") - #---Get the list of include directories------------------ - get_directory_property(incdirs INCLUDE_DIRECTORIES) - if(CMAKE_PROJECT_NAME STREQUAL ROOT) - set(includedirs -I${CMAKE_SOURCE_DIR} - -I${CMAKE_BINARY_DIR}/include) - elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/inc) - set(includedirs -I${CMAKE_CURRENT_SOURCE_DIR}/inc) - endif() - foreach( f ${ARG_EXTRA_INC_DIRS}) - if( IS_ABSOLUTE ${f}) - set(incdirs ${incdirs} ${f}) - else() - set(incdirs ${incdirs} ${CMAKE_CURRENT_SOURCE_DIR}/${f}) - endif() - endforeach() - foreach( d ${incdirs}) - set(includedirs ${includedirs} -I${d}) - endforeach() - list(REMOVE_DUPLICATES includedirs) - #---Get the list of definitions--------------------------- - get_directory_property(defs COMPILE_DEFINITIONS) - foreach( d ${defs}) - if((NOT d MATCHES "=") AND (NOT d MATCHES "^[$]<.*>$")) # avoid generator expressions - set(definitions ${definitions} -D${d}) - endif() - endforeach() - #---Get LinkDef.h file------------------------------------ - foreach( f ${ARG_LINKDEF}) - if( IS_ABSOLUTE ${f}) - set(_linkdef ${_linkdef} ${f}) - else() - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f}) - set(_linkdef ${_linkdef} ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f}) - else() - set(_linkdef ${_linkdef} ${CMAKE_CURRENT_SOURCE_DIR}/${f}) - endif() - endif() - endforeach() - - #---Build the names for library, pcm and rootmap file ---- - get_filename_component(dict_base_name ${dictionary} NAME_WE) - if(dict_base_name MATCHES "^G__") - string(SUBSTRING ${dictionary} 3 -1 deduced_arg_module) - else() - set(deduced_arg_module ${dict_base_name}) - endif() - - #---Set the library output directory----------------------- - if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY) - set(library_output_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - else() - set(library_output_dir ${CMAKE_CURRENT_BINARY_DIR}) - endif() - - if(ARG_MODULE) - set(library_name ${libprefix}${ARG_MODULE}${libsuffix}) - if(ARG_MULTIDICT) - set(newargs -s ${library_output_dir}/${library_name} -multiDict) - set(pcm_name ${library_output_dir}/${libprefix}${ARG_MODULE}_${dictionary}_rdict.pcm) - set(rootmap_name ${library_output_dir}/${libprefix}${deduced_arg_module}.rootmap) - else() - set(newargs -s ${library_output_dir}/${library_name}) - set(pcm_name ${library_output_dir}/${libprefix}${ARG_MODULE}_rdict.pcm) - set(rootmap_name ${library_output_dir}/${libprefix}${ARG_MODULE}.rootmap) - endif() - else() - set(library_name ${libprefix}${deduced_arg_module}${libsuffix}) - set(pcm_name ${dictionary}_rdict.pcm) - set(rootmap_name ${library_output_dir}/${libprefix}${deduced_arg_module}.rootmap) - endif() - - if(CMAKE_ROOTTEST_NOROOTMAP) - set(rootmapname ) - set(rootmapargs ) - else() - set(rootmapargs -rml ${library_name} -rmf ${rootmap_name}) - endif() - - #---Get the library and module dependencies----------------- - if(ARG_DEPENDENCIES) - foreach(dep ${ARG_DEPENDENCIES}) - set(newargs ${newargs} -m ${libprefix}${dep}_rdict.pcm) - endforeach() - endif() - - #---what rootcling command to use-------------------------- - if(ARG_STAGE1) - set(command rootcling_tmp) - set(pcm_name) - else() - if(CMAKE_PROJECT_NAME STREQUAL ROOT) - set(command rootcling -rootbuild) - set(ROOTCINTDEP rootcling) - else() - set(command rootcling) - endif() - endif() - - #---call rootcint------------------------------------------ - add_custom_command(OUTPUT ${dictionary}.cxx ${pcm_name} ${rootmap_name} - COMMAND ${command} -f ${dictionary}.cxx ${newargs} ${rootmapargs} - ${ARG_OPTIONS} ${definitions} ${includedirs} ${rheaderfiles} ${_linkdef} - DEPENDS ${headerfiles} ${_linkdef} ${ROOTCINTDEP}) - get_filename_component(dictname ${dictionary} NAME) - - #---roottest compability -# message("CMAKE_LIBRARY_OUTPUT_DIRECTORY : ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -# message("CMAKE_ROOTTEST_DICT : ${CMAKE_ROOTTEST_DICT}") -# message((CMAKE_ROOTTEST_DICT OR (NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY))) -# if(CMAKE_ROOTTEST_DICT OR (NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)) -# message("arg ${dictionary}.cxx") -# add_custom_target(${dictname} DEPENDS ${dictionary}.cxx) -# else() -# message("defined") -# add_custom_target(${dictname} DEPENDS ${dictionary}.cxx) -# -# set_property(GLOBAL APPEND PROPERTY ROOT_DICTIONARY_TARGETS ${dictname}) -# set_property(GLOBAL APPEND PROPERTY ROOT_DICTIONARY_FILES ${CMAKE_CURRENT_BINARY_DIR}/${dictionary}.cxx) -# -# if(ARG_STAGE1) -# message("CMAKE_INSTALL_LIBDIR : ${CMAKE_INSTALL_LIBDIR}") -#install(FILES ${rootmap_name} -# DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) -# else() -# message("CMAKE_INSTALL_LIBDIR : ${CMAKE_INSTALL_LIBDIR}") -# message("pcm_name : ${pcm_name}") -# message("rootmap_name : ${rootmap_name}") -# message("pcm_name : ${CMAKE_CURRENT_BINARY_DIR}/${pcm_name}") -# message("pcm_name : ${CMAKE_CURRENT_BINARY_DIR}/${rootmap_name}") -# install(FILES "${pcm_name}" "${rootmap_name}" -# DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) -# endif() -# endif() -endfunction() - - -#--------------------------------------------------------------------------------------------------- -#---ROOT_LINKER_LIBRARY( source1 source2 ...[TYPE STATIC|SHARED] [DLLEXPORT] LIBRARIES library1 library2 ...) -#--------------------------------------------------------------------------------------------------- -function(ROOT_LINKER_LIBRARY library) - CMAKE_PARSE_ARGUMENTS(ARG "DLLEXPORT;CMAKENOEXPORT;TEST" "TYPE" "LIBRARIES;DEPENDENCIES" ${ARGN}) - ROOT_GET_SOURCES(lib_srcs src ${ARG_UNPARSED_ARGUMENTS}) - if(NOT ARG_TYPE) - set(ARG_TYPE SHARED) - endif() - if(ARG_TEST) # we are building a test, so add EXCLUDE_FROM_ALL - set(_all EXCLUDE_FROM_ALL) - endif() - include_directories(${CMAKE_BINARY_DIR}/include) # This is a copy and certainly should last one - set(library_name ${library}) - if(TARGET ${library}) - message("Target ${library} already exists. Renaming target name to ${library}_new") - set(library ${library}_new) - endif() - if(WIN32 AND ARG_TYPE STREQUAL SHARED AND NOT ARG_DLLEXPORT) - #---create a list of all the object files----------------------------- - if(CMAKE_GENERATOR MATCHES "Visual Studio") - #foreach(src1 ${lib_srcs}) - # if(NOT src1 MATCHES "[.]h$|[.]icc$|[.]hxx$|[.]hpp$") - # string (REPLACE ${CMAKE_CURRENT_SOURCE_DIR} "" src2 ${src1}) - # string (REPLACE ${CMAKE_CURRENT_BINARY_DIR} "" src3 ${src2}) - # string (REPLACE ".." "__" src ${src3}) - # get_filename_component(name ${src} NAME_WE) - # set(lib_objs ${lib_objs} ${library}.dir/${CMAKE_CFG_INTDIR}/${name}.obj) - # endif() - #endforeach() - set(lib_objs ${lib_objs} ${library}.dir/${CMAKE_CFG_INTDIR}/*.obj) - else() - foreach(src1 ${lib_srcs}) - if(NOT src1 MATCHES "[.]h$|[.]icc$|[.]hxx$|[.]hpp$") - string (REPLACE ${CMAKE_CURRENT_SOURCE_DIR} "" src2 ${src1}) - string (REPLACE ${CMAKE_CURRENT_BINARY_DIR} "" src3 ${src2}) - string (REPLACE ".." "__" src ${src3}) - get_filename_component(name ${src} NAME) - get_filename_component(path ${src} PATH) - set(lib_objs ${lib_objs} ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${library}.dir/${path}/${name}.obj) - endif() - endforeach() - endif() - #---create a shared library with the .def file------------------------ - add_library(${library} ${_all} SHARED ${lib_srcs}) - target_link_libraries(${library} ${ARG_LIBRARIES} ${ARG_DEPENDENCIES}) - set_target_properties(${library} PROPERTIES ${ROOT_LIBRARY_PROPERTIES} LINK_FLAGS -DEF:${library}.def) - #---set the .def file as generated------------------------------------ - set_source_files_properties(${library}.def PROPERTIES GENERATED 1) - #---create a custom pre-link command that runs bindexplib - add_custom_command(TARGET ${library} PRE_LINK - COMMAND bindexplib - ARGS -o ${library}.def ${libprefix}${library} ${lib_objs} - DEPENDS bindexplib ) - else() - #---Need to add a dummy source file if all sources are OBJECT libraries (Xcode, ...) - if(NOT lib_srcs MATCHES "(^|[;])[^$][^<]") - add_custom_command(OUTPUT dummy.cxx COMMAND ${CMAKE_COMMAND} -E touch dummy.cxx) - set(lib_srcs ${lib_srcs} dummy.cxx) - endif() - add_library( ${library} ${_all} ${ARG_TYPE} ${lib_srcs}) - if(ARG_TYPE STREQUAL SHARED) - set_target_properties(${library} PROPERTIES ${ROOT_LIBRARY_PROPERTIES} ) - endif() - if(explicitlink OR ROOT_explicitlink_FOUND) - target_link_libraries(${library} ${ARG_LIBRARIES} ${ARG_DEPENDENCIES}) - else() - target_link_libraries(${library} ${ARG_LIBRARIES}) - endif() - endif() - if(TARGET G__${library}) - add_dependencies(${library} G__${library}) - endif() - if(TARGET move_headers) - add_dependencies(${library} move_headers) - endif() - set_property(GLOBAL APPEND PROPERTY ROOT_EXPORTED_TARGETS ${library}) - set_target_properties(${library} PROPERTIES OUTPUT_NAME ${library_name}) - set_target_properties(${library} PROPERTIES LINK_INTERFACE_LIBRARIES "${ARG_DEPENDENCIES}") - #----Installation details------------------------------------------------------- - if(NOT ARG_TEST AND CMAKE_LIBRARY_OUTPUT_DIRECTORY) - if(ARG_CMAKENOEXPORT) - install(TARGETS ${library} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) - else() - install(TARGETS ${library} EXPORT ${CMAKE_PROJECT_NAME}Exports - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) - endif() - if(WIN32 AND ARG_TYPE STREQUAL SHARED) - install(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/lib${library}.pdb - CONFIGURATIONS Debug RelWithDebInfo - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT libraries) - endif() - endif() -endfunction() - -#--------------------------------------------------------------------------------------------------- -#---ROOT_OBJECT_LIBRARY( source1 source2 ...) -#--------------------------------------------------------------------------------------------------- -function(ROOT_OBJECT_LIBRARY library) - ROOT_GET_SOURCES(lib_srcs src ${ARGN}) - include_directories(AFTER ${CMAKE_BINARY_DIR}/include) - add_library( ${library} OBJECT ${lib_srcs}) - if(lib_srcs MATCHES "(^|/)(G__[^.]*)[.]cxx.*") - add_dependencies(${library} ${CMAKE_MATCH_2}) - endif() - if(TARGET move_headers) - add_dependencies(${library} move_headers) - endif() - - #--- Fill the property OBJECTS with all the object files - # This is needed becuase the generator expression $ - # does not get expanded when used in custom command dependencies - get_target_property(sources ${library} SOURCES) - foreach(s ${sources}) - if(CMAKE_GENERATOR MATCHES Xcode) - get_filename_component(name ${s} NAME_WE) - set(obj ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.build/${CMAKE_CFG_INTDIR}/${library}.build/Objects-normal/x86_64/${name}${CMAKE_CXX_OUTPUT_EXTENSION}) - else() - if(IS_ABSOLUTE ${s}) - if(${s} MATCHES ${CMAKE_CURRENT_SOURCE_DIR}) - string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${library}.dir src ${s}) - elseif(${s} MATCHES ${CMAKE_CURRENT_BINARY_DIR}) - string(REPLACE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${library}.dir src ${s}) - else() - #message(WARNING "Unknown location of source ${s} for object library ${library}") - endif() - else() - set(src ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${library}.dir/${s}) - endif() - set(obj ${src}${CMAKE_CXX_OUTPUT_EXTENSION}) - endif() - set_property(TARGET ${library} APPEND PROPERTY OBJECTS ${obj}) - endforeach() -endfunction() - -#--------------------------------------------------------------------------------------------------- -#---ROOT_MODULE_LIBRARY( source1 source2 ... [DLLEXPORT] LIBRARIES library1 library2 ...) -#--------------------------------------------------------------------------------------------------- -function(ROOT_MODULE_LIBRARY library) - CMAKE_PARSE_ARGUMENTS(ARG "" "" "LIBRARIES" ${ARGN}) - ROOT_GET_SOURCES(lib_srcs src ${ARG_UNPARSED_ARGUMENTS}) - include_directories(${CMAKE_BINARY_DIR}/include) - add_library( ${library} SHARED ${lib_srcs}) - if(TARGET move_headers) - add_dependencies(${library} move_headers) - endif() - set_target_properties(${library} PROPERTIES ${ROOT_LIBRARY_PROPERTIES}) - target_link_libraries(${library} ${ARG_LIBRARIES}) - #----Installation details------------------------------------------------------- - install(TARGETS ${library} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) -endfunction() - -#--------------------------------------------------------------------------------------------------- -#---ROOT_USE_PACKAGE( package ) -#--------------------------------------------------------------------------------------------------- -macro( ROOT_USE_PACKAGE package ) -endmacro() - -#--------------------------------------------------------------------------------------------------- -#---ROOT_GENERATE_ROOTMAP( library LINKDEF linkdef LIBRRARY lib DEPENDENCIES lib1 lib2 ) -#--------------------------------------------------------------------------------------------------- -function(ROOT_GENERATE_ROOTMAP library) - return() #--- No needed anymore - CMAKE_PARSE_ARGUMENTS(ARG "" "LIBRARY" "LINKDEF;DEPENDENCIES" ${ARGN}) - get_filename_component(libname ${library} NAME_WE) - get_filename_component(path ${library} PATH) - - #---Set the library output directory----------------------- - if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY) - set(library_output_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - else() - set(library_output_dir ${CMAKE_CURRENT_BINARY_DIR}) - endif() - - set(outfile ${library_output_dir}/${libprefix}${libname}.rootmap) - foreach( f ${ARG_LINKDEF}) - if( IS_ABSOLUTE ${f}) - set(_linkdef ${_linkdef} ${f}) - else() - set(_linkdef ${_linkdef} ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f}) - endif() - endforeach() - foreach(d ${ARG_DEPENDENCIES}) - get_filename_component(_ext ${d} EXT) - if(_ext) - set(_dependencies ${_dependencies} ${d}) - else() - set(_dependencies ${_dependencies} ${libprefix}${d}${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - endforeach() - if(ARG_LIBRARY) - set(_library ${ARG_LIBRARY}) - else() - set(_library ${libprefix}${library}${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() - #---Build the rootmap file-------------------------------------- - add_custom_command(OUTPUT ${outfile} - COMMAND ${rlibmap_cmd} -o ${outfile} -l ${_library} -d ${_dependencies} -c ${_linkdef} - DEPENDS ${_linkdef} ${rlibmap_cmd} ) - add_custom_target( ${libprefix}${library}.rootmap ALL DEPENDS ${outfile}) - set_target_properties(${libprefix}${library}.rootmap PROPERTIES FOLDER RootMaps ) - #---Install the rootmap file------------------------------------ - install(FILES ${outfile} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) -endfunction() - -#--------------------------------------------------------------------------------------------------- -#---ROOT_INSTALL_HEADERS([dir1 dir2 ...] OPTIONS [options]) -#--------------------------------------------------------------------------------------------------- -function(ROOT_INSTALL_HEADERS) - CMAKE_PARSE_ARGUMENTS(ARG "" "" "OPTIONS" ${ARGN}) - if( ARG_UNPARSED_ARGUMENTS ) - set(dirs ${ARG_UNPARSED_ARGUMENTS}) - else() - set(dirs inc/) - endif() - foreach(d ${dirs}) - install(DIRECTORY ${d} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT headers - PATTERN ".svn" EXCLUDE - REGEX "LinkDef" EXCLUDE - ${ARG_OPTIONS}) - set_property(GLOBAL APPEND PROPERTY ROOT_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${d}) - endforeach() -endfunction() - -#--------------------------------------------------------------------------------------------------- -#---ROOT_STANDARD_LIBRARY_PACKAGE(libname DEPENDENCIES lib1 lib2) -#--------------------------------------------------------------------------------------------------- -function(ROOT_STANDARD_LIBRARY_PACKAGE libname) - CMAKE_PARSE_ARGUMENTS(ARG "" "" "DEPENDENCIES;DICTIONARY_OPTIONS" ${ARGN}) - ROOT_GENERATE_DICTIONARY(G__${libname} *.h MODULE ${libname} LINKDEF LinkDef.h OPTIONS ${ARG_DICTIONARY_OPTIONS}) - ROOT_LINKER_LIBRARY(${libname} *.cxx G__${libname}.cxx DEPENDENCIES ${ARG_DEPENDENCIES}) - ROOT_INSTALL_HEADERS() -endfunction() - -#--------------------------------------------------------------------------------------------------- -#---ROOT_EXECUTABLE( source1 source2 ... LIBRARIES library1 library2 ...) -#--------------------------------------------------------------------------------------------------- -function(ROOT_EXECUTABLE executable) - CMAKE_PARSE_ARGUMENTS(ARG "CMAKENOEXPORT;NOINSTALL;TEST" "" "LIBRARIES;ADDITIONAL_COMPILE_FLAGS" ${ARGN}) - ROOT_GET_SOURCES(exe_srcs src ${ARG_UNPARSED_ARGUMENTS}) - set(executable_name ${executable}) - if(TARGET ${executable}) - message("Target ${executable} already exists. Renaming target name to ${executable}_new") - set(executable ${executable}_new) - endif() - if(ARG_TEST) # we are building a test, so add EXCLUDE_FROM_ALL - set(_all EXCLUDE_FROM_ALL) - endif() - include_directories(${CMAKE_BINARY_DIR}/include) - add_executable( ${executable} ${_all} ${exe_srcs}) - target_link_libraries(${executable} ${ARG_LIBRARIES} ) - if(WIN32 AND ${executable} MATCHES .exe) - set_target_properties(${executable} PROPERTIES SUFFIX "") - endif() - set_property(GLOBAL APPEND PROPERTY ROOT_EXPORTED_TARGETS ${executable}) - set_target_properties(${executable} PROPERTIES OUTPUT_NAME ${executable_name}) - if (ARG_ADDITIONAL_COMPILE_FLAGS) - set_target_properties(${executable} PROPERTIES COMPILE_FLAGS ${ARG_ADDITIONAL_COMPILE_FLAGS}) - endif() - if(TARGET move_headers) - add_dependencies(${executable} move_headers) - endif() - - #----Installation details------------------------------------------------------ - if(NOT ARG_NOINSTALL AND CMAKE_RUNTIME_OUTPUT_DIRECTORY) - if(ARG_CMAKENOEXPORT) - install(TARGETS ${executable} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications) - else() - install(TARGETS ${executable} EXPORT ${CMAKE_PROJECT_NAME}Exports RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications) - endif() - if(WIN32) - install(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${executable}.pdb - CONFIGURATIONS Debug RelWithDebInfo - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT applications) - endif() - endif() -endfunction() - -#--------------------------------------------------------------------------------------------------- -#---REFLEX_BUILD_DICTIONARY( dictionary headerfiles selectionfile OPTIONS opt1 opt2 ... LIBRARIES lib1 lib2 ... ) -#--------------------------------------------------------------------------------------------------- -function(REFLEX_BUILD_DICTIONARY dictionary headerfiles selectionfile ) - CMAKE_PARSE_ARGUMENTS(ARG "" "" "LIBRARIES;OPTIONS" ${ARGN}) - REFLEX_GENERATE_DICTIONARY(${dictionary} ${headerfiles} SELECTION ${selectionfile} OPTIONS ${ARG_OPTIONS}) - add_library(${dictionary}Dict MODULE ${gensrcdict}) - target_link_libraries(${dictionary}Dict ${ARG_LIBRARIES} ${ROOT_Reflex_LIBRARY}) - #----Installation details------------------------------------------------------- - install(TARGETS ${dictionary}Dict LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - set(mergedRootMap ${CMAKE_INSTALL_PREFIX}/${lib}/${CMAKE_PROJECT_NAME}Dict.rootmap) - set(srcRootMap ${CMAKE_CURRENT_BINARY_DIR}/${rootmapname}) - install(CODE "EXECUTE_PROCESS(COMMAND ${merge_rootmap_cmd} --do-merge --input-file ${srcRootMap} --merged-file ${mergedRootMap})") -endfunction() - -#--------------------------------------------------------------------------------------------------- -#---ROOT_CHECK_OUT_OF_SOURCE_BUILD( ) -#--------------------------------------------------------------------------------------------------- -macro(ROOT_CHECK_OUT_OF_SOURCE_BUILD) - get_filename_component(bindir_parent ${CMAKE_BINARY_DIR} PATH) - if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) - file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/Testing) - file(REMOVE ${CMAKE_SOURCE_DIR}/DartConfiguration.tcl) - message(FATAL_ERROR "ROOT should be built as an out of source build, to keep the source directory clean. Please create a extra build directory and run the command 'cmake ' in this newly created directory. You have also to delete the directory CMakeFiles and the file CMakeCache.txt in the source directory. Otherwise cmake will complain even if you run it from an out-of-source directory.") - elseif(IS_SYMLINK ${CMAKE_BINARY_DIR} AND CMAKE_SOURCE_DIR STREQUAL bindir_parent) - message(FATAL_ERROR "ROOT cannot be built from a sub-directory of the source tree that is a symlink. This is a current limitation of CMake. Please create a real build directory and run the command 'cmake ' in this newly created directory.") - endif() -endmacro() - -#---------------------------------------------------------------------------- -# function ROOT_ADD_TEST( COMMAND cmd [arg1... ] -# [PRECMD cmd [arg1...]] [POSTCMD cmd [arg1...]] -# [OUTPUT outfile] [ERROR errfile] [INPUT infile] -# [ENVIRONMENT var1=val1 var2=val2 ... -# [DEPENDS test1 ...] -# [TIMEOUT seconds] -# [DEBUG] -# [SOURCE_DIR dir] [BINARY_DIR dir] -# [WORKING_DIR dir] -# [BUILD target] [PROJECT project] -# [PASSREGEX exp] [FAILREGEX epx] -# [PASSRC code]) -# -function(ROOT_ADD_TEST test) - CMAKE_PARSE_ARGUMENTS(ARG "DEBUG;WILLFAIL;CHECKOUT;CHECKERR" - "TIMEOUT;BUILD;INPUT;OUTPUT;ERROR;SOURCE_DIR;BINARY_DIR;WORKING_DIR;PROJECT;PASSRC" - "COMMAND;COPY_TO_BUILDDIR;DIFFCMD;OUTCNV;OUTCNVCMD;PRECMD;POSTCMD;ENVIRONMENT;COMPILEMACROS;DEPENDS;PASSREGEX;OUTREF;ERRREF;FAILREGEX;LABELS" - ${ARGN}) - - #- Handle COMMAND argument - list(LENGTH ARG_COMMAND _len) - if(_len LESS 1) - if(NOT ARG_BUILD) - message(FATAL_ERROR "ROOT_ADD_TEST: command is mandatory (without build)") - endif() - else() - list(GET ARG_COMMAND 0 _prg) - list(REMOVE_AT ARG_COMMAND 0) - - if(TARGET ${_prg}) # if command is a target, get the actual executable - set(_prg "$") - set(_cmd ${_prg} ${ARG_COMMAND}) - else() - find_program(_exe ${_prg}) - if(_exe) # if the command is found in the system, use it - set(_cmd ${_exe} ${ARG_COMMAND}) - elseif(NOT IS_ABSOLUTE ${_prg}) # if not absolute, assume is found in current binary dir - set(_prg ${CMAKE_CURRENT_BINARY_DIR}/${_prg}) - set(_cmd ${_prg} ${ARG_COMMAND}) - else() # take as it is - set(_cmd ${_prg} ${ARG_COMMAND}) - endif() - unset(_exe CACHE) - endif() - - string(REPLACE ";" "^" _cmd "${_cmd}") - endif() - - set(_command ${CMAKE_COMMAND} -DCMD=${_cmd}) - - #- Handle PRE and POST commands - if(ARG_PRECMD) - string(REPLACE ";" "^" _pre "${ARG_PRECMD}") - set(_command ${_command} -DPRE=${_pre}) - endif() - - if(ARG_POSTCMD) - string(REPLACE ";" "^" _post "${ARG_POSTCMD}") - set(_command ${_command} -DPOST=${_post}) - endif() - - #- Handle INPUT, OUTPUT, ERROR, DEBUG arguments - if(ARG_INPUT) - set(_command ${_command} -DIN=${ARG_INPUT}) - endif() - - if(ARG_OUTPUT) - set(_command ${_command} -DOUT=${ARG_OUTPUT}) - endif() - - if(ARG_OUTREF) - set(_command ${_command} -DOUTREF=${ARG_OUTREF}) - endif() - - if(ARG_ERRREF) - set(_command ${_command} -DERRREF=${ARG_ERRREF}) - endif() - - if(ARG_ERROR) - set(_command ${_command} -DERR=${ARG_ERROR}) - endif() - - if(ARG_WORKING_DIR) - set(_command ${_command} -DCWD=${ARG_WORKING_DIR}) - endif() - - if(ARG_DEBUG) - set(_command ${_command} -DDBG=ON) - endif() - - if(ARG_PASSRC) - set(_command ${_command} -DRC=${ARG_PASSRC}) - endif() - - if(ARG_OUTCNVCMD) - string(REPLACE ";" "^" _outcnvcmd "${ARG_OUTCNVCMD}") - set(_command ${_command} -DCNVCMD=${_outcnvcmd}) - endif() - - if(ARG_OUTCNV) - string(REPLACE ";" "^" _outcnv "${ARG_OUTCNV}") - set(_command ${_command} -DCNV=${_outcnv}) - endif() - - if(ARG_DIFFCMD) - string(REPLACE ";" "^" _diff_cmd "${ARG_DIFFCMD}") - set(_command ${_command} -DDIFFCMD=${_diff_cmd}) - endif() - - if(ARG_CHECKOUT) - set(_command ${_command} -DCHECKOUT=true) - endif() - - if(ARG_CHECKERR) - set(_command ${_command} -DCHECKERR=true) - endif() - - set(_command ${_command} -DSYS=${ROOTSYS}) - - #- Handle ENVIRONMENT argument - if(ARG_ENVIRONMENT) - string(REPLACE ";" "#" _env "${ARG_ENVIRONMENT}") - string(REPLACE "=" "@" _env "${_env}") - set(_command ${_command} -DENV=${_env}) - endif() - - #- Copy files to the build directory. - if(ARG_COPY_TO_BUILDDIR) - string(REPLACE ";" "^" _copy_files "${ARG_COPY_TO_BUILDDIR}") - set(_command ${_command} -DCOPY=${_copy_files}) - endif() - - #- Locate the test driver - find_file(ROOT_TEST_DRIVER RootTestDriver.cmake PATHS ${CMAKE_MODULE_PATH}) - if(NOT ROOT_TEST_DRIVER) - message(FATAL_ERROR "ROOT_ADD_TEST: RootTestDriver.cmake not found!") - endif() - set(_command ${_command} -P ${ROOT_TEST_DRIVER}) - - if(ARG_WILLFAIL) - set(test ${test}_WILL_FAIL) - endif() - - #- Now we can actually add the test - if(ARG_BUILD) - if(NOT ARG_SOURCE_DIR) - set(ARG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - if(NOT ARG_BINARY_DIR) - set(ARG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) - endif() - if(NOT ARG_PROJECT) - if(NOT PROJECT_NAME STREQUAL "ROOT") - set(ARG_PROJECT ${PROJECT_NAME}) - else() - set(ARG_PROJECT ${ARG_BUILD}) - endif() - endif() - add_test(NAME ${test} COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test ${ARG_SOURCE_DIR} ${ARG_BINARY_DIR} - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-target ${ARG_BUILD} - --build-project ${ARG_PROJECT} - --build-config $ - --build-noclean - --test-command ${_command} ) - set_property(TEST ${test} PROPERTY ENVIRONMENT ROOT_DIR=${CMAKE_BINARY_DIR}) - else() - add_test(NAME ${test} COMMAND ${_command}) - endif() - - #- Handle TIMOUT and DEPENDS arguments - if(ARG_TIMEOUT) - set_property(TEST ${test} PROPERTY TIMEOUT ${ARG_TIMEOUT}) - endif() - - if(ARG_DEPENDS) - set_property(TEST ${test} PROPERTY DEPENDS ${ARG_DEPENDS}) - endif() - - if(ARG_PASSREGEX) - set_property(TEST ${test} PROPERTY PASS_REGULAR_EXPRESSION ${ARG_PASSREGEX}) - endif() - - if(ARG_FAILREGEX) - set_property(TEST ${test} PROPERTY FAIL_REGULAR_EXPRESSION ${ARG_FAILREGEX}) - endif() - - if(ARG_WILLFAIL) - set_property(TEST ${test} PROPERTY WILL_FAIL true) - endif() - - if(ARG_LABELS) - set_tests_properties(${test} PROPERTIES LABELS "${ARG_LABELS}") - endif() - -endfunction() - -#---------------------------------------------------------------------------- -# ROOT_ADD_TEST_SUBDIRECTORY( ) -#---------------------------------------------------------------------------- -function(ROOT_ADD_TEST_SUBDIRECTORY subdir) - file(RELATIVE_PATH subdir ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}) - set_property(GLOBAL APPEND PROPERTY ROOT_TEST_SUBDIRS ${subdir}) -endfunction() - -#---------------------------------------------------------------------------- -# ROOT_ADD_BUILTIN_DEPENDENCIES(target EXTERNAL) -#---------------------------------------------------------------------------- -macro(ROOT_ADD_BUILTIN_DEPENDENCIES target EXTERNAL) - add_custom_command(OUTPUT ${${EXTERNAL}_LIBRARIES} DEPENDS ${EXTERNAL}) - if(NOT TARGET ${EXTERNAL}LIBS) - add_custom_target(${EXTERNAL}LIBS DEPENDS ${${EXTERNAL}_LIBRARIES}) - endif() - add_dependencies(${target} ${EXTERNAL}LIBS) -endmacro() - -#---------------------------------------------------------------------------- -# ROOT_ADD_CXX_FLAG(var flag) -#---------------------------------------------------------------------------- -function(ROOT_ADD_CXX_FLAG var flag) - string(REGEX REPLACE "[-.+/:= ]" "_" flag_esc "${flag}") - CHECK_CXX_COMPILER_FLAG("${flag}" CXX_HAS${flag_esc}) - if(CXX_HAS${flag_esc}) - set(${var} "${${var}} ${flag}" PARENT_SCOPE) - endif() -endfunction() -#---------------------------------------------------------------------------- -# ROOT_ADD_C_FLAG(var flag) -#---------------------------------------------------------------------------- -function(ROOT_ADD_C_FLAG var flag) - string(REGEX REPLACE "[-.+/:= ]" "_" flag_esc "${flag}") - CHECK_C_COMPILER_FLAG("${flag}" C_HAS${flag_esc}) - if(C_HAS${flag_esc}) - set(${var} "${${var}} ${flag}" PARENT_SCOPE) - endif() -endfunction() - diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 0bb3133134..385d8f99e7 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -3,25 +3,30 @@ include(FindDoxygen) if(NOT DOXYGEN_DOT_FOUND) - message(WARNING "Graphviz doesn't seem to be installed. Doxygen will not be able to generate graphs. Consider installing this package.") + message( + WARNING + "Graphviz doesn't seem to be installed. Doxygen will not be able to generate graphs. Consider installing this package." + ) endif(NOT DOXYGEN_DOT_FOUND) -if (DOXYGEN_FOUND) - # Configure the doxygen config file with current settings - set("DOC_OUTPUT_DIR" "${CMAKE_CURRENT_BINARY_DIR}") - configure_file(doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/documentation-config.doxygen @ONLY) +if(DOXYGEN_FOUND) + # Configure the doxygen config file with current settings + set("DOC_OUTPUT_DIR" "${CMAKE_CURRENT_BINARY_DIR}") + configure_file(doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/documentation-config.doxygen @ONLY) - # target doc - add_custom_target(doc - ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/documentation-config.doxygen - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API documentation using doxygen for ${PROJECT_NAME} - \n Output will be available in ${DOC_OUTPUT_DIR}/html" VERBATIM) + # target doc + add_custom_target( + doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/documentation-config.doxygen + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation using doxygen for ${PROJECT_NAME} + \n Output will be available in ${DOC_OUTPUT_DIR}/html" + VERBATIM + ) - # installation - option(DOC_INSTALL "Install the documentation when calling \"make install\"" OFF) - if(DOC_INSTALL) - message(STATUS "Documentation will be installed but you *must* run `make doc`") - install(DIRECTORY ${DOC_OUTPUT_DIR}/html DESTINATION share/doc/${PROJECT_NAME} COMPONENT doc) - endif(DOC_INSTALL) -endif (DOXYGEN_FOUND) + # installation + option(DOC_INSTALL "Install the documentation when calling \"make install\"" OFF) + if(DOC_INSTALL) + message(STATUS "Documentation will be installed but you *must* run `make doc`") + install(DIRECTORY ${DOC_OUTPUT_DIR}/html DESTINATION share/doc/${PROJECT_NAME} COMPONENT doc) + endif(DOC_INSTALL) +endif(DOXYGEN_FOUND)