diff --git a/.clang-format b/.clang-format index bfaedf0e6dd4f..d382ebadf16e7 100644 --- a/.clang-format +++ b/.clang-format @@ -25,6 +25,7 @@ IndentCaseLabels: true IndentFunctionDeclarationAfterType: true IndentWidth: 2 # It is broken on windows. Breaks all #include "header.h" +--- Language: Cpp MaxEmptyLinesToKeep: 1 KeepEmptyLinesAtTheStartOfBlocks: true @@ -49,3 +50,7 @@ SpacesInParentheses: false Standard: Cpp11 TabWidth: 2 UseTab: Never +--- +# Do not format protobuf files +Language: Proto +DisableFormat: true diff --git a/.cmake-format.py b/.cmake-format.py new file mode 100644 index 0000000000000..414a8b9870ddb --- /dev/null +++ b/.cmake-format.py @@ -0,0 +1,204 @@ +# How wide to allow formatted cmake files +line_width = 80 + +# How many spaces to tab for indent +tab_size = 2 + +# If arglists are longer than this, break them always +max_subargs_per_line = 5 + +# If true, separate flow control names from their parentheses with a space +separate_ctrl_name_with_space = False + +# If true, separate function names from parentheses with a space +separate_fn_name_with_space = False + +# If a statement is wrapped to more than one line, than dangle the closing +# parenthesis on it's own line +dangle_parens = False + +# What character to use for bulleted lists +bullet_char = '*' + +# What character to use as punctuation after numerals in an enumerated list +enum_char = '.' + +# What style line endings to use in the output. +line_ending = 'unix' + +# Format command names consistently as 'lower' or 'upper' case +command_case = 'canonical' + +# Format keywords consistently as 'lower' or 'upper' case +keyword_case = 'upper' + +# Specify structure for custom cmake functions +# * = ZERO_OR_MORE +# + = ONE_OR_MORE +additional_commands = { + "o2_add_executable": { + "flags": ["IS_TEST", "IS_BENCHMARK", "NO_INSTALL"], + "kwargs": { + "SOURCES": '+', + "PUBLIC_LINK_LIBRARIES": '*', + "COMPONENT_NAME": '*', + "EXEVARNAME": '*' + } + }, + "o2_add_header_only_library": { + "kwargs": { + "INCLUDE_DIRECTORIES": '*', + "INTERFACE_LINK_LIBRARIES": '*', + } + }, + "o2_add_library": { + "kwargs": { + "SOURCES": '+', + "PUBLIC_INCLUDE_DIRECTORIES": '*', + "PUBLIC_LINK_LIBRARIES": '*', + "PRIVATE_INCLUDE_DIRECTORIES": '*', + "TARGETVARNAME": '*', + } + }, + "o2_target_root_dictionary": { + "kwargs": { + "LINKDEF": '+', + "HEADERS": '*', + } + }, + "o2_target_man_page": { + "kwargs": { + "NAME": '+', + "SECTION": '*', + } + }, + "add_root_dictionary": { + "kwargs": { + "LINKDEF": '+', + "HEADERS": '*', + "BASENAME": '*', + } + }, + "o2_data_file": { + "kwargs": { + "COPY": '+', + "DESTINATION": '*', + } + }, + "o2_add_test_wrapper": { + "flags": ["DONT_FAIL_ON_TIMEOUT", "NON_FATAL"], + "kwargs": { + "COMMAND": '*', + "NO_BOOST_TEST": '*', + "MAX_ATTEMPTS": '*', + "TIMEOUT": '*', + "NAME": '*', + "WORKING_DIRECTORY": '*', + "CONFIGURATIONS": '*', + "COMMAND_LINE_ARGS": '*', + "LABELS": '*', + "ENVIRONMENT": '*', + } + }, + "o2_add_test": { + "kwargs": { + "INSTALL": '*', + "NO_BOOST_TEST": '*', + "NON_FATAL": '*', + "COMPONENT_NAME": '*', + "MAX_ATTEMPTS": '*', + "TIMEOUT": '*', + "WORKING_DIRECTORY": '*', + "SOURCES": '*', + "PUBLIC_LINK_LIBRARIES": '*', + "COMMAND_LINE_ARGS": '*', + "LABELS": '*', + "ENVIRONMENT": '*', + } + }, + "o2_add_test_root_macro": { + "flags": ["NON_FATAL", "LOAD_ONLY"], + "kwargs": { + "ENVIRONMENT": '*', + "PUBLIC_LINK_LIBRARIES": '*', + "LABELS": '*', + } + }, + "o2_name_target": { + "kwargs": { + "INCLUDE_DIRECTORIES": '*', + "INTERFACE_LINK_LIBRARIES": '*', + } + }, + "find_package_handle_standard_args": { + "flags": ["CONFIG_MODE"], + "kwargs": { + "DEFAULT_MSG": '*', + "REQUIRED_VARS": '*', + "VERSION_VAR": '*', + "HANDLE_COMPONENTS": '*', + "FAIL_MESSAGE": '*' + } + }, + "set_package_properties": { + "kwargs": { + "PROPERTIES": '*', + "URL": '*', + "TYPE": '*', + "PURPOSE": '*' + } + } +} + +# A list of command names which should always be wrapped +always_wrap = [] + +# Specify the order of wrapping algorithms during successive reflow attempts +algorithm_order = [0, 1, 2, 3, 4] + +# If true, the argument lists which are known to be sortable will be sorted +# lexicographicall +autosort = False + +# enable comment markup parsing and reflow +enable_markup = True + +# If comment markup is enabled, don't reflow the first comment block in +# eachlistfile. Use this to preserve formatting of your +# copyright/licensestatements. +first_comment_is_literal = False + +# If comment markup is enabled, don't reflow any comment block which matchesthis +# (regex) pattern. Default is `None` (disabled). +literal_comment_pattern = None + +# Regular expression to match preformat fences in comments +# default=r'^\s*([`~]{3}[`~]*)(.*)$' +fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$' + +# Regular expression to match rulers in comments +# default=r'^\s*[^\w\s]{3}.*[^\w\s]{3}$' +ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$' + +# If true, emit the unicode byte-order mark (BOM) at the start of the file +emit_byteorder_mark = False + +# If a comment line starts with at least this many consecutive hash characters, +# then don't lstrip() them off. This allows for lazy hash rulers where the first +# hash char is not separated by space +hashruler_min_length = 10 + +# If true, then insert a space between the first hash char and remaining hash +# chars in a hash ruler, and normalize it's length to fill the column +canonicalize_hashrulers = True + +# Specify the encoding of the input file. Defaults to utf-8. +input_encoding = 'utf-8' + +# Specify the encoding of the output file. Defaults to utf-8. Note that cmake +# only claims to support utf-8 so be careful when using anything else +output_encoding = 'utf-8' + +# A dictionary containing any per-command configuration overrides. Currently +# only `command_case` is supported. +per_command = {} diff --git a/Algorithm/CMakeLists.txt b/Algorithm/CMakeLists.txt index 7ecd682ac3ea7..bafabe58ec28a 100644 --- a/Algorithm/CMakeLists.txt +++ b/Algorithm/CMakeLists.txt @@ -1,57 +1,54 @@ -# @author Matthias Richter -# @brief cmake setup for module Algorithm - -set(MODULE_NAME "Algorithm") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - ) - -set(LIBRARY_NAME ${MODULE_NAME}) - -set(BUCKET_NAME Algorithm_bucket) - -# no library for the moment -#O2_GENERATE_LIBRARY() - -Set(Exe_Names - ) - -set(Exe_Source - ) - -list(LENGTH Exe_Names _length) -if (LENGTH) -math(EXPR _length ${_length}-1) - -ForEach (_file RANGE 0 ${_length}) - list(GET Exe_Names ${_file} _name) - list(GET Exe_Source ${_file} _src) - O2_GENERATE_EXECUTABLE( - EXE_NAME ${_name} - SOURCES ${_src} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - ) -EndForEach (_file RANGE 0 ${_length}) -endif() - -set(TEST_SRCS - test/o2formatparser.cxx - test/headerstack.cxx - test/parser.cxx - test/tableview.cxx - test/pageparser.cxx - test/test_mpl_tools.cxx - test/test_RangeTokenizer.cxx - test/test_BitstreamReader.cxx -) - -O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) - -O2_GENERATE_MAN(NAME Algorithm SECTION 3) -O2_GENERATE_MAN(NAME algorithm_parser SECTION 3) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_header_only_library(Algorithm INTERFACE_LINK_LIBRARIES O2::Headers) + +o2_target_man_page(Algorithm NAME Algorithm SECTION 3) +o2_target_man_page(Algorithm NAME algorithm_parser SECTION 3) + +o2_add_test(o2formatparser + SOURCES test/o2formatparser.cxx + COMPONENT_NAME Algorithm + PUBLIC_LINK_LIBRARIES O2::Algorithm + LABELS algorithm) + +o2_add_test(headerstack + SOURCES test/headerstack.cxx + COMPONENT_NAME Algorithm + PUBLIC_LINK_LIBRARIES O2::Algorithm + LABELS algorithm) + +o2_add_test(parser + SOURCES test/parser.cxx + COMPONENT_NAME Algorithm + PUBLIC_LINK_LIBRARIES O2::Algorithm + LABELS algorithm) + +o2_add_test(tableview + SOURCES test/tableview.cxx + COMPONENT_NAME Algorithm + PUBLIC_LINK_LIBRARIES O2::Algorithm + LABELS algorithm) + +o2_add_test(pageparser + SOURCES test/pageparser.cxx + COMPONENT_NAME Algorithm + PUBLIC_LINK_LIBRARIES O2::Algorithm + LABELS algorithm) + +o2_add_test(mpl_tools + SOURCES test/test_mpl_tools.cxx + COMPONENT_NAME Algorithm + LABELS algorithm) + +o2_add_test(RangeTokenizer + SOURCES test/test_RangeTokenizer.cxx + COMPONENT_NAME Algorithm + LABELS algorithm) diff --git a/AliceO2_test.cmake b/AliceO2_test.cmake deleted file mode 100644 index 98a2458f81b3b..0000000000000 --- a/AliceO2_test.cmake +++ /dev/null @@ -1,55 +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" # - ################################################################################ -Set(CTEST_SOURCE_DIRECTORY $ENV{SOURCEDIR}) -Set(CTEST_BINARY_DIRECTORY $ENV{BUILDDIR}) -Set(CTEST_SITE $ENV{SITE}) -Set(CTEST_BUILD_NAME $ENV{LABEL}) -Set(CTEST_CMAKE_GENERATOR "Unix Makefiles") -Set(CTEST_PROJECT_NAME "AliceO2") -Set(EXTRA_FLAGS $ENV{EXTRA_FLAGS}) - -Find_Program(CTEST_GIT_COMMAND NAMES git) -Set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}") - -Set(BUILD_COMMAND "make") -Set(CTEST_BUILD_COMMAND "${BUILD_COMMAND} -j$ENV{number_of_processors}") - -If($ENV{ctest_model} MATCHES Nightly OR $ENV{ctest_model} MATCHES Profile) - - Find_Program(GCOV_COMMAND gcov) - If(GCOV_COMMAND) - Message("Found GCOV: ${GCOV_COMMAND}") - Set(CTEST_COVERAGE_COMMAND ${GCOV_COMMAND}) - EndIf(GCOV_COMMAND) - - String(TOUPPER $ENV{ctest_model} _Model) - Set(ENV{ctest_model} Nightly) - - Set(CTEST_CONFIGURE_COMMAND " \"${CMAKE_EXECUTABLE_NAME}\" \"-DCMAKE_BUILD_TYPE=${_Model}\" \"-G${CTEST_CMAKE_GENERATOR}\" \"${EXTRA_FLAGS}\" \"${CTEST_SOURCE_DIRECTORY}\" ") - - CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) - -EndIf() - -Configure_File(${CTEST_SOURCE_DIRECTORY}/CTestCustom.cmake - ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake - ) -Ctest_Read_Custom_Files("${CTEST_BINARY_DIRECTORY}") - -Ctest_Start($ENV{ctest_model}) -If(NOT $ENV{ctest_model} MATCHES Experimental) - Ctest_Update(SOURCE "${CTEST_SOURCE_DIRECTORY}") -EndIf() -Ctest_Configure(BUILD "${CTEST_BINARY_DIRECTORY}") -Ctest_Build(BUILD "${CTEST_BINARY_DIRECTORY}") -Ctest_Test(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL $ENV{number_of_processors}) -If(${_Model} MATCHES PROFILE) - Ctest_Coverage(BUILD "${CTEST_BINARY_DIRECTORY}") -EndIf() -Ctest_Submit() - diff --git a/CCDB/CMakeLists.txt b/CCDB/CMakeLists.txt index 9331e535240a7..95952c80dd8f5 100644 --- a/CCDB/CMakeLists.txt +++ b/CCDB/CMakeLists.txt @@ -1,165 +1,94 @@ -set(MODULE_NAME "CCDB") - -O2_SETUP(NAME ${MODULE_NAME}) - -# When Protobuf is built with CMake, its PROTOBUF_GENERATE_CPP always puts the output files -# in ${CMAKE_CURRENT_BINARY_DIR} but sets the path strings to ${CMAKE_CURRENT_BINARY_DIR}/src -# which is not what we want. -# The following function allows a destination path as argument, which we'll set to empty. -function(PROTOBUF_GENERATE_CPP_DEST PATH SRCS HDRS) - if(NOT ARGN) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") - return() - endif() - - if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - - if(DEFINED PROTOBUF_IMPORT_DIRS) - foreach(DIR ${PROTOBUF_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - endif() - - set(${SRCS}) - set(${HDRS}) - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - - list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${PATH}/${FIL_WE}.pb.cc") - list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${PATH}/${FIL_WE}.pb.h") - - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${PATH}) - - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${PATH}/${FIL_WE}.pb.cc" - "${CMAKE_CURRENT_BINARY_DIR}/${PATH}/${FIL_WE}.pb.h" - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} - ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR}/${PATH} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} - COMMENT "Running C++ protocol buffer compiler on ${FIL}" - VERBATIM ) - endforeach() - - set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) - set(${SRCS} ${${SRCS}} PARENT_SCOPE) - set(${HDRS} ${${HDRS}} PARENT_SCOPE) -endfunction() - -PROTOBUF_GENERATE_CPP_DEST("" PROTO_SRCS PROTO_HDRS src/request.proto) - -include_directories(${CMAKE_BINARY_DIR}/CCDB) - -set(SRCS - src/Backend.cxx - src/BackendOCDB.cxx - src/BackendRiak.cxx - src/Condition.cxx - src/ConditionId.cxx - src/ConditionMetaData.cxx - src/FileStorage.cxx - src/GridStorage.cxx - src/IdPath.cxx - src/IdRunRange.cxx - src/LocalStorage.cxx - src/Manager.cxx - src/ObjectHandler.cxx - src/Storage.cxx - src/XmlHandler.cxx - src/CcdbApi.cxx -) - -set(HEADERS - include/${MODULE_NAME}/Backend.h - include/${MODULE_NAME}/BackendOCDB.h - include/${MODULE_NAME}/BackendRiak.h - include/${MODULE_NAME}/Condition.h - include/${MODULE_NAME}/ConditionId.h - include/${MODULE_NAME}/ConditionMetaData.h - include/${MODULE_NAME}/FileStorage.h - include/${MODULE_NAME}/GridStorage.h - include/${MODULE_NAME}/IdPath.h - include/${MODULE_NAME}/IdRunRange.h - include/${MODULE_NAME}/LocalStorage.h - include/${MODULE_NAME}/Manager.h - include/${MODULE_NAME}/ObjectHandler.h - include/${MODULE_NAME}/Storage.h - include/${MODULE_NAME}/XmlHandler.h - test/TestClass.h -) - -Set(NO_DICT_SRCS - src/ConditionsMQServer.cxx - src/ConditionsMQClient.cxx - ${PROTO_SRCS} -) - -set(LIBRARY_NAME ${MODULE_NAME}) - -set(LINKDEF src/CCDBLinkDef.h) -set(BUCKET_NAME CCDB_bucket) - -O2_GENERATE_LIBRARY() - -Set(Exe_Names - o2-ccdb-conditions-server - o2-ccdb-conditions-client - o2-ccdb-standalone-client -) - -Set(Exe_Source - src/runConditionsServer.cxx - src/runConditionsClient.cxx - test/testQueryServerStandalone.cxx -) - -list(LENGTH Exe_Names _length) -math(EXPR _length ${_length}-1) - -foreach (_file RANGE 0 ${_length}) # loop over a range because we traverse 2 lists and not 1 - list(GET Exe_Names ${_file} _name) - list(GET Exe_Source ${_file} _src) -# Set(DEPENDENCIES CCDB) - O2_GENERATE_EXECUTABLE( - EXE_NAME ${_name} - SOURCES ${_src} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - ) -endforeach (_file RANGE 0 ${_length}) - -install( - FILES config/conditions-server.json - config/conditions-client.json - example/fill_local_ocdb.C - DESTINATION bin/config -) - -if (NOT APPLE) - set(TEST_SRCS - test/testWriteReadAny.cxx - test/testCcdbApi.cxx - ) - - O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - MODULE_LIBRARY_NAME ${MODULE_NAME} - TEST_SRCS ${TEST_SRCS} - ) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(CCDB + SOURCES src/Backend.cxx + src/BackendOCDB.cxx + src/BackendRiak.cxx + src/Condition.cxx + src/ConditionId.cxx + src/ConditionMetaData.cxx + src/FileStorage.cxx + src/GridStorage.cxx + src/IdPath.cxx + src/IdRunRange.cxx + src/LocalStorage.cxx + src/Manager.cxx + src/ObjectHandler.cxx + src/Storage.cxx + src/XmlHandler.cxx + src/CcdbApi.cxx + src/ConditionsMQServer.cxx + src/ConditionsMQClient.cxx + src/request.proto + PUBLIC_LINK_LIBRARIES FairMQ::FairMQ + protobuf::libprotobuf + ROOT::Hist + ROOT::XMLParser + O2::CommonUtils + FairRoot::ParMQ + O2::Device + CURL::libcurl + Boost::thread + TARGETVARNAME targetName) + +protobuf_generate(TARGET ${targetName}) + +o2_target_root_dictionary(CCDB + HEADERS include/CCDB/Backend.h + include/CCDB/BackendOCDB.h + include/CCDB/BackendRiak.h + include/CCDB/Condition.h + include/CCDB/ConditionId.h + include/CCDB/ConditionMetaData.h + include/CCDB/FileStorage.h + include/CCDB/GridStorage.h + include/CCDB/IdPath.h + include/CCDB/IdRunRange.h + include/CCDB/LocalStorage.h + include/CCDB/Manager.h + include/CCDB/ObjectHandler.h + include/CCDB/Storage.h + include/CCDB/XmlHandler.h + include/CCDB/TObjectWrapper.h + test/TestClass.h) + +o2_add_executable(conditions-server + SOURCES src/runConditionsServer.cxx + COMPONENT_NAME ccdb + PUBLIC_LINK_LIBRARIES O2::CCDB) + +o2_add_executable(conditions-client + SOURCES src/runConditionsClient.cxx + COMPONENT_NAME ccdb + PUBLIC_LINK_LIBRARIES O2::CCDB) + +o2_add_executable(standalone-client + SOURCES test/testQueryServerStandalone.cxx + COMPONENT_NAME ccdb + PUBLIC_LINK_LIBRARIES O2::CCDB) + +o2_data_file(COPY config/conditions-server.json config/conditions-client.json + example/fill_local_ocdb.C + DESTINATION config) + +if(NOT APPLE) + o2_add_test(WriteReadAny + SOURCES test/testWriteReadAny.cxx + COMPONENT_NAME ccdb + PUBLIC_LINK_LIBRARIES O2::CCDB + LABELS ccdb) + + o2_add_test(CcdbApi + SOURCES test/testCcdbApi.cxx + COMPONENT_NAME ccdb + PUBLIC_LINK_LIBRARIES O2::CCDB + LABELS ccdb) endif() diff --git a/CCDB/src/request.proto b/CCDB/src/request.proto index c15e34dfb7582..b1af60c0acf63 100644 --- a/CCDB/src/request.proto +++ b/CCDB/src/request.proto @@ -1,3 +1,5 @@ +syntax = "proto2"; + package messaging; option java_package = "com.cern.messaging"; diff --git a/CMakeLists.txt b/CMakeLists.txt index a41eda067f078..466b75f350f9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,332 +1,116 @@ -# The name of our project is "ALICEO2". CMakeLists files in this project can -# refer to the root source directory of the project as ${ALICEO2_SOURCE_DIR} -# or as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as -# ${ALICEO2_BINARY_DIR} or ${CMAKE_BINARY_DIR}. -# This difference is important for the base classes which are in FAIRROOT -# and the experiment part. +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -# Check IF cmake has the required version -CMAKE_MINIMUM_REQUIRED(VERSION 3.11.0 FATAL_ERROR) +# Preamble -### CMP0025 Compiler id for Apple Clang is now AppleClang. -### CMP0042 MACOSX_RPATH is enabled by default. +cmake_minimum_required(VERSION 3.13 FATAL_ERROR) -FOREACH (p - CMP0025 # CMake 3.0 - CMP0042 # CMake 3.0 - CMP0028 - CMP0068 - CMP0057 - ) - IF (POLICY ${p}) - cmake_policy(SET ${p} NEW) - ENDIF () -endforeach () +# it's important to specify accurately the list of languages. for instance C and +# C++ as we _do_ have some C files to compile explicitely as C (e.g. gl3w.c) +project(O2 LANGUAGES C CXX VERSION 1.2.0) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # project specific cmake dir - -# Set name of our project to "ALICEO2". Has to be done -# after check of cmake version since this is a new feature -project(ALICEO2) - -# Toplevel targets -ADD_CUSTOM_TARGET(man ALL) -#In case you need Fortran -#ENABLE_LANGUAGE(Fortran) - -find_package(Boost REQUIRED) - -# Load some basic macros which are needed later on -include(O2Utils) -include(O2Dependencies) -include(FairMacros) -include(WriteConfigFile) include(CTest) -#include(CheckFortran) - -# check if we have a simulation environment -if (Geant3_FOUND AND Geant4_FOUND AND Geant4VMC_FOUND AND Pythia6_FOUND AND PYTHIA8_FOUND) - SET (HAVESIMULATION 1) - message(STATUS "Simulation environment found") -else() - message(STATUS "Simulation environment not found : at least one of the variables Geant3_FOUND , Geant4_FOUND , Geant4VMC_FOUND , Pythia6_FOUND or PYTHIA8_FOUND is not set") - message(STATUS "All of them are needed for a simulation environment.") - message(STATUS "That might not be a problem if you don't care about simulation though.") - message(STATUS "Geant3_FOUND = ${Geant3_FOUND}") - message(STATUS "Geant4_FOUND = ${Geant4_FOUND}") - message(STATUS "Geant4VMC_FOUND = ${Geant4VMC_FOUND}") - message(STATUS "Pythia6_FOUND=${Pythia6_FOUND}") - message(STATUS "PYTHIA8_FOUND=${PYTHIA8_FOUND}") - message(FATAL "stop") -endif() - - -# Build type for coverage builds -set(CMAKE_CXX_FLAGS_COVERAGE "-g -O2 -fprofile-arcs -ftest-coverage") -set(CMAKE_C_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE}") -set(CMAKE_Fortran_FLAGS_COVERAGE "-g -O2 -fprofile-arcs -ftest-coverage") -set(CMAKE_LINK_FLAGS_COVERAGE "--coverage -fprofile-arcs -fPIC") - -MARK_AS_ADVANCED( - CMAKE_CXX_FLAGS_COVERAGE - CMAKE_C_FLAGS_COVERAGE - CMAKE_Fortran_FLAGS_COVERAGE - CMAKE_LINK_FLAGS_COVERAGE) - - -#Check the compiler and set the compile and link flags -IF (NOT CMAKE_BUILD_TYPE) - Message(STATUS "Set BuildType DEBUG") - set(CMAKE_BUILD_TYPE Debug) -ENDIF (NOT CMAKE_BUILD_TYPE) - -IF(ENABLE_CASSERT) #For the CI, we want to have assertions enabled - set(CMAKE_CXX_FLAGS_RELEASE "-O2") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") -ELSE() - set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG") -ENDIF() -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") -set(CMAKE_Fortran_FLAGS_RELEASE "-O2") -set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") -set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-O2 -g") -# make sure Debug build not optimized (does not seem to work without CACHE + FORCE) -set(CMAKE_CXX_FLAGS_DEBUG "-g -O0" CACHE STRING "Debug mode build flags" FORCE) -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "Debug mode build flags" FORCE) -set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0" CACHE STRING "Debug mode build flags" FORCE) - -message(STATUS "Using build type: ${CMAKE_BUILD_TYPE} - CXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}") - -set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib") -set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") -set(INCLUDE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/include") -Set(VMCWORKDIR ${CMAKE_SOURCE_DIR}) -Option(USE_PATH_INFO "Information from PATH and LD_LIBRARY_PATH are used." OFF) -IF (USE_PATH_INFO) - Set(PATH "$PATH") - IF (APPLE) - Set(LD_LIBRARY_PATH $ENV{DYLD_LIBRARY_PATH}) - ELSE (APPLE) - Set(LD_LIBRARY_PATH $ENV{LD_LIBRARY_PATH}) - ENDIF (APPLE) -ELSE (USE_PATH_INFO) - STRING(REGEX MATCHALL "[^:]+" PATH "$ENV{PATH}") -ENDIF (USE_PATH_INFO) - -# Check IF the user wants to build the project in the source -# directory -CHECK_OUT_OF_SOURCE_BUILD() - -# Check IF we are on an UNIX system. IF not stop with an error -# message -IF (NOT UNIX) - MESSAGE(FATAL_ERROR "You're not on an UNIX system. The project was up to now only tested on UNIX systems, so we break here. IF you want to go on please edit the CMakeLists.txt in the source directory.") -ENDIF (NOT UNIX) -# Check IF the external packages are installed into a separate install -# directory -CHECK_EXTERNAL_PACKAGE_INSTALL_DIR() - -# Set the library version in the main CMakeLists.txt -SET(ALICEO2_MAJOR_VERSION 0) -SET(ALICEO2_MINOR_VERSION 0) -SET(ALICEO2_PATCH_VERSION 0) -SET(ALICEO2_VERSION "${ALICEO2_MAJOR_VERSION}.${ALICEO2_MINOR_VERSION}.${ALICEO2_PATCH_VERSION}") -IF (NOT ROOT_FOUND_VERSION OR ROOT_FOUND_VERSION LESS 59999) - SET(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES} - VERSION "${ALICEO2_VERSION}" - SOVERSION "${ALICEO2_MAJOR_VERSION}" - SUFFIX ".so" - ) -ELSE () - SET(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES} - VERSION "${ALICEO2_VERSION}" - SOVERSION "${ALICEO2_MAJOR_VERSION}" - ) -ENDIF () - -Generate_Version_Info() - -# Our libraries will be under "lib" -SET(_LIBDIR ${CMAKE_BINARY_DIR}/lib) -SET(LD_LIBRARY_PATH ${_LIBDIR} ${LD_LIBRARY_PATH}) - -# 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) - -# Check for the required C++ standard features (break if not available) -set(CheckCXX14SrcDir "${CMAKE_SOURCE_DIR}/cmake/checks") -include(CheckCXX14Features) - -# Recurse into the given subdirectories. This does not actually -# cause another cmake executable to run. The same process will walk through -# the project's entire directory structure. - -add_subdirectory(Generators) -set(GENERATORS_LIBRARY Generators) - -add_subdirectory(CCDB) +# Project wide setup + +# Would better fit inside GPU/CMakeLists.txt, but include GPU/Common directly +set(ALIGPU_BUILD_TYPE "O2") + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +set_property(GLOBAL PROPERTY REPORT_UNDEFINED_PROPERTIES) +include(O2BuildSanityChecks) +o2_build_sanity_checks() +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +include(O2CheckCXXFeatures) +o2_check_cxx_features() + +include(O2DefineOptions) +o2_define_options() + +include(O2DefineOutputPaths) +o2_define_output_paths() + +include(O2DefineRPATH) +o2_define_rpath() + +# External dependencies +include(dependencies/CMakeLists.txt) + +# include macros and functions that are used in the following subdirectories' +# CMakeLists.txt +include(O2AddExecutable) +include(O2AddHeaderOnlyLibrary) +include(O2AddLibrary) +include(O2AddTest) +include(O2AddTestRootMacro) +include(O2TargetRootDictionary) +include(O2DataFile) +include(O2TargetManPage) + +# Main targets of the project in various subdirectories. Order matters. +add_subdirectory(Common/Constants) +add_subdirectory(GPU/Common) +add_subdirectory(Common/MathUtils) +add_subdirectory(DataFormats/Detectors/Common) +add_subdirectory(DataFormats/common) +add_subdirectory(DataFormats/Reconstruction) add_subdirectory(Common) -add_subdirectory(DataFormats) -add_subdirectory(Detectors) -add_subdirectory(EventVisualisation) -SET(BUILD_EXAMPLES FALSE CACHE BOOL "Build examples") -if (BUILD_EXAMPLES) - add_subdirectory(Examples) -endif() -add_subdirectory(Framework) +add_subdirectory(DataFormats/MemoryResources) +add_subdirectory(DataFormats/Headers) +add_subdirectory(Utilities/O2Device) +add_subdirectory(CCDB) add_subdirectory(Algorithm) -add_subdirectory(macro) -add_subdirectory(Utilities) -add_subdirectory(Steer) -add_subdirectory(doc) -if (HAVESIMULATION) - add_subdirectory(run) -endif() -add_subdirectory(config) +add_subdirectory(DataFormats/Parameters) +add_subdirectory(Detectors/Base) +add_subdirectory(DataFormats/simulation) +add_subdirectory(DataFormats/Detectors) +add_subdirectory(DataFormats/TimeFrame) +add_subdirectory(Utilities/PCG) +add_subdirectory(Framework) +add_subdirectory(EventVisualisation) +add_subdirectory(Generators) +add_subdirectory(Detectors/TRD) +add_subdirectory(Detectors/ITSMFT) add_subdirectory(GPU) +add_subdirectory(Detectors) +add_subdirectory(Framework/TestWorkflows) +add_subdirectory(Utilities) +add_subdirectory(Steer) # consider building this only for simulation ? -IF (IWYU_FOUND) - ADD_CUSTOM_TARGET(checkHEADERS - DEPENDS $ENV{ALL_HEADER_RULES} - ) -ENDIF () - -SET(VMCWORKDIR ${CMAKE_SOURCE_DIR}) - -SET(VMCWORKDIR ${CMAKE_INSTALL_PREFIX}/share) -SET(ROOT_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include) - -# Place the CTestCustom.cmake in the build dir -configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake - ${CMAKE_BINARY_DIR}/CTestCustom.cmake - ) - -O2_GENERATE_MAN(NAME o2) -O2_GENERATE_MAN(NAME FairMQDevice) - -# Macros from this list will be excluded from tests. To be used only in exceptional cases, such as -# when the macro uses symbols from outside the standard O2 build/runtime environment -set(EXCLUDE_MACROS_FROM_TEST - - ${CMAKE_SOURCE_DIR}/Generators/share/external/hijing.C - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/macros/EVE/rootlogon.C - - # Temporarily disable the following macros: ROOT v6-14-04 fails to parse - # correctly some Boost headers - ${CMAKE_SOURCE_DIR}/CCDB/example/fill_local_ocdb.C - ${CMAKE_SOURCE_DIR}/macro/loadExtDepLib.C - ${CMAKE_SOURCE_DIR}/macro/putCondition.C - - # Exclude AliRoot macros from AliGPU package - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Merger/macros/checkPropagation.C - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Merger/macros/fitPolynomialFieldIts.C - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Merger/macros/fitPolynomialFieldTpc.C - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Merger/macros/fitPolynomialFieldTrd.C - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Standalone/tools/dump.C - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/TRDTracking/macros/checkDbgOutput.C - ${CMAKE_SOURCE_DIR}/GPU/TPCFastTransformation/macro/initTPCcalibration.C - ${CMAKE_SOURCE_DIR}/GPU/TPCFastTransformation/macro/createTPCFastTransform.C - ${CMAKE_SOURCE_DIR}/GPU/TPCFastTransformation/macro/moveTPCFastTransform.C - ${CMAKE_SOURCE_DIR}/GPU/TPCFastTransformation/macro/loadlibs.C - - # This macro is used by the o2-sim tests, no need to re-check. Parallel tests - # of the same macro are also breaking it - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/test/checkStack.C -) - -# Macros from this list will have the test in compiled mode ran in a non-fatal way -set(EXCLUDE_MACROS_FROM_COMPILED_TEST - ${CMAKE_SOURCE_DIR}/Detectors/TPC/calibration/macro/comparePedestalsAndNoise.C - ${CMAKE_SOURCE_DIR}/Detectors/TPC/calibration/macro/drawNoiseAndPedestal.C - ${CMAKE_SOURCE_DIR}/Detectors/TPC/monitor/macro/RunCompareMode3.C - ${CMAKE_SOURCE_DIR}/Detectors/TPC/monitor/macro/RunFindAdcError.C - ${CMAKE_SOURCE_DIR}/Detectors/TPC/reconstruction/macro/dEdxRes.C - ${CMAKE_SOURCE_DIR}/Detectors/TPC/reconstruction/macro/readClusters.C - ${CMAKE_SOURCE_DIR}/Detectors/TPC/reconstruction/macro/testTracks.C - ${CMAKE_SOURCE_DIR}/Detectors/TPC/simulation/macro/readMCtruth.C - ${CMAKE_SOURCE_DIR}/macro/convertClusterToClusterHardware.C - ${CMAKE_SOURCE_DIR}/macro/run_clus_tpc.C -) - -# ROOT on MacOS has linking issues with Vc, disabled until fixed -if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(EXCLUDE_MACROS_FROM_COMPILED_TEST - ${EXCLUDE_MACROS_FROM_COMPILED_TEST} - ${CMAKE_SOURCE_DIR}/GPU/TPCFastTransformation/macro/IrregularSpline1DTest.C - ${CMAKE_SOURCE_DIR}/GPU/TPCFastTransformation/macro/IrregularSpline2D3DTest.C - ) +if(BUILD_EXAMPLES) + add_subdirectory(Examples) endif() -# UNIT TESTS VERIFYING CONSISTENT STATE OF OUR ROOT MACROS AND THE EXECUTION ENVIRONMENT -if(HAVESIMULATION) - # On Mac OS GLOB_RECURSE returns both .C and .c files, i.e. case insensitive - file(GLOB_RECURSE MACRO_FILES "*.C") - # Case sensitive filtering of .C files - list(FILTER MACRO_FILES INCLUDE REGEX "^.*\\.C$") - foreach(MACRO_FILE ${MACRO_FILES}) - if(NOT ${MACRO_FILE} IN_LIST EXCLUDE_MACROS_FROM_TEST) - string(REPLACE ${CMAKE_SOURCE_DIR} "" MACRO_FILE_LABEL ${MACRO_FILE}) - - # Test for "interpreted" macros - add_test_wrap(NAME ${MACRO_FILE_LABEL} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND root -n -b -l -q -e ".L ${MACRO_FILE}") - - # Test for compiled macros - if(NOT ${MACRO_FILE} IN_LIST EXCLUDE_MACROS_FROM_COMPILED_TEST) - add_test_wrap(NAME ${MACRO_FILE_LABEL}_compiled - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ${_MACRO_NON_FATAL} - COMMAND root -n -b -l -q -e ".L ${MACRO_FILE}++") - - # Set environment variables - foreach(_TEST_NAME "${MACRO_FILE_LABEL}" "${MACRO_FILE_LABEL}_compiled") - set_property(TEST ${_TEST_NAME} PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_BINARY_DIR}/lib") - if(APPLE) - set_property(TEST ${_TEST_NAME} APPEND PROPERTY ENVIRONMENT "DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}:${CMAKE_BINARY_DIR}/lib") - endif() - set_property(TEST ${_TEST_NAME} APPEND PROPERTY ENVIRONMENT "ROOT_HIST=0") - endforeach() - - # Cleanup - unset(_TEST_NAME) - endif() - endif() - endforeach() +if(BUILD_SIMULATION) + add_subdirectory(run) endif() -# Create special .rootrc for testing compiled macros -configure_file("${CMAKE_SOURCE_DIR}/cmake/tests.rootrc.in" - "${CMAKE_BINARY_DIR}/.rootrc" - @ONLY - NEWLINE_STYLE UNIX) +add_subdirectory(config) -# Create tests wrapper (and make it executable) -configure_file("${CMAKE_SOURCE_DIR}/cmake/tests-wrapper.sh.in" - "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/tests-wrapper.sh" - @ONLY - NEWLINE_STYLE UNIX) -file(COPY "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/tests-wrapper.sh" - DESTINATION "${CMAKE_BINARY_DIR}" - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +add_custom_target(man ALL) +o2_target_man_page(man NAME o2) +o2_target_man_page(man NAME FairMQDevice) -# Create test for executable naming convention -configure_file("${CMAKE_SOURCE_DIR}/cmake/ensure-executable-naming-convention.sh.in" - "${CMAKE_BINARY_DIR}/ensure-executable-naming-convention.sh" - @ONLY - NEWLINE_STYLE UNIX) +# Testing and packaging only needed if we are the top level directory +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + # Documentation + add_subdirectory(doc) + if(BUILD_TESTING) + add_subdirectory(tests) + endif() + if(BUILD_TEST_ROOT_MACROS) + add_subdirectory(macro) + include(O2ReportNonTestedMacros) + o2_report_non_tested_macros() + endif() + add_subdirectory(packaging) -add_test(NAME "ensure-executable-naming-convention" - COMMAND "ensure-executable-naming-convention.sh") +endif() diff --git a/CTestConfig.cmake b/CTestConfig.cmake deleted file mode 100644 index 5265acd38e1d1..0000000000000 --- a/CTestConfig.cmake +++ /dev/null @@ -1,18 +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" # - ################################################################################ -# Dashboard is opened for submissions for a 24 hour period starting at -# the specified NIGHLY_START_TIME. Time is specified in 24 hour format. -set(CTEST_PROJECT_NAME "AliceO2") -set(CTEST_NIGHTLY_START_TIME "00:00:00 CEST") - -set(CTEST_DROP_METHOD "https") -set(CTEST_DROP_SITE "cdash.gsi.de") -set(CTEST_DROP_LOCATION "/submit.php?project=AliceO2") -set(CTEST_DROP_SITE_CDASH TRUE) - -set(CTEST_TESTING_TIMEOUT 60) diff --git a/CTestCustom.cmake b/CTestCustom.cmake deleted file mode 100644 index 969e6d0a18968..0000000000000 --- a/CTestCustom.cmake +++ /dev/null @@ -1,137 +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" # - ################################################################################ -# -*- mode: cmake -*- - -#message(" -- Read CTestCustom.cmake --") - -# ----------------------------------------------------------- -# -- Number of warnings to display -# ----------------------------------------------------------- - -set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "500" ) - -# ----------------------------------------------------------- -# -- Number of errors to display -# ----------------------------------------------------------- - -set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "50" ) - -# ----------------------------------------------------------- -# -- Warning execptions -# ----------------------------------------------------------- - -set(CTEST_CUSTOM_WARNING_EXCEPTION - ${CTEST_CUSTOM_WARNING_EXCEPTION} - - # -- doxygen warnings -# "of command \@param is not found in the argument list of" -# "for \\link command" -# "for \\ref command" -# "\\class statement" -# "\\file statement" -# "are not documented:" -# "Skipping documentation" -# "has a brief description" - - # -- CLHEP and Pluto warnings - "/include/CLHEP/" - "PDataBase.h" - "PMesh.h" - "PParticle.h" - "PStaticData.h" - "PUtils.h" - "include/pluto/" - - # -- warnings from ubuntu systems which are a little to much - # -- probably defined warn-unused-result. ignoring the result - # -- of fgets is common practice. A work around would be to - # -- store the return value in a dummy variable - "ignoring return value of 'char* fgets(char*, int, FILE*)'" - "ignoring return value of 'char* fscanf(char*, int, FILE*)'" - - # -- boost warnings - "/include/boost/exception/exception.hpp:" - "/include/boost/smart_ptr/detail/sp_convertible.hpp:" - "/include/boost/smart_ptr/shared_ptr.hpp:" - "/include/boost/" - - # -- Root warnings when installed in installation dir - "/include/root/" - # -- Root warnings which should not show up in the test setup - "/include/G__ci.h:" - "/include/TAttImage.h:" - "/include/TBuffer.h:" - "/include/TCollectionProxyInfo.h" - "/include/TCut.h:" - "/include/TChainElement.h:" - "/include/TEveBoxSet.h:" - "/include/TEveTrackPropagator.h:" - "/include/TEveTrackPropagator.h:" - "/include/TEveVector.h:" - "/include/TFcnAdapter.h:" - "/include/TFitterMinuit.h:" - "/include/TGeoMatrix.h:" - "/include/TGeoPainter.h:" - "/include/TList.h:" - "/include/TMap.h:" - "/include/TMatrixT.h:" - "/include/TMatrixTSym.h:" - "/include/TMemberInspector.h:" - "/include/TObjArray.h:" - "/include/TRefArray.h:" - "/include/TString.h:" - "/include/Minuit2/BasicFunctionGradient.h:" - "/include/Minuit2/MnUserParameterState.h:" - "/include/Minuit2/StackAllocator.h:" - "/include/TMVA/ClassInfo.h:" - "/include/TMVA/Config.h:" - "/include/TMVA/Configurable.h:" - "/include/TMVA/DataInputHandler.h:" - "/include/TMVA/DataSet.h:" - "/include/TMVA/DataSetInfo.h:" - "/include/TMVA/DataSetManager.h:" - "/include/TMVA/Event.h:" - "/include/TMVA/Factory.h:" - "/include/TMVA/KDEKernel.h:" - "/include/TMVA/Option.h:" - "/include/TMVA/PDF.h:" - "/include/TMVA/Reader.h:" - "/include/TMVA/Types.h:" - - # -- Geant3 warnings - "TGeant3/TGeant3.h:" - "TGeant3/TGeant3TGeo.h:" - - # -- Errors which are filtered for the time being - # -- MbsAPI is only a copy from elsewhere so don't know what to do - "MbsAPI" - "/MbsAPI/f_evcli.c" - "FairTSBufferFunctional.*std::binary_function" - ) - -# ----------------------------------------------------------- -# -- Warning addon's -# ----------------------------------------------------------- -set(CTEST_CUSTOM_WARNING_MATCH ${CTEST_CUSTOM_WARNING_MATCH} - ) - -Set (CTEST_CUSTOM_COVERAGE_EXCLUDE - ".*Dict.h" - ".*Dict.cxx" - ".*GTest.*" - ) - -# ----------------------------------------------------------- -# -- Error execptions -# -- Get rid of boost warnings which are misinterpreted as errors -# ----------------------------------------------------------- - -Set(CTEST_CUSTOM_ERROR_EXCEPTION - ${CTEST_CUSTOM_ERROR_EXCEPTION} - "/include/boost/" -) \ No newline at end of file diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt index 43af3ceb0ef9b..6b0137635b20c 100644 --- a/Common/CMakeLists.txt +++ b/Common/CMakeLists.txt @@ -1,11 +1,16 @@ -add_subdirectory(MathUtils) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(Field) -add_subdirectory(SimConfig) -add_subdirectory(Constants) add_subdirectory(Types) add_subdirectory(Utils) +add_subdirectory(SimConfig) -install( - DIRECTORY maps - DESTINATION share/Common/ -) +o2_data_file(COPY maps DESTINATION Common) diff --git a/Common/Constants/CMakeLists.txt b/Common/Constants/CMakeLists.txt index e738c19c10faa..40fd739c7ecf1 100644 --- a/Common/Constants/CMakeLists.txt +++ b/Common/Constants/CMakeLists.txt @@ -1,5 +1,11 @@ -set(INC_DIR include/CommonConstants) -install( - DIRECTORY ${INC_DIR} - DESTINATION include -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_header_only_library(CommonConstants) diff --git a/Common/Field/CMakeLists.txt b/Common/Field/CMakeLists.txt index ec056fe4789b8..6687f10d7daec 100644 --- a/Common/Field/CMakeLists.txt +++ b/Common/Field/CMakeLists.txt @@ -1,36 +1,41 @@ -set(MODULE_NAME "Field") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(Field + SOURCES src/MagFieldContFact.cxx + src/MagFieldFact.cxx + src/MagFieldFast.cxx + src/MagFieldParam.cxx + src/MagneticField.cxx + src/MagneticWrapperChebyshev.cxx + PUBLIC_LINK_LIBRARIES O2::MathUtils) -set(SRCS - src/MagneticWrapperChebyshev.cxx - src/MagneticField.cxx - src/MagFieldParam.cxx - src/MagFieldContFact.cxx - src/MagFieldFast.cxx - src/MagFieldFact.cxx - ) +o2_target_root_dictionary(Field + HEADERS include/Field/MagneticWrapperChebyshev.h + include/Field/MagneticField.h + include/Field/MagFieldParam.h + include/Field/MagFieldContFact.h + include/Field/MagFieldFast.h + include/Field/MagFieldFact.h) -set(HEADERS - include/${MODULE_NAME}/MagneticWrapperChebyshev.h - include/${MODULE_NAME}/MagneticField.h - include/${MODULE_NAME}/MagFieldParam.h - include/${MODULE_NAME}/MagFieldContFact.h - include/${MODULE_NAME}/MagFieldFast.h - include/${MODULE_NAME}/MagFieldFact.h - ) -set(LINKDEF src/FieldLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME common_field_bucket) +o2_add_test(MagneticField + SOURCES test/testMagneticField.cxx + PUBLIC_LINK_LIBRARIES O2::Field + COMPONENT_NAME Field + LABELS field + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage) -O2_GENERATE_LIBRARY() +o2_add_test_root_macro(macro/extractMapsAsText.C + PUBLIC_LINK_LIBRARIES O2::Field + LABELS field) -set(TEST_SRCS - test/testMagneticField.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +o2_add_test_root_macro(macro/createMapsFromText.C + PUBLIC_LINK_LIBRARIES O2::Field + LABELS field) diff --git a/Common/MathUtils/CMakeLists.txt b/Common/MathUtils/CMakeLists.txt index 0c871695bb531..891e334136a56 100644 --- a/Common/MathUtils/CMakeLists.txt +++ b/Common/MathUtils/CMakeLists.txt @@ -1,40 +1,43 @@ -set(MODULE_NAME "MathUtils") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Chebyshev3D.cxx - src/Chebyshev3DCalc.cxx - src/MathBase.cxx - src/Cartesian2D.cxx - src/Cartesian3D.cxx - src/CachingTF1.cxx -) - -set(HEADERS - include/${MODULE_NAME}/Utils.h - include/${MODULE_NAME}/Chebyshev3D.h - include/${MODULE_NAME}/Chebyshev3DCalc.h - include/${MODULE_NAME}/MathBase.h - include/${MODULE_NAME}/Cartesian2D.h - include/${MODULE_NAME}/Cartesian3D.h - include/${MODULE_NAME}/CachingTF1.h -) - -set(LINKDEF src/MathUtilsLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME common_math_bucket) - -O2_GENERATE_LIBRARY() - - -set(TEST_SRCS - test/testCartesian3D.cxx - test/testCachingTF1.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(MathUtils + SOURCES src/CachingTF1.cxx + src/Cartesian2D.cxx + src/Cartesian3D.cxx + src/Chebyshev3D.cxx + src/Chebyshev3DCalc.cxx + src/MathBase.cxx + PUBLIC_LINK_LIBRARIES ROOT::Hist + FairRoot::Base + O2::CommonConstants + O2::GPUCommon + ROOT::GenVector + ROOT::Geom) + +o2_target_root_dictionary(MathUtils + HEADERS include/MathUtils/Chebyshev3D.h + include/MathUtils/Chebyshev3DCalc.h + include/MathUtils/MathBase.h + include/MathUtils/Cartesian2D.h + include/MathUtils/Cartesian3D.h + include/MathUtils/CachingTF1.h) + +o2_add_test(CachingTF1 + SOURCES test/testCachingTF1.cxx + COMPONENT_NAME MathUtils + PUBLIC_LINK_LIBRARIES O2::MathUtils + LABELS utils) + +o2_add_test(Cartesian3D + SOURCES test/testCartesian3D.cxx + COMPONENT_NAME MathUtils + PUBLIC_LINK_LIBRARIES O2::MathUtils + LABELS utils) diff --git a/Common/SimConfig/CMakeLists.txt b/Common/SimConfig/CMakeLists.txt index c1a538c5f0638..e6840275110a6 100644 --- a/Common/SimConfig/CMakeLists.txt +++ b/Common/SimConfig/CMakeLists.txt @@ -1,40 +1,39 @@ -set(MODULE_NAME "SimConfig") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/SimConfig.cxx - src/ConfigurableParam.cxx - src/ConfigurableParamHelper.cxx - src/SimCutParams.cxx - src/G4Params.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/SimConfig.h - include/${MODULE_NAME}/SimCutParams.h - include/${MODULE_NAME}/G4Params.h - include/${MODULE_NAME}/ConfigurableParam.h - include/${MODULE_NAME}/ConfigurableParamHelper.h - ) - -set(LINKDEF src/SimConfigLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME configuration_bucket) - -O2_GENERATE_LIBRARY() - -O2_GENERATE_EXECUTABLE( - EXE_NAME testSimConf - SOURCES test/TestConfig.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME testConfigurableParam - SOURCES test/TestConfigurableParam.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) - +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(SimConfig + SOURCES src/SimConfig.cxx src/ConfigurableParam.cxx + src/ConfigurableParamHelper.cxx src/SimCutParams.cxx + src/G4Params.cxx + PUBLIC_LINK_LIBRARIES O2::CommonUtils + O2::DetectorsCommonDataFormats + FairRoot::Base Boost::program_options + Boost::filesystem) + +o2_target_root_dictionary(SimConfig + HEADERS include/SimConfig/SimConfig.h + include/SimConfig/SimCutParams.h + include/SimConfig/ConfigurableParam.h + include/SimConfig/ConfigurableParamHelper.h + include/SimConfig/G4Params.h) + +o2_add_test(Config + SOURCES test/TestConfig.cxx + COMPONENT_NAME SimConfig + PUBLIC_LINK_LIBRARIES O2::SimConfig + NO_BOOST_TEST) + +# FIXME: not working ? +# +# * o2_add_test(ConfigurableParam +# * SOURCES test/TestConfigurableParam.cxx +# * COMPONENT_NAME SimConfig +# * PUBLIC_LINK_LIBRARIES O2::SimConfig +# * NO_BOOST_TEST) diff --git a/Common/Types/CMakeLists.txt b/Common/Types/CMakeLists.txt index ef6a172f37190..fa0bb8740f714 100644 --- a/Common/Types/CMakeLists.txt +++ b/Common/Types/CMakeLists.txt @@ -1,5 +1,11 @@ -set(INC_DIR include/CommonTypes) -install( - DIRECTORY ${INC_DIR} - DESTINATION include -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_header_only_library(CommonTypes) diff --git a/Common/Utils/CMakeLists.txt b/Common/Utils/CMakeLists.txt index 6e84216839d7a..dca00567dcdb7 100644 --- a/Common/Utils/CMakeLists.txt +++ b/Common/Utils/CMakeLists.txt @@ -1,39 +1,42 @@ -set(MODULE_NAME "CommonUtils") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(CommonUtils + SOURCES src/TreeStream.cxx src/TreeStreamRedirector.cxx + src/RootChain.cxx src/CompStream.cxx src/ShmManager.cxx + PUBLIC_LINK_LIBRARIES ROOT::Tree Boost::iostreams + FairLogger::FairLogger) -set(SRCS - src/TreeStream.cxx - src/TreeStreamRedirector.cxx - src/RootChain.cxx - src/CompStream.cxx - src/ShmManager.cxx -) +o2_target_root_dictionary(CommonUtils + HEADERS include/CommonUtils/TreeStream.h + include/CommonUtils/TreeStreamRedirector.h + include/CommonUtils/RootChain.h + include/CommonUtils/BoostSerializer.h + include/CommonUtils/ShmManager.h + include/CommonUtils/RngHelper.h + include/CommonUtils/StringUtils.h) -Set(HEADERS - include/${MODULE_NAME}/TreeStream.h - include/${MODULE_NAME}/TreeStreamRedirector.h - include/${MODULE_NAME}/RootChain.h - include/${MODULE_NAME}/BoostSerializer.h - include/${MODULE_NAME}/ShmManager.h - include/${MODULE_NAME}/RngHelper.h - include/${MODULE_NAME}/StringUtils.h -) +o2_add_test(TreeStream + COMPONENT_NAME CommonUtils + LABELS utils + SOURCES test/testTreeStream.cxx + PUBLIC_LINK_LIBRARIES O2::CommonUtils O2::ReconstructionDataFormats) -Set(LINKDEF src/CommonUtilsLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME common_utils_bucket) +o2_add_test(BoostSerializer + COMPONENT_NAME CommonUtils + LABELS utils + SOURCES test/testBoostSerializer.cxx + PUBLIC_LINK_LIBRARIES O2::CommonUtils Boost::serialization) -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testTreeStream.cxx - test/testBoostSerializer.cxx - test/testCompStream.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +o2_add_test(CompStream + COMPONENT_NAME CommonUtils + LABELS utils + SOURCES test/testCompStream.cxx + PUBLIC_LINK_LIBRARIES O2::CommonUtils Boost::filesystem) diff --git a/Dart.sh b/Dart.sh deleted file mode 100755 index 13a5fdc75b212..0000000000000 --- a/Dart.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash - - -function print_example(){ -echo "##################################################################" -echo "# To set the required parameters as source and the build #" -echo "# directory for ctest, the linux flavour and the SIMPATH #" -echo "# put the export commands below to a separate file which is read #" -echo "# during execution and which is defined on the command line. #" -echo "# Set all parameters according to your needs. #" -echo "# LINUX_FLAVOUR should be set to the distribution you are using #" -echo "# eg Debian, SuSe etc. #" -echo "# An additional varibale NCPU can overwrite the default number #" -echo "# of parallel processes used to compile the project. #" -echo "# This can be usefull if one can use a distributed build system #" -echo "# like icecream. #" -echo "# For example #" -echo "#!/bin/bash #" -echo "#export LINUX_FLAVOUR=Ubuntu14.x #" -echo "#export FAIRSOFT_VERSION="july14p3" #" -echo "#export SIMPATH= #" -echo "#export BUILDDIR=/tmp/AliceO2/build_\${FAIRSOFT_VERSION} #" -echo "#export SOURCEDIR=~/AliceO2 #" -echo "#export NCPU=8 #" -echo "##################################################################" -} - -if [ "$#" -lt "2" ]; then - echo "" - echo "-- Error -- Please start script with two parameters" - echo "-- Error -- The first parameter is the ctest model." - echo "-- Error -- Possible arguments are Nightly, Experimental," - echo "-- Error -- Continuous or Profile." - echo "-- Error -- The second parameter is the file containg the" - echo "-- Error -- Information about the setup at the client" - echo "-- Error -- installation (see example below)." - echo "" - print_example - exit 1 -fi - -# test if a valid ctest model is defined -if [ "$1" == "Experimental" -o "$1" == "Nightly" -o "$1" == "Continuous" -o "$1" == "Profile" -o "$1" == "Test_ROOT6" ]; then - echo "" -else - echo "-- Error -- This ctest model is not supported." - echo "-- Error -- Possible arguments are Nightly, Experimental, Continuous, Profile or Test_ROOT6." - exit 1 -fi - -# test if the input file exists and execute it -if [ -e "$2" ];then - source $2 -else - echo "-- Error -- Input file does not exist." - echo "-- Error -- Please choose existing input file." - exit 1 -fi - -# set the ctest model to command line parameter -export ctest_model=$1 - -# test for architecture -arch=$(uname -s | tr '[A-Z]' '[a-z]') -chip=$(uname -m | tr '[A-Z]' '[a-z]') - -# extract information about the system and the machine and set -# environment variables used by ctest -SYSTEM=$arch-$chip -if test -z $CXX ; then - COMPILER=gcc; - GCC_VERSION=$(gcc -dumpversion) -else - COMPILER=$CXX; - GCC_VERSION=$($CXX -dumpversion) -fi - -export LABEL1=${LINUX_FLAVOUR}-$SYSTEM-$COMPILER$GCC_VERSION-fairroot_$GIT_BRANCH-fairsoft_$FAIRSOFT_VERSION -export LABEL=$(echo $LABEL1 | sed -e 's#/#_#g') - -# get the number of processors -# and information about the host -if [ "$arch" = "linux" ]; -then - if [ "$NCPU" != "" ]; - then - export number_of_processors=$NCPU - else - export number_of_processors=$(cat /proc/cpuinfo | grep processor | wc -l) - fi - export SITE=$(hostname -f) -elif [ "$arch" = "darwin" ]; -then - if [ "$NCPU" != "" ]; - then - export number_of_processors=$NCPU - else - export number_of_processors=$(sysctl -n hw.ncpu) - fi - export SITE=$(hostname -s) -fi - -echo "************************" -date -echo "LABEL: " $LABEL -echo "SITE: " $SITE -echo "Model: " ${ctest_model} -echo "Nr. of processes: " $number_of_processors -echo "************************" - -cd $SOURCEDIR - -ctest -S $SOURCEDIR/AliceO2_test.cmake -V --VV diff --git a/DataFormats/CMakeLists.txt b/DataFormats/CMakeLists.txt deleted file mode 100644 index d84b424fbc825..0000000000000 --- a/DataFormats/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# @brief cmake setup for the DataFormats module of AliceO2 - -add_subdirectory (Headers) -add_subdirectory (simulation) -add_subdirectory (TimeFrame) -add_subdirectory (Parameters) -add_subdirectory (Detectors) -add_subdirectory (Reconstruction) -add_subdirectory (common) -add_subdirectory (MemoryResources) diff --git a/DataFormats/Detectors/CMakeLists.txt b/DataFormats/Detectors/CMakeLists.txt index 6a0e15b433057..551710edc5cd3 100644 --- a/DataFormats/Detectors/CMakeLists.txt +++ b/DataFormats/Detectors/CMakeLists.txt @@ -1,8 +1,17 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + # @brief cmake setup for the DataFormats module of AliceO2 -add_subdirectory (Common) -add_subdirectory (TPC) -add_subdirectory (ITSMFT) -add_subdirectory (MUON) -add_subdirectory (TOF) -add_subdirectory (FIT) +add_subdirectory(TPC) +add_subdirectory(ITSMFT) +add_subdirectory(MUON) +add_subdirectory(TOF) +add_subdirectory(FIT) diff --git a/DataFormats/Detectors/Common/CMakeLists.txt b/DataFormats/Detectors/Common/CMakeLists.txt index 2bb5fc8fd7f0f..1eb1a33bcaec6 100644 --- a/DataFormats/Detectors/Common/CMakeLists.txt +++ b/DataFormats/Detectors/Common/CMakeLists.txt @@ -1,33 +1,25 @@ -set(MODULE_NAME "DetectorsCommonDataFormats") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/DetID.cxx - src/AlignParam.cxx - src/DetMatrixCache.cxx -) - -Set(HEADERS - include/${MODULE_NAME}/DetID.h - include/${MODULE_NAME}/AlignParam.h - include/${MODULE_NAME}/DetMatrixCache.h -) - -Set(LINKDEF src/DetectorsCommonDataFormatsLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME data_format_detectors_common_bucket) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testDetID.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) - - +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(DetectorsCommonDataFormats + SOURCES src/DetID.cxx src/AlignParam.cxx src/DetMatrixCache.cxx + PUBLIC_LINK_LIBRARIES ROOT::Core ROOT::Geom O2::MathUtils) + +o2_target_root_dictionary( + DetectorsCommonDataFormats + HEADERS include/DetectorsCommonDataFormats/DetID.h + include/DetectorsCommonDataFormats/AlignParam.h + include/DetectorsCommonDataFormats/DetMatrixCache.h) + +o2_add_test(DetID + SOURCES test/testDetID.cxx + PUBLIC_LINK_LIBRARIES O2::DetectorsCommonDataFormats + COMPONENT_NAME DetectorsCommonDataFormats + LABELS dataformats) diff --git a/DataFormats/Detectors/FIT/CMakeLists.txt b/DataFormats/Detectors/FIT/CMakeLists.txt index 0407c24ff558b..e4c209cade8fa 100644 --- a/DataFormats/Detectors/FIT/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/CMakeLists.txt @@ -1,19 +1,12 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -# Libraries -#add_subdirectory(common) add_subdirectory(T0) add_subdirectory(V0) diff --git a/DataFormats/Detectors/FIT/T0/CMakeLists.txt b/DataFormats/Detectors/FIT/T0/CMakeLists.txt index d4d34ad39c67b..69aa46007a580 100644 --- a/DataFormats/Detectors/FIT/T0/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/T0/CMakeLists.txt @@ -1,24 +1,20 @@ -set(MODULE_NAME "DataFormatsFITT0") -set(MODULE_BUCKET_NAME data_format_fit_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Digit.cxx - src/RecPoints.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/Digit.h - include/${MODULE_NAME}/RecPoints.h - include/${MODULE_NAME}/MCLabel.h - include/${MODULE_NAME}/HitType.h - ) - -Set(LINKDEF src/DataFormatsFITT0LinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. +o2_add_library(DataFormatsFITT0 + SOURCES src/Digit.cxx src/RecPoints.cxx + PUBLIC_LINK_LIBRARIES O2::CommonDataFormat + O2::SimulationDataFormat) +o2_target_root_dictionary(DataFormatsFITT0 + HEADERS include/DataFormatsFITT0/Digit.h + include/DataFormatsFITT0/RecPoints.h + include/DataFormatsFITT0/MCLabel.h + include/DataFormatsFITT0/HitType.h) diff --git a/DataFormats/Detectors/FIT/T0/src/RecPoints.cxx b/DataFormats/Detectors/FIT/T0/src/RecPoints.cxx index 9fc4b7e28f724..44fcc06f1026e 100644 --- a/DataFormats/Detectors/FIT/T0/src/RecPoints.cxx +++ b/DataFormats/Detectors/FIT/T0/src/RecPoints.cxx @@ -9,20 +9,26 @@ // or submit itself to any jurisdiction. #include "DataFormatsFITT0/RecPoints.h" -#include "T0Base/Geometry.h" +#include #include #include #include using namespace o2::t0; +namespace +{ +constexpr int NCellsA = 24; // number of radiatiors on A side +constexpr int NCellsC = 28; // number of radiatiors on C side +} // namespace + void RecPoints::fillFromDigits(const o2::t0::Digit& digit) { mCollisionTime = {}; Int_t ndigitsC = 0, ndigitsA = 0; - constexpr Int_t nMCPsA = 4 * o2::t0::Geometry::NCellsA; - constexpr Int_t nMCPsC = 4 * o2::t0::Geometry::NCellsC; + constexpr Int_t nMCPsA = 4 * NCellsA; + constexpr Int_t nMCPsC = 4 * NCellsC; constexpr Int_t nMCPs = nMCPsA + nMCPsC; Float_t sideAtime = 0, sideCtime = 0; @@ -34,7 +40,7 @@ void RecPoints::fillFromDigits(const o2::t0::Digit& digit) mTimeAmp = digit.getChDgData(); for (auto& d : mTimeAmp) { d.CFDTime -= mEventTime /*- BCEventTime*/; - if (abs(d.CFDTime - BCEventTime) < 2) { + if (std::fabs(d.CFDTime - BCEventTime) < 2) { if (d.ChId < nMCPsA) { sideAtime += d.CFDTime; ndigitsA++; diff --git a/DataFormats/Detectors/FIT/V0/CMakeLists.txt b/DataFormats/Detectors/FIT/V0/CMakeLists.txt index c3d47b0f769a8..9bba27774e5a7 100644 --- a/DataFormats/Detectors/FIT/V0/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/V0/CMakeLists.txt @@ -1,20 +1,16 @@ -set(MODULE_NAME "DataFormatsFITV0") -set(MODULE_BUCKET_NAME data_format_fit_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Hit.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/Hit.h - ) - -Set(LINKDEF src/DataFormatsFITV0LinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. +o2_add_library(DataFormatsFITV0 + SOURCES src/Hit.cxx + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat) +o2_target_root_dictionary(DataFormatsFITV0 + HEADERS include/DataFormatsFITV0/Hit.h) diff --git a/DataFormats/Detectors/ITSMFT/CMakeLists.txt b/DataFormats/Detectors/ITSMFT/CMakeLists.txt index 7c40dfee029d2..2d4bd7067fa3a 100644 --- a/DataFormats/Detectors/ITSMFT/CMakeLists.txt +++ b/DataFormats/Detectors/ITSMFT/CMakeLists.txt @@ -1,19 +1,13 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -# Libraries add_subdirectory(common) add_subdirectory(ITS) add_subdirectory(MFT) diff --git a/DataFormats/Detectors/ITSMFT/ITS/CMakeLists.txt b/DataFormats/Detectors/ITSMFT/ITS/CMakeLists.txt index d49fbbe21bce3..a52a870fb3c6d 100644 --- a/DataFormats/Detectors/ITSMFT/ITS/CMakeLists.txt +++ b/DataFormats/Detectors/ITSMFT/ITS/CMakeLists.txt @@ -1,16 +1,17 @@ -set(MODULE_NAME "DataFormatsITS") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/TrackITS.cxx -) -set(HEADERS - include/${MODULE_NAME}/TrackITS.h -) - -Set(LINKDEF src/DataFormatsITSLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -Set(BUCKET_NAME data_format_its_bucket) -O2_GENERATE_LIBRARY() +o2_add_library(DataFormatsITS + SOURCES src/TrackITS.cxx + PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats + O2::DataFormatsITSMFT) +o2_target_root_dictionary(DataFormatsITS + HEADERS include/DataFormatsITS/TrackITS.h) diff --git a/DataFormats/Detectors/ITSMFT/MFT/CMakeLists.txt b/DataFormats/Detectors/ITSMFT/MFT/CMakeLists.txt index 9e0fe4b1d15e9..a61e3a758722b 100644 --- a/DataFormats/Detectors/ITSMFT/MFT/CMakeLists.txt +++ b/DataFormats/Detectors/ITSMFT/MFT/CMakeLists.txt @@ -1,16 +1,17 @@ -set(MODULE_NAME "DataFormatsMFT") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/TrackMFT.cxx -) -set(HEADERS - include/${MODULE_NAME}/TrackMFT.h -) - -Set(LINKDEF src/DataFormatsMFTLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -Set(BUCKET_NAME data_format_mft_bucket) -O2_GENERATE_LIBRARY() +o2_add_library(DataFormatsMFT + SOURCES src/TrackMFT.cxx + PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats + O2::DataFormatsITSMFT) +o2_target_root_dictionary(DataFormatsMFT + HEADERS include/DataFormatsMFT/TrackMFT.h) diff --git a/DataFormats/Detectors/ITSMFT/common/CMakeLists.txt b/DataFormats/Detectors/ITSMFT/common/CMakeLists.txt index 9ac210fa30bae..2c06092d8156a 100644 --- a/DataFormats/Detectors/ITSMFT/common/CMakeLists.txt +++ b/DataFormats/Detectors/ITSMFT/common/CMakeLists.txt @@ -1,27 +1,27 @@ -set(MODULE_NAME "DataFormatsITSMFT") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(DataFormatsITSMFT + SOURCES src/ROFRecord.cxx + src/Cluster.cxx + src/CompCluster.cxx + src/ClusterPattern.cxx + src/ClusterTopology.cxx + src/TopologyDictionary.cxx + PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats) -set(SRCS - src/ROFRecord.cxx - src/Cluster.cxx - src/CompCluster.cxx - src/ClusterPattern.cxx - src/ClusterTopology.cxx - src/TopologyDictionary.cxx -) - -Set(HEADERS - include/${MODULE_NAME}/ROFRecord.h - include/${MODULE_NAME}/Cluster.h - include/${MODULE_NAME}/CompCluster.h - include/${MODULE_NAME}/ClusterPattern.h - include/${MODULE_NAME}/ClusterTopology.h - include/${MODULE_NAME}/TopologyDictionary.h -) - -Set(LINKDEF src/ITSMFTDataFormatsLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME data_format_itsmft_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(DataFormatsITSMFT + HEADERS include/DataFormatsITSMFT/ROFRecord.h + include/DataFormatsITSMFT/Cluster.h + include/DataFormatsITSMFT/CompCluster.h + include/DataFormatsITSMFT/ClusterPattern.h + include/DataFormatsITSMFT/ClusterTopology.h + include/DataFormatsITSMFT/TopologyDictionary.h + LINKDEF src/ITSMFTDataFormatsLinkDef.h) diff --git a/DataFormats/Detectors/MUON/CMakeLists.txt b/DataFormats/Detectors/MUON/CMakeLists.txt index 2245f65e6df2b..25f5ebce089ac 100644 --- a/DataFormats/Detectors/MUON/CMakeLists.txt +++ b/DataFormats/Detectors/MUON/CMakeLists.txt @@ -1 +1,11 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(MID) diff --git a/DataFormats/Detectors/MUON/MID/CMakeLists.txt b/DataFormats/Detectors/MUON/MID/CMakeLists.txt index b848df3679b64..5a937388e637f 100644 --- a/DataFormats/Detectors/MUON/MID/CMakeLists.txt +++ b/DataFormats/Detectors/MUON/MID/CMakeLists.txt @@ -1,29 +1,19 @@ -set(MODULE_NAME "DataFormatsMID") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(DataFormatsMID + SOURCES src/ColumnData.cxx src/Track.cxx + PUBLIC_LINK_LIBRARIES Boost::serialization O2::MathUtils) -set(SRCS - src/ColumnData.cxx - src/Track.cxx -) - -set(HEADERS - include/${MODULE_NAME}/Cluster2D.h - include/${MODULE_NAME}/Cluster3D.h - include/${MODULE_NAME}/ColumnData.h - include/${MODULE_NAME}/Track.h -) - -set(LINKDEF src/DataFormatsMIDLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME data_format_mid_bucket) - -# The O2_GENERATE_LIBRARY does not work properly if there are no SRCS -# and there is no linkdef, since it fails in determining if is a C++ file. -# Let us install the headers directly -# Install all the public headers -#if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/${MODULE_NAME}) -# install(DIRECTORY include/${MODULE_NAME} DESTINATION include) -#endif() - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(DataFormatsMID + HEADERS include/DataFormatsMID/Cluster2D.h + include/DataFormatsMID/Cluster3D.h + include/DataFormatsMID/ColumnData.h + include/DataFormatsMID/Track.h) diff --git a/DataFormats/Detectors/TOF/CMakeLists.txt b/DataFormats/Detectors/TOF/CMakeLists.txt index f7a59070d7552..49a2fad17120d 100644 --- a/DataFormats/Detectors/TOF/CMakeLists.txt +++ b/DataFormats/Detectors/TOF/CMakeLists.txt @@ -1,21 +1,17 @@ -set(MODULE_NAME "DataFormatsTOF") -set(MODULE_BUCKET_NAME data_format_TOF_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -link_directories( ${LINK_DIRECTORIES}) - -set(SRCS - src/Cluster.cxx -) - -set(HEADERS - include/${MODULE_NAME}/Cluster.h -) - -set(LINKDEF src/DataFormatsTOFLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() +o2_add_library(DataFormatsTOF + SOURCES src/Cluster.cxx + PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats + Boost::serialization) +o2_target_root_dictionary(DataFormatsTOF + HEADERS include/DataFormatsTOF/Cluster.h) diff --git a/DataFormats/Detectors/TPC/CMakeLists.txt b/DataFormats/Detectors/TPC/CMakeLists.txt index ca6337178790c..ec93a75c52e18 100644 --- a/DataFormats/Detectors/TPC/CMakeLists.txt +++ b/DataFormats/Detectors/TPC/CMakeLists.txt @@ -1,45 +1,47 @@ -# @author David Rohr -# @brief TPC data formats - -set(MODULE_NAME "DataFormatsTPC") -set(MODULE_BUCKET_NAME data_format_TPC_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -link_directories( ${LINK_DIRECTORIES}) - -set(SRCS - src/Helpers.cxx - src/TrackTPC.cxx - src/TPCSectorHeader.cxx - src/ClusterNativeHelper.cxx -) - -set(HEADERS - include/${MODULE_NAME}/ClusterGroupAttribute.h - include/${MODULE_NAME}/ClusterNative.h - include/${MODULE_NAME}/ClusterNativeHelper.h - include/${MODULE_NAME}/ClusterHardware.h - include/${MODULE_NAME}/Helpers.h - include/${MODULE_NAME}/TrackTPC.h - include/${MODULE_NAME}/Constants.h - include/${MODULE_NAME}/Defs.h - include/${MODULE_NAME}/dEdxInfo.h - include/${MODULE_NAME}/CompressedClusters.h -) - -set(LINKDEF src/DataFormatsTPCLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testClusterNative.cxx - test/testClusterHardware.cxx -) - -O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# Comments +# +# * FIXME: ClusterNative depends on SimulationDataFormats : quite annoying for a +# (supposedly real data component) +# +# * GPUCommonDef -> GPUCommonDef to follow more closely the rest of the AliceO2 +# code, but probably the name should be simplified to remove some common ... + +o2_add_library(DataFormatsTPC + SOURCES src/Helpers.cxx src/TrackTPC.cxx src/TPCSectorHeader.cxx + src/ClusterNativeHelper.cxx + PUBLIC_LINK_LIBRARIES O2::GPUCommon O2::SimulationDataFormat + O2::Headers O2::Algorithm) + +o2_target_root_dictionary(DataFormatsTPC + HEADERS include/DataFormatsTPC/ClusterGroupAttribute.h + include/DataFormatsTPC/ClusterNative.h + include/DataFormatsTPC/ClusterNativeHelper.h + include/DataFormatsTPC/ClusterHardware.h + include/DataFormatsTPC/Helpers.h + include/DataFormatsTPC/TrackTPC.h + include/DataFormatsTPC/Constants.h + include/DataFormatsTPC/Defs.h + include/DataFormatsTPC/dEdxInfo.h + include/DataFormatsTPC/CompressedClusters.h) + +o2_add_test(ClusterNative + SOURCES test/testClusterNative.cxx + COMPONENT_NAME DataFormats-TPC + PUBLIC_LINK_LIBRARIES O2::DataFormatsTPC + LABELS tpc dataformats) + +o2_add_test(ClusterHardware + SOURCES test/testClusterHardware.cxx + COMPONENT_NAME DataFormats-TPC + PUBLIC_LINK_LIBRARIES O2::DataFormatsTPC + LABELS tpc dataformats) diff --git a/DataFormats/Headers/CMakeLists.txt b/DataFormats/Headers/CMakeLists.txt index c0d9fb656b693..2394697c9795c 100644 --- a/DataFormats/Headers/CMakeLists.txt +++ b/DataFormats/Headers/CMakeLists.txt @@ -1,38 +1,38 @@ -# @author Mikolaj Krzewicki - -set(MODULE_NAME "Headers") - -O2_SETUP(NAME ${MODULE_NAME}) - -# Define the source and header files -set(SRCS - src/DataHeader.cxx - src/NameHeader.cxx - src/HeartbeatFrame.cxx - src/TimeStamp.cxx -) - -set(HEADERS - include/${MODULE_NAME}/DataHeader.h - include/${MODULE_NAME}/NameHeader.h - include/${MODULE_NAME}/HeartbeatFrame.h - include/${MODULE_NAME}/TimeStamp.h -) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME data_format_headers_bucket) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testDataHeader.cxx - test/testTimeStamp.cxx - test/test_HeartbeatFrame.cxx - test/test_RAWDataHeader.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(Headers + SOURCES src/DataHeader.cxx src/NameHeader.cxx + src/HeartbeatFrame.cxx src/TimeStamp.cxx + PUBLIC_LINK_LIBRARIES O2::MemoryResources) + +o2_add_test(DataHeader + SOURCES test/testDataHeader.cxx + PUBLIC_LINK_LIBRARIES O2::Headers + COMPONENT_NAME Headers + LABELS dataformats) + +o2_add_test(TimeStamp + SOURCES test/testTimeStamp.cxx + PUBLIC_LINK_LIBRARIES O2::Headers + COMPONENT_NAME Headers + LABELS dataformats) + +o2_add_test(HeartbeatFrame + SOURCES test/test_HeartbeatFrame.cxx + PUBLIC_LINK_LIBRARIES O2::Headers + COMPONENT_NAME Headers + LABELS dataformats) + +o2_add_test(RAWDataHeader + SOURCES test/test_RAWDataHeader.cxx + PUBLIC_LINK_LIBRARIES O2::Headers + LABELS dataformats + COMPONENT_NAME Headers) diff --git a/DataFormats/MemoryResources/CMakeLists.txt b/DataFormats/MemoryResources/CMakeLists.txt index a0f3f2d672ad4..6620e6c467b74 100644 --- a/DataFormats/MemoryResources/CMakeLists.txt +++ b/DataFormats/MemoryResources/CMakeLists.txt @@ -1,31 +1,23 @@ -# @author Mikolaj Krzewicki - -set(MODULE_NAME "MemoryResources") - -O2_SETUP(NAME ${MODULE_NAME}) - -# Define the source and header files -set(SRCS - src/MemoryResources.cxx -) - -set(HEADERS - include/${MODULE_NAME}/MemoryResources.h - include/${MODULE_NAME}/observer_ptr.h -) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME pmr_bucket) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testMemoryResources.cxx - test/test_observer_ptr.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(MemoryResources + SOURCES src/MemoryResources.cxx + PUBLIC_LINK_LIBRARIES FairMQ::FairMQ) + +o2_add_test(MemoryResources + SOURCES test/testMemoryResources.cxx + PUBLIC_LINK_LIBRARIES O2::MemoryResources + COMPONENT_NAME MemoryResources) + +o2_add_test(observer_ptr + SOURCES test/test_observer_ptr.cxx + PUBLIC_LINK_LIBRARIES O2::MemoryResources + COMPONENT_NAME MemoryResources) diff --git a/DataFormats/Parameters/CMakeLists.txt b/DataFormats/Parameters/CMakeLists.txt index 5066e6997299a..c6adf65737866 100644 --- a/DataFormats/Parameters/CMakeLists.txt +++ b/DataFormats/Parameters/CMakeLists.txt @@ -1,18 +1,24 @@ -set(MODULE_NAME "DataFormatsParameters") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/GRPObject.cxx -) - -Set(HEADERS - include/${MODULE_NAME}/GRPObject.h -) - -Set(LINKDEF src/ParametersDataLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -Set(BUCKET_NAME data_parameters_bucket) - -O2_GENERATE_LIBRARY() +o2_add_library(DataFormatsParameters + SOURCES src/GRPObject.cxx + PUBLIC_LINK_LIBRARIES FairRoot::Base O2::CommonConstants + O2::CommonTypes + O2::DetectorsCommonDataFormats) +o2_target_root_dictionary(DataFormatsParameters + HEADERS include/DataFormatsParameters/GRPObject.h + LINKDEF src/ParametersDataLinkDef.h) +# note we are explicitely giving the LINKDEF parameter as the LinkDef does not +# follow the usual naming scheme [module]LinkDef.h +# +# * should be src/DataFormatParametersLinkDef.h +# * is src/ParametersDataLinkDef.h instead diff --git a/DataFormats/Reconstruction/CMakeLists.txt b/DataFormats/Reconstruction/CMakeLists.txt index 97afed54bc8de..0aca451618988 100644 --- a/DataFormats/Reconstruction/CMakeLists.txt +++ b/DataFormats/Reconstruction/CMakeLists.txt @@ -1,49 +1,50 @@ -set(MODULE_NAME "ReconstructionDataFormats") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Track.cxx - src/BaseCluster.cxx - src/TrackTPCITS.cxx - src/Vertex.cxx - src/MatchInfoTOF.cxx - src/CalibInfoTOFshort.cxx - src/CalibInfoTOF.cxx - src/CalibLHCphaseTOF.cxx - src/CalibTimeSlewingParamTOF.cxx - src/TrackLTIntegral.cxx - src/PID.cxx - ) - -Set(HEADERS - include/${MODULE_NAME}/Track.h - include/${MODULE_NAME}/BaseCluster.h - include/${MODULE_NAME}/TrackTPCITS.h - include/${MODULE_NAME}/Vertex.h - include/${MODULE_NAME}/MatchInfoTOF.h - include/${MODULE_NAME}/CalibInfoTOFshort.h - include/${MODULE_NAME}/CalibInfoTOF.h - include/${MODULE_NAME}/CalibLHCphaseTOF.h - include/${MODULE_NAME}/CalibTimeSlewingParamTOF.h - include/${MODULE_NAME}/TrackLTIntegral.h - include/${MODULE_NAME}/PID.h -) - -Set(LINKDEF src/ReconstructionDataFormatsLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME data_format_reconstruction_bucket) - -O2_GENERATE_LIBRARY() - - -set(TEST_SRCS - test/testVertex.cxx - test/testLTOFIntegration.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(ReconstructionDataFormats + SOURCES src/Track.cxx + src/BaseCluster.cxx + src/TrackTPCITS.cxx + src/Vertex.cxx + src/MatchInfoTOF.cxx + src/CalibInfoTOFshort.cxx + src/CalibInfoTOF.cxx + src/CalibLHCphaseTOF.cxx + src/CalibTimeSlewingParamTOF.cxx + src/TrackLTIntegral.cxx + src/PID.cxx + PUBLIC_LINK_LIBRARIES O2::GPUCommon + O2::DetectorsCommonDataFormats + O2::CommonDataFormat) + +o2_target_root_dictionary( + ReconstructionDataFormats + HEADERS include/ReconstructionDataFormats/Track.h + include/ReconstructionDataFormats/BaseCluster.h + include/ReconstructionDataFormats/TrackTPCITS.h + include/ReconstructionDataFormats/Vertex.h + include/ReconstructionDataFormats/MatchInfoTOF.h + include/ReconstructionDataFormats/CalibInfoTOFshort.h + include/ReconstructionDataFormats/CalibInfoTOF.h + include/ReconstructionDataFormats/CalibLHCphaseTOF.h + include/ReconstructionDataFormats/CalibTimeSlewingParamTOF.h + include/ReconstructionDataFormats/TrackLTIntegral.h + include/ReconstructionDataFormats/PID.h) + +o2_add_test(Vertex + SOURCES test/testVertex.cxx + COMPONENT_NAME ReconstructionDataFormats + PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats + O2::CommonDataFormat) + +o2_add_test(LTOFIntegration + SOURCES test/testLTOFIntegration.cxx + COMPONENT_NAME ReconstructionDataFormats + PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats) diff --git a/DataFormats/TimeFrame/CMakeLists.txt b/DataFormats/TimeFrame/CMakeLists.txt index 68b56d12baa2b..65dddd10df872 100644 --- a/DataFormats/TimeFrame/CMakeLists.txt +++ b/DataFormats/TimeFrame/CMakeLists.txt @@ -1,29 +1,20 @@ -# @author Sandro Wenzel -# @brief cmake setup for module DataFormats/TimeFrame - -set(MODULE_NAME "TimeFrame") -set(MODULE_BUCKET_NAME TimeFrame_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/TimeFrame.cxx -) - -# define headers -set(HEADERS include/TimeFrame/TimeFrame.h) - -set(LINKDEF src/TimeFrameLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/TimeFrameTest.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS}) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(TimeFrame + SOURCES src/TimeFrame.cxx + PUBLIC_LINK_LIBRARIES FairMQ::FairMQ O2::Headers ROOT::RIO) + +o2_target_root_dictionary(TimeFrame HEADERS include/TimeFrame/TimeFrame.h) + +o2_add_test(TimeFrameTest + SOURCES test/TimeFrameTest.cxx + PUBLIC_LINK_LIBRARIES O2::TimeFrame + COMPONENT_NAME DataFormats) diff --git a/DataFormats/common/CMakeLists.txt b/DataFormats/common/CMakeLists.txt index 2de8291581d44..df5fd75cac3fb 100644 --- a/DataFormats/common/CMakeLists.txt +++ b/DataFormats/common/CMakeLists.txt @@ -1,33 +1,31 @@ -set(MODULE_NAME "CommonDataFormat") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(CommonDataFormat + SOURCES src/InteractionRecord.cxx src/BunchFilling.cxx + PUBLIC_LINK_LIBRARIES O2::CommonConstants O2::GPUCommon + ROOT::Core FairRoot::Base) -set(SRCS - src/InteractionRecord.cxx - src/BunchFilling.cxx -) +o2_target_root_dictionary(CommonDataFormat + HEADERS include/CommonDataFormat/TimeStamp.h + include/CommonDataFormat/EvIndex.h + include/CommonDataFormat/RangeReference.h + include/CommonDataFormat/InteractionRecord.h + include/CommonDataFormat/BunchFilling.h) -Set(HEADERS - include/${MODULE_NAME}/TimeStamp.h - include/${MODULE_NAME}/EvIndex.h - include/${MODULE_NAME}/RangeReference.h - include/${MODULE_NAME}/InteractionRecord.h - include/${MODULE_NAME}/BunchFilling.h -) +o2_add_test(TimeStamp + SOURCES test/testTimeStamp.cxx + COMPONENT_NAME CommonDataFormat + PUBLIC_LINK_LIBRARIES O2::CommonDataFormat) -Set(LINKDEF src/CommonDataFormatLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME data_format_common_bucket) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testTimeStamp.cxx - test/testRangeRef.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +o2_add_test(RangeRef + SOURCES test/testRangeRef.cxx + COMPONENT_NAME CommonDataFormat + PUBLIC_LINK_LIBRARIES O2::CommonDataFormat) diff --git a/DataFormats/simulation/CMakeLists.txt b/DataFormats/simulation/CMakeLists.txt index 6a4a550fe3cf6..a9f9e912a94a6 100644 --- a/DataFormats/simulation/CMakeLists.txt +++ b/DataFormats/simulation/CMakeLists.txt @@ -1,46 +1,61 @@ -set(MODULE_NAME "SimulationDataFormat") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(SimulationDataFormat + SOURCES src/Stack.cxx + src/MCTrack.cxx + src/MCCompLabel.cxx + src/RunContext.cxx + src/StackParam.cxx + src/MCEventHeader.cxx + PUBLIC_LINK_LIBRARIES ms_gsl::ms_gsl + O2::DetectorsCommonDataFormats + O2::GPUCommon O2::DetectorsBase + O2::SimConfig) -set(SRCS - src/Stack.cxx - src/MCTrack.cxx - src/MCCompLabel.cxx - src/RunContext.cxx - src/StackParam.cxx - src/MCEventHeader.cxx -) +o2_target_root_dictionary( + SimulationDataFormat + HEADERS include/SimulationDataFormat/Stack.h + include/SimulationDataFormat/StackParam.h + include/SimulationDataFormat/MCTrack.h + include/SimulationDataFormat/BaseHits.h + include/SimulationDataFormat/MCTruthContainer.h + include/SimulationDataFormat/MCCompLabel.h + include/SimulationDataFormat/TrackReference.h + include/SimulationDataFormat/PrimaryChunk.h + include/SimulationDataFormat/RunContext.h + include/SimulationDataFormat/LabelContainer.h + include/SimulationDataFormat/MCEventHeader.h + include/SimulationDataFormat/MCEventStats.h + LINKDEF src/SimulationDataLinkDef.h) +# note the explicit LINKDEF as the linkdef in src is +# +# * src/SimulationDataLinkDef.h +# * and not src/SimulationDataFormatLinkDef.h -Set(HEADERS - include/${MODULE_NAME}/Stack.h - include/${MODULE_NAME}/StackParam.h - include/${MODULE_NAME}/MCTrack.h - include/${MODULE_NAME}/BaseHits.h - include/${MODULE_NAME}/MCTruthContainer.h - include/${MODULE_NAME}/MCCompLabel.h - include/${MODULE_NAME}/TrackReference.h - include/${MODULE_NAME}/PrimaryChunk.h - include/${MODULE_NAME}/RunContext.h - include/${MODULE_NAME}/LabelContainer.h - include/${MODULE_NAME}/MCEventHeader.h - include/${MODULE_NAME}/MCEventStats.h -) +o2_add_test(BasicHits + SOURCES test/testBasicHits.cxx + COMPONENT_NAME SimulationDataFormat + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat) -Set(LINKDEF src/SimulationDataLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME data_format_simulation_bucket) +o2_add_test(MCTruthContainer + SOURCES test/testMCTruthContainer.cxx + COMPONENT_NAME SimulationDataFormat + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat) -O2_GENERATE_LIBRARY() +o2_add_test(MCCompLabel + SOURCES test/testMCCompLabel.cxx + COMPONENT_NAME SimulationDataFormat + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat) -set(TEST_SRCS - test/testBasicHits.cxx - test/testMCTruthContainer.cxx - test/testMCCompLabel.cxx - test/MCTrack.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +o2_add_test(MCTrack + SOURCES test/MCTrack.cxx + COMPONENT_NAME SimulationDataFormat + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat) diff --git a/Detectors/Base/CMakeLists.txt b/Detectors/Base/CMakeLists.txt index 9e003e0762d17..b5d179fea1bae 100644 --- a/Detectors/Base/CMakeLists.txt +++ b/Detectors/Base/CMakeLists.txt @@ -1,46 +1,53 @@ -set(MODULE_NAME "DetectorsBase") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(DetectorsBase + SOURCES src/Detector.cxx + src/GeometryManager.cxx + src/MaterialManager.cxx + src/Propagator.cxx + src/MatLayerCyl.cxx + src/MatLayerCylSet.cxx + src/Ray.cxx + PUBLIC_LINK_LIBRARIES FairRoot::Base + O2::CommonUtils + O2::DetectorsCommonDataFormats + O2::GPUCommon + O2::ReconstructionDataFormats + O2::Field + FairMQ::FairMQ + O2::DataFormatsParameters + ROOT::VMC) -set(SRCS - src/Detector.cxx - src/GeometryManager.cxx - src/MaterialManager.cxx - src/Propagator.cxx - src/MatLayerCyl.cxx - src/MatLayerCylSet.cxx - src/Ray.cxx - src/DCAFitter.cxx -) +o2_target_root_dictionary(DetectorsBase + HEADERS include/DetectorsBase/Detector.h + include/DetectorsBase/GeometryManager.h + include/DetectorsBase/MaterialManager.h + include/DetectorsBase/Propagator.h + include/DetectorsBase/Triggers.h + include/DetectorsBase/Ray.h + include/DetectorsBase/MatCell.h + include/DetectorsBase/MatLayerCyl.h + include/DetectorsBase/MatLayerCylSet.h) -Set(HEADERS - include/${MODULE_NAME}/Detector.h - include/${MODULE_NAME}/GeometryManager.h - include/${MODULE_NAME}/MaterialManager.h - include/${MODULE_NAME}/Propagator.h - include/${MODULE_NAME}/Triggers.h - include/${MODULE_NAME}/Ray.h - include/${MODULE_NAME}/MatCell.h - include/${MODULE_NAME}/MatLayerCyl.h - include/${MODULE_NAME}/MatLayerCylSet.h - include/${MODULE_NAME}/DCAFitter.h -) - -Set(LINKDEF src/DetectorsBaseLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME detectors_base_bucket) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testMatBudLUT.cxx - test/testDCAFitter.cxx -) - -if (HAVESIMULATION) - O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} - ) +if(BUILD_SIMULATION) + o2_add_test( + MatBudLUT + SOURCES test/testMatBudLUT.cxx + COMPONENT_NAME DetectorsBase + PUBLIC_LINK_LIBRARIES O2::DetectorsBase + LABELS detectorsbase + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage + VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/${CMAKE_INSTALL_DATADIR}) endif() + +o2_add_test_root_macro(test/buildMatBudLUT.C + PUBLIC_LINK_LIBRARIES O2::DetectorsBase + LABELS detectorsbase) diff --git a/Detectors/Base/test/buildMatBudLUT.C b/Detectors/Base/test/buildMatBudLUT.C index c830803c17db9..1c23b208f2299 100644 --- a/Detectors/Base/test/buildMatBudLUT.C +++ b/Detectors/Base/test/buildMatBudLUT.C @@ -46,6 +46,7 @@ bool buildMatBudLUT(int nTst, int maxLr, std::string outName, std::string outFil { if (gSystem->AccessPathName(geomName.c_str())) { // if needed, create geometry + std::cout << geomName << " does not exist. Will create it\n"; gSystem->Exec("$O2_ROOT/bin/o2-sim -n 0"); geomName = "./O2geometry.root"; } diff --git a/Detectors/CMakeLists.txt b/Detectors/CMakeLists.txt index b9626125459f8..b7b3a33190091 100644 --- a/Detectors/CMakeLists.txt +++ b/Detectors/CMakeLists.txt @@ -1,36 +1,37 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** - -# Libraries -add_subdirectory(Base) -add_subdirectory(Passive) -add_subdirectory(ITSMFT) -add_subdirectory(TPC) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# * add_subdirectory(Base) # already done earlier in src/CMakeLists.txt + +add_subdirectory(Passive) # must be first as some detector's macros use it + +add_subdirectory(PHOS) +add_subdirectory(CPV) add_subdirectory(EMCAL) +add_subdirectory(FIT) add_subdirectory(HMPID) add_subdirectory(TOF) -add_subdirectory(TRD) -add_subdirectory(FIT) -add_subdirectory(PHOS) -add_subdirectory(CPV) -add_subdirectory(MUON) add_subdirectory(ZDC) + +# already done earlier as they are required for GPU and GPU is required for +# Detectors/TPC ... * add_subdirectory(ITSMFT) * add_subdirectory(TRD) + +add_subdirectory(MUON) + +add_subdirectory(TPC) + add_subdirectory(GlobalTracking) add_subdirectory(GlobalTrackingWorkflow) -IF (HAVESIMULATION) + +if(BUILD_SIMULATION) add_subdirectory(gconfig) -ENDIF (HAVESIMULATION) +endif() -Install(DIRECTORY Geometry gconfig DESTINATION share/Detectors/) +o2_data_file(COPY Geometry gconfig DESTINATION Detectors) diff --git a/Detectors/CPV/CMakeLists.txt b/Detectors/CPV/CMakeLists.txt index 725fd5bad2bb8..72d8cbeba7af8 100644 --- a/Detectors/CPV/CMakeLists.txt +++ b/Detectors/CPV/CMakeLists.txt @@ -1,3 +1,13 @@ -# Libraries +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(base) -add_subdirectory(simulation) \ No newline at end of file +add_subdirectory(simulation) +add_subdirectory(testsimulation) diff --git a/Detectors/CPV/base/CMakeLists.txt b/Detectors/CPV/base/CMakeLists.txt index bd41b17678d23..2011f57c8345b 100644 --- a/Detectors/CPV/base/CMakeLists.txt +++ b/Detectors/CPV/base/CMakeLists.txt @@ -1,21 +1,17 @@ -SET(MODULE_NAME CPVBase) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(CPVBase + SOURCES src/Geometry.cxx src/Hit.cxx src/Digit.cxx + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat) -set(SRCS - src/Geometry.cxx - src/Hit.cxx - src/Digit.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/Geometry.h - include/${MODULE_NAME}/Hit.h - include/${MODULE_NAME}/Digit.h -) - -SET(LINKDEF src/CPVBaseLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME cpv_base_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(CPVBase + HEADERS include/CPVBase/Geometry.h + include/CPVBase/Hit.h include/CPVBase/Digit.h) diff --git a/Detectors/CPV/simulation/CMakeLists.txt b/Detectors/CPV/simulation/CMakeLists.txt index b972139f108c3..1e2086deaf9d6 100644 --- a/Detectors/CPV/simulation/CMakeLists.txt +++ b/Detectors/CPV/simulation/CMakeLists.txt @@ -1,23 +1,20 @@ -SET(MODULE_NAME CPVSimulation) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(CPVSimulation + SOURCES src/Detector.cxx src/GeometryParams.cxx src/Digitizer.cxx + src/DigitizerTask.cxx + PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2::CPVBase) -set(SRCS - src/Detector.cxx - src/GeometryParams.cxx - src/Digitizer.cxx - src/DigitizerTask.cxx -) - -set(HEADERS - include/CPVSimulation/Detector.h - include/CPVSimulation/GeometryParams.h - include/CPVSimulation/Digitizer.h - include/CPVSimulation/DigitizerTask.h -) - -SET(LINKDEF src/CPVSimulationLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME cpv_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(CPVSimulation + HEADERS include/CPVSimulation/Detector.h + include/CPVSimulation/GeometryParams.h + include/CPVSimulation/Digitizer.h + include/CPVSimulation/DigitizerTask.h) diff --git a/Detectors/CPV/testsimulation/CMakeLists.txt b/Detectors/CPV/testsimulation/CMakeLists.txt new file mode 100644 index 0000000000000..759b3bfac389f --- /dev/null +++ b/Detectors/CPV/testsimulation/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_test_root_macro(drawCPVgeometry.C + PUBLIC_LINK_LIBRARIES O2::CPVSimulation + O2::DetectorsPassive + O2::PHOSSimulation + LABELS cpv) + +o2_add_test_root_macro(plot_hit_cpv.C + PUBLIC_LINK_LIBRARIES FairRoot::Base O2::CPVSimulation + LABELS cpv) + +o2_add_test_root_macro(plot_dig_cpv.C + PUBLIC_LINK_LIBRARIES FairRoot::Base O2::CPVSimulation + LABELS cpv) + +o2_add_test_root_macro(run_digi_cpv.C + PUBLIC_LINK_LIBRARIES FairRoot::Base O2::CPVSimulation + LABELS cpv) + +o2_add_test_root_macro(run_sim_cpv.C + PUBLIC_LINK_LIBRARIES FairRoot::Base O2::DetectorsPassive + O2::CPVSimulation O2::Generators + LABELS cpv) diff --git a/Detectors/EMCAL/CMakeLists.txt b/Detectors/EMCAL/CMakeLists.txt index 29e5e4071a0d5..a9d29693f18f8 100644 --- a/Detectors/EMCAL/CMakeLists.txt +++ b/Detectors/EMCAL/CMakeLists.txt @@ -1,4 +1,16 @@ -# Libraries +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(base) add_subdirectory(simulation) add_subdirectory(calib) +if(BUILD_TESTING) + add_subdirectory(testsimulation) +endif() diff --git a/Detectors/EMCAL/base/CMakeLists.txt b/Detectors/EMCAL/base/CMakeLists.txt index 6306e08c20981..183d105fe20b4 100644 --- a/Detectors/EMCAL/base/CMakeLists.txt +++ b/Detectors/EMCAL/base/CMakeLists.txt @@ -1,26 +1,25 @@ -SET(MODULE_NAME EMCALBase) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(EMCALBase + SOURCES src/Digit.cxx src/Geometry.cxx src/Hit.cxx + src/ShishKebabTrd1Module.cxx + PUBLIC_LINK_LIBRARIES O2::CommonDataFormat Boost::serialization + O2::MathUtils O2::SimulationDataFormat + ROOT::Physics) -set(SRCS - src/Digit.cxx - src/Geometry.cxx - src/Hit.cxx - src/ShishKebabTrd1Module.cxx -) - -set(HEADERS - include/${MODULE_NAME}/Cell.h - include/${MODULE_NAME}/Constants.h - include/${MODULE_NAME}/Digit.h - include/${MODULE_NAME}/GeometryBase.h - include/${MODULE_NAME}/Geometry.h - include/${MODULE_NAME}/Hit.h - include/${MODULE_NAME}/ShishKebabTrd1Module.h -) - -SET(LINKDEF src/EMCALBaseLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME emcal_base_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(EMCALBase + HEADERS include/EMCALBase/Cell.h + include/EMCALBase/Constants.h + include/EMCALBase/Digit.h + include/EMCALBase/GeometryBase.h + include/EMCALBase/Geometry.h + include/EMCALBase/Hit.h + include/EMCALBase/ShishKebabTrd1Module.h) diff --git a/Detectors/EMCAL/calib/CMakeLists.txt b/Detectors/EMCAL/calib/CMakeLists.txt index c5534a4ed6c9d..7c4e1f532e9ec 100644 --- a/Detectors/EMCAL/calib/CMakeLists.txt +++ b/Detectors/EMCAL/calib/CMakeLists.txt @@ -1,27 +1,23 @@ -SET(MODULE_NAME EMCALCalib) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(EMCALCalib + SOURCES src/BadChannelMap.cxx + PUBLIC_LINK_LIBRARIES O2::EMCALBase) -set(SRCS - src/BadChannelMap.cxx -) +o2_target_root_dictionary(EMCALCalib + HEADERS include/EMCALCalib/BadChannelMap.h + LINKDEF src/EMCALCalibLinkDef.h) -set(HEADERS - include/${MODULE_NAME}/BadChannelMap.h -) - -SET(LINKDEF src/EMCALCalibLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME emcal_calib_bucket) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testBadChannelMap.cxx -) - -O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - MODULE_LIBRARY_NAME ${MODULE_NAME} - TEST_SRCS ${TEST_SRCS} -) \ No newline at end of file +o2_add_test(BadChannelMap + SOURCES test/testBadChannelMap.cxx + PUBLIC_LINK_LIBRARIES O2::EMCALCalib + COMPONENT_NAME emcal + LABELS emcal) diff --git a/Detectors/EMCAL/simulation/CMakeLists.txt b/Detectors/EMCAL/simulation/CMakeLists.txt index 7829808c61ccb..78bc6ec2e8f31 100644 --- a/Detectors/EMCAL/simulation/CMakeLists.txt +++ b/Detectors/EMCAL/simulation/CMakeLists.txt @@ -1,25 +1,21 @@ -SET(MODULE_NAME EMCALSimulation) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(EMCALSimulation + SOURCES src/Detector.cxx src/Digitizer.cxx src/DigitizerTask.cxx + src/SpaceFrame.cxx src/SimParam.cxx + PUBLIC_LINK_LIBRARIES O2::EMCALBase O2::DetectorsBase) -set(SRCS - src/Detector.cxx - src/Digitizer.cxx - src/DigitizerTask.cxx - src/SpaceFrame.cxx - src/SimParam.cxx -) - -set(HEADERS - include/EMCALSimulation/Detector.h - include/EMCALSimulation/Digitizer.h - include/EMCALSimulation/DigitizerTask.h - include/EMCALSimulation/SpaceFrame.h - include/EMCALSimulation/SimParam.h -) - -SET(LINKDEF src/EMCALSimulationLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME emcal_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(EMCALSimulation + HEADERS include/EMCALSimulation/Detector.h + include/EMCALSimulation/Digitizer.h + include/EMCALSimulation/DigitizerTask.h + include/EMCALSimulation/SpaceFrame.h + include/EMCALSimulation/SimParam.h) diff --git a/Detectors/EMCAL/testsimulation/CMakeLists.txt b/Detectors/EMCAL/testsimulation/CMakeLists.txt new file mode 100644 index 0000000000000..ab27580e80331 --- /dev/null +++ b/Detectors/EMCAL/testsimulation/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_test_root_macro(PutEmcalInTop.C + PUBLIC_LINK_LIBRARIES O2::EMCALSimulation + O2::DetectorsPassive FairRoot::Base + LABELS emcal) + +o2_add_test_root_macro(drawEMCALgeometry.C + PUBLIC_LINK_LIBRARIES O2::EMCALSimulation + O2::DetectorsPassive FairRoot::Base + LABELS emcal) + +o2_add_test_root_macro(run_sim_emcal.C + PUBLIC_LINK_LIBRARIES FairRoot::Base O2::EMCALSimulation + O2::DetectorsPassive O2::Generators + LABELS emcal) diff --git a/Detectors/FIT/CMakeLists.txt b/Detectors/FIT/CMakeLists.txt index fe27129293445..ac67c3a10466e 100644 --- a/Detectors/FIT/CMakeLists.txt +++ b/Detectors/FIT/CMakeLists.txt @@ -1,7 +1,16 @@ -# Libraries -add_subdirectory(common) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(T0) +add_subdirectory(common) add_subdirectory(V0) add_subdirectory(FDD) add_subdirectory(workflow) - +add_subdirectory(macros) diff --git a/Detectors/FIT/FDD/CMakeLists.txt b/Detectors/FIT/FDD/CMakeLists.txt index 32a36ff118835..46b43743c005e 100644 --- a/Detectors/FIT/FDD/CMakeLists.txt +++ b/Detectors/FIT/FDD/CMakeLists.txt @@ -1,4 +1,12 @@ -# Libraries +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(base) add_subdirectory(simulation) -#add_subdirectory(reconstruction) diff --git a/Detectors/FIT/FDD/base/CMakeLists.txt b/Detectors/FIT/FDD/base/CMakeLists.txt index c248e5d7de97e..0379c26e37b6f 100644 --- a/Detectors/FIT/FDD/base/CMakeLists.txt +++ b/Detectors/FIT/FDD/base/CMakeLists.txt @@ -1,17 +1,15 @@ -set(MODULE_NAME "FDDBase") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Geometry.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/Geometry.h - ) - -Set(LINKDEF src/FDDBaseLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME fit_base_bucket) - -O2_GENERATE_LIBRARY() +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(FDDBase + SOURCES src/Geometry.cxx + PUBLIC_LINK_LIBRARIES ROOT::Geom FairRoot::Base) + +o2_target_root_dictionary(FDDBase HEADERS include/FDDBase/Geometry.h) diff --git a/Detectors/FIT/FDD/simulation/CMakeLists.txt b/Detectors/FIT/FDD/simulation/CMakeLists.txt index dde47f97d608e..2f4e93a166534 100644 --- a/Detectors/FIT/FDD/simulation/CMakeLists.txt +++ b/Detectors/FIT/FDD/simulation/CMakeLists.txt @@ -1,18 +1,18 @@ -set(MODULE_NAME "FDDSimulation") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(FDDSimulation + SOURCES src/Detector.cxx + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::FDDBase + ROOT::Physics) -set(SRCS - src/Detector.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/Detector.h - include/${MODULE_NAME}/Hit.h - ) - -Set(LINKDEF src/FDDSimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME fit_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(FDDSimulation + HEADERS include/FDDSimulation/Detector.h + include/FDDSimulation/Hit.h) diff --git a/Detectors/FIT/T0/CMakeLists.txt b/Detectors/FIT/T0/CMakeLists.txt index 7153b888b9502..a885f0a3f20d9 100644 --- a/Detectors/FIT/T0/CMakeLists.txt +++ b/Detectors/FIT/T0/CMakeLists.txt @@ -1,4 +1,13 @@ -# Libraries +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(base) -add_subdirectory(simulation) add_subdirectory(reconstruction) +add_subdirectory(simulation) diff --git a/Detectors/FIT/T0/base/CMakeLists.txt b/Detectors/FIT/T0/base/CMakeLists.txt index e056c9e8b2836..ed660fe49bc9f 100644 --- a/Detectors/FIT/T0/base/CMakeLists.txt +++ b/Detectors/FIT/T0/base/CMakeLists.txt @@ -1,23 +1,17 @@ -set(MODULE_NAME "T0Base") -set(BUCKET_NAME fit_base_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(T0Base + SOURCES src/Geometry.cxx + PUBLIC_LINK_LIBRARIES ROOT::Physics FairRoot::Base) -set(SRCS - src/Geometry.cxx - ) +o2_target_root_dictionary(T0Base HEADERS include/T0Base/Geometry.h) -set(HEADERS - include/${MODULE_NAME}/Geometry.h - ) - - Set(LINKDEF src/T0BaseLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) - - -O2_GENERATE_LIBRARY() - -install( - DIRECTORY files - DESTINATION share/Detectors/T0/ -) +o2_data_file(COPY files DESTINATION Detectors/T0/) diff --git a/Detectors/FIT/T0/reconstruction/CMakeLists.txt b/Detectors/FIT/T0/reconstruction/CMakeLists.txt index 11773a38ca199..cc27d26c49106 100644 --- a/Detectors/FIT/T0/reconstruction/CMakeLists.txt +++ b/Detectors/FIT/T0/reconstruction/CMakeLists.txt @@ -1,20 +1,17 @@ -set(MODULE_NAME "T0Reconstruction") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/CollisionTimeRecoTask.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/CollisionTimeRecoTask.h - ) - - -Set(LINKDEF src/T0ReconstructionLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME fit_reconstruction_bucket) - -O2_GENERATE_LIBRARY() - - +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(T0Reconstruction + SOURCES src/CollisionTimeRecoTask.cxx + PUBLIC_LINK_LIBRARIES O2::DataFormatsFITT0) + +o2_target_root_dictionary( + T0Reconstruction + HEADERS include/T0Reconstruction/CollisionTimeRecoTask.h) diff --git a/Detectors/FIT/T0/simulation/CMakeLists.txt b/Detectors/FIT/T0/simulation/CMakeLists.txt index e70cf0c0ae85a..818654f396b02 100644 --- a/Detectors/FIT/T0/simulation/CMakeLists.txt +++ b/Detectors/FIT/T0/simulation/CMakeLists.txt @@ -1,19 +1,16 @@ -set(MODULE_NAME "T0Simulation") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(T0Simulation + SOURCES src/Detector.cxx + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::T0Base + O2::DataFormatsFITT0) -set(SRCS - src/Detector.cxx - #src/DigitizerTask.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/Detector.h - #include/${MODULE_NAME}/DigitizerTask.h - ) - -Set(LINKDEF src/T0SimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME fit_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(T0Simulation HEADERS include/T0Simulation/Detector.h) diff --git a/Detectors/FIT/V0/CMakeLists.txt b/Detectors/FIT/V0/CMakeLists.txt index 32a36ff118835..46b43743c005e 100644 --- a/Detectors/FIT/V0/CMakeLists.txt +++ b/Detectors/FIT/V0/CMakeLists.txt @@ -1,4 +1,12 @@ -# Libraries +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(base) add_subdirectory(simulation) -#add_subdirectory(reconstruction) diff --git a/Detectors/FIT/V0/base/CMakeLists.txt b/Detectors/FIT/V0/base/CMakeLists.txt index 97d21db10eccf..ebc9355314d11 100644 --- a/Detectors/FIT/V0/base/CMakeLists.txt +++ b/Detectors/FIT/V0/base/CMakeLists.txt @@ -1,22 +1,17 @@ -set(MODULE_NAME "V0Base") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(V0Base + SOURCES src/Geometry.cxx + PUBLIC_LINK_LIBRARIES ROOT::Geom FairRoot::Base) -set(SRCS - src/Geometry.cxx - ) +o2_target_root_dictionary(V0Base HEADERS include/V0Base/Geometry.h) -set(HEADERS - include/${MODULE_NAME}/Geometry.h - ) - -Set(LINKDEF src/V0BaseLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME fit_base_bucket) - -O2_GENERATE_LIBRARY() - -install( - DIRECTORY files - DESTINATION share/Detectors/V0/ -) +o2_data_file(COPY files DESTINATION Detectors/V0/) diff --git a/Detectors/FIT/V0/simulation/CMakeLists.txt b/Detectors/FIT/V0/simulation/CMakeLists.txt index 10e250fc4cc77..5f9c75cc84638 100644 --- a/Detectors/FIT/V0/simulation/CMakeLists.txt +++ b/Detectors/FIT/V0/simulation/CMakeLists.txt @@ -1,19 +1,16 @@ -set(MODULE_NAME "V0Simulation") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(V0Simulation + SOURCES src/Detector.cxx + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::V0Base + O2::DataFormatsFITV0 ROOT::Physics) -set(SRCS - src/Detector.cxx - #src/DigitizerTask.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/Detector.h - #include/${MODULE_NAME}/DigitizerTask.h - ) - -Set(LINKDEF src/V0SimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME fit_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(V0Simulation HEADERS include/V0Simulation/Detector.h) diff --git a/Detectors/FIT/common/CMakeLists.txt b/Detectors/FIT/common/CMakeLists.txt index 457159d3a08bc..80107a0b4906e 100644 --- a/Detectors/FIT/common/CMakeLists.txt +++ b/Detectors/FIT/common/CMakeLists.txt @@ -1,4 +1,11 @@ -# Libraries -#add_subdirectory(base) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(simulation) -#add_subdirectory(reconstruction) diff --git a/Detectors/FIT/common/simulation/CMakeLists.txt b/Detectors/FIT/common/simulation/CMakeLists.txt index 5bd07c681e44e..b3e081bfcd7ae 100644 --- a/Detectors/FIT/common/simulation/CMakeLists.txt +++ b/Detectors/FIT/common/simulation/CMakeLists.txt @@ -1,21 +1,19 @@ -set(MODULE_NAME "FITSimulation") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Digitizer.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/Digitizer.h - include/${MODULE_NAME}/DigitizationParameters.h - ) - - -Set(LINKDEF src/FITSimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME fit_simulation_bucket) - -O2_GENERATE_LIBRARY() - - +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(FITSimulation + SOURCES src/Digitizer.cxx + PUBLIC_LINK_LIBRARIES O2::CommonDataFormat O2::DataFormatsFITT0 + O2::T0Simulation) + +o2_target_root_dictionary( + FITSimulation + HEADERS include/FITSimulation/Digitizer.h + include/FITSimulation/DigitizationParameters.h) diff --git a/Detectors/FIT/macros/CMakeLists.txt b/Detectors/FIT/macros/CMakeLists.txt new file mode 100644 index 0000000000000..0f6103fea5804 --- /dev/null +++ b/Detectors/FIT/macros/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_test_root_macro(readHitsDigits.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsFITT0 + LABELS fit) + +o2_add_test_root_macro(run_reco_t0.C + PUBLIC_LINK_LIBRARIES FairRoot::Base + FairLogger::FairLogger + O2::T0Reconstruction + LABELS fit) diff --git a/Detectors/FIT/workflow/CMakeLists.txt b/Detectors/FIT/workflow/CMakeLists.txt index a046011d82535..a0d95ecb8fdb6 100644 --- a/Detectors/FIT/workflow/CMakeLists.txt +++ b/Detectors/FIT/workflow/CMakeLists.txt @@ -1,38 +1,20 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See http://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. - -set(MODULE_NAME "FITWorkflow") -set(MODULE_BUCKET_NAME fit_workflow_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/RecoWorkflow.cxx - src/T0DigitReaderSpec.cxx - src/T0ReconstructorSpec.cxx - src/T0RecPointWriterSpec.cxx - src/T0RecPointReaderSpec.cxx - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-fit-reco-workflow" - - SOURCES - src/fit-reco-workflow.cxx - - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(FITWorkflow + SOURCES src/RecoWorkflow.cxx src/T0DigitReaderSpec.cxx + src/T0ReconstructorSpec.cxx src/T0RecPointWriterSpec.cxx + src/T0RecPointReaderSpec.cxx + PUBLIC_LINK_LIBRARIES O2::T0Reconstruction O2::Framework) + +o2_add_executable(reco-workflow + COMPONENT_NAME fit + SOURCES src/fit-reco-workflow.cxx + PUBLIC_LINK_LIBRARIES O2::FITWorkflow) diff --git a/Detectors/GlobalTracking/CMakeLists.txt b/Detectors/GlobalTracking/CMakeLists.txt index 1c985f321a013..ff32d0b59eb19 100644 --- a/Detectors/GlobalTracking/CMakeLists.txt +++ b/Detectors/GlobalTracking/CMakeLists.txt @@ -1,24 +1,29 @@ -set(MODULE_NAME "GlobalTracking") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/MatchTPCITS.cxx - src/MatchTOF.cxx - src/CalibTOF.cxx - src/CollectCalibInfoTOF.cxx -) - -set(HEADERS - include/${MODULE_NAME}/MatchTPCITS.h - include/${MODULE_NAME}/MatchTOF.h - include/${MODULE_NAME}/CalibTOF.h - include/${MODULE_NAME}/CollectCalibInfoTOF.h -) - -set(LINKDEF src/GlobalTrackingLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME global_tracking_bucket) - -O2_GENERATE_LIBRARY() +o2_add_library(GlobalTracking + SOURCES src/MatchTPCITS.cxx src/MatchTOF.cxx src/CalibTOF.cxx + src/CollectCalibInfoTOF.cxx + PUBLIC_LINK_LIBRARIES O2::DataFormatsTPC + O2::DataFormatsITSMFT + O2::DataFormatsITS + O2::DataFormatsFITT0 + O2::DataFormatsTOF + O2::TPCFastTransformation + O2::GPUTracking + O2::TPCBase + O2::TPCReconstruction + O2::TOFBase) +o2_target_root_dictionary(GlobalTracking + HEADERS include/GlobalTracking/MatchTPCITS.h + include/GlobalTracking/MatchTOF.h + include/GlobalTracking/CalibTOF.h + include/GlobalTracking/CollectCalibInfoTOF.h) diff --git a/Detectors/GlobalTrackingWorkflow/CMakeLists.txt b/Detectors/GlobalTrackingWorkflow/CMakeLists.txt index 41ae594d045d1..6a3a45b68df18 100644 --- a/Detectors/GlobalTrackingWorkflow/CMakeLists.txt +++ b/Detectors/GlobalTrackingWorkflow/CMakeLists.txt @@ -1,35 +1,22 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See http://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(MODULE_NAME "GlobalTrackingWorkflow") -set(MODULE_BUCKET_NAME GlobalTracking_workflow_bucket) +# FIXME: do we actually need a library here, or is the executable enough ? +o2_add_library(GlobalTrackingWorkflow + SOURCES src/TrackWriterTPCITSSpec.cxx src/TPCITSMatchingSpec.cxx + src/MatchTPCITSWorkflow.cxx + PUBLIC_LINK_LIBRARIES O2::GlobalTracking O2::ITSWorkflow + O2::TPCWorkflow O2::FITWorkflow + O2::ITSMFTWorkflow) -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/TrackWriterTPCITSSpec.cxx - src/TPCITSMatchingSpec.cxx - src/MatchTPCITSWorkflow.cxx - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -O2_GENERATE_EXECUTABLE( - EXE_NAME o2-tpcits-match-workflow - - SOURCES - src/tpcits-match-workflow.cxx - - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - ) +o2_add_executable(match-workflow + COMPONENT_NAME tpcits + SOURCES src/tpcits-match-workflow.cxx + PUBLIC_LINK_LIBRARIES O2::GlobalTrackingWorkflow) diff --git a/Detectors/HMPID/CMakeLists.txt b/Detectors/HMPID/CMakeLists.txt index d5355745196a1..46b43743c005e 100644 --- a/Detectors/HMPID/CMakeLists.txt +++ b/Detectors/HMPID/CMakeLists.txt @@ -1,3 +1,12 @@ -# Libraries +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(base) add_subdirectory(simulation) diff --git a/Detectors/HMPID/base/CMakeLists.txt b/Detectors/HMPID/base/CMakeLists.txt index 8482115142935..5f1940e8a6597 100644 --- a/Detectors/HMPID/base/CMakeLists.txt +++ b/Detectors/HMPID/base/CMakeLists.txt @@ -1,18 +1,18 @@ -set(MODULE_NAME "HMPIDBase") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(HMPIDBase + SOURCES src/Param.cxx src/Digit.cxx + PUBLIC_LINK_LIBRARIES O2::CommonDataFormat + O2::SimulationDataFormat ROOT::Physics) -set(SRCS - src/Param.cxx - src/Digit.cxx - ) -set(HEADERS - include/${MODULE_NAME}/Param.h - include/${MODULE_NAME}/Digit.h - ) - -Set(LINKDEF src/HMPIDBaseLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME hmpid_base_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(HMPIDBase + HEADERS include/HMPIDBase/Param.h + include/HMPIDBase/Digit.h) diff --git a/Detectors/HMPID/simulation/CMakeLists.txt b/Detectors/HMPID/simulation/CMakeLists.txt index 7b6a952290995..bff7b61a3e45c 100644 --- a/Detectors/HMPID/simulation/CMakeLists.txt +++ b/Detectors/HMPID/simulation/CMakeLists.txt @@ -1,18 +1,17 @@ -set(MODULE_NAME "HMPIDSimulation") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(HMPIDSimulation + SOURCES src/Detector.cxx src/HMPIDDigitizer.cxx + PUBLIC_LINK_LIBRARIES O2::HMPIDBase) -set(SRCS - src/Detector.cxx - src/HMPIDDigitizer.cxx - ) -set(HEADERS - include/${MODULE_NAME}/Detector.h - include/${MODULE_NAME}/HMPIDDigitizer.h - ) - -Set(LINKDEF src/HMPIDSimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME hmpid_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(HMPIDSimulation + HEADERS include/HMPIDSimulation/Detector.h + include/HMPIDSimulation/HMPIDDigitizer.h) diff --git a/Detectors/ITSMFT/CMakeLists.txt b/Detectors/ITSMFT/CMakeLists.txt index b4fb37699ad3f..e08e8e47e3f87 100644 --- a/Detectors/ITSMFT/CMakeLists.txt +++ b/Detectors/ITSMFT/CMakeLists.txt @@ -1,20 +1,14 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -# Libraries -add_subdirectory(ITS) add_subdirectory(common) +add_subdirectory(ITS) add_subdirectory(test) add_subdirectory(MFT) diff --git a/Detectors/ITSMFT/ITS/CMakeLists.txt b/Detectors/ITSMFT/ITS/CMakeLists.txt index 014c45684d402..cc2c95d27352d 100644 --- a/Detectors/ITSMFT/ITS/CMakeLists.txt +++ b/Detectors/ITSMFT/ITS/CMakeLists.txt @@ -1,22 +1,16 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -# Libraries add_subdirectory(base) add_subdirectory(simulation) add_subdirectory(reconstruction) add_subdirectory(tracking) add_subdirectory(workflow) - +add_subdirectory(macros) diff --git a/Detectors/ITSMFT/ITS/base/CMakeLists.txt b/Detectors/ITSMFT/ITS/base/CMakeLists.txt index fbbdbb04772ea..6c311d5fc409f 100644 --- a/Detectors/ITSMFT/ITS/base/CMakeLists.txt +++ b/Detectors/ITSMFT/ITS/base/CMakeLists.txt @@ -1,22 +1,19 @@ -set(MODULE_NAME "ITSBase") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(ITSBase + SOURCES src/GeometryTGeo.cxx src/ContainerFactory.cxx + src/MisalignmentParameter.cxx + PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2::ITSMFTBase) -set(SRCS - src/GeometryTGeo.cxx - src/ContainerFactory.cxx - src/MisalignmentParameter.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/GeometryTGeo.h - include/${MODULE_NAME}/ContainerFactory.h - include/${MODULE_NAME}/MisalignmentParameter.h - ) - - -Set(LINKDEF src/ITSBaseLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME its_base_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(ITSBase + HEADERS include/ITSBase/GeometryTGeo.h + include/ITSBase/ContainerFactory.h + include/ITSBase/MisalignmentParameter.h) diff --git a/Detectors/ITSMFT/ITS/macros/CMakeLists.txt b/Detectors/ITSMFT/ITS/macros/CMakeLists.txt new file mode 100644 index 0000000000000..b88d9a3a43c4e --- /dev/null +++ b/Detectors/ITSMFT/ITS/macros/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +add_subdirectory(EVE) +add_subdirectory(test) diff --git a/Detectors/ITSMFT/ITS/macros/EVE/CMakeLists.txt b/Detectors/ITSMFT/ITS/macros/EVE/CMakeLists.txt new file mode 100644 index 0000000000000..871e6ef259600 --- /dev/null +++ b/Detectors/ITSMFT/ITS/macros/EVE/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_test_root_macro(DisplayEvents.C + PUBLIC_LINK_LIBRARIES O2::EventVisualisationView + O2::ITSMFTReconstruction + O2::ITSBase O2::DataFormatsITS + LABELS its) + +o2_add_test_root_macro(simple_geom_ITS.C + PUBLIC_LINK_LIBRARIES O2::EventVisualisationView + O2::ITSMFTReconstruction + O2::ITSBase O2::DataFormatsITS + LABELS its) diff --git a/Detectors/ITSMFT/ITS/macros/test/CMakeLists.txt b/Detectors/ITSMFT/ITS/macros/test/CMakeLists.txt new file mode 100644 index 0000000000000..849aed4d28116 --- /dev/null +++ b/Detectors/ITSMFT/ITS/macros/test/CMakeLists.txt @@ -0,0 +1,72 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_test_root_macro(CheckClusterShape.C + PUBLIC_LINK_LIBRARIES O2::ITSBase O2::ITSMFTSimulation + O2::SimulationDataFormat + LABELS its) + +o2_add_test_root_macro(CheckClusters.C + PUBLIC_LINK_LIBRARIES O2::ITSBase O2::DataFormatsITSMFT + O2::ITSMFTSimulation O2::MathUtils + O2::SimulationDataFormat + LABELS its) + +o2_add_test_root_macro(CheckDigits.C + PUBLIC_LINK_LIBRARIES O2::ITSBase + O2::ITSMFTBase + O2::ITSMFTSimulation + O2::MathUtils + O2::SimulationDataFormat + O2::DetectorsBase + LABELS its) + +o2_add_test_root_macro(CheckLUtime.C + PUBLIC_LINK_LIBRARIES O2::ITSMFTReconstruction + O2::DataFormatsITSMFT + LABELS its) + +o2_add_test_root_macro(CheckTopologies.C + PUBLIC_LINK_LIBRARIES O2::MathUtils + O2::ITSBase + O2::ITSMFTReconstruction + O2::ITSMFTSimulation + O2::DataFormatsITSMFT + O2::SimulationDataFormat + LABELS its) + +o2_add_test_root_macro(CheckTracks.C + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat + O2::DataFormatsITS + O2::DataFormatsITSMFT + LABELS its) + +o2_add_test_root_macro(DisplayTrack.C + PUBLIC_LINK_LIBRARIES O2::ITSBase + O2::DataFormatsITSMFT + O2::ITSMFTSimulation + O2::DataFormatsITS + O2::MathUtils + O2::SimulationDataFormat + LABELS its) + +o2_add_test_root_macro(dictionary_integrity_test.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsITSMFT + O2::ITSMFTReconstruction + LABELS its) + +o2_add_test_root_macro(run_buildTopoDict_its.C + PUBLIC_LINK_LIBRARIES O2::MathUtils + O2::ITSBase + O2::ITSMFTReconstruction + O2::DataFormatsITSMFT + O2::ITSMFTSimulation + O2::SimulationDataFormat + LABELS its) diff --git a/Detectors/ITSMFT/ITS/macros/test/CheckClusterShape.C b/Detectors/ITSMFT/ITS/macros/test/CheckClusterShape.C index 35d18e24dcc6d..d3f27fffc8e64 100644 --- a/Detectors/ITSMFT/ITS/macros/test/CheckClusterShape.C +++ b/Detectors/ITSMFT/ITS/macros/test/CheckClusterShape.C @@ -13,7 +13,6 @@ #include "ITSBase/GeometryTGeo.h" #include "ITSMFTBase/SegmentationAlpide.h" #include "ITSMFTBase/Digit.h" -#include "TPCSimulation/Point.h" #include "ITSMFTSimulation/ClusterShape.h" #include "SimulationDataFormat/MCTruthContainer.h" #include "SimulationDataFormat/MCCompLabel.h" diff --git a/Detectors/ITSMFT/ITS/reconstruction/CMakeLists.txt b/Detectors/ITSMFT/ITS/reconstruction/CMakeLists.txt index f3c022c939d68..ed61a9d4bc617 100644 --- a/Detectors/ITSMFT/ITS/reconstruction/CMakeLists.txt +++ b/Detectors/ITSMFT/ITS/reconstruction/CMakeLists.txt @@ -1,27 +1,19 @@ -set(MODULE_NAME "ITSReconstruction") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/ClustererTask.cxx - src/CookedTracker.cxx - ) -# src/TrivialClustererTask.cxx - -set(NO_DICT_SRCS # sources not for the dictionary - src/TrivialVertexer.cxx - ) -# src/TrivialClusterer.cxx - - -# Headers from sources -string(REPLACE ".cxx" ".h" HEADERS "${SRCS}") -string(REPLACE "src" "include/${MODULE_NAME}" HEADERS "${HEADERS}") -string(REPLACE ".cxx" ".h" NO_DICT_HEADERS "${NO_DICT_SRCS}") -string(REPLACE "src" "include/${MODULE_NAME}" NO_DICT_HEADERS "${NO_DICT_HEADERS}") - -Set(LINKDEF src/ITSReconstructionLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -Set(BUCKET_NAME its_reconstruction_bucket) -O2_GENERATE_LIBRARY() +o2_add_library(ITSReconstruction + SOURCES src/ClustererTask.cxx src/CookedTracker.cxx + src/TrivialVertexer.cxx + PUBLIC_LINK_LIBRARIES O2::ITSBase O2::ITSMFTReconstruction + O2::DataFormatsITS) +o2_target_root_dictionary(ITSReconstruction + HEADERS include/ITSReconstruction/ClustererTask.h + include/ITSReconstruction/CookedTracker.h) diff --git a/Detectors/ITSMFT/ITS/simulation/CMakeLists.txt b/Detectors/ITSMFT/ITS/simulation/CMakeLists.txt index 9f6313a8fa066..f5392bcf92388 100644 --- a/Detectors/ITSMFT/ITS/simulation/CMakeLists.txt +++ b/Detectors/ITSMFT/ITS/simulation/CMakeLists.txt @@ -1,24 +1,22 @@ -set(MODULE_NAME "ITSSimulation") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(ITSSimulation + SOURCES src/V11Geometry.cxx src/V1Layer.cxx src/V3Layer.cxx + src/Detector.cxx src/V3Services.cxx + PUBLIC_LINK_LIBRARIES O2::ITSBase O2::ITSMFTSimulation + ROOT::Physics) -set(SRCS - src/V11Geometry.cxx - src/V1Layer.cxx - src/V3Layer.cxx - src/V3Services.cxx - src/Detector.cxx - ) -set(HEADERS - include/${MODULE_NAME}/Detector.h - include/${MODULE_NAME}/V1Layer.h - include/${MODULE_NAME}/V3Layer.h - include/${MODULE_NAME}/V3Services.h - include/${MODULE_NAME}/V11Geometry.h - ) - -Set(LINKDEF src/ITSSimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME its_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(ITSSimulation + HEADERS include/ITSSimulation/Detector.h + include/ITSSimulation/V1Layer.h + include/ITSSimulation/V3Layer.h + include/ITSSimulation/V11Geometry.h + include/ITSSimulation/V3Services.h) diff --git a/Detectors/ITSMFT/ITS/tracking/CMakeLists.txt b/Detectors/ITSMFT/ITS/tracking/CMakeLists.txt index 38d03a8617568..fb85d228ff973 100644 --- a/Detectors/ITSMFT/ITS/tracking/CMakeLists.txt +++ b/Detectors/ITSMFT/ITS/tracking/CMakeLists.txt @@ -1,58 +1,44 @@ -if (ENABLE_CUDA) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(ITStracking + TARGETVARNAME targetName + SOURCES src/ClusterLines.cxx + src/Cluster.cxx + src/ROframe.cxx + src/Graph.cxx + src/DBScan.cxx + src/IOUtils.cxx + src/Label.cxx + src/PrimaryVertexContext.cxx + src/Road.cxx + src/Tracker.cxx + src/TrackerTraitsCPU.cxx + src/ClusterLines.cxx + src/Vertexer.cxx + src/VertexerTraits.cxx + PUBLIC_LINK_LIBRARIES O2::GPUCommon + ms_gsl::ms_gsl + O2::CommonConstants + O2::DataFormatsITSMFT + O2::SimulationDataFormat + O2::ITSBase + O2::DataFormatsITS) + +o2_target_root_dictionary(ITStracking + HEADERS include/ITStracking/ClusterLines.h + include/ITStracking/Tracklet.h + include/ITStracking/DBScan.h + LINKDEF src/TrackingLinkDef.h) + +if(CUDA_ENABLED) add_subdirectory(cuda) + target_compile_definitions(${targetName} PRIVATE CUDA_ENABLED) endif() - -set(MODULE_NAME "ITStracking") - -O2_SETUP(NAME ${MODULE_NAME}) - -#DEBUG -set(SRC - src/ClusterLines.cxx -) - -set(HEADERS - include/${MODULE_NAME}/ClusterLines.h - include/${MODULE_NAME}/Tracklet.h - include/${MODULE_NAME}/DBScan.h -) - -Set(LINKDEF src/TrackingLinkDef.h) -#\DEBUG - -set(NO_DICT_SRCS # sources not for the dictionary - src/Cluster.cxx - src/ROframe.cxx - src/Graph.cxx - src/DBScan.cxx - src/IOUtils.cxx - src/Label.cxx - src/PrimaryVertexContext.cxx - src/Road.cxx - src/Tracker.cxx - src/TrackerTraitsCPU.cxx - src/ClusterLines.cxx - src/Vertexer.cxx - src/VertexerTraits.cxx - ) -# src/TrivialClusterer.cxx - - -# Headers from sources -string(REPLACE ".cxx" ".h" NO_DICT_HEADERS "${NO_DICT_SRCS}") -string(REPLACE "src" "include/${MODULE_NAME}" NO_DICT_HEADERS "${NO_DICT_HEADERS}") - -set(NO_DICT_HEADERS - ${NO_DICT_HEADERS} - include/${MODULE_NAME}/Cell.h - include/${MODULE_NAME}/Config.h - include/${MODULE_NAME}/Definitions.h - include/${MODULE_NAME}/TrackerTraits.h - include/${MODULE_NAME}/Tracklet.h - ) - -# Set(LINKDEF src/${MODULE_NAME}LinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -Set(BUCKET_NAME its_tracking_bucket) -O2_GENERATE_LIBRARY() - diff --git a/Detectors/ITSMFT/ITS/tracking/cuda/CMakeLists.txt b/Detectors/ITSMFT/ITS/tracking/cuda/CMakeLists.txt index fb3ea34758516..9ca4ba80d3cd6 100644 --- a/Detectors/ITSMFT/ITS/tracking/cuda/CMakeLists.txt +++ b/Detectors/ITSMFT/ITS/tracking/cuda/CMakeLists.txt @@ -1,33 +1,29 @@ -set(MODULE_NAME "ITStrackingCUDA") -O2_SETUP(NAME ${MODULE_NAME}) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -message(STATUS "Building ITS CUDA tracker") - -set(NO_DICT_SRCS - src/Context.cu - src/DeviceStoreNV.cu - src/Stream.cu - src/TrackerTraitsNV.cu - src/VertexerTraitsGPU.cu - src/Utils.cu -) - -string(REPLACE ".cu" ".h" NO_DICT_HEADERS "${NO_DICT_SRCS}") -string(REPLACE "src" "include/${MODULE_NAME}" NO_DICT_HEADERS "${NO_DICT_HEADERS}") +find_package(cub) +set_package_properties(cub PROPERTIES TYPE REQUIRED) +message(STATUS "Building ITS CUDA tracker") -set(NO_DICT_HEADERS ${NO_DICT_HEADERS} - include/${MODULE_NAME}/Array.h - include/${MODULE_NAME}/PrimaryVertexContextNV.h - include/${MODULE_NAME}/UniquePointer.h - include/${MODULE_NAME}/Vector.h -) -set(NO_DICT_SRCS ${NO_DICT_SRCS} - src/dummy.cxx -) +o2_add_library(ITStrackingCUDA + SOURCES src/Context.cu + src/DeviceStoreNV.cu + src/Stream.cu + src/TrackerTraitsNV.cu + src/VertexerTraitsGPU.cu + src/Utils.cu + PUBLIC_LINK_LIBRARIES O2::ITStracking cub::cub + TARGETVARNAME targetName) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME its_tracking_CUDA_bucket) -O2_GENERATE_LIBRARY() +set_property(TARGET ${targetName} PROPERTY CUDA_SEPARABLE_COMPILATION ON) -set_property(TARGET "O2${MODULE_NAME}" PROPERTY CUDA_SEPARABLE_COMPILATION ON) +target_compile_definitions( + ${targetName} PRIVATE $) diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Definitions.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Definitions.h index 7857c88031d68..47d39caf19331 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Definitions.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Definitions.h @@ -32,7 +32,7 @@ #endif #endif -#if defined(ENABLE_CUDA) +#if defined(CUDA_ENABLED) #define TRACKINGITSU_GPU_MODE true #else #define TRACKINGITSU_GPU_MODE false diff --git a/Detectors/ITSMFT/ITS/workflow/CMakeLists.txt b/Detectors/ITSMFT/ITS/workflow/CMakeLists.txt index 998a81e316f81..e55a0db69a589 100644 --- a/Detectors/ITSMFT/ITS/workflow/CMakeLists.txt +++ b/Detectors/ITSMFT/ITS/workflow/CMakeLists.txt @@ -1,31 +1,30 @@ -set(MODULE_NAME "ITSWorkflow") -set(MODULE_BUCKET_NAME ITS_workflow_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/RecoWorkflow.cxx - src/DigitReaderSpec.cxx - src/ClustererSpec.cxx - src/ClusterWriterSpec.cxx - src/TrackerSpec.cxx - src/CookedTrackerSpec.cxx - src/TrackWriterSpec.cxx - src/TrackReaderSpec.cxx - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-its-reco-workflow" - - SOURCES - src/its-reco-workflow.cxx - - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(ITSWorkflow + SOURCES src/RecoWorkflow.cxx + src/DigitReaderSpec.cxx + src/ClustererSpec.cxx + src/ClusterWriterSpec.cxx + src/TrackerSpec.cxx + src/CookedTrackerSpec.cxx + src/TrackWriterSpec.cxx + src/TrackReaderSpec.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + O2::SimConfig + O2::DataFormatsITS + O2::SimulationDataFormat + O2::ITStracking + O2::ITSReconstruction) + +o2_add_executable(reco-workflow + SOURCES src/its-reco-workflow.cxx + COMPONENT_NAME its + PUBLIC_LINK_LIBRARIES O2::ITSWorkflow) diff --git a/Detectors/ITSMFT/MFT/CMakeLists.txt b/Detectors/ITSMFT/MFT/CMakeLists.txt index 670fe1ee5f171..28235aa7e7c16 100644 --- a/Detectors/ITSMFT/MFT/CMakeLists.txt +++ b/Detectors/ITSMFT/MFT/CMakeLists.txt @@ -1,21 +1,16 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -# Libraries add_subdirectory(base) add_subdirectory(simulation) add_subdirectory(reconstruction) +add_subdirectory(macros/test) -install(DIRECTORY data DESTINATION share/Detectors/Geometry/MFT/) +o2_data_file(COPY data DESTINATION Detectors/Geometry/MFT/) diff --git a/Detectors/ITSMFT/MFT/base/CMakeLists.txt b/Detectors/ITSMFT/MFT/base/CMakeLists.txt index d4d4d30794219..e3f16ce283d7f 100644 --- a/Detectors/ITSMFT/MFT/base/CMakeLists.txt +++ b/Detectors/ITSMFT/MFT/base/CMakeLists.txt @@ -1,51 +1,50 @@ -set(MODULE_NAME "MFTBase") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/GeometryTGeo.cxx - src/Geometry.cxx - src/GeometryBuilder.cxx - src/VSegmentation.cxx - src/Segmentation.cxx - src/HalfSegmentation.cxx - src/HalfDiskSegmentation.cxx - src/LadderSegmentation.cxx - src/ChipSegmentation.cxx - src/HalfDetector.cxx - src/HalfDisk.cxx - src/Ladder.cxx - src/Flex.cxx - src/Support.cxx - src/HeatExchanger.cxx - src/HalfCone.cxx - src/PowerSupplyUnit.cxx -) - -set(HEADERS - include/${MODULE_NAME}/Constants.h - include/${MODULE_NAME}/GeometryTGeo.h - include/${MODULE_NAME}/Geometry.h - include/${MODULE_NAME}/GeometryBuilder.h - include/${MODULE_NAME}/VSegmentation.h - include/${MODULE_NAME}/Segmentation.h - include/${MODULE_NAME}/HalfSegmentation.h - include/${MODULE_NAME}/HalfDiskSegmentation.h - include/${MODULE_NAME}/LadderSegmentation.h - include/${MODULE_NAME}/ChipSegmentation.h - include/${MODULE_NAME}/HalfDetector.h - include/${MODULE_NAME}/HalfDisk.h - include/${MODULE_NAME}/Ladder.h - include/${MODULE_NAME}/Flex.h - include/${MODULE_NAME}/Support.h - include/${MODULE_NAME}/HeatExchanger.h - include/${MODULE_NAME}/HalfCone.h - include/${MODULE_NAME}/PowerSupplyUnit.h -) - -Set(LINKDEF src/MFTBaseLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mft_base_bucket) - -O2_GENERATE_LIBRARY() +o2_add_library(MFTBase + SOURCES src/GeometryTGeo.cxx + src/Geometry.cxx + src/GeometryBuilder.cxx + src/VSegmentation.cxx + src/Segmentation.cxx + src/HalfSegmentation.cxx + src/HalfDiskSegmentation.cxx + src/LadderSegmentation.cxx + src/ChipSegmentation.cxx + src/HalfDetector.cxx + src/HalfDisk.cxx + src/Ladder.cxx + src/Flex.cxx + src/Support.cxx + src/HeatExchanger.cxx + src/HalfCone.cxx + src/PowerSupplyUnit.cxx + PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2::ITSMFTBase + O2::ITSMFTSimulation ROOT::XMLIO) +o2_target_root_dictionary(MFTBase + HEADERS include/MFTBase/Constants.h + include/MFTBase/GeometryTGeo.h + include/MFTBase/Geometry.h + include/MFTBase/GeometryBuilder.h + include/MFTBase/VSegmentation.h + include/MFTBase/Segmentation.h + include/MFTBase/HalfSegmentation.h + include/MFTBase/HalfDiskSegmentation.h + include/MFTBase/LadderSegmentation.h + include/MFTBase/ChipSegmentation.h + include/MFTBase/HalfDetector.h + include/MFTBase/HalfDisk.h + include/MFTBase/Ladder.h + include/MFTBase/Flex.h + include/MFTBase/Support.h + include/MFTBase/HeatExchanger.h + include/MFTBase/HalfCone.h + include/MFTBase/PowerSupplyUnit.h) diff --git a/Detectors/ITSMFT/MFT/macros/test/CMakeLists.txt b/Detectors/ITSMFT/MFT/macros/test/CMakeLists.txt new file mode 100644 index 0000000000000..9a82d0b44a6c3 --- /dev/null +++ b/Detectors/ITSMFT/MFT/macros/test/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_test_root_macro(extractMFTMapping.C + PUBLIC_LINK_LIBRARIES O2::MFTBase + LABELS mft) diff --git a/Detectors/ITSMFT/MFT/reconstruction/CMakeLists.txt b/Detectors/ITSMFT/MFT/reconstruction/CMakeLists.txt index 92aa7b6ae1646..0d5931acf732a 100644 --- a/Detectors/ITSMFT/MFT/reconstruction/CMakeLists.txt +++ b/Detectors/ITSMFT/MFT/reconstruction/CMakeLists.txt @@ -1,25 +1,18 @@ -set(MODULE_NAME "MFTReconstruction") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/ClustererTask.cxx - src/TrackerTask.cxx -) -set(HEADERS - include/${MODULE_NAME}/ClustererTask.h - include/${MODULE_NAME}/TrackerTask.h -) -set(NO_DICT_SRCS # sources not for the dictionary - src/Tracker.cxx -) -set(NO_DICT_HEADERS # sources not for the dictionary - include/${MODULE_NAME}/Tracker.h -) - -Set(LINKDEF src/MFTReconstructionLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -Set(BUCKET_NAME mft_reconstruction_bucket) - -O2_GENERATE_LIBRARY() +o2_add_library(MFTReconstruction + SOURCES src/ClustererTask.cxx src/TrackerTask.cxx src/Tracker.cxx + PUBLIC_LINK_LIBRARIES O2::MFTBase O2::ITSMFTReconstruction + O2::DataFormatsMFT) +o2_target_root_dictionary(MFTReconstruction + HEADERS include/MFTReconstruction/ClustererTask.h + include/MFTReconstruction/TrackerTask.h) diff --git a/Detectors/ITSMFT/MFT/simulation/CMakeLists.txt b/Detectors/ITSMFT/MFT/simulation/CMakeLists.txt index 197cbe1de8360..1a31664b637d8 100644 --- a/Detectors/ITSMFT/MFT/simulation/CMakeLists.txt +++ b/Detectors/ITSMFT/MFT/simulation/CMakeLists.txt @@ -1,19 +1,17 @@ -set(MODULE_NAME "MFTSimulation") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Detector.cxx - src/DigitizerTask.cxx -) -set(HEADERS - include/${MODULE_NAME}/Detector.h - include/${MODULE_NAME}/DigitizerTask.h -) - -Set(LINKDEF src/MFTSimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mft_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_add_library(MFTSimulation + SOURCES src/Detector.cxx src/DigitizerTask.cxx + PUBLIC_LINK_LIBRARIES O2::MFTBase ROOT::Physics) +o2_target_root_dictionary(MFTSimulation + HEADERS include/MFTSimulation/Detector.h + include/MFTSimulation/DigitizerTask.h) diff --git a/Detectors/ITSMFT/common/CMakeLists.txt b/Detectors/ITSMFT/common/CMakeLists.txt index 1651b3414a087..6c0adc0758148 100644 --- a/Detectors/ITSMFT/common/CMakeLists.txt +++ b/Detectors/ITSMFT/common/CMakeLists.txt @@ -1,25 +1,16 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -# Libraries add_subdirectory(base) add_subdirectory(simulation) add_subdirectory(reconstruction) add_subdirectory(workflow) -install( - DIRECTORY data - DESTINATION share/Detectors/ITSMFT -) +o2_data_file(COPY data DESTINATION Detectors/ITSMFT) diff --git a/Detectors/ITSMFT/common/base/CMakeLists.txt b/Detectors/ITSMFT/common/base/CMakeLists.txt index c879fe874cef5..b8e4d32393eba 100644 --- a/Detectors/ITSMFT/common/base/CMakeLists.txt +++ b/Detectors/ITSMFT/common/base/CMakeLists.txt @@ -1,26 +1,23 @@ -set(MODULE_NAME "ITSMFTBase") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(ITSMFTBase + SOURCES src/SDigit.cxx src/Digit.cxx src/SegmentationAlpide.cxx + src/GeometryTGeo.cxx src/DPLAlpideParam.cxx + PUBLIC_LINK_LIBRARIES O2::MathUtils + O2::DetectorsCommonDataFormats + O2::SimConfig) -set(SRCS - src/SDigit.cxx - src/Digit.cxx - src/SegmentationAlpide.cxx - src/GeometryTGeo.cxx - src/DPLAlpideParam.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/SDigit.h - include/${MODULE_NAME}/Digit.h - include/${MODULE_NAME}/SegmentationAlpide.h - include/${MODULE_NAME}/GeometryTGeo.h - include/${MODULE_NAME}/DPLAlpideParam.h - ) - - -Set(LINKDEF src/ITSMFTBaseLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME itsmft_base_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(ITSMFTBase + HEADERS include/ITSMFTBase/SDigit.h + include/ITSMFTBase/Digit.h + include/ITSMFTBase/SegmentationAlpide.h + include/ITSMFTBase/GeometryTGeo.h + include/ITSMFTBase/DPLAlpideParam.h) diff --git a/Detectors/ITSMFT/common/reconstruction/CMakeLists.txt b/Detectors/ITSMFT/common/reconstruction/CMakeLists.txt index 8fe8426442d43..3da19c5717ce8 100644 --- a/Detectors/ITSMFT/common/reconstruction/CMakeLists.txt +++ b/Detectors/ITSMFT/common/reconstruction/CMakeLists.txt @@ -1,39 +1,49 @@ -set(MODULE_NAME "ITSMFTReconstruction") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(ITSMFTReconstruction + SOURCES src/ChipMappingITS.cxx + src/ChipMappingMFT.cxx + src/DigitPixelReader.cxx + src/Clusterer.cxx + src/PixelData.cxx + src/BuildTopologyDictionary.cxx + src/LookUp.cxx + src/TopologyFastSimulation.cxx + src/AlpideCoder.cxx + src/PayLoadCont.cxx + src/GBTWord.cxx + src/RUInfo.cxx + PUBLIC_LINK_LIBRARIES O2::ITSMFTBase + O2::CommonDataFormat + O2::SimulationDataFormat # FIXME: why do we + # depend on sim + # data format for + # reconstruction ? + O2::DataFormatsITSMFT + O2::Headers) -set(SRCS - src/ChipMappingITS.cxx - src/ChipMappingMFT.cxx - src/DigitPixelReader.cxx - src/Clusterer.cxx - src/PixelData.cxx - src/BuildTopologyDictionary.cxx - src/LookUp.cxx - src/TopologyFastSimulation.cxx - src/AlpideCoder.cxx - src/PayLoadCont.cxx - src/GBTWord.cxx - src/RUInfo.cxx -) -set(HEADERS - include/${MODULE_NAME}/PixelReader.h - include/${MODULE_NAME}/DigitPixelReader.h - include/${MODULE_NAME}/RawPixelReader.h - include/${MODULE_NAME}/PixelData.h - include/${MODULE_NAME}/Clusterer.h - include/${MODULE_NAME}/BuildTopologyDictionary.h - include/${MODULE_NAME}/LookUp.h - include/${MODULE_NAME}/TopologyFastSimulation.h - include/${MODULE_NAME}/ChipMappingITS.h - include/${MODULE_NAME}/ChipMappingMFT.h - include/${MODULE_NAME}/AlpideCoder.h - include/${MODULE_NAME}/GBTWord.h - include/${MODULE_NAME}/PayLoadCont.h - include/${MODULE_NAME}/PayLoadSG.h - include/${MODULE_NAME}/RUInfo.h -) -Set(LINKDEF src/ITSMFTReconstructionLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -Set(BUCKET_NAME itsmft_reconstruction_bucket) -O2_GENERATE_LIBRARY() +o2_target_root_dictionary( + ITSMFTReconstruction + HEADERS include/ITSMFTReconstruction/PixelReader.h + include/ITSMFTReconstruction/DigitPixelReader.h + include/ITSMFTReconstruction/RawPixelReader.h + include/ITSMFTReconstruction/PixelData.h + include/ITSMFTReconstruction/Clusterer.h + include/ITSMFTReconstruction/BuildTopologyDictionary.h + include/ITSMFTReconstruction/LookUp.h + include/ITSMFTReconstruction/TopologyFastSimulation.h + include/ITSMFTReconstruction/ChipMappingITS.h + include/ITSMFTReconstruction/ChipMappingMFT.h + include/ITSMFTReconstruction/AlpideCoder.h + include/ITSMFTReconstruction/GBTWord.h + include/ITSMFTReconstruction/PayLoadCont.h + include/ITSMFTReconstruction/PayLoadSG.h + include/ITSMFTReconstruction/RUInfo.h) diff --git a/Detectors/ITSMFT/common/simulation/CMakeLists.txt b/Detectors/ITSMFT/common/simulation/CMakeLists.txt index d0541f9c2390c..ee0a59a9caac6 100644 --- a/Detectors/ITSMFT/common/simulation/CMakeLists.txt +++ b/Detectors/ITSMFT/common/simulation/CMakeLists.txt @@ -1,43 +1,42 @@ -set(MODULE_NAME "ITSMFTSimulation") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(ITSMFTSimulation + SOURCES src/Hit.cxx + src/AlpideSimResponse.cxx + src/ChipDigitsContainer.cxx + src/AlpideChip.cxx + src/DigiParams.cxx + src/Digitizer.cxx + src/AlpideSignalTrapezoid.cxx + src/ClusterShape.cxx + src/DPLDigitizerParam.cxx + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ITSMFTBase + O2::DataFormatsITSMFT) -set(SRCS - src/Hit.cxx - src/AlpideSimResponse.cxx - src/ChipDigitsContainer.cxx - src/AlpideChip.cxx - src/DigiParams.cxx - src/Digitizer.cxx - src/AlpideSignalTrapezoid.cxx - src/ClusterShape.cxx - src/DPLDigitizerParam.cxx - ) -set(HEADERS - include/${MODULE_NAME}/Hit.h - include/${MODULE_NAME}/AlpideSimResponse.h - include/${MODULE_NAME}/DigiParams.h - include/${MODULE_NAME}/Digitizer.h - include/${MODULE_NAME}/PreDigit.h - include/${MODULE_NAME}/ChipDigitsContainer.h - include/${MODULE_NAME}/AlpideChip.h - include/${MODULE_NAME}/AlpideSignalTrapezoid.h - include/${MODULE_NAME}/ClusterShape.h - include/${MODULE_NAME}/DPLDigitizerParam.h - ) +o2_target_root_dictionary( + ITSMFTSimulation + HEADERS include/ITSMFTSimulation/Hit.h + include/ITSMFTSimulation/AlpideSimResponse.h + include/ITSMFTSimulation/DigiParams.h + include/ITSMFTSimulation/Digitizer.h + include/ITSMFTSimulation/PreDigit.h + include/ITSMFTSimulation/ChipDigitsContainer.h + include/ITSMFTSimulation/AlpideChip.h + include/ITSMFTSimulation/AlpideSignalTrapezoid.h + include/ITSMFTSimulation/ClusterShape.h + include/ITSMFTSimulation/DPLDigitizerParam.h) -Set(LINKDEF src/ITSMFTSimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME itsmft_simulation_bucket) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testAlpideSimResponse.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +o2_add_test(AlpideSimResponse + SOURCES test/testAlpideSimResponse.cxx + COMPONENT_NAME ITSMFT + PUBLIC_LINK_LIBRARIES O2::ITSMFTSimulation + LABELS "its;mft" + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage) diff --git a/Detectors/ITSMFT/common/workflow/CMakeLists.txt b/Detectors/ITSMFT/common/workflow/CMakeLists.txt index 7bcad30abe901..2663179355db2 100644 --- a/Detectors/ITSMFT/common/workflow/CMakeLists.txt +++ b/Detectors/ITSMFT/common/workflow/CMakeLists.txt @@ -1,14 +1,14 @@ -set(MODULE_NAME "ITSMFTWorkflow") -set(MODULE_BUCKET_NAME ITSMFT_workflow_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/ClusterReaderSpec.cxx - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(ITSMFTWorkflow + SOURCES src/ClusterReaderSpec.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsITSMFT + O2::SimulationDataFormat) diff --git a/Detectors/ITSMFT/test/CMakeLists.txt b/Detectors/ITSMFT/test/CMakeLists.txt index 24abf8234a11e..1f39c887404f9 100644 --- a/Detectors/ITSMFT/test/CMakeLists.txt +++ b/Detectors/ITSMFT/test/CMakeLists.txt @@ -1 +1,11 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(HitAnalysis) diff --git a/Detectors/ITSMFT/test/HitAnalysis/CMakeLists.txt b/Detectors/ITSMFT/test/HitAnalysis/CMakeLists.txt index 8fcc47851f080..afc16d98a495d 100644 --- a/Detectors/ITSMFT/test/HitAnalysis/CMakeLists.txt +++ b/Detectors/ITSMFT/test/HitAnalysis/CMakeLists.txt @@ -1,18 +1,15 @@ -set(MODULE_NAME "HitAnalysis") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/HitAnalysis.cxx - ) -set(HEADERS - include/HitAnalysis/HitAnalysis.h - ) -Set(LINKDEF src/HitAnalysisLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME hitanalysis_bucket) - - -O2_GENERATE_LIBRARY() - - +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(HitAnalysis + SOURCES src/HitAnalysis.cxx + PUBLIC_LINK_LIBRARIES FairRoot::Base O2::ITSMFTSimulation + O2::ITSBase) +o2_target_root_dictionary(HitAnalysis HEADERS include/HitAnalysis/HitAnalysis.h) diff --git a/Detectors/MUON/CMakeLists.txt b/Detectors/MUON/CMakeLists.txt index 77b53cab207c5..29c99f261cd86 100644 --- a/Detectors/MUON/CMakeLists.txt +++ b/Detectors/MUON/CMakeLists.txt @@ -1,2 +1,12 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(MCH) add_subdirectory(MID) diff --git a/Detectors/MUON/MCH/Base/CMakeLists.txt b/Detectors/MUON/MCH/Base/CMakeLists.txt index a9f1bae489f24..d1967825c9691 100644 --- a/Detectors/MUON/MCH/Base/CMakeLists.txt +++ b/Detectors/MUON/MCH/Base/CMakeLists.txt @@ -1,28 +1,22 @@ -set(MODULE_NAME "MCHBase") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -link_directories( ${LINK_DIRECTORIES}) - -set(SRCS - src/Mapping.cxx - src/DigitBlock.cxx - src/PreClusterBlock.cxx - src/ClusterBlock.cxx - src/TrackBlock.cxx -) - -set(HEADERS - include/${MODULE_NAME}/Mapping.h - include/${MODULE_NAME}/DigitBlock.h - include/${MODULE_NAME}/PreClusterBlock.h - include/${MODULE_NAME}/ClusterBlock.h - include/${MODULE_NAME}/TrackBlock.h -) - -set(LINKDEF src/MCHBaseLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mch_base_bucket) - -O2_GENERATE_LIBRARY() +o2_add_library(MCHBase + SOURCES src/Mapping.cxx src/DigitBlock.cxx + src/PreClusterBlock.cxx src/ClusterBlock.cxx + src/TrackBlock.cxx + PUBLIC_LINK_LIBRARIES ROOT::Core FairRoot::Base FairMQ::FairMQ) +o2_target_root_dictionary(MCHBase + HEADERS include/MCHBase/Mapping.h + include/MCHBase/DigitBlock.h + include/MCHBase/PreClusterBlock.h + include/MCHBase/ClusterBlock.h + include/MCHBase/TrackBlock.h) diff --git a/Detectors/MUON/MCH/CMakeLists.txt b/Detectors/MUON/MCH/CMakeLists.txt index 34482954fd66d..f99584f9485ba 100644 --- a/Detectors/MUON/MCH/CMakeLists.txt +++ b/Detectors/MUON/MCH/CMakeLists.txt @@ -1,3 +1,13 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(Base) add_subdirectory(Contour) add_subdirectory(Mapping) diff --git a/Detectors/MUON/MCH/Contour/CMakeLists.txt b/Detectors/MUON/MCH/Contour/CMakeLists.txt index c66cf19783775..bef75cce0587b 100644 --- a/Detectors/MUON/MCH/Contour/CMakeLists.txt +++ b/Detectors/MUON/MCH/Contour/CMakeLists.txt @@ -1,38 +1,59 @@ -set(BUCKET_NAME mch_contour_bucket) -set(MODULE_NAME MCHContour) - -add_library(MCHContour INTERFACE) - -install(DIRECTORY include/MCHContour DESTINATION include) - -O2_GENERATE_TESTS( - - BUCKET_NAME mch_contour_bucket - - TEST_SRCS - test/BBox.cxx - test/Contour.cxx - test/ContourCreator.cxx - test/Edge.cxx - test/Interval.cxx - test/Polygon.cxx - test/SegmentTree.cxx - test/Vertex.cxx - -) - -# custom target so that some IDE (e.g. CLion) recognize those files as -# being part of the project even though they are not part of a CMake target -add_custom_target(MCHContour_ide SOURCES - include/MCHContour/BBox.h - include/MCHContour/Contour.h - include/MCHContour/ContourCreator.h - include/MCHContour/ContourCreator.inl - include/MCHContour/Edge.h - include/MCHContour/Helper.h - include/MCHContour/Interval.h - include/MCHContour/Polygon.h - include/MCHContour/SegmentTree.h - include/MCHContour/SVGWriter.h - include/MCHContour/Vertex.h - ) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_header_only_library(MCHContour) + +o2_add_test(BBox + COMPONENT_NAME mchcontour + LABELS mch muon + PUBLIC_LINK_LIBRARIES O2::MCHContour + SOURCES test/BBox.cxx) + +o2_add_test(Contour + COMPONENT_NAME mchcontour + LABELS mch muon + PUBLIC_LINK_LIBRARIES O2::MCHContour + SOURCES test/Contour.cxx) + +o2_add_test(ContourCreator + COMPONENT_NAME mchcontour + LABELS mch muon + PUBLIC_LINK_LIBRARIES O2::MCHContour + SOURCES test/ContourCreator.cxx) + +o2_add_test(Edge + COMPONENT_NAME mchcontour + LABELS mch muon + PUBLIC_LINK_LIBRARIES O2::MCHContour + SOURCES test/Edge.cxx) + +o2_add_test(Interval + COMPONENT_NAME mchcontour + LABELS mch muon + PUBLIC_LINK_LIBRARIES O2::MCHContour + SOURCES test/Interval.cxx) + +o2_add_test(Polygon + COMPONENT_NAME mchcontour + LABELS mch muon + PUBLIC_LINK_LIBRARIES O2::MCHContour + SOURCES test/Polygon.cxx) + +o2_add_test(SegmentTree + COMPONENT_NAME mchcontour + LABELS mch muon + PUBLIC_LINK_LIBRARIES O2::MCHContour + SOURCES test/SegmentTree.cxx) + +o2_add_test(Vertex + COMPONENT_NAME mchcontour + LABELS mch muon + PUBLIC_LINK_LIBRARIES O2::MCHContour + SOURCES test/Vertex.cxx) diff --git a/Detectors/MUON/MCH/Mapping/CMakeLists.txt b/Detectors/MUON/MCH/Mapping/CMakeLists.txt index d3d0c699c1801..ae8c0e7a0ac98 100644 --- a/Detectors/MUON/MCH/Mapping/CMakeLists.txt +++ b/Detectors/MUON/MCH/Mapping/CMakeLists.txt @@ -1,4 +1,16 @@ -add_subdirectory(Impl3) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(Interface) +add_subdirectory(Impl3) add_subdirectory(SegContour) -add_subdirectory(test) \ No newline at end of file +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/Detectors/MUON/MCH/Mapping/Impl3/CMakeLists.txt b/Detectors/MUON/MCH/Mapping/Impl3/CMakeLists.txt index 6e09cf8f94676..a83fc616ea6d7 100644 --- a/Detectors/MUON/MCH/Mapping/Impl3/CMakeLists.txt +++ b/Detectors/MUON/MCH/Mapping/Impl3/CMakeLists.txt @@ -1,40 +1,49 @@ -O2_SETUP(NAME MCHMappingImpl3) -set(BUCKET_NAME mch_mapping_impl3_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(SRCS - src/GenDetElemId2SegType.cxx - src/GenDetElemId2SegType.h - src/PadGroup.h - src/PadGroupType.cxx - src/PadGroupType.h - src/CathodeSegmentationCImpl3.cxx - src/CathodeSegmentationCreator.cxx - src/CathodeSegmentationCreator.h - src/CathodeSegmentationImpl3.cxx - src/CathodeSegmentationImpl3.h - ) +o2_add_library(MCHMappingImpl3 + SOURCES src/GenDetElemId2SegType.cxx + src/GenDetElemId2SegType.h + src/PadGroup.h + src/PadGroupType.cxx + src/PadGroupType.h + src/CathodeSegmentationCImpl3.cxx + src/CathodeSegmentationCreator.cxx + src/CathodeSegmentationCreator.h + src/CathodeSegmentationImpl3.cxx + src/CathodeSegmentationImpl3.h + PUBLIC_LINK_LIBRARIES Boost::boost O2::MCHMappingInterface + ms_gsl::ms_gsl + TARGETVARNAME targetName) -# We add all segmentation creators by default, -# but the final goal would be to tailor this -# for each executable reaching a given FLP (so it gets only -# the mapping it needs) -foreach (segtype RANGE 20) - set(SRCS ${SRCS} src/GenCathodeSegmentationCreatorForSegType${segtype}.cxx) -endforeach () - -set(LIBRARY_NAME MCHMappingImpl3) -O2_GENERATE_LIBRARY() +# We add all segmentation creators by default, but the final goal would be to +# tailor this for each executable reaching a given FLP (so it gets only the +# mapping it needs) +foreach(segtype RANGE 20) + target_sources(${targetName} PRIVATE + src/GenCathodeSegmentationCreatorForSegType${segtype}.cxx) +endforeach() include(GenerateExportHeader) -generate_export_header(O2MCHMappingImpl3) - -set_target_properties(O2MCHMappingImpl3 PROPERTIES CXX_VISIBILITY_PRESET hidden) -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - target_compile_options(O2MCHMappingImpl3 PRIVATE -fext-numeric-literals) -endif () -if (APPLE) - add_custom_command(TARGET O2MCHMappingImpl3 POST_BUILD - COMMAND ${CMAKE_SOURCE_DIR}/Detectors/MUON/check_nof_exported_symbols.sh $ 18 - COMMENT "Checking number of exported symbols in the library") -endif () +generate_export_header(${targetName} BASE_NAME o2mchmappingimpl3) +set_target_properties(${targetName} PROPERTIES CXX_VISIBILITY_PRESET hidden) +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_options(${targetName} PRIVATE -fext-numeric-literals) +endif() +if(APPLE) + get_filename_component( + script ${CMAKE_CURRENT_LIST_DIR}/../../../check_nof_exported_symbols.sh + ABSOLUTE) + add_custom_command( + TARGET ${targetName} POST_BUILD + COMMAND ${script} $ 18 + COMMENT "Checking number of exported symbols in the library") +endif() diff --git a/Detectors/MUON/MCH/Mapping/Interface/CMakeLists.txt b/Detectors/MUON/MCH/Mapping/Interface/CMakeLists.txt index c8c206003e1c1..6dda214ccc02f 100644 --- a/Detectors/MUON/MCH/Mapping/Interface/CMakeLists.txt +++ b/Detectors/MUON/MCH/Mapping/Interface/CMakeLists.txt @@ -1,13 +1,11 @@ -O2_SETUP(NAME MCHMappingInterface) -set(BUCKET_NAME mch_mapping_interface_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -add_library(MCHMappingInterface INTERFACE) - -install(DIRECTORY include/MCHMappingInterface DESTINATION include) - -# custom target so that some IDE (e.g. CLion) recognize those files as -# being part of the project even though they are not part of a CMake target -add_custom_target(MCHMappingInterface_ide SOURCES - include/MCHMappingInterface/CathodeSegmentation.h - include/MCHMappingInterface/CathodeSegmentationCInterface.h - ) +o2_add_header_only_library(MCHMappingInterface) diff --git a/Detectors/MUON/MCH/Mapping/SegContour/CMakeLists.txt b/Detectors/MUON/MCH/Mapping/SegContour/CMakeLists.txt index 4640821c7ff8b..bd26a26becbc6 100644 --- a/Detectors/MUON/MCH/Mapping/SegContour/CMakeLists.txt +++ b/Detectors/MUON/MCH/Mapping/SegContour/CMakeLists.txt @@ -1,18 +1,22 @@ -O2_SETUP(NAME MCHMappingSegContour) -set(BUCKET_NAME mch_mapping_segcontour_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(SRCS - src/CathodeSegmentationContours.cxx - src/CathodeSegmentationSVGWriter.cxx - src/SegmentationContours.cxx) - -set(LIBRARY_NAME MCHMappingSegContour3) - -O2_GENERATE_LIBRARY() - -O2_GENERATE_EXECUTABLE( - EXE_NAME o2-mch-mapping-svg-segmentation3 - SOURCES src/SVGSegmentation.cxx - BUCKET_NAME mch_mapping_segcontour_bucket - MODULE_LIBRARY_NAME ${LIBRARY_NAME}) +o2_add_library(MCHMappingSegContour3 + SOURCES src/CathodeSegmentationContours.cxx + src/CathodeSegmentationSVGWriter.cxx + src/SegmentationContours.cxx + PUBLIC_LINK_LIBRARIES O2::MCHMappingImpl3 O2::MCHContour + Boost::boost) +o2_add_executable(mapping-svg-segmentation3 + COMPONENT_NAME mch + SOURCES src/SVGSegmentation.cxx + PUBLIC_LINK_LIBRARIES O2::MCHMappingSegContour3 + Boost::program_options) diff --git a/Detectors/MUON/MCH/Mapping/test/CMakeLists.txt b/Detectors/MUON/MCH/Mapping/test/CMakeLists.txt index c7fb934a48d24..dedb025444320 100644 --- a/Detectors/MUON/MCH/Mapping/test/CMakeLists.txt +++ b/Detectors/MUON/MCH/Mapping/test/CMakeLists.txt @@ -1,32 +1,32 @@ -o2_setup(NAME MCHMappingTest) -set(BUCKET_NAME mch_mapping_test_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. # trying to get only one test exe for this module -o2_generate_executable(EXE_NAME - test_MCHMappingTest - SOURCES - src/CathodeSegmentation.cxx - src/CathodeSegmentationLong.cxx - src/Segmentation.cxx - BUCKET_NAME - mch_mapping_test_bucket - NO_INSTALL TRUE) - -target_link_libraries(test_MCHMappingTest Boost::unit_test_framework) -add_test_wrap(NAME test_MCHMappingTest COMMAND test_MCHMappingTest) +o2_add_test(StressTest + SOURCES src/CathodeSegmentation.cxx src/CathodeSegmentationLong.cxx + src/Segmentation.cxx + COMPONENT_NAME mchmapping + PUBLIC_LINK_LIBRARIES O2::MCHMappingImpl3 O2::MCHMappingSegContour3 + RapidJSON::RapidJSON + LABELS "muon;mch;long" CONFIGURATIONS RelWithDebInfo) if(benchmark_FOUND) - o2_generate_executable(EXE_NAME - mch-mapping-bench-segmentation3 - SOURCES - src/BenchCathodeSegmentation.cxx - src/BenchSegmentation.cxx - BUCKET_NAME - mch_mapping_test_bucket - NO_INSTALL TRUE) + o2_add_executable(segmentation3 + SOURCES src/BenchCathodeSegmentation.cxx + src/BenchSegmentation.cxx + IS_BENCHMARK + COMPONENT_NAME mch + PUBLIC_LINK_LIBRARIES O2::MCHMappingImpl3 + O2::MCHMappingSegContour3 + benchmark::benchmark) endif() -file(COPY - ${CMAKE_CURRENT_SOURCE_DIR}/data/test_random_pos.json - DESTINATION - ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data/test_random_pos.json + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/Detectors/MUON/MCH/PreClustering/CMakeLists.txt b/Detectors/MUON/MCH/PreClustering/CMakeLists.txt index 3fb4ec6263317..8219dd9430908 100644 --- a/Detectors/MUON/MCH/PreClustering/CMakeLists.txt +++ b/Detectors/MUON/MCH/PreClustering/CMakeLists.txt @@ -1,31 +1,20 @@ -set(MODULE_NAME "MCHPreClustering") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/PreClusterFinder.cxx -) - -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mch_preclustering_bucket) - -O2_GENERATE_LIBRARY() - -# todo we repeat ourselves because the above macro dares deleting the variables we pass to it. -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mch_preclustering_bucket) - -# Define application -O2_GENERATE_EXECUTABLE( - EXE_NAME o2-mch-preclusterizer-workflow - - SOURCES - src/PreClusterizerWorkflow.cxx - src/DigitSamplerSpec.cxx - src/PreClusterFinderSpec.cxx - src/PreClusterSinkSpec.cxx - - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - - BUCKET_NAME ${BUCKET_NAME} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(MCHPreClustering + SOURCES src/PreClusterFinder.cxx + PUBLIC_LINK_LIBRARIES O2::MCHBase O2::Framework) + +o2_add_executable(preclusterizer-workflow + COMPONENT_NAME mch + SOURCES src/PreClusterizerWorkflow.cxx + src/DigitSamplerSpec.cxx src/PreClusterFinderSpec.cxx + src/PreClusterSinkSpec.cxx + PUBLIC_LINK_LIBRARIES O2::MCHPreClustering) diff --git a/Detectors/MUON/MCH/Simulation/CMakeLists.txt b/Detectors/MUON/MCH/Simulation/CMakeLists.txt index 581f067413761..9246508e43973 100644 --- a/Detectors/MUON/MCH/Simulation/CMakeLists.txt +++ b/Detectors/MUON/MCH/Simulation/CMakeLists.txt @@ -1,43 +1,47 @@ -set(MODULE_NAME "MCHSimulation") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(MCHSimulation + SOURCES src/Detector.cxx + src/Digit.cxx + src/Digitizer.cxx + src/Geometry.cxx + src/GeometryTest.cxx + src/Hit.cxx + src/Materials.cxx + src/Materials.h + src/Response.cxx + src/Station1Geometry.cxx + src/Station1Geometry.h + src/Station2Geometry.cxx + src/Station2Geometry.h + src/Station345Geometry.cxx + src/Station345Geometry.h + src/Stepper.cxx + src/Stepper.h + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat + O2::MCHMappingImpl3 O2::DetectorsBase + RapidJSON::RapidJSON) -set(SRCS - src/Detector.cxx - src/Digit.cxx - src/Digitizer.cxx - src/Geometry.cxx - src/GeometryTest.cxx - src/Hit.cxx - src/Materials.cxx - src/Materials.h - src/Response.cxx - src/Station1Geometry.cxx - src/Station1Geometry.h - src/Station2Geometry.cxx - src/Station2Geometry.h - src/Station345Geometry.cxx - src/Station345Geometry.h - src/Stepper.cxx - src/Stepper.h -) - -set(HEADERS - include/${MODULE_NAME}/Detector.h - include/${MODULE_NAME}/Digit.h - include/${MODULE_NAME}/Digitizer.h - include/${MODULE_NAME}/Geometry.h - include/${MODULE_NAME}/GeometryTest.h - include/${MODULE_NAME}/Hit.h - include/${MODULE_NAME}/Response.h -) - -SET(LINKDEF src/MCHSimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mch_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(MCHSimulation + HEADERS include/MCHSimulation/Detector.h + include/MCHSimulation/Digit.h + include/MCHSimulation/Digitizer.h + include/MCHSimulation/Geometry.h + include/MCHSimulation/GeometryTest.h + include/MCHSimulation/Hit.h + include/MCHSimulation/Response.h) if(BUILD_TESTING) add_subdirectory(test) + o2_add_test_root_macro(macros/drawMCHGeometry.C + PUBLIC_LINK_LIBRARIES O2::MCHSimulation + LABELS "muon;mch") endif() diff --git a/Detectors/MUON/MCH/Simulation/test/CMakeLists.txt b/Detectors/MUON/MCH/Simulation/test/CMakeLists.txt index fd732dddc5b0a..17aad30cf90d0 100644 --- a/Detectors/MUON/MCH/Simulation/test/CMakeLists.txt +++ b/Detectors/MUON/MCH/Simulation/test/CMakeLists.txt @@ -1,23 +1,25 @@ -O2_SETUP(NAME MCHSimulationTest) -set(BUCKET_NAME mch_simulation_test_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_GENERATE_EXECUTABLE( - EXE_NAME test_MCHSimulation - SOURCES testDigitMerging.cxx DigitMerging.cxx testGeometry.cxx testDigitization.cxx testResponse.cxx - BUCKET_NAME mch_simulation_test_bucket - NO_INSTALL TRUE -) +o2_add_test(simulation + COMPONENT_NAME mchsimulation + SOURCES testDigitMerging.cxx DigitMerging.cxx testGeometry.cxx + testDigitization.cxx testResponse.cxx + PUBLIC_LINK_LIBRARIES O2::MCHSimulation + LABELS muon mch long CONFIGURATIONS RelWithDebInfo) -target_link_libraries(test_MCHSimulation Boost::unit_test_framework O2MCHSimulation) -add_test_wrap(NAME test_MCHSimulation COMMAND test_MCHSimulation) - -if (benchmark_FOUND) - O2_GENERATE_EXECUTABLE( - EXE_NAME o2-mch-bench-digit-merging +if(benchmark_FOUND) + o2_add_executable( + digit-merging + COMPONENT_NAME mch SOURCES benchDigitMerging.cxx DigitMerging.cxx - BUCKET_NAME ${BUCKET_NAME} - NO_INSTALL TRUE - ) + PUBLIC_LINK_LIBRARIES O2::MCHSimulation benchmark::benchmark) endif() - diff --git a/Detectors/MUON/MCH/Tracking/CMakeLists.txt b/Detectors/MUON/MCH/Tracking/CMakeLists.txt index e048fd4cabbd0..042d650bb37dd 100644 --- a/Detectors/MUON/MCH/Tracking/CMakeLists.txt +++ b/Detectors/MUON/MCH/Tracking/CMakeLists.txt @@ -1,35 +1,20 @@ -set(MODULE_NAME "MCHTracking") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Cluster.cxx - src/TrackParam.cxx - src/Track.cxx - src/TrackExtrap.cxx - src/TrackFitter.cxx -) - -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mch_tracking_bucket) - -O2_GENERATE_LIBRARY() - -# todo we repeat ourselves because the above macro dares deleting the variables we pass to it. -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mch_tracking_bucket) - -# Define application -O2_GENERATE_EXECUTABLE( - EXE_NAME o2-mch-trackfitter-workflow - - SOURCES - src/TrackFitterWorkflow.cxx - src/TrackSamplerSpec.cxx - src/TrackFitterSpec.cxx - src/TrackSinkSpec.cxx - - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - - BUCKET_NAME ${BUCKET_NAME} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(MCHTracking + SOURCES src/Cluster.cxx src/TrackParam.cxx src/Track.cxx + src/TrackExtrap.cxx src/TrackFitter.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::Field O2::MCHBase) + +o2_add_executable(trackfitter-workflow + SOURCES src/TrackFitterWorkflow.cxx src/TrackSamplerSpec.cxx + src/TrackFitterSpec.cxx src/TrackSinkSpec.cxx + COMPONENT_NAME mch + PUBLIC_LINK_LIBRARIES O2::MCHTracking) diff --git a/Detectors/MUON/MID/Base/CMakeLists.txt b/Detectors/MUON/MID/Base/CMakeLists.txt index 45e0a8bf576e1..c7b86a2bfe0f5 100644 --- a/Detectors/MUON/MID/Base/CMakeLists.txt +++ b/Detectors/MUON/MID/Base/CMakeLists.txt @@ -1,26 +1,19 @@ -set(MODULE_NAME "MIDBase") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(MIDBase + SOURCES src/ChamberEfficiency.cxx src/Constants.cxx + src/GeometryTransformer.cxx src/Mapping.cxx + src/MpArea.cxx + PUBLIC_LINK_LIBRARIES O2::MathUtils O2::DataFormatsMID) -set(SRCS - src/ChamberEfficiency.cxx - src/Constants.cxx - src/GeometryTransformer.cxx - src/Mapping.cxx - src/MpArea.cxx -) - -set(NO_DICT_HEADERS - include/${MODULE_NAME}/ChamberEfficiency.h - include/${MODULE_NAME}/Constants.h - include/${MODULE_NAME}/GeometryTransformer.h - include/${MODULE_NAME}/Mapping.h - include/${MODULE_NAME}/MpArea.h -) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mid_base_bucket) - -O2_GENERATE_LIBRARY() - -add_subdirectory(test) +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/Detectors/MUON/MID/Base/test/CMakeLists.txt b/Detectors/MUON/MID/Base/test/CMakeLists.txt index 00a9ae0e7bd0f..d86f7fd6d8b76 100644 --- a/Detectors/MUON/MID/Base/test/CMakeLists.txt +++ b/Detectors/MUON/MID/Base/test/CMakeLists.txt @@ -1,22 +1,24 @@ -O2_SETUP(NAME "MIDBaseTest") -set(BUCKET_NAME mid_base_test_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS src/testMapping.cxx -) +o2_add_test(Mapping + SOURCES src/testMapping.cxx + COMPONENT_NAME mid + PUBLIC_LINK_LIBRARIES O2::MIDBase + LABELS muon mid) -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS src/Positions.cxx -) +o2_add_test(Positions + SOURCES src/Positions.cxx + COMPONENT_NAME mid + PUBLIC_LINK_LIBRARIES RapidJSON::RapidJSON O2::MIDBase + LABELS muon mid) -# target_link_libraries(test_MIDpositions Boost::unit_test_framework MIDBase) -# add_test(NAME test_MIDpositions COMMAND test_MIDpositions) - -file(COPY - ${CMAKE_CURRENT_SOURCE_DIR}/data/test_random_pos.json - DESTINATION - ${CMAKE_CURRENT_BINARY_DIR}) \ No newline at end of file +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data/test_random_pos.json + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/Detectors/MUON/MID/CMakeLists.txt b/Detectors/MUON/MID/CMakeLists.txt index 5b96ca9c012b0..4e03d4f1f9fd2 100644 --- a/Detectors/MUON/MID/CMakeLists.txt +++ b/Detectors/MUON/MID/CMakeLists.txt @@ -1,6 +1,16 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(Base) add_subdirectory(Clustering) -add_subdirectory(Simulation) add_subdirectory(TestingSimTools) add_subdirectory(Tracking) +add_subdirectory(Simulation) add_subdirectory(Workflow) diff --git a/Detectors/MUON/MID/Clustering/CMakeLists.txt b/Detectors/MUON/MID/Clustering/CMakeLists.txt index cd3c661ddbbae..2a2d546d4039b 100644 --- a/Detectors/MUON/MID/Clustering/CMakeLists.txt +++ b/Detectors/MUON/MID/Clustering/CMakeLists.txt @@ -1,18 +1,18 @@ -set(MODULE_NAME "MIDClustering") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Clusterizer.cxx - src/PreClusterizer.cxx - src/PreCluster.cxx - src/PreClusterHelper.cxx - src/PreClustersDE.cxx -) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mid_clustering_bucket) - -O2_GENERATE_LIBRARY() - -add_subdirectory(test) +o2_add_library(MIDClustering + SOURCES src/Clusterizer.cxx src/PreClusterizer.cxx + src/PreCluster.cxx src/PreClusterHelper.cxx + src/PreClustersDE.cxx + PUBLIC_LINK_LIBRARIES O2::MIDBase ms_gsl::ms_gsl) +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/Detectors/MUON/MID/Clustering/test/CMakeLists.txt b/Detectors/MUON/MID/Clustering/test/CMakeLists.txt index 70b2880acd2bc..3ccd5f4155621 100644 --- a/Detectors/MUON/MID/Clustering/test/CMakeLists.txt +++ b/Detectors/MUON/MID/Clustering/test/CMakeLists.txt @@ -1,14 +1,22 @@ -O2_SETUP(NAME MIDClusteringTest) -set(BUCKET_NAME mid_clustering_test_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS testClusterizer.cxx -) +o2_add_test(Clusterizer + SOURCES testClusterizer.cxx + COMPONENT_NAME mid + PUBLIC_LINK_LIBRARIES O2::MIDClustering) -if (benchmark_FOUND) - O2_GENERATE_EXECUTABLE( - EXE_NAME o2-mid-bench-clusterizer - SOURCES bench_Clusterizer.cxx - BUCKET_NAME ${BUCKET_NAME}) -endif () +if(benchmark_FOUND) + o2_add_executable(clusterizer + SOURCES bench_Clusterizer.cxx + IS_BENCHMARK + PUBLIC_LINK_LIBRARIES O2::MIDClustering benchmark::benchmark + COMPONENT_NAME mid) +endif() diff --git a/Detectors/MUON/MID/Simulation/CMakeLists.txt b/Detectors/MUON/MID/Simulation/CMakeLists.txt index 4d16abb80ca81..4aa0efca0ce68 100644 --- a/Detectors/MUON/MID/Simulation/CMakeLists.txt +++ b/Detectors/MUON/MID/Simulation/CMakeLists.txt @@ -1,49 +1,58 @@ -set(MODULE_NAME "MIDSimulation") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(MIDSimulation + SOURCES src/ChamberEfficiencyResponse.cxx + src/ChamberHV.cxx + src/ChamberResponse.cxx + src/ChamberResponseParams.cxx + src/ClusterLabeler.cxx + src/Detector.cxx + src/Digitizer.cxx + src/DigitsMerger.cxx + src/DigitsPacker.cxx + src/Geometry.cxx + src/Hit.cxx + src/Materials.cxx + src/MCClusterLabel.cxx + src/MCLabel.cxx + src/PreClusterLabeler.cxx + src/Stepper.cxx + src/TrackLabeler.cxx + PUBLIC_LINK_LIBRARIES O2::MIDBase O2::CommonDataFormat + O2::DetectorsBase O2::SimulationDataFormat + O2::MIDClustering) -set(SRCS - src/ChamberEfficiencyResponse.cxx - src/ChamberHV.cxx - src/ChamberResponse.cxx - src/ChamberResponseParams.cxx - src/ClusterLabeler.cxx - src/Detector.cxx - src/Digitizer.cxx - src/DigitsMerger.cxx - src/DigitsPacker.cxx - src/Geometry.cxx - src/Hit.cxx - src/Materials.cxx - src/MCClusterLabel.cxx - src/MCLabel.cxx - src/PreClusterLabeler.cxx - src/Stepper.cxx - src/TrackLabeler.cxx -) +o2_target_root_dictionary( + MIDSimulation + HEADERS include/MIDSimulation/ChamberEfficiencyResponse.h + include/MIDSimulation/ChamberHV.h + include/MIDSimulation/ChamberResponse.h + include/MIDSimulation/ChamberResponseParams.h + include/MIDSimulation/ClusterLabeler.h + include/MIDSimulation/ColumnDataMC.h + include/MIDSimulation/Detector.h + include/MIDSimulation/Digitizer.h + include/MIDSimulation/DigitsMerger.h + include/MIDSimulation/DigitsPacker.h + include/MIDSimulation/Hit.h + include/MIDSimulation/MCClusterLabel.h + include/MIDSimulation/MCLabel.h + include/MIDSimulation/Stepper.h) -set(HEADERS - include/${MODULE_NAME}/ChamberEfficiencyResponse.h - include/${MODULE_NAME}/ChamberHV.h - include/${MODULE_NAME}/ChamberResponse.h - include/${MODULE_NAME}/ChamberResponseParams.h - include/${MODULE_NAME}/ClusterLabeler.h - include/${MODULE_NAME}/ColumnDataMC.h - include/${MODULE_NAME}/Detector.h - include/${MODULE_NAME}/Digitizer.h - include/${MODULE_NAME}/DigitsMerger.h - include/${MODULE_NAME}/DigitsPacker.h - include/${MODULE_NAME}/Hit.h - include/${MODULE_NAME}/MCClusterLabel.h - include/${MODULE_NAME}/MCLabel.h - include/${MODULE_NAME}/Stepper.h - include/${MODULE_NAME}/TrackLabeler.h -) +if(BUILD_TESTING) + add_subdirectory(test) -set(LINKDEF src/MIDSimulationLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mid_simulation_bucket) - -O2_GENERATE_LIBRARY() - -add_subdirectory(test) + o2_add_test_root_macro(macros/drawMIDGeometry.C + PUBLIC_LINK_LIBRARIES FairRoot::Base + O2::DetectorsPassive + O2::MIDSimulation + LABELS "muon;mid") +endif() diff --git a/Detectors/MUON/MID/Simulation/test/CMakeLists.txt b/Detectors/MUON/MID/Simulation/test/CMakeLists.txt index ae84bb34eb7d6..124440c7bbbc7 100644 --- a/Detectors/MUON/MID/Simulation/test/CMakeLists.txt +++ b/Detectors/MUON/MID/Simulation/test/CMakeLists.txt @@ -1,12 +1,21 @@ -O2_SETUP(NAME "MIDSimulationTest") -set(BUCKET_NAME mid_simulation_test_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS testGeometry.cxx -) +o2_add_test(Geometry + SOURCES testGeometry.cxx + PUBLIC_LINK_LIBRARIES O2::MIDSimulation + COMPONENT_NAME mid + LABELS mid muon) -O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS testSimulation.cxx -) +o2_add_test(Simulation + SOURCES testSimulation.cxx + PUBLIC_LINK_LIBRARIES O2::MIDSimulation O2::MIDTracking + COMPONENT_NAME mid + LABELS mid long muon) diff --git a/Detectors/MUON/MID/TestingSimTools/CMakeLists.txt b/Detectors/MUON/MID/TestingSimTools/CMakeLists.txt index 9456f02b8696b..e4ee6bc51ab62 100644 --- a/Detectors/MUON/MID/TestingSimTools/CMakeLists.txt +++ b/Detectors/MUON/MID/TestingSimTools/CMakeLists.txt @@ -1,18 +1,13 @@ -set(MODULE_NAME "MIDTestingSimTools") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/HitFinder.cxx - src/TrackGenerator.cxx -) - -set(HEADERS - include/${MODULE_NAME}/HitFinder.h - include/${MODULE_NAME}/TrackGenerator.h -) - -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mid_testingSimTools_bucket) - -O2_GENERATE_LIBRARY() +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(MIDTestingSimTools + SOURCES src/HitFinder.cxx src/TrackGenerator.cxx + PUBLIC_LINK_LIBRARIES O2::DataFormatsMID O2::MIDBase) diff --git a/Detectors/MUON/MID/Tracking/CMakeLists.txt b/Detectors/MUON/MID/Tracking/CMakeLists.txt index 47f4ae914ce9f..7bdac9d67ce8e 100644 --- a/Detectors/MUON/MID/Tracking/CMakeLists.txt +++ b/Detectors/MUON/MID/Tracking/CMakeLists.txt @@ -1,14 +1,18 @@ -set(MODULE_NAME "MIDTracking") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(MIDTracking + SOURCES src/Tracker.cxx + PUBLIC_LINK_LIBRARIES O2::DataFormatsMID O2::MIDBase + O2::MIDTestingSimTools ms_gsl::ms_gsl) -set(SRCS - src/Tracker.cxx -) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME mid_tracking_bucket) - -O2_GENERATE_LIBRARY() - -add_subdirectory(test) +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/Detectors/MUON/MID/Tracking/test/CMakeLists.txt b/Detectors/MUON/MID/Tracking/test/CMakeLists.txt index b2f9704daee38..537f347f8c9fa 100644 --- a/Detectors/MUON/MID/Tracking/test/CMakeLists.txt +++ b/Detectors/MUON/MID/Tracking/test/CMakeLists.txt @@ -1,14 +1,23 @@ -O2_SETUP(NAME MIDTrackingTest) -set(BUCKET_NAME mid_tracking_test_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS testTracker.cxx -) +o2_add_test(Tracker + SOURCES testTracker.cxx + LABELS mid + COMPONENT_NAME mid + PUBLIC_LINK_LIBRARIES O2::MIDTracking) -if (benchmark_FOUND) - O2_GENERATE_EXECUTABLE( - EXE_NAME o2-mid-bench-tracker - SOURCES bench_Tracker.cxx - BUCKET_NAME ${BUCKET_NAME}) -endif () +if(benchmark_FOUND) + o2_add_executable(tracker + COMPONENT_NAME mid + SOURCES bench_Tracker.cxx + IS_BENCHMARK + PUBLIC_LINK_LIBRARIES O2::MIDTracking benchmark::benchmark) +endif() diff --git a/Detectors/MUON/MID/Workflow/CMakeLists.txt b/Detectors/MUON/MID/Workflow/CMakeLists.txt index a3762c53ba495..b8813b589910d 100644 --- a/Detectors/MUON/MID/Workflow/CMakeLists.txt +++ b/Detectors/MUON/MID/Workflow/CMakeLists.txt @@ -1,25 +1,34 @@ -set(MODULE_NAME "MIDWorkflow") -set(MODULE_BUCKET_NAME mid_workflow_bucket) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_executable(reco-workflow + SOURCES src/mid-reco-workflow.cxx + COMPONENT_NAME mid + SOURCES src/mid-reco-workflow.cxx + src/ClusterizerSpec.cxx + src/ClusterLabelerSpec.cxx + src/DigitReaderSpec.cxx + src/RecoWorkflow.cxx + src/TrackerSpec.cxx + src/TrackLabelerSpec.cxx + TARGETVARNAME + exename + PUBLIC_LINK_LIBRARIES O2::Framework + O2::SimConfig + ms_gsl::ms_gsl + O2::SimulationDataFormat + O2::DataFormatsMID + O2::DPLUtils + O2::MIDSimulation + O2::MIDTracking) -set(SRCS - src/ClusterizerSpec.cxx - src/ClusterLabelerSpec.cxx - src/DigitReaderSpec.cxx - src/RecoWorkflow.cxx - src/TrackerSpec.cxx - src/TrackLabelerSpec.cxx - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -O2_GENERATE_EXECUTABLE( - EXE_NAME o2-mid-reco-workflow - SOURCES src/mid-reco-workflow.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) \ No newline at end of file +target_include_directories( + ${exename} + PRIVATE $) diff --git a/Detectors/MUON/check_nof_exported_symbols.sh b/Detectors/MUON/check_nof_exported_symbols.sh index 266e731d3e50e..b5c3e936e652b 100755 --- a/Detectors/MUON/check_nof_exported_symbols.sh +++ b/Detectors/MUON/check_nof_exported_symbols.sh @@ -4,11 +4,11 @@ library=$1 expected=$2 -nlibs=$(/usr/bin/nm -m -extern-only -defined-only $library -s __TEXT __text | wc -l) +nlibs=$(/usr/bin/nm -m -extern-only -defined-only $library -s __TEXT __text | grep mch | wc -l) if [ $nlibs -ne $expected ]; then echo "bad: check number of exported symbols in $library" /usr/bin/nm -m -extern-only -defined-only $library -s __TEXT __text else echo "good: $library contains the expected $expected exported symbols" -fi \ No newline at end of file +fi diff --git a/Detectors/PHOS/CMakeLists.txt b/Detectors/PHOS/CMakeLists.txt index 524338acee253..3a46f92f8f3c5 100644 --- a/Detectors/PHOS/CMakeLists.txt +++ b/Detectors/PHOS/CMakeLists.txt @@ -1,4 +1,16 @@ -# Libraries +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(base) add_subdirectory(simulation) -add_subdirectory(reconstruction) \ No newline at end of file +add_subdirectory(reconstruction) +if(BUILD_TESTING) + add_subdirectory(testsimulation) +endif() diff --git a/Detectors/PHOS/base/CMakeLists.txt b/Detectors/PHOS/base/CMakeLists.txt index e814434942968..435dcef906de2 100644 --- a/Detectors/PHOS/base/CMakeLists.txt +++ b/Detectors/PHOS/base/CMakeLists.txt @@ -1,21 +1,18 @@ -SET(MODULE_NAME PHOSBase) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(PHOSBase + SOURCES src/Geometry.cxx src/Hit.cxx src/Digit.cxx + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat) -set(SRCS - src/Geometry.cxx - src/Hit.cxx - src/Digit.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/Geometry.h - include/${MODULE_NAME}/Hit.h - include/${MODULE_NAME}/Digit.h -) - -SET(LINKDEF src/PHOSBaseLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME phos_base_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(PHOSBase + HEADERS include/PHOSBase/Geometry.h + include/PHOSBase/Hit.h + include/PHOSBase/Digit.h) diff --git a/Detectors/PHOS/reconstruction/CMakeLists.txt b/Detectors/PHOS/reconstruction/CMakeLists.txt index 5b0b822cf4a4d..1912c0b8cc150 100644 --- a/Detectors/PHOS/reconstruction/CMakeLists.txt +++ b/Detectors/PHOS/reconstruction/CMakeLists.txt @@ -1,21 +1,18 @@ -SET(MODULE_NAME PHOSReconstruction) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(PHOSReconstruction + SOURCES src/Cluster.cxx src/Clusterer.cxx src/ClustererTask.cxx + PUBLIC_LINK_LIBRARIES O2::PHOSBase) -set(SRCS - src/Cluster.cxx - src/Clusterer.cxx - src/ClustererTask.cxx - ) - -set(HEADERS - include/PHOSReconstruction/Cluster.h - include/PHOSReconstruction/Clusterer.h - include/PHOSReconstruction/ClustererTask.h -) - -SET(LINKDEF src/PHOSReconstructionLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME phos_reconstruction_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(PHOSReconstruction + HEADERS include/PHOSReconstruction/Cluster.h + include/PHOSReconstruction/Clusterer.h + include/PHOSReconstruction/ClustererTask.h) diff --git a/Detectors/PHOS/simulation/CMakeLists.txt b/Detectors/PHOS/simulation/CMakeLists.txt index d853403a12ea4..6f2a9323c3808 100644 --- a/Detectors/PHOS/simulation/CMakeLists.txt +++ b/Detectors/PHOS/simulation/CMakeLists.txt @@ -1,23 +1,20 @@ -SET(MODULE_NAME PHOSSimulation) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(PHOSSimulation + SOURCES src/Detector.cxx src/GeometryParams.cxx src/Digitizer.cxx + src/DigitizerTask.cxx + PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2::PHOSBase) -set(SRCS - src/Detector.cxx - src/GeometryParams.cxx - src/Digitizer.cxx - src/DigitizerTask.cxx -) - -set(HEADERS - include/PHOSSimulation/Detector.h - include/PHOSSimulation/GeometryParams.h - include/PHOSSimulation/Digitizer.h - include/PHOSSimulation/DigitizerTask.h -) - -SET(LINKDEF src/PHOSSimulationLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME phos_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(PHOSSimulation + HEADERS include/PHOSSimulation/Detector.h + include/PHOSSimulation/GeometryParams.h + include/PHOSSimulation/Digitizer.h + include/PHOSSimulation/DigitizerTask.h) diff --git a/Detectors/PHOS/testsimulation/CMakeLists.txt b/Detectors/PHOS/testsimulation/CMakeLists.txt new file mode 100644 index 0000000000000..34371d1020654 --- /dev/null +++ b/Detectors/PHOS/testsimulation/CMakeLists.txt @@ -0,0 +1,51 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_test_root_macro(PutPhosInTop.C + PUBLIC_LINK_LIBRARIES O2::DetectorsPassive FairRoot::Base + O2::PHOSSimulation + LABELS phos) + +o2_add_test_root_macro(drawPHOSgeometry.C + PUBLIC_LINK_LIBRARIES O2::DetectorsPassive FairRoot::Base + O2::PHOSSimulation + LABELS phos) + +o2_add_test_root_macro(plot_clu_phos.C + PUBLIC_LINK_LIBRARIES FairRoot::Base + O2::SimulationDataFormat + O2::PHOSReconstruction O2::PHOSBase + LABELS phos) + +o2_add_test_root_macro(plot_dig_phos.C + PUBLIC_LINK_LIBRARIES FairRoot::Base + O2::SimulationDataFormat + O2::PHOSSimulation O2::PHOSBase + LABELS phos) + +o2_add_test_root_macro(plot_hit_phos.C + PUBLIC_LINK_LIBRARIES FairRoot::Base + O2::SimulationDataFormat + O2::PHOSSimulation + LABELS phos) + +o2_add_test_root_macro(run_clu_phos.C + PUBLIC_LINK_LIBRARIES FairRoot::Base + O2::PHOSReconstruction + LABELS phos) + +o2_add_test_root_macro(run_digi_phos.C + PUBLIC_LINK_LIBRARIES FairRoot::Base O2::PHOSSimulation + LABELS phos) + +o2_add_test_root_macro(run_sim_phos.C + PUBLIC_LINK_LIBRARIES FairRoot::Base O2::DetectorsPassive + O2::PHOSSimulation + LABELS phos) diff --git a/Detectors/Passive/CMakeLists.txt b/Detectors/Passive/CMakeLists.txt index d756de89809e1..7aa338d4437c9 100644 --- a/Detectors/Passive/CMakeLists.txt +++ b/Detectors/Passive/CMakeLists.txt @@ -1,37 +1,42 @@ -set(MODULE_NAME "DetectorsPassive") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(DetectorsPassive + SOURCES src/Absorber.cxx + src/Cave.cxx + src/Dipole.cxx + src/Compensator.cxx + src/Pipe.cxx + src/Magnet.cxx + src/PassiveContFact.cxx + src/FrameStructure.cxx + src/Shil.cxx + src/Hall.cxx + src/HallSimParam.cxx + PUBLIC_LINK_LIBRARIES O2::Field O2::DetectorsBase O2::SimConfig) -set(SRCS - src/Absorber.cxx - src/Cave.cxx - src/Dipole.cxx - src/Compensator.cxx - src/Pipe.cxx - src/Magnet.cxx - src/PassiveContFact.cxx - src/FrameStructure.cxx - src/Shil.cxx - src/Hall.cxx - src/HallSimParam.cxx -) +o2_target_root_dictionary(DetectorsPassive + HEADERS include/DetectorsPassive/Absorber.h + include/DetectorsPassive/Cave.h + include/DetectorsPassive/Dipole.h + include/DetectorsPassive/Compensator.h + include/DetectorsPassive/Magnet.h + include/DetectorsPassive/PassiveContFact.h + include/DetectorsPassive/Pipe.h + include/DetectorsPassive/FrameStructure.h + include/DetectorsPassive/Shil.h + include/DetectorsPassive/Hall.h + include/DetectorsPassive/HallSimParam.h + LINKDEF src/PassiveLinkDef.h) -Set(HEADERS - include/${MODULE_NAME}/Absorber.h - include/${MODULE_NAME}/Cave.h - include/${MODULE_NAME}/Dipole.h - include/${MODULE_NAME}/Compensator.h - include/${MODULE_NAME}/Magnet.h - include/${MODULE_NAME}/PassiveContFact.h - include/${MODULE_NAME}/Pipe.h - include/${MODULE_NAME}/FrameStructure.h - include/${MODULE_NAME}/Shil.h - include/${MODULE_NAME}/Hall.h - include/${MODULE_NAME}/HallSimParam.h -) - -Set(LINKDEF src/PassiveLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME passive_detector_bucket) - -O2_GENERATE_LIBRARY() +# FIXME: if PutFrameInTop really depends on TRD, then the following can not work +# as TRD is built afterwards. So we have a dependency problem here potentially. +# o2_add_test_root_macro(FILENAME "macro/PutFrameInTop.C" PUBLIC_LINK_LIBRARIES +# DetectorsPassive FairRoot::Base TRDSimulation) diff --git a/Detectors/TOF/CMakeLists.txt b/Detectors/TOF/CMakeLists.txt index 7153b888b9502..16c5cffaae06c 100644 --- a/Detectors/TOF/CMakeLists.txt +++ b/Detectors/TOF/CMakeLists.txt @@ -1,4 +1,16 @@ -# Libraries +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(base) add_subdirectory(simulation) add_subdirectory(reconstruction) +if(BUILD_TESTING) + add_subdirectory(prototyping) +endif() diff --git a/Detectors/TOF/base/CMakeLists.txt b/Detectors/TOF/base/CMakeLists.txt index e761ded3f0cc0..d19a9ac662539 100644 --- a/Detectors/TOF/base/CMakeLists.txt +++ b/Detectors/TOF/base/CMakeLists.txt @@ -1,29 +1,22 @@ -SET(MODULE_NAME TOFBase) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(TOFBase + SOURCES src/Geo.cxx src/Digit.cxx + PUBLIC_LINK_LIBRARIES Boost::serialization FairRoot::Base + O2::DetectorsBase) -set(SRCS - src/Geo.cxx - src/Digit.cxx -) +o2_target_root_dictionary(TOFBase + HEADERS include/TOFBase/Geo.h include/TOFBase/Digit.h) -set(HEADERS - include/${MODULE_NAME}/Geo.h - include/${MODULE_NAME}/Digit.h -) - -SET(LINKDEF src/TOFBaseLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME tof_base_bucket) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testTOFIndex.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +o2_add_test(TOFIndex + SOURCES test/testTOFIndex.cxx + COMPONENT_NAME TOF + PUBLIC_LINK_LIBRARIES O2::TOFBase) diff --git a/Detectors/TOF/prototyping/CMakeLists.txt b/Detectors/TOF/prototyping/CMakeLists.txt new file mode 100644 index 0000000000000..fcb071eb1c19f --- /dev/null +++ b/Detectors/TOF/prototyping/CMakeLists.txt @@ -0,0 +1,40 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_test_root_macro(checkRotation.C + PUBLIC_LINK_LIBRARIES O2::TOFBase + LABELS tof) + +o2_add_test_root_macro(convertTreeTo02object.C + PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats + LABELS tof) + +o2_add_test_root_macro(drawTOFgeometry.C + PUBLIC_LINK_LIBRARIES O2::DetectorsPassive + O2::TOFSimulation + LABELS tof) + +o2_add_test_root_macro(findLabels.C + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat + O2::ReconstructionDataFormats + O2::DataFormatsTPC + O2::DataFormatsITS + O2::DataFormatsTOF + O2::TOFBase + LABELS tof) + +o2_add_test_root_macro(findTOFclusterFromLabel.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsTOF + O2::SimulationDataFormat + O2::DataFormatsTPC + O2::ReconstructionDataFormats + O2::CommonDataFormat + O2::TOFBase + LABELS tof) diff --git a/Detectors/TOF/reconstruction/CMakeLists.txt b/Detectors/TOF/reconstruction/CMakeLists.txt index 31df0c45160e5..0528a13b32576 100644 --- a/Detectors/TOF/reconstruction/CMakeLists.txt +++ b/Detectors/TOF/reconstruction/CMakeLists.txt @@ -1,21 +1,20 @@ -SET(MODULE_NAME TOFReconstruction) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(TOFReconstruction + SOURCES src/DataReader.cxx src/Clusterer.cxx + src/ClustererTask.cxx + PUBLIC_LINK_LIBRARIES O2::TOFBase O2::DataFormatsTOF + O2::SimulationDataFormat) -set(SRCS - src/DataReader.cxx - src/Clusterer.cxx - src/ClustererTask.cxx -) - -set(HEADERS - include/TOFReconstruction/DataReader.h - include/TOFReconstruction/Clusterer.h - include/TOFReconstruction/ClustererTask.h -) - -SET(LINKDEF src/TOFReconstructionLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME tof_reconstruction_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(TOFReconstruction + HEADERS include/TOFReconstruction/DataReader.h + include/TOFReconstruction/Clusterer.h + include/TOFReconstruction/ClustererTask.h) diff --git a/Detectors/TOF/simulation/CMakeLists.txt b/Detectors/TOF/simulation/CMakeLists.txt index 6a07a5e63f393..090468946e6f5 100644 --- a/Detectors/TOF/simulation/CMakeLists.txt +++ b/Detectors/TOF/simulation/CMakeLists.txt @@ -1,23 +1,21 @@ -SET(MODULE_NAME TOFSimulation) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(TOFSimulation + SOURCES src/Detector.cxx src/Digitizer.cxx src/DigitizerTask.cxx + src/Strip.cxx + PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2::TOFBase + O2::SimulationDataFormat) -set(SRCS - src/Detector.cxx - src/Digitizer.cxx - src/DigitizerTask.cxx - src/Strip.cxx -) - -set(HEADERS - include/TOFSimulation/Detector.h - include/TOFSimulation/Digitizer.h - include/TOFSimulation/DigitizerTask.h - include/TOFSimulation/Strip.h -) - -SET(LINKDEF src/TOFSimulationLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME tof_simulation_bucket) - -O2_GENERATE_LIBRARY() +o2_target_root_dictionary(TOFSimulation + HEADERS include/TOFSimulation/Detector.h + include/TOFSimulation/Digitizer.h + include/TOFSimulation/DigitizerTask.h + include/TOFSimulation/Strip.h) diff --git a/Detectors/TPC/CMakeLists.txt b/Detectors/TPC/CMakeLists.txt index 4d964b45f9765..0aa5ae3f912d9 100644 --- a/Detectors/TPC/CMakeLists.txt +++ b/Detectors/TPC/CMakeLists.txt @@ -1,22 +1,16 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -# Libraries add_subdirectory(base) add_subdirectory(reconstruction) -add_subdirectory(simulation) add_subdirectory(calibration) +add_subdirectory(simulation) add_subdirectory(monitor) add_subdirectory(workflow) diff --git a/Detectors/TPC/base/CMakeLists.txt b/Detectors/TPC/base/CMakeLists.txt index 2ada740a7ac99..f79f79eea4c8e 100644 --- a/Detectors/TPC/base/CMakeLists.txt +++ b/Detectors/TPC/base/CMakeLists.txt @@ -1,82 +1,98 @@ -set(MODULE_NAME "TPCBase") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(TPCBase + SOURCES src/CalArray.cxx + src/CalDet.cxx + src/CDBInterface.cxx + src/ContainerFactory.cxx + src/CRU.cxx + src/Digit.cxx + src/DigitPos.cxx + src/ModelGEM.cxx + src/FECInfo.cxx + src/Mapper.cxx + src/PadInfo.cxx + src/PadPos.cxx + src/PadRegionInfo.cxx + src/PadROCPos.cxx + src/PadSecPos.cxx + src/Painter.cxx + src/ParameterDetector.cxx + src/ParameterElectronics.cxx + src/ParameterGas.cxx + src/ParameterGEM.cxx + src/PartitionInfo.cxx + src/RandomRing.cxx + src/ROC.cxx + src/Sector.cxx + PUBLIC_LINK_LIBRARIES Vc::Vc Boost::boost O2::DataFormatsTPC + O2::CCDB FairRoot::Base) -set(SRCS - src/CalArray.cxx - src/CalDet.cxx - src/CDBInterface.cxx - src/ContainerFactory.cxx - src/CRU.cxx - src/Digit.cxx - src/DigitPos.cxx - src/ModelGEM.cxx - src/FECInfo.cxx - src/Mapper.cxx - src/PadInfo.cxx - src/PadPos.cxx - src/PadRegionInfo.cxx - src/PadROCPos.cxx - src/PadSecPos.cxx - src/Painter.cxx - src/ParameterDetector.cxx - src/ParameterElectronics.cxx - src/ParameterGas.cxx - src/ParameterGEM.cxx - src/PartitionInfo.cxx - src/RandomRing.cxx - src/ROC.cxx - src/Sector.cxx -) +o2_target_root_dictionary(TPCBase + HEADERS include/TPCBase/CalArray.h + include/TPCBase/CalDet.h + include/TPCBase/CDBInterface.h + include/TPCBase/ContainerFactory.h + include/TPCBase/CRU.h + include/TPCBase/Digit.h + include/TPCBase/DigitPos.h + include/TPCBase/ModelGEM.h + include/TPCBase/FECInfo.h + include/TPCBase/Mapper.h + include/TPCBase/PadInfo.h + include/TPCBase/PadPos.h + include/TPCBase/PadRegionInfo.h + include/TPCBase/PadROCPos.h + include/TPCBase/PadSecPos.h + include/TPCBase/Painter.h + include/TPCBase/ParameterDetector.h + include/TPCBase/ParameterElectronics.h + include/TPCBase/ParameterGas.h + include/TPCBase/ParameterGEM.h + include/TPCBase/PartitionInfo.h + include/TPCBase/RandomRing.h + include/TPCBase/ROC.h + include/TPCBase/Sector.h) -set(HEADERS - include/TPCBase/CalArray.h - include/TPCBase/CalDet.h - include/TPCBase/CDBInterface.h - include/TPCBase/ContainerFactory.h - include/TPCBase/CRU.h - include/TPCBase/Digit.h - include/TPCBase/DigitPos.h - include/TPCBase/ModelGEM.h - include/TPCBase/FECInfo.h - include/TPCBase/Mapper.h - include/TPCBase/PadInfo.h - include/TPCBase/PadPos.h - include/TPCBase/PadRegionInfo.h - include/TPCBase/PadROCPos.h - include/TPCBase/PadSecPos.h - include/TPCBase/Painter.h - include/TPCBase/ParameterDetector.h - include/TPCBase/ParameterElectronics.h - include/TPCBase/ParameterGas.h - include/TPCBase/ParameterGEM.h - include/TPCBase/PartitionInfo.h - include/TPCBase/RandomRing.h - include/TPCBase/ROC.h - include/TPCBase/Sector.h -) +o2_add_test(Base + COMPONENT_NAME tpc + PUBLIC_LINK_LIBRARIES O2::TPCBase + SOURCES test/testTPCBase.cxx + LABELS tpc) -Set(LINKDEF src/TPCBaseLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME tpc_base_bucket) +o2_add_test(CalDet + COMPONENT_NAME tpc + PUBLIC_LINK_LIBRARIES O2::TPCBase + SOURCES test/testTPCCalDet.cxx + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage + LABELS tpc) -O2_GENERATE_LIBRARY() +o2_add_test(Mapper + COMPONENT_NAME tpc + PUBLIC_LINK_LIBRARIES O2::TPCBase + SOURCES test/testTPCMapper.cxx + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage + LABELS tpc) -set(TEST_SRCS - test/testTPCBase.cxx - test/testTPCCalDet.cxx - test/testTPCMapper.cxx - test/testTPCParameters.cxx - test/testTPCCDBInterface.cxx -) +o2_add_test(Parameters + COMPONENT_NAME tpc + PUBLIC_LINK_LIBRARIES O2::TPCBase + SOURCES test/testTPCParameters.cxx + LABELS tpc) -O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - MODULE_LIBRARY_NAME ${MODULE_NAME} - TEST_SRCS ${TEST_SRCS} -) +o2_add_test(CCDBInterface + COMPONENT_NAME tpc + PUBLIC_LINK_LIBRARIES O2::TPCBase + SOURCES test/testTPCCDBInterface.cxx + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage + LABELS tpc) -install( - DIRECTORY files - DESTINATION share/Detectors/TPC/ -) +o2_data_file(COPY files DESTINATION Detectors/TPC) diff --git a/Detectors/TPC/base/src/Mapper.cxx b/Detectors/TPC/base/src/Mapper.cxx index ca5a4b7481b52..596d6a055aec3 100644 --- a/Detectors/TPC/base/src/Mapper.cxx +++ b/Detectors/TPC/base/src/Mapper.cxx @@ -21,9 +21,11 @@ // using boost::format; #include "TPCBase/Mapper.h" -namespace o2 { -namespace tpc { - constexpr std::array Mapper::SinsPerSector/*{{ +namespace o2 +{ +namespace tpc +{ +constexpr std::array Mapper::SinsPerSector /*{{ 0, 0.3420201433256687129080830800376133993268, 0.6427876096865392518964199553010985255241, @@ -42,11 +44,12 @@ namespace tpc { -0.8660254037844385965883020617184229195118, -0.6427876096865395849633273428480606526136, -0.3420201433256686018857806175219593569636 - }}*/; + }}*/ + ; - // static constexpr std::array test{1,2}; +// static constexpr std::array test{1,2}; - constexpr std::array Mapper::CosinsPerSector/*{{ +constexpr std::array Mapper::CosinsPerSector /*{{ 1, 0.9396926207859084279050421173451468348503, 0.7660444431189780134516809084743726998568, @@ -65,13 +68,14 @@ namespace tpc { 0.5000000000000001110223024625156540423632, 0.7660444431189777914070759834430646151304, 0.9396926207859084279050421173451468348503 - }}*/; + }}*/ + ; Mapper::Mapper(const std::string& mappingDir) : mMapGlobalPadToPadPos(mPadsInSector), mMapGlobalPadCentre(mPadsInSector), mMapPadPosGlobalPad(), - mMapFECIDGlobalPad(FECInfo::globalSAMPAId(91,0,0)), + mMapFECIDGlobalPad(FECInfo::globalSAMPAId(91, 0, 0)), mMapGlobalPadFECInfo(mPadsInSector), mMapPadRegionInfo(), mMapPartitionInfo() @@ -101,8 +105,8 @@ bool Mapper::readMappingFile(std::string file) GlobalPadNumber padIndex; unsigned int padRow; unsigned int pad; - float xPos; - float yPos; + float xPos; + float yPos; // pad plane info unsigned int connector; @@ -117,65 +121,58 @@ bool Mapper::readMappingFile(std::string file) unsigned int sampaChip; unsigned int sampaChannel; - std::string line; + std::string line; std::ifstream infile(file, std::ifstream::in); + if (!infile.is_open()) { + std::cout << "could not open file " << file << "\n"; + exit(1); + } while (std::getline(infile, line)) { std::stringstream streamLine(line); streamLine // pad info - >> padIndex - >> padRow - >> pad - >> xPos - >> yPos + >> padIndex >> padRow >> pad >> xPos >> yPos // pad plane info - >> connector - >> pin - >> partion - >> region + >> connector >> pin >> partion >> region // FEC info - >> fecIndex - >> fecConnector - >> fecChannel - >> sampaChip - >> sampaChannel; - - // the x and y positions are in mm - // in the mapping files, the values are given for sector C04 in the global ALICE coordinate system - // however, we need it in the local tracking system. Therefore: - const float localX=yPos/10.f; - const float localY=-xPos/10.f; - // with the pad counting (looking to C-Side pad 0,0 is bottom left -- pad-side front view) - // these values are for the C-Side - // For the A-Side the localY position must be mirrored - - mMapGlobalPadToPadPos[padIndex] = PadPos(padRow,pad); - mMapPadPosGlobalPad[PadPos(padRow,pad)] = padIndex; - mMapGlobalPadFECInfo[padIndex] = FECInfo(fecIndex, /*fecConnector, fecChannel,*/ sampaChip, sampaChannel); - mMapFECIDGlobalPad[FECInfo::globalSAMPAId(fecIndex, sampaChip, sampaChannel)] = padIndex; - mMapGlobalPadCentre[padIndex] = PadCentre(localX, localY); - - //std::cout - //<< padIndex<< " " - //<< padRow<< " " - //<< pad<< " " - //<< xPos<< " " - //<< yPos<< " " - //<< " " - //// pad plane info<< " " - //<< connector<< " " - //<< pin<< " " - //<< partion<< " " - //<< region<< " " - //<< " " - //// FEC info<< " " - //<< fecIndex<< " " - //<< fecConnector<< " " - //<< fecChannel<< " " - //<< sampaChip<< " " - //<< sampaChannel << std::endl; + >> fecIndex >> fecConnector >> fecChannel >> sampaChip >> sampaChannel; + + // the x and y positions are in mm + // in the mapping files, the values are given for sector C04 in the global ALICE coordinate system + // however, we need it in the local tracking system. Therefore: + const float localX = yPos / 10.f; + const float localY = -xPos / 10.f; + // with the pad counting (looking to C-Side pad 0,0 is bottom left -- pad-side front view) + // these values are for the C-Side + // For the A-Side the localY position must be mirrored + + mMapGlobalPadToPadPos[padIndex] = PadPos(padRow, pad); + mMapPadPosGlobalPad[PadPos(padRow, pad)] = padIndex; + mMapGlobalPadFECInfo[padIndex] = FECInfo(fecIndex, /*fecConnector, fecChannel,*/ sampaChip, sampaChannel); + mMapFECIDGlobalPad[FECInfo::globalSAMPAId(fecIndex, sampaChip, sampaChannel)] = padIndex; + mMapGlobalPadCentre[padIndex] = PadCentre(localX, localY); + + //std::cout + //<< padIndex<< " " + //<< padRow<< " " + //<< pad<< " " + //<< xPos<< " " + //<< yPos<< " " + //<< " " + //// pad plane info<< " " + //<< connector<< " " + //<< pin<< " " + //<< partion<< " " + //<< region<< " " + //<< " " + //// FEC info<< " " + //<< fecIndex<< " " + //<< fecConnector<< " " + //<< fecChannel<< " " + //<< sampaChip<< " " + //<< sampaChannel << std::endl; } return true; } @@ -183,8 +180,8 @@ bool Mapper::readMappingFile(std::string file) void Mapper::load(const std::string& mappingDir) { -// std::string inputDir(std::getenv("ALICEO2")); - std::string inputDir=mappingDir; + // std::string inputDir(std::getenv("ALICEO2")); + std::string inputDir = mappingDir; if (!inputDir.size()) { //const char* aliceO2env=std::getenv("ALICEO2"); //if (aliceO2env) inputDir=aliceO2env; @@ -193,14 +190,15 @@ void Mapper::load(const std::string& mappingDir) //readMappingFile(inputDir+"/Detectors/TPC/base/files/TABLE-OROC2.txt"); //readMappingFile(inputDir+"/Detectors/TPC/base/files/TABLE-OROC3.txt"); - const char* aliceO2env=std::getenv("O2_ROOT"); - if (aliceO2env) inputDir=aliceO2env; - inputDir+="/share/Detectors/TPC/files"; + const char* aliceO2env = std::getenv("O2_ROOT"); + if (aliceO2env) + inputDir = aliceO2env; + inputDir += "/share/Detectors/TPC/files"; } - readMappingFile(inputDir+"/TABLE-IROC.txt"); - readMappingFile(inputDir+"/TABLE-OROC1.txt"); - readMappingFile(inputDir+"/TABLE-OROC2.txt"); - readMappingFile(inputDir+"/TABLE-OROC3.txt"); + readMappingFile(inputDir + "/TABLE-IROC.txt"); + readMappingFile(inputDir + "/TABLE-OROC1.txt"); + readMappingFile(inputDir + "/TABLE-OROC2.txt"); + readMappingFile(inputDir + "/TABLE-OROC3.txt"); initPadRegionsAndPartitions(); } @@ -209,28 +207,28 @@ void Mapper::initPadRegionsAndPartitions() { // original values for pad widht and height and pad row position are in mm // the ALICE coordinate system is in cm - mMapPadRegionInfo[0]=PadRegionInfo(0, 0, 17, 7.5/10., 4.16/10., 848.5/10., 0, 33.20, 0); - mMapPadRegionInfo[1]=PadRegionInfo(0, 1, 15, 7.5/10., 4.20/10., 976.0/10., 17, 33.00, 17); - mMapPadRegionInfo[2]=PadRegionInfo(1, 2, 16, 7.5/10., 4.20/10., 1088.5/10., 32, 33.08, 32); - mMapPadRegionInfo[3]=PadRegionInfo(1, 3, 15, 7.5/10., 4.36/10., 1208.5/10., 48, 31.83, 48); - mMapPadRegionInfo[4]=PadRegionInfo(2, 4, 18, 10/10. , 6.00/10., 1347.0/10., 0, 38.00, 63); - mMapPadRegionInfo[5]=PadRegionInfo(2, 5, 16, 10/10. , 6.00/10., 1527.0/10., 18, 38.00, 81); - mMapPadRegionInfo[6]=PadRegionInfo(3, 6, 16, 12/10. , 6.08/10., 1708.0/10., 0, 47.90, 97); - mMapPadRegionInfo[7]=PadRegionInfo(3, 7, 14, 12/10. , 5.88/10., 1900.0/10., 16, 49.55, 113); - mMapPadRegionInfo[8]=PadRegionInfo(4, 8, 13, 15/10. , 6.04/10., 2089.0/10., 0, 59.39, 127); - mMapPadRegionInfo[9]=PadRegionInfo(4, 9, 12, 15/10. , 6.07/10., 2284.0/10., 0, 64.70, 140); - - mMapPartitionInfo[0]=PartitionInfo(15, 0 , 32, 0 , 2400 ); - mMapPartitionInfo[1]=PartitionInfo(18, 15 , 31, 32 , 2880 ); - mMapPartitionInfo[2]=PartitionInfo(18, 15+18 , 34, 32+31 , 2880 ); - mMapPartitionInfo[3]=PartitionInfo(20, 15+18+18 , 30, 32+31+34 , 3200 ); - mMapPartitionInfo[4]=PartitionInfo(20, 15+18+18+20, 25, 32+31+34+30, 3200 ); - - int globalRow=0; - int padsInRow=0; - int padOffset=0; + mMapPadRegionInfo[0] = PadRegionInfo(0, 0, 17, 7.5 / 10., 4.16 / 10., 848.5 / 10., 0, 33.20, 0); + mMapPadRegionInfo[1] = PadRegionInfo(0, 1, 15, 7.5 / 10., 4.20 / 10., 976.0 / 10., 17, 33.00, 17); + mMapPadRegionInfo[2] = PadRegionInfo(1, 2, 16, 7.5 / 10., 4.20 / 10., 1088.5 / 10., 32, 33.08, 32); + mMapPadRegionInfo[3] = PadRegionInfo(1, 3, 15, 7.5 / 10., 4.36 / 10., 1208.5 / 10., 48, 31.83, 48); + mMapPadRegionInfo[4] = PadRegionInfo(2, 4, 18, 10 / 10., 6.00 / 10., 1347.0 / 10., 0, 38.00, 63); + mMapPadRegionInfo[5] = PadRegionInfo(2, 5, 16, 10 / 10., 6.00 / 10., 1527.0 / 10., 18, 38.00, 81); + mMapPadRegionInfo[6] = PadRegionInfo(3, 6, 16, 12 / 10., 6.08 / 10., 1708.0 / 10., 0, 47.90, 97); + mMapPadRegionInfo[7] = PadRegionInfo(3, 7, 14, 12 / 10., 5.88 / 10., 1900.0 / 10., 16, 49.55, 113); + mMapPadRegionInfo[8] = PadRegionInfo(4, 8, 13, 15 / 10., 6.04 / 10., 2089.0 / 10., 0, 59.39, 127); + mMapPadRegionInfo[9] = PadRegionInfo(4, 9, 12, 15 / 10., 6.07 / 10., 2284.0 / 10., 0, 64.70, 140); + + mMapPartitionInfo[0] = PartitionInfo(15, 0, 32, 0, 2400); + mMapPartitionInfo[1] = PartitionInfo(18, 15, 31, 32, 2880); + mMapPartitionInfo[2] = PartitionInfo(18, 15 + 18, 34, 32 + 31, 2880); + mMapPartitionInfo[3] = PartitionInfo(20, 15 + 18 + 18, 30, 32 + 31 + 34, 3200); + mMapPartitionInfo[4] = PartitionInfo(20, 15 + 18 + 18 + 20, 25, 32 + 31 + 34 + 30, 3200); + + int globalRow = 0; + int padsInRow = 0; + int padOffset = 0; for (const auto& reg : mMapPadRegionInfo) { - for (int row=0; row @@ -116,8 +115,8 @@ class Digitizer Sector mSector = -1; ///< ID of the currently processed sector float mEventTime = 0.f; ///< Time of the currently processed event // FIXME: whats the reason for hving this static? - static bool mIsContinuous; ///< Switch for continuous readout - bool mUseSCDistortions = false; ///< Flag to switch on the use of space-charge distortions + static bool mIsContinuous; ///< Switch for continuous readout + bool mUseSCDistortions = false; ///< Flag to switch on the use of space-charge distortions ClassDefNV(Digitizer, 1); }; diff --git a/Detectors/TPC/simulation/test/CMakeLists.txt b/Detectors/TPC/simulation/test/CMakeLists.txt index 4cacd5c2d53c3..50891e6317a3b 100644 --- a/Detectors/TPC/simulation/test/CMakeLists.txt +++ b/Detectors/TPC/simulation/test/CMakeLists.txt @@ -1,16 +1,60 @@ -set(MODULE_NAME "TPCTest") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_test(DigitContainer + LABELS tpc + PUBLIC_LINK_LIBRARIES O2::TPCSimulation + COMPONENT_NAME tpc + SOURCES testTPCDigitContainer.cxx + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage) -link_directories( ${LINK_DIRECTORIES}) +o2_add_test(ElectronTransport + LABELS tpc + PUBLIC_LINK_LIBRARIES O2::TPCSimulation + COMPONENT_NAME tpc + SOURCES testTPCElectronTransport.cxx) -set(SRCS -) +o2_add_test(GEMAmplification + LABELS tpc + PUBLIC_LINK_LIBRARIES O2::TPCSimulation + COMPONENT_NAME tpc + SOURCES testTPCGEMAmplification.cxx + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage + TIMEOUT 200 + LABELS long) -set(HEADERS -) -Set(LINKDEF src/TPCSimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME tpc_simulation_bucket) +o2_add_test(SAMPAProcessing + LABELS tpc + PUBLIC_LINK_LIBRARIES O2::TPCSimulation + COMPONENT_NAME tpc + SOURCES testTPCSAMPAProcessing.cxx + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage) -O2_GENERATE_LIBRARY() +o2_add_test(Simulation + LABELS tpc + PUBLIC_LINK_LIBRARIES O2::TPCSimulation + COMPONENT_NAME tpc + SOURCES testTPCSimulation.cxx) + +# * # add the TPC run sim as a unit test (if simulation was enabled) +# * if (BUILD_SIMULATION) +# * add_test_wrap(NAME tpcsim_G4 COMMAND ${CMAKE_BINARY_DIR}/bin/o2-sim-tpc -n 2 +# -e TGeant4) +# * set_tests_properties(tpcsim_G4 PROPERTIES PASS_REGULAR_EXPRESSION "Macro +# finished succesfully") +# * add_test_wrap(NAME tpcsim_G3 COMMAND ${CMAKE_BINARY_DIR}/bin/o2-sim-tpc -n 2 +# -e TGeant3) +# * set_tests_properties(tpcsim_G3 PROPERTIES PASS_REGULAR_EXPRESSION "Macro +# finished succesfully") +# * # sets the necessary environment +# * set_tests_properties(tpcsim_G3 tpcsim_G4 PROPERTIES ENVIRONMENT +# VMCWORKDIR=${CMAKE_SOURCE_DIR}) +# * endif() +# diff --git a/Detectors/TPC/workflow/CMakeLists.txt b/Detectors/TPC/workflow/CMakeLists.txt index ae59cc1c53341..0567867433a01 100644 --- a/Detectors/TPC/workflow/CMakeLists.txt +++ b/Detectors/TPC/workflow/CMakeLists.txt @@ -1,55 +1,31 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See http://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. - -set(MODULE_NAME "TPCWorkflow") -set(MODULE_BUCKET_NAME TPC_workflow_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) -set(SRCS - src/RecoWorkflow.cxx - src/PublisherSpec.cxx - src/ClustererSpec.cxx - src/ClusterDecoderRawSpec.cxx - src/CATrackerSpec.cxx - # - src/TrackReaderSpec.cxx - ) - -if (OPENGL_FOUND AND GLFW_FOUND AND GLEW_FOUND AND OPENGL_GLU_FOUND AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") - add_definitions(-DBUILD_EVENT_DISPLAY) -endif() - -## TODO: feature of macro, it deletes the variables we pass to it, set them again -## this has to be fixed in the macro implementation -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -O2_GENERATE_EXECUTABLE( - EXE_NAME o2-tpc-reco-workflow - - SOURCES - src/tpc-reco-workflow.cxx - - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) - -set(TEST_SRCS - test/test_TPCWorkflow.cxx - ) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} - TIMEOUT 60 -) +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# FIXME: do we really need a library here ? Is the exe not enough ? +o2_add_library(TPCWorkflow + SOURCES src/RecoWorkflow.cxx + src/PublisherSpec.cxx + src/ClustererSpec.cxx + src/ClusterDecoderRawSpec.cxx + src/CATrackerSpec.cxx + src/TrackReaderSpec.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsTPC + O2::DPLUtils O2::TPCReconstruction) + +o2_add_executable(reco-workflow + COMPONENT_NAME tpc + SOURCES src/tpc-reco-workflow.cxx + PUBLIC_LINK_LIBRARIES O2::TPCWorkflow) + +o2_add_test(workflow + COMPONENT_NAME tpc + LABELS tpc workflow + SOURCES test/test_TPCWorkflow.cxx + PUBLIC_LINK_LIBRARIES O2::TPCWorkflow) diff --git a/Detectors/TRD/CMakeLists.txt b/Detectors/TRD/CMakeLists.txt index 2cf472045094f..46b43743c005e 100644 --- a/Detectors/TRD/CMakeLists.txt +++ b/Detectors/TRD/CMakeLists.txt @@ -1,2 +1,12 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(base) add_subdirectory(simulation) diff --git a/Detectors/TRD/base/CMakeLists.txt b/Detectors/TRD/base/CMakeLists.txt index 7f7452f9c4af1..9e46938423f9f 100644 --- a/Detectors/TRD/base/CMakeLists.txt +++ b/Detectors/TRD/base/CMakeLists.txt @@ -1,54 +1,53 @@ -SET(MODULE_NAME TRDBase) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(TRDBase + SOURCES src/TRDPadPlane.cxx + src/TRDGeometryBase.cxx + src/TRDGeometry.cxx + src/TRDGeometryFlat.cxx + src/TRDCommonParam.cxx + src/TRDSimParam.cxx + src/PadResponse.cxx + src/Digit.cxx + src/TRDCalPadStatus.cxx + src/TRDCalSingleChamberStatus.cxx + src/CalDet.cxx + src/CalROC.cxx + src/TRDFeeParam.cxx + src/LTUParam.cxx + PUBLIC_LINK_LIBRARIES O2::GPUCommon + O2::DetectorsCommonDataFormats + O2::Field + O2::DetectorsBase + ROOT::Physics + O2::SimulationDataFormat) -SET(SRCS - src/TRDPadPlane.cxx - src/TRDGeometryBase.cxx - src/TRDGeometry.cxx - src/TRDGeometryFlat.cxx - src/TRDCommonParam.cxx - src/TRDSimParam.cxx - src/PadResponse.cxx - src/Digit.cxx - src/TRDCalPadStatus.cxx - src/TRDCalSingleChamberStatus.cxx - src/CalDet.cxx - src/CalROC.cxx - src/TRDFeeParam.cxx - src/LTUParam.cxx -) +o2_target_root_dictionary(TRDBase + HEADERS include/TRDBase/TRDPadPlane.h + include/TRDBase/TRDGeometryBase.h + include/TRDBase/TRDGeometry.h + include/TRDBase/TRDGeometryFlat.h + include/TRDBase/TRDSimParam.h + include/TRDBase/TRDCommonParam.h + include/TRDBase/PadResponse.h + include/TRDBase/Digit.h + include/TRDBase/MCLabel.h + include/TRDBase/CalDet.h + include/TRDBase/CalROC.h + include/TRDBase/TRDFeeParam.h + include/TRDBase/LTUParam.h) -SET(HEADERS - include/${MODULE_NAME}/TRDPadPlane.h - include/${MODULE_NAME}/TRDGeometryBase.h - include/${MODULE_NAME}/TRDGeometry.h - include/${MODULE_NAME}/TRDGeometryFlat.h - include/${MODULE_NAME}/TRDSimParam.h - include/${MODULE_NAME}/TRDCommonParam.h - include/${MODULE_NAME}/PadResponse.h - include/${MODULE_NAME}/Digit.h - include/${MODULE_NAME}/MCLabel.h - include/${MODULE_NAME}/TRDCalPadStatus.h - include/${MODULE_NAME}/TRDCalSingleChamberStatus.h - include/${MODULE_NAME}/CalDet.h - include/${MODULE_NAME}/CalROC.h - include/${MODULE_NAME}/TRDFeeParam.h - include/${MODULE_NAME}/LTUParam.h -) - -SET(LINKDEF src/TRDBaseLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME trd_base_bucket) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testTRDDiffusionCoefficient.cxx -) - -O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - MODULE_LIBRARY_NAME ${MODULE_NAME} - TEST_SRCS ${TEST_SRCS} -) +o2_add_test(DiffusionCoefficient + SOURCES test/testTRDDiffusionCoefficient.cxx + COMPONENT_NAME trd + PUBLIC_LINK_LIBRARIES O2::TRDBase + ENVIRONMENT VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/share + LABELS trd) diff --git a/Detectors/TRD/simulation/CMakeLists.txt b/Detectors/TRD/simulation/CMakeLists.txt index 16e1f31b1c250..8f8e24de809af 100644 --- a/Detectors/TRD/simulation/CMakeLists.txt +++ b/Detectors/TRD/simulation/CMakeLists.txt @@ -1,22 +1,21 @@ -SET(MODULE_NAME TRDSimulation) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(TRDSimulation + SOURCES src/Detector.cxx src/TRsim.cxx src/Digitizer.cxx + PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2::SimulationDataFormat + O2::TRDBase) -SET(SRCS - src/Detector.cxx - src/TRsim.cxx - src/Digitizer.cxx -) -SET(HEADERS - include/${MODULE_NAME}/Detector.h - include/${MODULE_NAME}/TRsim.h - include/${MODULE_NAME}/Digitizer.h -) +o2_target_root_dictionary(TRDSimulation + HEADERS include/TRDSimulation/Detector.h + include/TRDSimulation/TRsim.h + include/TRDSimulation/Digitizer.h) -SET(LINKDEF src/TRDSimulationLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME trd_simulation_bucket) - -O2_GENERATE_LIBRARY() - -INSTALL(DIRECTORY data DESTINATION share/Detectors/TRD/simulation) +o2_data_file(COPY data DESTINATION Detectors/TRD/simulation) diff --git a/Detectors/ZDC/CMakeLists.txt b/Detectors/ZDC/CMakeLists.txt index d5355745196a1..46b43743c005e 100644 --- a/Detectors/ZDC/CMakeLists.txt +++ b/Detectors/ZDC/CMakeLists.txt @@ -1,3 +1,12 @@ -# Libraries +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + add_subdirectory(base) add_subdirectory(simulation) diff --git a/Detectors/ZDC/base/CMakeLists.txt b/Detectors/ZDC/base/CMakeLists.txt index af12a9d90c2a3..b37dadb832cd6 100644 --- a/Detectors/ZDC/base/CMakeLists.txt +++ b/Detectors/ZDC/base/CMakeLists.txt @@ -1,17 +1,15 @@ -SET(MODULE_NAME ZDCBase) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Geometry.cxx -) - -set(HEADERS - include/${MODULE_NAME}/Geometry.h -) - -SET(LINKDEF src/ZDCBaseLinkDef.h) -SET(LIBRARY_NAME ${MODULE_NAME}) -SET(BUCKET_NAME zdc_base_bucket) - -O2_GENERATE_LIBRARY() +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(ZDCBase + SOURCES src/Geometry.cxx + PUBLIC_LINK_LIBRARIES ROOT::MathCore FairRoot::Base) + +o2_target_root_dictionary(ZDCBase HEADERS include/ZDCBase/Geometry.h) diff --git a/Detectors/ZDC/simulation/CMakeLists.txt b/Detectors/ZDC/simulation/CMakeLists.txt index ad27885190e42..589a4fc1253a8 100644 --- a/Detectors/ZDC/simulation/CMakeLists.txt +++ b/Detectors/ZDC/simulation/CMakeLists.txt @@ -1,23 +1,21 @@ -set(MODULE_NAME "ZDCSimulation") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(ZDCSimulation + SOURCES src/Detector.cxx src/Digitizer.cxx + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase) -set(SRCS - src/Detector.cxx - src/Digitizer.cxx - src/Digit.cxx - ) -set(HEADERS - include/${MODULE_NAME}/Hit.h - include/${MODULE_NAME}/Digit.h - include/${MODULE_NAME}/Digitizer.h - include/${MODULE_NAME}/Detector.h - ) +o2_target_root_dictionary(ZDCSimulation + HEADERS include/ZDCSimulation/Hit.h + include/ZDCSimulation/Digit.h + include/ZDCSimulation/Digitizer.h + include/ZDCSimulation/Detector.h) -Set(LINKDEF src/ZDCSimulationLinkDef.h) -Set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME zdc_simulation_bucket) - -O2_GENERATE_LIBRARY() - -INSTALL(DIRECTORY data DESTINATION share/Detectors/ZDC/simulation) +o2_data_file(COPY data DESTINATION Detectors/ZDC/simulation) diff --git a/Detectors/gconfig/CMakeLists.txt b/Detectors/gconfig/CMakeLists.txt index b7473d4e0aae6..7ed49ea5cf737 100644 --- a/Detectors/gconfig/CMakeLists.txt +++ b/Detectors/gconfig/CMakeLists.txt @@ -1,21 +1,50 @@ -set(MODULE_NAME "SimSetup") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_library(SimSetup + SOURCES src/G3Config.cxx src/G4Config.cxx + src/GlobalProcessCutSimParam.cxx src/SimSetup.cxx + PUBLIC_LINK_LIBRARIES geant321 + geant4vmc + geant4 + O2::SimulationDataFormat + O2::DetectorsPassive + pythia6 # this is needed by Geant3 and + # EGPythia6 + ROOT::EGPythia6 # this is needed by Geant4 + # (TPythia6Decayer) + ) -set(SRCS - src/G3Config.cxx - src/G4Config.cxx - src/SimSetup.cxx - src/GlobalProcessCutSimParam.cxx - ) +o2_target_root_dictionary(SimSetup + HEADERS include/SimSetup/SimSetup.h + include/SimSetup/GlobalProcessCutSimParam.h + LINKDEF src/GConfLinkDef.h) -set(HEADERS - include/${MODULE_NAME}/SimSetup.h - include/${MODULE_NAME}/GlobalProcessCutSimParam.h - ) +o2_add_test_root_macro(DecayConfig.C + PUBLIC_LINK_LIBRARIES O2::SimSetup + LABELS simsetup) -Set(LINKDEF src/GConfLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME simulation_setup_bucket) +o2_add_test_root_macro(UserDecay.C + PUBLIC_LINK_LIBRARIES O2::SimSetup + LABELS simsetup) -O2_GENERATE_LIBRARY() +o2_add_test_root_macro(commonConfig.C + PUBLIC_LINK_LIBRARIES O2::SimSetup + LABELS simsetup) + +o2_add_test_root_macro(g3libs.C LABELS simsetup) + +o2_add_test_root_macro(g3Config.C + PUBLIC_LINK_LIBRARIES O2::SimSetup + LABELS simsetup) + +o2_add_test_root_macro(g4Config.C + PUBLIC_LINK_LIBRARIES O2::SimSetup + LABELS simsetup) diff --git a/EventVisualisation/Base/CMakeLists.txt b/EventVisualisation/Base/CMakeLists.txt index 7124a5a32f7db..bc058d9da89c2 100644 --- a/EventVisualisation/Base/CMakeLists.txt +++ b/EventVisualisation/Base/CMakeLists.txt @@ -1,29 +1,16 @@ -# @author Jeremi Niedziela +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(MODULE_NAME "EventVisualisationBase") - -O2_SETUP(NAME ${MODULE_NAME}) - -# Define the source and header files -set(SRCS - src/ConfigurationManager.cxx - src/DataInterpreter.cxx - src/EventManager.cxx - src/GeometryManager.cxx - src/Track.cxx - ) - -# HEADERS is not needed if we don't generate a dictionary. -set(HEADERS - include/${MODULE_NAME}/ConfigurationManager.h - include/${MODULE_NAME}/DataInterpreter.h - include/${MODULE_NAME}/EventManager.h - include/${MODULE_NAME}/GeometryManager.h - include/${MODULE_NAME}/Track.h - include/${MODULE_NAME}/VisualisationConstants.h - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME event_visualisation_base_bucket) - -O2_GENERATE_LIBRARY() +o2_add_library(EventVisualisationBase + SOURCES src/ConfigurationManager.cxx src/DataInterpreter.cxx + src/EventManager.cxx src/GeometryManager.cxx + src/Track.cxx + PUBLIC_LINK_LIBRARIES O2::CCDB ROOT::Eve + O2::EventVisualisationDataConverter) diff --git a/EventVisualisation/Base/README.md b/EventVisualisation/Base/README.md index 77a148d8dc419..f4720a95f05af 100644 --- a/EventVisualisation/Base/README.md +++ b/EventVisualisation/Base/README.md @@ -1,31 +1 @@ \page refEventVisualisationBase EventVisualisation Base - -Example 1 -========= - -[TOC] - -# Introduction {#Introduction} - -This is an example of a basic module using the O2 CMake macros to generate a library and an executable. - -## Macros and variables {#Macros} - -- O2_SETUP : necessary to register the module in O2. -- O2_GENERATE_LIBRARY : use once and only once per module to generate a library. -- O2_GENERATE_EXECUTABLE : generate executables. -- HEADERS is not needed in case we don't generate a dictionary. - -## Classes {#Classes} - -We have one class that belongs to the interface (Foo) and one class that is internal (Bar). -As a consequence, the header of the former should go to the include directory whereas the header -of the second must go to the src directory. - -Foo uses Bar, both are included in the library. The executable uses Foo. - -# Documentation {#Documentation} - -The documentation is in markdown with special markers for doxygen such as `[TOC]`. -Note the that the TOC will work only if no levels are skip (don't create a subsection without a section -above it). diff --git a/EventVisualisation/CMakeLists.txt b/EventVisualisation/CMakeLists.txt index 347f5a8665e7c..73828a9961a30 100644 --- a/EventVisualisation/CMakeLists.txt +++ b/EventVisualisation/CMakeLists.txt @@ -1,4 +1,14 @@ -add_subdirectory (Base) -add_subdirectory (Detectors) -add_subdirectory (View) -add_subdirectory (DataConverter) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +add_subdirectory(DataConverter) +add_subdirectory(Base) +add_subdirectory(Detectors) +add_subdirectory(View) diff --git a/EventVisualisation/DataConverter/CMakeLists.txt b/EventVisualisation/DataConverter/CMakeLists.txt index 2e62e37c0b69d..d2460ac777f17 100644 --- a/EventVisualisation/DataConverter/CMakeLists.txt +++ b/EventVisualisation/DataConverter/CMakeLists.txt @@ -1,23 +1,12 @@ -# @author Jeremi Niedziela - -set(MODULE_NAME "EventVisualisationDataConverter") - -O2_SETUP(NAME ${MODULE_NAME}) - -# Define the source and header files -set(SRCS - src/MinimalisticEvent.cxx - src/MinimalisticTrack.cxx -) - -# HEADERS is not needed if we don't generate a dictionary. -set(HEADERS - include/${MODULE_NAME}/MinimalisticEvent.h - include/${MODULE_NAME}/MinimalisticTrack.h - include/${MODULE_NAME}/ConversionConstants.h -) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME event_visualisation_data_converter_bucket) - -O2_GENERATE_LIBRARY() +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(EventVisualisationDataConverter + SOURCES src/MinimalisticEvent.cxx src/MinimalisticTrack.cxx) diff --git a/EventVisualisation/Detectors/CMakeLists.txt b/EventVisualisation/Detectors/CMakeLists.txt index bdfff470c1f3a..168af169998a3 100644 --- a/EventVisualisation/Detectors/CMakeLists.txt +++ b/EventVisualisation/Detectors/CMakeLists.txt @@ -1,20 +1,13 @@ -# @author Jeremi Niedziela - -set(MODULE_NAME "EventVisualisationDetectors") - -O2_SETUP(NAME ${MODULE_NAME}) - -# Define the source and header files -set(SRCS - src/DataInterpreterRND.cxx - ) - -# HEADERS is not needed if we don't generate a dictionary. -set(HEADERS - include/${MODULE_NAME}/DataInterpreterRND.h - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME event_visualisation_detectors_bucket) - -O2_GENERATE_LIBRARY() +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(EventVisualisationDetectors + SOURCES src/DataInterpreterRND.cxx + PUBLIC_LINK_LIBRARIES O2::EventVisualisationBase) diff --git a/EventVisualisation/View/CMakeLists.txt b/EventVisualisation/View/CMakeLists.txt index 0e1ea6d97b291..f5f7c41a751a8 100644 --- a/EventVisualisation/View/CMakeLists.txt +++ b/EventVisualisation/View/CMakeLists.txt @@ -1,32 +1,22 @@ -# @author Jeremi Niedziela - -set(MODULE_NAME "EventVisualisationView") - -O2_SETUP(NAME ${MODULE_NAME}) - -# Define the source and header files -set(SRCS - src/MultiView.cxx - src/Initializer.cxx - ) - -# HEADERS is not needed if we don't generate a dictionary. -set(HEADERS - include/${MODULE_NAME}/MultiView.h - include/${MODULE_NAME}/Initializer.h - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME event_visualisation_view_bucket) - -set(LINKDEF src/EventVisualisationViewLinkDef.h) - -O2_GENERATE_LIBRARY() - -# Define application -O2_GENERATE_EXECUTABLE( -EXE_NAME o2-eve -SOURCES src/main.cxx -MODULE_LIBRARY_NAME ${LIBRARY_NAME} -BUCKET_NAME ${BUCKET_NAME} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(EventVisualisationView + SOURCES src/MultiView.cxx src/Initializer.cxx + PUBLIC_LINK_LIBRARIES O2::EventVisualisationBase + O2::EventVisualisationDetectors) + +o2_target_root_dictionary(EventVisualisationView + HEADERS include/EventVisualisationView/MultiView.h + include/EventVisualisationView/Initializer.h) + +o2_add_executable(eve + SOURCES src/main.cxx + PUBLIC_LINK_LIBRARIES O2::EventVisualisationView) diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index 88c729496b89e..6af6eede8ddfd 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -1,4 +1,17 @@ -add_subdirectory (flp2epn) -add_subdirectory (flp2epn-distributed) -add_subdirectory (ExampleModule1) -add_subdirectory (ExampleModule2) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +add_subdirectory(Ex1) +add_subdirectory(Ex2) +add_subdirectory(Ex3) +add_subdirectory(Ex4) +add_subdirectory(Ex5) +add_subdirectory(flp2epn) +add_subdirectory(flp2epn-distributed) diff --git a/Examples/Ex1/CMakeLists.txt b/Examples/Ex1/CMakeLists.txt new file mode 100644 index 0000000000000..d1964b5451fb6 --- /dev/null +++ b/Examples/Ex1/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(Ex1 + SOURCES src/A.cxx src/B.cxx + PUBLIC_LINK_LIBRARIES FairMQ::FairMQ) diff --git a/Examples/Ex1/README.md b/Examples/Ex1/README.md new file mode 100644 index 0000000000000..1d93edcd7aeba --- /dev/null +++ b/Examples/Ex1/README.md @@ -0,0 +1,3 @@ +\page refEx1 Ex1 A basic example with one library + +See [CMakeInstructions](../doc/CMakeInstructions.md) for an explanation about this directory. diff --git a/Examples/Ex1/include/Ex1/A.h b/Examples/Ex1/include/Ex1/A.h new file mode 100644 index 0000000000000..9a013ba0f293a --- /dev/null +++ b/Examples/Ex1/include/Ex1/A.h @@ -0,0 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef _A_H_ +#define _A_H_ + +class A +{ + public: + A(); +}; +#endif diff --git a/Examples/Ex1/src/A.cxx b/Examples/Ex1/src/A.cxx new file mode 100644 index 0000000000000..68c34e02d5ed8 --- /dev/null +++ b/Examples/Ex1/src/A.cxx @@ -0,0 +1,17 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "Ex1/A.h" +#include + +A::A() +{ + std::cout << "Hello from A ctor\n"; +} diff --git a/Examples/Ex1/src/B.cxx b/Examples/Ex1/src/B.cxx new file mode 100644 index 0000000000000..c90c44f05fa7a --- /dev/null +++ b/Examples/Ex1/src/B.cxx @@ -0,0 +1,18 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "B.h" +#include +#include "fairmq/FairMQDevice.h" + +B::B() +{ + std::cout << "Hello from B\n"; +} diff --git a/Examples/Ex1/src/B.h b/Examples/Ex1/src/B.h new file mode 100644 index 0000000000000..274c53309e8ed --- /dev/null +++ b/Examples/Ex1/src/B.h @@ -0,0 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef _B_H_ +#define _B_H_ + +class B +{ + public: + B(); +}; +#endif diff --git a/Examples/Ex2/CMakeLists.txt b/Examples/Ex2/CMakeLists.txt new file mode 100644 index 0000000000000..8ed7d61e5b61d --- /dev/null +++ b/Examples/Ex2/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(Ex2 + SOURCES src/A.cxx src/B.cxx + PUBLIC_LINK_LIBRARIES FairMQ::FairMQ) + +o2_target_root_dictionary(Ex2 + HEADERS include/Ex2/A.h src/B.h + LINKDEF src/Ex2LinkDef.h) diff --git a/Examples/Ex2/README.md b/Examples/Ex2/README.md new file mode 100644 index 0000000000000..458f19ff4a3cf --- /dev/null +++ b/Examples/Ex2/README.md @@ -0,0 +1,3 @@ +\page refEx2 Ex2 A basic library with a Root dictionary + +See [CMakeInstructions](../doc/CMakeInstructions.md) for an explanation about this directory. diff --git a/Examples/ExampleModule2/src/ExampleLinkDef.h b/Examples/Ex2/include/Ex2/A.h similarity index 67% rename from Examples/ExampleModule2/src/ExampleLinkDef.h rename to Examples/Ex2/include/Ex2/A.h index f5d5af97ddcce..5367bac7d6bba 100644 --- a/Examples/ExampleModule2/src/ExampleLinkDef.h +++ b/Examples/Ex2/include/Ex2/A.h @@ -8,13 +8,19 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifdef __CLING__ +#ifndef _EX2_A_H_ +#define _EX2_A_H_ -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; +#include "TObject.h" -#pragma link C++ class o2::Examples::ExampleModule2::Foo+; -//#pragma link C++ class o2::Examples::ExampleModule2::Bar+; +namespace ex2 +{ +class A : public TObject +{ + public: + A(); + ClassDef(A, 1); +}; +} // namespace ex2 #endif diff --git a/Examples/Ex2/src/A.cxx b/Examples/Ex2/src/A.cxx new file mode 100644 index 0000000000000..70369e8859942 --- /dev/null +++ b/Examples/Ex2/src/A.cxx @@ -0,0 +1,23 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "Ex2/A.h" +#include + +ClassImp(ex2::A); + +namespace ex2 +{ + +A::A() +{ + std::cout << "Hello from ex2::A ctor\n"; +} +} // namespace ex2 diff --git a/Examples/Ex2/src/B.cxx b/Examples/Ex2/src/B.cxx new file mode 100644 index 0000000000000..c90c44f05fa7a --- /dev/null +++ b/Examples/Ex2/src/B.cxx @@ -0,0 +1,18 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "B.h" +#include +#include "fairmq/FairMQDevice.h" + +B::B() +{ + std::cout << "Hello from B\n"; +} diff --git a/Examples/Ex2/src/B.h b/Examples/Ex2/src/B.h new file mode 100644 index 0000000000000..274c53309e8ed --- /dev/null +++ b/Examples/Ex2/src/B.h @@ -0,0 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef _B_H_ +#define _B_H_ + +class B +{ + public: + B(); +}; +#endif diff --git a/Examples/Ex2/src/Ex2LinkDef.h b/Examples/Ex2/src/Ex2LinkDef.h new file mode 100644 index 0000000000000..70724b9ec69cd --- /dev/null +++ b/Examples/Ex2/src/Ex2LinkDef.h @@ -0,0 +1,14 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#if defined(__ROOTCLING__) +#pragma link C++ namespace ex2; +#pragma link C++ class ex2::A + ; +#endif diff --git a/Examples/Ex3/CMakeLists.txt b/Examples/Ex3/CMakeLists.txt new file mode 100644 index 0000000000000..01268c6b21a5d --- /dev/null +++ b/Examples/Ex3/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(Ex3 + SOURCES src/A.cxx src/B.cxx + PUBLIC_LINK_LIBRARIES FairMQ::FairMQ) + +o2_target_root_dictionary(Ex3 HEADERS include/Ex3/A.h src/B.h) + +o2_add_executable(ex3 + SOURCES src/run.cxx + PUBLIC_LINK_LIBRARIES O2::Ex3 O2::Ex2 + COMPONENT_NAME example) diff --git a/Examples/Ex3/README.md b/Examples/Ex3/README.md new file mode 100644 index 0000000000000..38790baf9dc7d --- /dev/null +++ b/Examples/Ex3/README.md @@ -0,0 +1,3 @@ +\page refEx3 Ex3 Adding an executable + +See [CMakeInstructions](../doc/CMakeInstructions.md) for an explanation about this directory. diff --git a/Examples/Ex3/include/Ex3/A.h b/Examples/Ex3/include/Ex3/A.h new file mode 100644 index 0000000000000..e71ab6dc8e09c --- /dev/null +++ b/Examples/Ex3/include/Ex3/A.h @@ -0,0 +1,27 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef _EX3_A_H_ +#define _EX3_A_H_ + +#include "TObject.h" + +namespace ex3 +{ +class A : public TObject +{ + public: + A(); + + ClassDef(A, 1); +}; + +} // namespace ex3 +#endif diff --git a/Examples/Ex3/src/A.cxx b/Examples/Ex3/src/A.cxx new file mode 100644 index 0000000000000..191760646d18b --- /dev/null +++ b/Examples/Ex3/src/A.cxx @@ -0,0 +1,22 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "Ex3/A.h" +#include + +ClassImp(ex3::A); + +namespace ex3 +{ +A::A() +{ + std::cout << "Hello from ex3::A ctor\n"; +} +} // namespace ex3 diff --git a/Examples/Ex3/src/B.cxx b/Examples/Ex3/src/B.cxx new file mode 100644 index 0000000000000..c90c44f05fa7a --- /dev/null +++ b/Examples/Ex3/src/B.cxx @@ -0,0 +1,18 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "B.h" +#include +#include "fairmq/FairMQDevice.h" + +B::B() +{ + std::cout << "Hello from B\n"; +} diff --git a/Examples/Ex3/src/B.h b/Examples/Ex3/src/B.h new file mode 100644 index 0000000000000..274c53309e8ed --- /dev/null +++ b/Examples/Ex3/src/B.h @@ -0,0 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef _B_H_ +#define _B_H_ + +class B +{ + public: + B(); +}; +#endif diff --git a/Examples/Ex3/src/Ex3LinkDef.h b/Examples/Ex3/src/Ex3LinkDef.h new file mode 100644 index 0000000000000..eb747c25a543c --- /dev/null +++ b/Examples/Ex3/src/Ex3LinkDef.h @@ -0,0 +1,14 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#if defined(__ROOTCLING__) +#pragma link C++ namespace ex3; +#pragma link C++ class ex3::A + ; +#endif diff --git a/Examples/Ex3/src/run.cxx b/Examples/Ex3/src/run.cxx new file mode 100644 index 0000000000000..f84e232248ce6 --- /dev/null +++ b/Examples/Ex3/src/run.cxx @@ -0,0 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "Ex3/A.h" +#include "Ex2/A.h" + +int main() +{ + ex2::A b; + ex3::A c; + return 0; +} diff --git a/Examples/Ex4/CMakeLists.txt b/Examples/Ex4/CMakeLists.txt new file mode 100644 index 0000000000000..1163e7073f363 --- /dev/null +++ b/Examples/Ex4/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(Ex4 + SOURCES src/A.cxx src/B.cxx + PUBLIC_LINK_LIBRARIES FairMQ::FairMQ) + +o2_target_root_dictionary(Ex4 HEADERS include/Ex4/A.h src/B.h) + +o2_add_executable(ex4 + SOURCES src/run.cxx + PUBLIC_LINK_LIBRARIES O2::Ex4 O2::Ex2 O2::Ex3 + COMPONENT_NAME example) + +o2_add_test(test1 + SOURCES test/test1.cxx + PUBLIC_LINK_LIBRARIES O2::Ex4 + COMPONENT_NAME Ex4 + LABELS fast dummy obvious + INSTALL) + +o2_add_test(test2 + SOURCES test/test2.cxx + PUBLIC_LINK_LIBRARIES O2::Ex4 O2::Ex3 O2::Ex2 + COMPONENT_NAME Ex4 + LABELS fast dummy) diff --git a/Examples/Ex4/README.md b/Examples/Ex4/README.md new file mode 100644 index 0000000000000..0abb3f7178bc5 --- /dev/null +++ b/Examples/Ex4/README.md @@ -0,0 +1,3 @@ +\page refEx4 Ex4 Adding tests + +See [CMakeInstructions](../doc/CMakeInstructions.md) for an explanation about this directory. diff --git a/Examples/Ex4/include/Ex4/A.h b/Examples/Ex4/include/Ex4/A.h new file mode 100644 index 0000000000000..4569b68cc2bf2 --- /dev/null +++ b/Examples/Ex4/include/Ex4/A.h @@ -0,0 +1,29 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef _EX4_A_H_ +#define _EX4_A_H_ + +#include "TObject.h" + +namespace ex4 +{ +class A : public TObject +{ + public: + A(); + + int value() const; + + ClassDef(A, 1); +}; + +} // namespace ex4 +#endif diff --git a/Examples/Ex4/src/A.cxx b/Examples/Ex4/src/A.cxx new file mode 100644 index 0000000000000..5470c69d007fb --- /dev/null +++ b/Examples/Ex4/src/A.cxx @@ -0,0 +1,26 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "Ex4/A.h" +#include + +ClassImp(ex4::A); + +namespace ex4 +{ +A::A() +{ + std::cout << "Hello from ex4::A ctor\n"; +} +int A::value() const +{ + return 42; +} +} // namespace ex4 diff --git a/Examples/Ex4/src/B.cxx b/Examples/Ex4/src/B.cxx new file mode 100644 index 0000000000000..c90c44f05fa7a --- /dev/null +++ b/Examples/Ex4/src/B.cxx @@ -0,0 +1,18 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "B.h" +#include +#include "fairmq/FairMQDevice.h" + +B::B() +{ + std::cout << "Hello from B\n"; +} diff --git a/Examples/Ex4/src/B.h b/Examples/Ex4/src/B.h new file mode 100644 index 0000000000000..274c53309e8ed --- /dev/null +++ b/Examples/Ex4/src/B.h @@ -0,0 +1,19 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef _B_H_ +#define _B_H_ + +class B +{ + public: + B(); +}; +#endif diff --git a/Examples/Ex4/src/Ex4LinkDef.h b/Examples/Ex4/src/Ex4LinkDef.h new file mode 100644 index 0000000000000..3e733480cf211 --- /dev/null +++ b/Examples/Ex4/src/Ex4LinkDef.h @@ -0,0 +1,14 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#if defined(__ROOTCLING__) +#pragma link C++ namespace ex4; +#pragma link C++ class ex4::A + ; +#endif diff --git a/Examples/Ex4/src/run.cxx b/Examples/Ex4/src/run.cxx new file mode 100644 index 0000000000000..126248c4b755b --- /dev/null +++ b/Examples/Ex4/src/run.cxx @@ -0,0 +1,22 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "Ex2/A.h" +#include "Ex3/A.h" +#include "Ex4/A.h" + +int main() +{ + + ex2::A a; + ex3::A b; + ex4::A c; + return 0; +} diff --git a/Examples/ExampleModule1/test/testExampleModule1.cxx b/Examples/Ex4/test/test1.cxx similarity index 60% rename from Examples/ExampleModule1/test/testExampleModule1.cxx rename to Examples/Ex4/test/test1.cxx index a6c735ad91ac7..6039b637fad63 100644 --- a/Examples/ExampleModule1/test/testExampleModule1.cxx +++ b/Examples/Ex4/test/test1.cxx @@ -8,30 +8,17 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// -/// \author Barthelemy von Haller -/// - -#include "../include/ExampleModule1/Foo.h" - -#define BOOST_TEST_MODULE MO test -#define BOOST_TEST_MAIN +#define BOOST_TEST_MODULE Ex4 #define BOOST_TEST_DYN_LINK -#include -#include -#include "ExampleModule1/Foo.h" +#define BOOST_TEST_MAIN +#include +#include "Ex4/A.h" -namespace o2 { -namespace Examples { -namespace ExampleModule1 { +#include -BOOST_AUTO_TEST_CASE(testFoo) +BOOST_AUTO_TEST_CASE(AValueShouldBeTheAnswer) { - Foo foo; - foo.greet(); + ex4::A a; + BOOST_CHECK_EQUAL(a.value(), 42); } - -} /* namespace ExampleModule1 */ -} /* namespace Examples */ -} /* namespace AliceO2 */ \ No newline at end of file diff --git a/Examples/Ex4/test/test2.cxx b/Examples/Ex4/test/test2.cxx new file mode 100644 index 0000000000000..36e97dacd4502 --- /dev/null +++ b/Examples/Ex4/test/test2.cxx @@ -0,0 +1,60 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#define BOOST_TEST_MODULE Ex4 +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MAIN + +#include +#include "Ex2/A.h" +#include "Ex3/A.h" +#include "Ex4/A.h" + +#include +#include + +BOOST_AUTO_TEST_CASE(AValueShouldBeTheAnswer) +{ + ex4::A a; + BOOST_CHECK_EQUAL(a.value(), 42); +} + +BOOST_AUTO_TEST_CASE(ACtorShouldSayHello) +{ + std::stringstream buffer; + std::streambuf* old = std::cout.rdbuf(buffer.rdbuf()); + + ex4::A a; + + std::string text = buffer.str(); + + std::cout.rdbuf(old); + + BOOST_CHECK_EQUAL(text, "Hello from ex4::A ctor\n"); +} + +BOOST_AUTO_TEST_CASE(AAACtorShouldSayHello) +{ + std::stringstream buffer; + std::streambuf* old = std::cout.rdbuf(buffer.rdbuf()); + + ex2::A a; + ex3::A b; + ex4::A c; + + std::string text = buffer.str(); + + std::cout.rdbuf(old); + + BOOST_CHECK_EQUAL(text, + "Hello from ex2::A ctor\n" + "Hello from ex3::A ctor\n" + "Hello from ex4::A ctor\n"); +} diff --git a/Examples/Ex5/CMakeLists.txt b/Examples/Ex5/CMakeLists.txt new file mode 100644 index 0000000000000..dd691ec774794 --- /dev/null +++ b/Examples/Ex5/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_executable(ex5 + SOURCES src/run.cxx + COMPONENT_NAME example TARGETVARNAME targetName) + +o2_target_man_page(${targetName} NAME ex5 SECTION 7) diff --git a/Examples/Ex5/README.md b/Examples/Ex5/README.md new file mode 100644 index 0000000000000..54d68cbc797aa --- /dev/null +++ b/Examples/Ex5/README.md @@ -0,0 +1,3 @@ +\page refEx5 Ex5 Adding a man page + +See [CMakeInstructions](../doc/CMakeInstructions.md) for an explanation about this directory. diff --git a/Examples/ExampleModule2/doc/runExampleModule2.1.in b/Examples/Ex5/doc/ex5.7.in similarity index 82% rename from Examples/ExampleModule2/doc/runExampleModule2.1.in rename to Examples/Ex5/doc/ex5.7.in index 21d66c410e277..5d346f7f4798d 100644 --- a/Examples/ExampleModule2/doc/runExampleModule2.1.in +++ b/Examples/Ex5/doc/ex5.7.in @@ -1,4 +1,4 @@ -.\" Manpage for runExampleModule2. +.\" Manpage for ex5. .\" this file gives some basic introduction on how to use the .\" roff format to write man pages @@ -6,18 +6,18 @@ .\" at the beginning of the line .\" the header section -.TH AliceO2 1 "12 May 2017" "1.0" "runExampleModule2 man page" +.TH AliceO2 1 "07 July 2019" "1.0" "ex5 man page" .\" .SH starts a new section, NAME is the first section .SH NAME -runExampleModule2 - A simple example for AliceO2 submodules +ex5 - A simple example for AliceO2 submodules .\" next is the SYNOPSIS section .SH SYNOPSIS .\" some bold formatted text -.B runExampleModule2 +.B ex5 .\" alternate between roman and bold font, separated by blank, i.e. the .\" square backets in roman and the option in bold .RB [ --someoption ] @@ -32,7 +32,7 @@ runExampleModule2 - A simple example for AliceO2 submodules .SH DESCRIPTION -runExampleModule2 is an example to demonstrate the AliceO2 cmake setup of +ex5 is an example to demonstrate the AliceO2 cmake setup of modules. This document illustrates creation of man pages. All options and arument are pure fictive. @@ -53,7 +53,7 @@ Add additional information to run with gdb .SH SEE ALSO -runExampleModule2(1) +ex5(1) http://gnustep.made-it.com/man-groff.html diff --git a/Examples/Ex5/src/run.cxx b/Examples/Ex5/src/run.cxx new file mode 100644 index 0000000000000..0ade248892b47 --- /dev/null +++ b/Examples/Ex5/src/run.cxx @@ -0,0 +1,17 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include + +int main() +{ + std::cout << "This is ex5\n"; + return 42; +} diff --git a/Examples/ExampleModule1/CMakeLists.txt b/Examples/ExampleModule1/CMakeLists.txt deleted file mode 100644 index 5002108fb39b2..0000000000000 --- a/Examples/ExampleModule1/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# @author Barthélémy von Haller - -set(MODULE_NAME "ExampleModule1") - -O2_SETUP(NAME ${MODULE_NAME}) - -# Define the source and header files -set(SRCS - src/Foo.cxx - src/Bar.cxx - ) - -# HEADERS is not needed if we don't generate a dictionary. -#set(HEADERS -# include/${MODULE_NAME}/Foo.h -# src/Bar.h -# ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ExampleModule1_bucket) - -O2_GENERATE_LIBRARY() - -# Define application -O2_GENERATE_EXECUTABLE( - EXE_NAME runExampleModule1 - SOURCES src/main.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) - - - -set(TEST_SRCS - test/testExampleModule1.cxx - ) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) diff --git a/Examples/ExampleModule1/README.md b/Examples/ExampleModule1/README.md deleted file mode 100644 index 9544532fc9e51..0000000000000 --- a/Examples/ExampleModule1/README.md +++ /dev/null @@ -1,31 +0,0 @@ -\page refExamplesExampleModule1 Example Module 1 - -Example 1 -========= - -[TOC] - -# Introduction {#Introduction} - -This is an example of a basic module using the O2 CMake macros to generate a library and an executable. - -## Macros and variables {#Macros} - -- O2_SETUP : necessary to register the module in O2. -- O2_GENERATE_LIBRARY : use once and only once per module to generate a library. -- O2_GENERATE_EXECUTABLE : generate executables. -- HEADERS is not needed in case we don't generate a dictionary. - -## Classes {#Classes} - -We have one class that belongs to the interface (Foo) and one class that is internal (Bar). -As a consequence, the header of the former should go to the include directory whereas the header -of the second must go to the src directory. - -Foo uses Bar, both are included in the library. The executable uses Foo. - -# Documentation {#Documentation} - -The documentation is in markdown with special markers for doxygen such as `[TOC]`. -Note the that the TOC will work only if no levels are skip (don't create a subsection without a section -above it). diff --git a/Examples/ExampleModule1/cmake/.gitignore b/Examples/ExampleModule1/cmake/.gitignore deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/Examples/ExampleModule1/doc/.gitignore b/Examples/ExampleModule1/doc/.gitignore deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/Examples/ExampleModule1/include/ExampleModule1/Foo.h b/Examples/ExampleModule1/include/ExampleModule1/Foo.h deleted file mode 100644 index 1bf2f407efa1b..0000000000000 --- a/Examples/ExampleModule1/include/ExampleModule1/Foo.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// @file Foo.h -/// @author Barthelemy von Haller -/// - -#ifndef ALICE_O2_EXAMPLEMODULE1_FOO_H -#define ALICE_O2_EXAMPLEMODULE1_FOO_H - -/// @brief Here you put a short description of the namespace -/// Extended documentation for this namespace -/// @author Barthelemy von Haller -namespace o2 { -namespace Examples { -namespace ExampleModule1 { - -/// @brief Here you put a short description of the class -/// Extended documentation for this class. -/// @author Barthelemy von Haller -class Foo -{ - public: - - /// @brief Greets the caller - /// @author Barthelemy von Haller - /// @brief Simple hello world - void greet(); - - /// @brief Returns the value passed to it - /// Longer description that is useless here. - /// @author Barthelemy von Haller - /// @param n (In) input number. - /// @return Returns the input number given. - int returnsN(int n); -}; - -} // namespace ExampleModule1 -} // namespace Examples -} // namespace AliceO2 - -#endif // ALICE_O2_EXAMPLEMODULE1_FOO_H diff --git a/Examples/ExampleModule1/src/Bar.cxx b/Examples/ExampleModule1/src/Bar.cxx deleted file mode 100644 index 010c6619a5f87..0000000000000 --- a/Examples/ExampleModule1/src/Bar.cxx +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// @file Bar.cxx -/// @author Barthelemy von Haller -/// - -#include "Bar.h" - -#include - -namespace o2 { -namespace Examples { -namespace ExampleModule1 { - -Bar::Bar() -= default; - -Bar::~Bar() -= default; - -void Bar::greet() -{ - std::cout << "Hello world from ExampleModule1::Bar" << std::endl; -} - -int Bar::returnsN(int n) -{ - - /// \todo This is how you can markup a todo in your code that will show up in the documentation of your project. - /// \bug This is how you annotate a bug in your code. - return n; -} - -} // namespace ExampleModule1 -} // namespace Examples -} // namespace AliceO2 diff --git a/Examples/ExampleModule1/src/Bar.h b/Examples/ExampleModule1/src/Bar.h deleted file mode 100644 index 9cd108ff77d32..0000000000000 --- a/Examples/ExampleModule1/src/Bar.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// @file Bar.h -/// @author Barthelemy von Haller -/// - -#ifndef ALICE_O2_EXAMPLEMODULE1_BAR_H -#define ALICE_O2_EXAMPLEMODULE1_BAR_H - -/// @brief Here you put a short description of the namespace -/// Extended documentation for this namespace -/// @author Barthelemy von Haller -namespace o2 { -namespace Examples { -namespace ExampleModule1 { - -/// @brief Here you put a short description of the class -/// Extended documentation for this class. -/// @author Barthelemy von Haller -class Bar -{ - public: - Bar(); - virtual ~Bar(); - - /// @brief Greets the caller - /// @author Barthelemy von Haller - /// @brief Simple hello world - void greet(); - - /// @brief Returns the value passed to it - /// Longer description that is useless here. - /// @author Barthelemy von Haller - /// @param n (In) input number. - /// @return Returns the input number given. - int returnsN(int n); -}; - -} // namespace ExampleModule1 -} // namespace Examples -} // namespace AliceO2 - -#endif // ALICE_O2_EXAMPLEMODULE1_BAR_H diff --git a/Examples/ExampleModule1/src/Foo.cxx b/Examples/ExampleModule1/src/Foo.cxx deleted file mode 100644 index c44f981c3caaf..0000000000000 --- a/Examples/ExampleModule1/src/Foo.cxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// @file Foo.cxx -/// @author Barthelemy von Haller -/// - -#include "ExampleModule1/Foo.h" -#include "Bar.h" - -#include - -namespace o2 { -namespace Examples { -namespace ExampleModule1 { - -void Foo::greet() -{ - std::cout << "Hello world from ExampleModule1::Foo" << std::endl; - Bar bar; - bar.greet(); -} - -int Foo::returnsN(int n) -{ - - /// \todo This is how you can markup a todo in your code that will show up in the documentation of your project. - /// \bug This is how you annotate a bug in your code. - return n; -} - -} // namespace ExampleModule1 -} // namespace Examples -} // namespace AliceO2 diff --git a/Examples/ExampleModule1/src/main.cxx b/Examples/ExampleModule1/src/main.cxx deleted file mode 100644 index fb049ca35183e..0000000000000 --- a/Examples/ExampleModule1/src/main.cxx +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// @file main.cxx -/// @author Barthelemy von Haller -/// - -#include "ExampleModule1/Foo.h" -#include -#include - -namespace po = boost::program_options; - -int main(int argc, char *argv[]) -{ - // Arguments parsing - po::variables_map vm; - po::options_description desc("Allowed options"); - desc.add_options()("help,h", "Produce help message."); - po::store(parse_command_line(argc, argv, desc), vm); - po::notify(vm); - // help - if (vm.count("help")) { - std::cout << desc << std::endl; - return EXIT_SUCCESS; - } - - // Actual "work" - o2::Examples::ExampleModule1::Foo hello; - hello.greet(); - - return EXIT_SUCCESS; -} diff --git a/Examples/ExampleModule1/test/.gitignore b/Examples/ExampleModule1/test/.gitignore deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/Examples/ExampleModule2/CMakeLists.txt b/Examples/ExampleModule2/CMakeLists.txt deleted file mode 100644 index 844fbccfc48e2..0000000000000 --- a/Examples/ExampleModule2/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -# @author Barthélémy von Haller - -set(MODULE_NAME "ExampleModule2") - -O2_SETUP(NAME ${MODULE_NAME}) - -# Define the source and header files of the library -set(SRCS - src/Foo.cxx - ) - -set(NO_DICT_SRCS # sources not for the dictionary - src/Bar.cxx - ) - -set(HEADERS # needed for the dictionary generation - src/Bar.h - include/${MODULE_NAME}/Foo.h - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ExampleModule2_bucket) -set(LINKDEF src/ExampleLinkDef.h) # needed for the dictionary generation - -O2_GENERATE_LIBRARY() - -# Define application -O2_GENERATE_EXECUTABLE( - EXE_NAME runExampleModule2 - SOURCES src/main.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) - -O2_GENERATE_MAN(NAME runExampleModule2) diff --git a/Examples/ExampleModule2/README.md b/Examples/ExampleModule2/README.md deleted file mode 100644 index dbc4b969796bd..0000000000000 --- a/Examples/ExampleModule2/README.md +++ /dev/null @@ -1,23 +0,0 @@ -\page refExamplesExampleModule2 Example Module 2 - -Example 2 -========= - -[TOC] - -TODO : explain what is specific to this example - -This is an example of a basic module using the O2 CMake macros to generate a library and an executable. -It also generates the ROOT dictionary. - -In particular : -- O2_SETUP : necessary to register the module in O2. -- O2_GENERATE_LIBRARY : use once and only once per module to generate a library. -- O2_GENERATE_EXECUTABLE : generate executables. - -We have one class that belongs to the interface (Foo) and for which a dictionary is -generated and one class that is internal (Bar) without dictionary. We use NO_DICT_SRCS for the latter. -The header of Foo should go to the include directory whereas the header -of Bar must go to the src directory. - -Foo uses Bar, both are included in the library. The executable uses Foo. diff --git a/Examples/ExampleModule2/cmake/.gitignore b/Examples/ExampleModule2/cmake/.gitignore deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/Examples/ExampleModule2/doc/.gitignore b/Examples/ExampleModule2/doc/.gitignore deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/Examples/ExampleModule2/include/ExampleModule2/Foo.h b/Examples/ExampleModule2/include/ExampleModule2/Foo.h deleted file mode 100644 index 67ac3eb82e79a..0000000000000 --- a/Examples/ExampleModule2/include/ExampleModule2/Foo.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// @file Foo.h -/// @author Barthelemy von Haller -/// - -#ifndef ALICE_O2_EXAMPLEMODULE2_FOO_H -#define ALICE_O2_EXAMPLEMODULE2_FOO_H - -#include "Rtypes.h" // for ClassDef - -/// @brief Here you put a short description of the namespace -/// Extended documentation for this namespace -/// @author Barthelemy von Haller -namespace o2 { -namespace Examples { -namespace ExampleModule2 { - -/// @brief Here you put a short description of the class -/// Extended documentation for this class. -/// @author Barthelemy von Haller -class Foo -{ - public: - - /// @brief Greets the caller - /// @author Barthelemy von Haller - /// @brief Simple hello world - void greet(); - - /// @brief Returns the value passed to it - /// Longer description that is useless here. - /// @author Barthelemy von Haller - /// @param n (In) input number. - /// @return Returns the input number given. - int returnsN(int n); - - ClassDefNV(Foo, 1) -}; - -} // namespace ExampleModule2 -} // namespace Examples -} // namespace AliceO2 - -#endif // ALICE_O2_EXAMPLEMODULE2_FOO_H diff --git a/Examples/ExampleModule2/src/Bar.cxx b/Examples/ExampleModule2/src/Bar.cxx deleted file mode 100644 index 4484cca24bf33..0000000000000 --- a/Examples/ExampleModule2/src/Bar.cxx +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// @file Bar.cxx -/// @author Barthelemy von Haller -/// - -#include "Bar.h" - -#include - -namespace o2 { -namespace Examples { -namespace ExampleModule2 { - -Bar::Bar() -= default; - -Bar::~Bar() -= default; - -void Bar::greet() -{ - std::cout << "Hello world from ExampleModule2::Bar" << std::endl; -} - -int Bar::returnsN(int n) -{ - - /// \todo This is how you can markup a todo in your code that will show up in the documentation of your project. - /// \bug This is how you annotate a bug in your code. - return n; -} - -} // namespace ExampleModule2 -} // namespace Examples -} // namespace AliceO2 diff --git a/Examples/ExampleModule2/src/Bar.h b/Examples/ExampleModule2/src/Bar.h deleted file mode 100644 index 6331c11b60cec..0000000000000 --- a/Examples/ExampleModule2/src/Bar.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// @file Bar.h -/// @author Barthelemy von Haller -/// - -#ifndef ALICE_O2_EXAMPLEMODULE2_BAR_H -#define ALICE_O2_EXAMPLEMODULE2_BAR_H - -/// @brief Here you put a short description of the namespace -/// Extended documentation for this namespace -/// @author Barthelemy von Haller -namespace o2 { -namespace Examples { -namespace ExampleModule2 { - -/// @brief Here you put a short description of the class -/// Extended documentation for this class. -/// @author Barthelemy von Haller -class Bar -{ - public: - Bar(); - virtual ~Bar(); - - /// @brief Greets the caller - /// @author Barthelemy von Haller - /// @brief Simple hello world - void greet(); - - /// @brief Returns the value passed to it - /// Longer description that is useless here. - /// @author Barthelemy von Haller - /// @param n (In) input number. - /// @return Returns the input number given. - int returnsN(int n); -}; - -} // namespace ExampleModule2 -} // namespace Examples -} // namespace AliceO2 - -#endif // ALICE_O2_EXAMPLEMODULE2_BAR_H diff --git a/Examples/ExampleModule2/src/Foo.cxx b/Examples/ExampleModule2/src/Foo.cxx deleted file mode 100644 index 07879a9931cf4..0000000000000 --- a/Examples/ExampleModule2/src/Foo.cxx +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// @file Foo.cxx -/// @author Barthelemy von Haller -/// - -#include "ExampleModule2/Foo.h" -#include "ExampleModule1/Foo.h" -#include "Bar.h" // private class, not in the api - -#include - -namespace o2 { -namespace Examples { -namespace ExampleModule2 { - -void Foo::greet() -{ - std::cout << "Hello world from ExampleModule2::Foo" << std::endl; - o2::Examples::ExampleModule1::Foo otherFoo; - otherFoo.greet(); - o2::Examples::ExampleModule2::Bar bar; - bar.greet(); -} - -int Foo::returnsN(int n) -{ - - /// \todo This is how you can markup a todo in your code that will show up in the documentation of your project. - /// \bug This is how you annotate a bug in your code. - return n; -} - -} // namespace ExampleModule2 -} // namespace Examples -} // namespace AliceO2 diff --git a/Examples/ExampleModule2/src/main.cxx b/Examples/ExampleModule2/src/main.cxx deleted file mode 100644 index 209b136e95fda..0000000000000 --- a/Examples/ExampleModule2/src/main.cxx +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// @file main.cxx -/// @author Barthelemy von Haller -/// - -#include "ExampleModule2/Foo.h" -#include -#include -#include - -namespace po = boost::program_options; -using namespace std; - -int main(int argc, char *argv[]) -{ - // Arguments parsing - po::variables_map vm; - po::options_description desc("Allowed options"); - desc.add_options()("help,h", "Produce help message."); - po::store(parse_command_line(argc, argv, desc), vm); - po::notify(vm); - // help - if (vm.count("help")) { - std::cout << desc << std::endl; - return EXIT_SUCCESS; - } - - // Actual "work" - o2::Examples::ExampleModule2::Foo hello; - hello.greet(); - std::cout << "Class is " << hello.Class()->GetName() << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Examples/ExampleModule2/test/.gitignore b/Examples/ExampleModule2/test/.gitignore deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/Examples/README.md b/Examples/README.md index 47cb6931a0e1f..c3bd3a90f8c09 100644 --- a/Examples/README.md +++ b/Examples/README.md @@ -1,8 +1,13 @@ -\page refExamples Module 'Examples' +\\page refExamples Module 'Examples' This module contains the following submodules: -- \subpage refExamplesflp2epn -- \subpage refExamplesflp2epn-distributed -- \subpage refExamplesExampleModule1 -- \subpage refExamplesExampleModule2 +- \\subpage refExamplesflp2epn +- \\subpage refExamplesflp2epn-distributed +- \\subpage refEx1 +- \\subpage refEx2 +- \\subpage refEx3 +- \\subpage refEx4 +- \\subpage refEx5 + +The various `Ex` directories are incremental illustrations of [how to write](../doc/CMakeInstructions.md) `CMakeLists.txt` files within AliceO2 repository. diff --git a/Examples/flp2epn-distributed/CMakeLists.txt b/Examples/flp2epn-distributed/CMakeLists.txt index 05f34983c4279..edb710ceac269 100644 --- a/Examples/flp2epn-distributed/CMakeLists.txt +++ b/Examples/flp2epn-distributed/CMakeLists.txt @@ -1,71 +1,67 @@ -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run/startFLP2EPN-distributed.sh.in ${CMAKE_BINARY_DIR}/bin/startFLP2EPN-distributed.sh) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/testFLP2EPN-distributed.sh.in ${CMAKE_BINARY_DIR}/Examples/flp2epn-distributed/test/testFLP2EPN-distributed.sh) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run/flp2epn-prototype.json ${CMAKE_BINARY_DIR}/bin/config/flp2epn-prototype.json) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run/flp2epn-prototype-dds.json ${CMAKE_BINARY_DIR}/bin/config/flp2epn-prototype-dds.json) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run/flp2epn-dds-topology.xml ${CMAKE_BINARY_DIR}/bin/config/flp2epn-dds-topology.xml @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run/flp2epn-dds-hosts.cfg ${CMAKE_BINARY_DIR}/bin/config/flp2epn-dds-hosts.cfg COPYONLY) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(MODULE_NAME "FLP2EPNex_distributed") +o2_add_library(FLP2EPNex_distributed + SOURCES src/FLPSyncSampler.cxx src/FLPSender.cxx + src/EPNReceiver.cxx + PUBLIC_LINK_LIBRARIES O2::Device) -O2_SETUP(NAME ${MODULE_NAME}) +o2_add_executable(flp-sync-sampler + SOURCES run/runFLPSyncSampler.cxx + PUBLIC_LINK_LIBRARIES O2::FLP2EPNex_distributed + COMPONENT_NAME example) -set(SRCS - src/FLPSyncSampler.cxx - src/FLPSender.cxx - src/EPNReceiver.cxx - ) +o2_add_executable(flp-sender + SOURCES run/runFLPSender.cxx + PUBLIC_LINK_LIBRARIES O2::FLP2EPNex_distributed + COMPONENT_NAME example) -set(HEADERS - include/${MODULE_NAME}/FLPSyncSampler.h - include/${MODULE_NAME}/FLPSender.h - include/${MODULE_NAME}/EPNReceiver.h) +o2_add_executable(epn-receiver + SOURCES run/runEPNReceiver.cxx + PUBLIC_LINK_LIBRARIES O2::FLP2EPNex_distributed + COMPONENT_NAME example) -if (DDS_FOUND) - set(BUCKET_NAME flp2epndistrib_bucket) -else () - set(BUCKET_NAME flp2epn_bucket) -endif () -set(LIBRARY_NAME ${MODULE_NAME}) - -O2_GENERATE_LIBRARY() - -Set(Exe_Names - ${Exe_Names} - flpSyncSampler - flpSender - epnReceiver - ) - -set(Exe_Source - run/runFLPSyncSampler.cxx - run/runFLPSender.cxx - run/runEPNReceiver.cxx - ) - -list(LENGTH Exe_Names _length) -math(EXPR _length ${_length}-1) - -ForEach (_file RANGE 0 ${_length}) - list(GET Exe_Names ${_file} _name) - list(GET Exe_Source ${_file} _src) - O2_GENERATE_EXECUTABLE( - EXE_NAME ${_name} - SOURCES ${_src} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/run/startFLP2EPN-distributed.sh.in + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/o2-start-flp2epn-distributed.sh) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/test/testFLP2EPN-distributed.sh.in + ${CMAKE_BINARY_DIR}/Examples/flp2epn-distributed/test/o2-test-flp2epn-distributed.sh ) -EndForEach (_file RANGE 0 ${_length}) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run/flp2epn-prototype.json + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/config/flp2epn-prototype.json) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/run/flp2epn-prototype-dds.json + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/config/flp2epn-prototype-dds.json) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run/flp2epn-dds-topology.xml + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/config/flp2epn-dds-topology.xml + @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run/flp2epn-dds-hosts.cfg + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/config/flp2epn-dds-hosts.cfg + COPYONLY) -#add_test_wrap(NAME run_flp2epn_distributed COMMAND ${CMAKE_BINARY_DIR}/Examples/flp2epn-distributed/test/testFLP2EPN-distributed.sh) -#set_tests_properties(run_flp2epn_distributed PROPERTIES TIMEOUT "30") -#set_tests_properties(run_flp2epn_distributed PROPERTIES PASS_REGULAR_EXPRESSION "acknowledged after") +# add_test_wrap(NAME run_flp2epn_distributed COMMAND +# ${CMAKE_BINARY_DIR}/Examples/flp2epn-distributed/test/testFLP2EPN- +# distributed.sh) set_tests_properties(run_flp2epn_distributed PROPERTIES +# TIMEOUT "30") set_tests_properties(run_flp2epn_distributed PROPERTIES +# PASS_REGULAR_EXPRESSION "acknowledged after") -install(FILES ${CMAKE_BINARY_DIR}/bin/startFLP2EPN-distributed.sh - ${CMAKE_BINARY_DIR}/Examples/flp2epn-distributed/test/testFLP2EPN-distributed.sh - DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install( + FILES + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/o2-start-flp2epn-distributed.sh + ${CMAKE_BINARY_DIR}/Examples/flp2epn-distributed/test/o2-test-flp2epn-distributed.sh + DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(FILES ${CMAKE_BINARY_DIR}/bin/config/flp2epn-prototype.json - ${CMAKE_BINARY_DIR}/bin/config/flp2epn-prototype-dds.json - ${CMAKE_BINARY_DIR}/bin/config/flp2epn-dds-topology.xml - ${CMAKE_BINARY_DIR}/bin/config/flp2epn-dds-hosts.cfg - DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/config) +install( + FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/config/flp2epn-prototype.json + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/config/flp2epn-prototype-dds.json + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/config/flp2epn-dds-topology.xml + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/config/flp2epn-dds-hosts.cfg + DESTINATION ${CMAKE_INSTALL_DATADIR}/config) diff --git a/Examples/flp2epn/CMakeLists.txt b/Examples/flp2epn/CMakeLists.txt index b01d57fc7a7c1..64b2954d16b77 100644 --- a/Examples/flp2epn/CMakeLists.txt +++ b/Examples/flp2epn/CMakeLists.txt @@ -1,49 +1,33 @@ -set(MODULE_NAME "flp2epn") - -O2_SETUP(NAME ${MODULE_NAME}) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/startFLP2EPN.sh.in ${CMAKE_BINARY_DIR}/bin/startFLP2EPN.sh) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/flp2epn.json ${CMAKE_BINARY_DIR}/bin/config/flp2epn.json) - - -set(HEADERS - include/${MODULE_NAME}/O2FLPex.h - include/${MODULE_NAME}/O2EPNex.h - ) - -set(SRCS - src/O2FLPex.cxx - src/O2EPNex.cxx - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME flp2epn_bucket) - -O2_GENERATE_LIBRARY() - -Set(Exe_Names - ${Exe_Names} - testFLP - testEPN - testProxy - ) - -set(Exe_Source - src/runFLP.cxx - src/runEPN.cxx - src/runProxy.cxx - ) - -list(LENGTH Exe_Names _length) -math(EXPR _length ${_length}-1) - -ForEach (_file RANGE 0 ${_length}) # loop over a range because we traverse 2 lists and not 1 - list(GET Exe_Names ${_file} _name) - list(GET Exe_Source ${_file} _src) - O2_GENERATE_EXECUTABLE( - EXE_NAME ${_name} - SOURCES ${_src} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - ) -EndForEach (_file RANGE 0 ${_length}) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(flp2epn + SOURCES src/O2FLPex.cxx src/O2EPNex.cxx + PUBLIC_LINK_LIBRARIES O2::Device) + +o2_add_executable(flp + SOURCES src/runFLP.cxx + PUBLIC_LINK_LIBRARIES O2::flp2epn + COMPONENT_NAME example) + +o2_add_executable(epn + SOURCES src/runEPN.cxx + PUBLIC_LINK_LIBRARIES O2::flp2epn + COMPONENT_NAME example) + +# FIXME: runProxy.cxx references no longer existing ? +# o2_add_executable(Proxy SOURCES src/runProxy.cxx PUBLIC_LINK_LIBRARIES +# O2::flp2epn COMPONENT_NAME example) +# +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/startFLP2EPN.sh.in + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/o2-start-flp2epn.sh) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/flp2epn.json + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/config/flp2epn.json) diff --git a/Examples/flp2epn/README.md b/Examples/flp2epn/README.md index a0ddb65548832..b0fbc5d5c38f3 100644 --- a/Examples/flp2epn/README.md +++ b/Examples/flp2epn/README.md @@ -1,7 +1,8 @@ \page refExamplesflp2epn Example flp2epn #### Example devices - testFLP and testEPN --------------------------------------------------------------- + +--- #### General @@ -12,6 +13,6 @@ For more basic FairMQ examples, take a look at the MQ examples in the [FairRoot #### Device configuration -The devices are started by the `startFLP2EPN.sh` script, which configures the devices via command line options and their communication channels via a JSON configuration file. +The devices are started by the `o2-start-flp2epn.sh` script, which configures the devices via command line options and their communication channels via a JSON configuration file. -To list *all* available device command line options, run the executable with `--help`. +To list _all_ available device command line options, run the executable with `--help`. diff --git a/Framework/ArrowTests/CMakeLists.txt b/Framework/ArrowTests/CMakeLists.txt index ef6f21169e1cb..af32281e8c4c4 100644 --- a/Framework/ArrowTests/CMakeLists.txt +++ b/Framework/ArrowTests/CMakeLists.txt @@ -1,31 +1,15 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See https://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. - -set(MODULE_NAME "ArrowTests") -set(MODULE_BUCKET_NAME arrow_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) -set(SRCS - src/dummy.cxx - ) - -## TODO: feature of macro, it deletes the variables we pass to it, set them again -## this has to be fixed in the macro implementation -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS "test/test_Arrow01.cxx" -) +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_test(01 + SOURCES test/test_Arrow01.cxx + COMPONENT_NAME arrow + PUBLIC_LINK_LIBRARIES arrow_shared + LABELS arrow) diff --git a/Framework/CMakeLists.txt b/Framework/CMakeLists.txt index c6d85d4b4440a..cacc11a99348b 100644 --- a/Framework/CMakeLists.txt +++ b/Framework/CMakeLists.txt @@ -1,10 +1,25 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +add_subdirectory(Logger) + +add_subdirectory(Foundation) + +add_subdirectory(DebugGUI) + add_subdirectory(Core) -add_subdirectory(TestWorkflows) + add_subdirectory(Utils) -# FIXME: only run if glfw3 is detected. -if(ARROW_FOUND) -add_subdirectory(ArrowTests) + +# add_subdirectory(TestWorkflows) + +if(arrow_FOUND) + add_subdirectory(ArrowTests) endif() -add_subdirectory(DebugGUI) -add_subdirectory(Foundation) -add_subdirectory(Logger) diff --git a/Framework/Core/CMakeLists.txt b/Framework/Core/CMakeLists.txt index ac5f7152babc7..f13cbd5ae6314 100644 --- a/Framework/Core/CMakeLists.txt +++ b/Framework/Core/CMakeLists.txt @@ -1,358 +1,265 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See http://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(MODULE_NAME "Framework") - -set(MODULE_BUCKET_NAME O2FrameworkCore_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) -if (GLFW_FOUND) - set(GUI_SOURCES src/FrameworkGUIDebugger.cxx) +if(GLFW_FOUND) + set(GUI_SOURCES src/FrameworkGUIDebugger.cxx src/FrameworkGUIDevicesGraph.cxx + src/FrameworkGUIDeviceInspector.cxx + src/FrameworkGUIDataRelayerUsage.cxx src/PaletteHelpers.cxx) else() set(GUI_SOURCES src/FrameworkDummyDebugger.cxx) endif() -set(SRCS - src/AODReaderHelpers.cxx - src/AnalysisHelpers.cxx - src/BoostOptionsRetriever.cxx - src/ConfigParamsHelper.cxx - src/CompletionPolicy.cxx - src/ChannelSpecHelpers.cxx - src/CompletionPolicyHelpers.cxx - src/ChannelConfigurationPolicy.cxx - src/ChannelMatching.cxx - src/ChannelConfigurationPolicyHelpers.cxx - src/DataAllocator.cxx - src/DataDescriptorMatcher.cxx - src/DataProcessingDevice.cxx - src/DataProcessingHeader.cxx - src/DataProcessor.cxx - src/DataRelayer.cxx - src/DataSampling.cxx - src/DataSamplingConditionRandom.cxx - src/DataSamplingConditionPayloadSize.cxx - src/DataSamplingConditionNConsecutive.cxx - src/DataSamplingConditionFactory.cxx - src/DataSamplingHeader.cxx - src/DataSamplingReadoutAdapter.cxx - src/DataSamplingPolicy.cxx - src/DataSpecUtils.cxx - src/DeviceMetricsInfo.cxx - src/DeviceSpec.cxx - src/DeviceSpecHelpers.cxx - src/DDSConfigHelpers.cxx - src/Dispatcher.cxx - src/O2ControlHelpers.cxx - src/DriverControl.cxx - src/DriverInfo.cxx - src/ExternalFairMQDeviceProxy.cxx - src/FairOptionsRetriever.cxx - src/FairMQDeviceProxy.cxx - src/FairMQResizableBuffer.cxx - src/FreePortFinder.cxx - src/GraphvizHelpers.cxx - src/InputRecord.cxx - src/InputSpec.cxx - src/OutputSpec.cxx - src/Kernels.cxx - src/DataDescriptorQueryBuilder.cxx - src/LifetimeHelpers.cxx - src/LocalRootFileService.cxx - src/LogParsingHelpers.cxx - src/Metric2DViewIndex.cxx - src/SimpleOptionsRetriever.cxx - src/SimpleResourceManager.cxx - src/TextControlService.cxx - src/TableBuilder.cxx - src/TableConsumer.cxx - src/WorkflowHelpers.cxx - src/WorkflowSerializationHelpers.cxx - src/WorkflowSpec.cxx - src/runDataProcessing.cxx - src/Task.cxx - src/TMessageSerializer.cxx - src/StreamOperators.cxx - src/FrameworkGUIDevicesGraph.cxx - src/FrameworkGUIDeviceInspector.cxx - src/FrameworkGUIDataRelayerUsage.cxx - src/PaletteHelpers.cxx - src/PropertyTreeHelpers.cxx - src/CommonDataProcessors.cxx - src/RCombinedDS.cxx - src/ReadoutAdapter.cxx - ${GUI_SOURCES} - test/TestClasses.cxx - src/Variant.cxx - src/MessageContext.cxx - ) - -set(HEADERS - include/Framework - include/Framework/AnalysisDataModel.h - include/Framework/ASoA.h - include/Framework/DataProcessor.h - include/Framework/DataSpecUtils.h - include/Framework/FrameworkGUIDevicesGraph.h - include/Framework/FrameworkGUIDataRelayerUsage.h - include/Framework/DeviceMetricsInfo.h - include/Framework/DeviceSpec.h - include/Framework/DeviceControl.h - include/Framework/InitContext.h - include/Framework/ServiceRegistry.h - include/Framework/DeviceExecution.h - include/Framework/DebugGUI.h - include/Framework/FreePortFinder.h - include/Framework/TypeTraits.h - include/Framework/PaletteHelpers.h - include/Framework/ConfigParamSpec.h - include/Framework/TMessageSerializer.h - include/Framework/DataProcessorLabel.h - include/Framework/LogParsingHelpers.h - include/Framework/InputSpec.h - include/Framework/DeviceInfo.h - include/Framework/BoostOptionsRetriever.h - include/Framework/DataChunk.h - include/Framework/FrameworkGUIDebugger.h - include/Framework/runDataProcessing.h - include/Framework/AlgorithmSpec.h - include/Framework/ParamRetriever.h - include/Framework/ErrorContext.h - include/Framework/InputRecord.h - include/Framework/DataProcessorSpec.h - include/Framework/ConfigParamsHelper.h - include/Framework/InputRoute.h - include/Framework/ChannelConfigurationPolicyHelpers.h - include/Framework/ForwardRoute.h - include/Framework/MessageContext.h - include/Framework/ChannelMatching.h - include/Framework/RawDeviceService.h - include/Framework/TextControlService.h - include/Framework/DataAllocator.h - include/Framework/ConfigParamRegistry.h - include/Framework/DataRef.h - include/Framework/WorkflowSpec.h - include/Framework/LocalRootFileService.h - include/Framework/OutputSpec.h - include/Framework/ChannelSpec.h - include/Framework/ChannelConfigurationPolicy.h - include/Framework/SimpleRawDeviceService.h - include/Framework/SimpleOptionsRetriever.h - include/Framework/ExternalFairMQDeviceProxy.h - include/Framework/ControlService.h - include/Framework/DataRelayer.h - include/Framework/DataRefUtils.h - include/Framework/RootFileService.h - include/Framework/OutputRoute.h - include/Framework/DataProcessingHeader.h - include/Framework/ProcessingContext.h - include/Framework/FairOptionsRetriever.h - include/Framework/ParallelContext.h - include/Framework/RootObjectContext.h - include/Framework/DataProcessingDevice.h - include/Framework/Variant.h - include/Framework/CallbackRegistry.h - include/Framework/CallbackService.h - include/Framework/DataSampling.h - include/Framework/DataSamplingCondition.h - include/Framework/DataSamplingConditionFactory.h - include/Framework/DataSamplingHeader.h - include/Framework/DataSamplingReadoutAdapter.h - include/Framework/DataSamplingPolicy.h - include/Framework/Dispatcher.h - include/Framework/DPLBoostSerializer.h - include/Framework/TableBuilder.h - include/Framework/FairMQResizableBuffer.h - include/Framework/Metric2DViewIndex.h - include/Framework/RawBufferContext.h - include/Framework/Kernels.h - src/ComputingResource.h - src/DDSConfigHelpers.h - src/O2ControlHelpers.h - src/DeviceSpecHelpers.h - src/DriverControl.h - src/DriverInfo.h - src/GraphvizHelpers.h - src/ResourceManager.h - src/SimpleResourceManager.h - src/WorkflowHelpers.h - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) +o2_add_library(Framework + SOURCES src/AODReaderHelpers.cxx + ${GUI_SOURCES} + src/AnalysisHelpers.cxx + src/BoostOptionsRetriever.cxx + src/ChannelConfigurationPolicy.cxx + src/ChannelMatching.cxx + src/ChannelConfigurationPolicyHelpers.cxx + src/ChannelSpecHelpers.cxx + src/CommonDataProcessors.cxx + src/CompletionPolicy.cxx + src/CompletionPolicyHelpers.cxx + src/ConfigParamsHelper.cxx + src/DDSConfigHelpers.cxx + src/DataAllocator.cxx + src/DataDescriptorMatcher.cxx + src/DataDescriptorQueryBuilder.cxx + src/DataProcessingDevice.cxx + src/DataProcessingHeader.cxx + src/DataProcessor.cxx + src/DataRelayer.cxx + src/DataSampling.cxx + src/DataSamplingConditionFactory.cxx + src/DataSamplingHeader.cxx + src/DataSamplingConditionNConsecutive.cxx + src/DataSamplingConditionPayloadSize.cxx + src/DataSamplingConditionRandom.cxx + src/DataSamplingHeader.cxx + src/DataSamplingPolicy.cxx + src/DataSamplingReadoutAdapter.cxx + src/DataSpecUtils.cxx + src/DeviceMetricsInfo.cxx + src/DeviceSpec.cxx + src/DeviceSpecHelpers.cxx + src/Dispatcher.cxx + src/DriverControl.cxx + src/DriverInfo.cxx + src/FairMQDeviceProxy.cxx + src/FairMQResizableBuffer.cxx + src/FairOptionsRetriever.cxx + src/FreePortFinder.cxx + src/GraphvizHelpers.cxx + src/InputRecord.cxx + src/InputSpec.cxx + src/OutputSpec.cxx + src/Kernels.cxx + src/LifetimeHelpers.cxx + src/LocalRootFileService.cxx + src/LogParsingHelpers.cxx + src/MessageContext.cxx + src/Metric2DViewIndex.cxx + src/SimpleOptionsRetriever.cxx + src/O2ControlHelpers.cxx + src/OutputSpec.cxx + src/PropertyTreeHelpers.cxx + src/RCombinedDS.cxx + src/ReadoutAdapter.cxx + src/SimpleResourceManager.cxx + src/StreamOperators.cxx + src/TMessageSerializer.cxx + src/TableBuilder.cxx + src/TableConsumer.cxx + src/Task.cxx + src/TextControlService.cxx + src/Variant.cxx + src/WorkflowHelpers.cxx + src/WorkflowSerializationHelpers.cxx + src/WorkflowSpec.cxx + src/runDataProcessing.cxx + src/ExternalFairMQDeviceProxy.cxx + test/TestClasses.cxx + PRIVATE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/src + PUBLIC_LINK_LIBRARIES AliceO2::Common + AliceO2::Configuration + AliceO2::InfoLogger + AliceO2::Monitoring + CURL::libcurl + FairMQ::FairMQ + O2::CommonUtils + O2::FrameworkFoundation + O2::Headers + O2::MemoryResources + O2::PCG + RapidJSON::RapidJSON + arrow_shared + ms_gsl::ms_gsl + ROOT::ROOTDataFrame + O2::DebugGUI + O2::FrameworkLogger + Boost::serialization) -# create dictionary for a test class to be serialized in unit test -set(LINKDEF test/FrameworkCoreTestLinkDef.h) -set(HEADERS - test/TestClasses.h - ) +o2_target_root_dictionary(Framework + HEADERS test/TestClasses.h + LINKDEF test/FrameworkCoreTestLinkDef.h) -O2_GENERATE_LIBRARY() +if(GLFW_FOUND) + foreach(t DebugGUISokol DebugGUIGL GUITests) + o2_add_test(${t} + SOURCES test/test_${t}.cxx + COMPONENT_NAME Framework + LABELS framework + PUBLIC_LINK_LIBRARIES O2::Framework) + endforeach() + # FIXME: investigate those two failures at some point + set_property(TEST Framework/Core/test/test_DebugGUISokol.cxx + PROPERTY DISABLED True) + set_property(TEST Framework/Core/test/test_DebugGUIGL.cxx + PROPERTY DISABLED True) +endif() -# TODO: feature of macro, it deletes the variables we pass to it, set them again -# this has to be fixed in the macro implementation -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) +foreach(t + AlgorithmSpec + AnalysisTask + ASoA + BoostOptionsRetriever + CallbackRegistry + ChannelSpecHelpers + CompletionPolicy + ConfigParamRegistry + ContextRegistry + DataDescriptorMatcher + DataProcessorSpec + DataRefUtils + DataRelayer + DataSamplingCondition + DataSamplingHeader + DataSamplingPolicy + DeviceMetricsInfo + DeviceSpec + DeviceSpecHelpers + ExternalFairMQDeviceProxy + FairMQOptionsRetriever + FairMQResizableBuffer + FrameworkDataFlowToDDS + Graphviz + InfoLogger + InputRecord + Kernels + LogParsingHelpers + Parallel + PtrHelpers + Root2ArrowTable + Services + SuppressionGenerator + TMessageSerializer + TableBuilder + TimeParallelPipelining + TimesliceIndex + TypeTraits + Variants + WorkflowHelpers + WorkflowSerialization) -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_SimpleDataProcessingDevice01" - SOURCES "test/test_SimpleDataProcessingDevice01.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) + # FIXME ? The NAME parameter of o2_add_test is only needed to help the current + # o2.sh recipe. If the recipe is changed, those params can go away, if needed. -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_Parallel" - SOURCES "test/test_Parallel.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) + o2_add_test(${t} NAME test_Framework_test_${t} + SOURCES test/test_${t}.cxx + COMPONENT_NAME Framework + LABELS framework + PUBLIC_LINK_LIBRARIES O2::Framework) +endforeach() -# TODO: is this better a unit test? -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_TimePipeline" - SOURCES "test/test_TimePipeline.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) +# tests with input data -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_DebugGUISokol" - SOURCES test/test_DebugGUISokol.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) +o2_data_file(COPY test/test_DataSampling.json DESTINATION tests) -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_DebugGUIGL" - SOURCES test/test_DebugGUIGL.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) +o2_add_test(DataSampling NAME test_Framework_test_DataSampling + SOURCES test/test_DataSampling.cxx + COMPONENT_NAME Framework + LABELS framework + PUBLIC_LINK_LIBRARIES O2::Framework + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage) -Install(FILES test/test_DataSampling.json DESTINATION share/tests/) +# tests with a name not starting with test_... -set(TEST_SRCS - test/test_ASoA.cxx - test/test_AnalysisTask.cxx - test/test_AlgorithmSpec.cxx - test/test_BoostOptionsRetriever.cxx - test/test_CallbackRegistry.cxx - test/test_ChannelSpecHelpers.cxx - test/test_ContextRegistry.cxx - test/test_ConfigParamRegistry.cxx - test/test_CompletionPolicy.cxx - test/test_DataDescriptorMatcher.cxx - test/test_DataProcessorSpec.cxx - test/test_DataRefUtils.cxx - test/test_DataRelayer.cxx - test/test_DataSampling.cxx - test/test_DataSamplingCondition.cxx - test/test_DataSamplingHeader.cxx - test/test_DataSamplingPolicy.cxx - test/unittest_DataSpecUtils.cxx - test/test_DeviceMetricsInfo.cxx - test/test_DeviceSpec.cxx - test/test_ExternalFairMQDeviceProxy.cxx - test/test_FairMQResizableBuffer.cxx - test/test_FrameworkDataFlowToDDS.cxx - test/test_FairMQOptionsRetriever.cxx - test/test_GUITests.cxx - test/test_Graphviz.cxx - test/test_InfoLogger.cxx - test/test_InputRecord.cxx - test/test_Kernels.cxx - test/test_LogParsingHelpers.cxx - test/test_PtrHelpers.cxx - test/test_Root2ArrowTable.cxx - test/test_Services.cxx - test/unittest_SimpleOptionsRetriever.cxx - test/test_SuppressionGenerator.cxx - test/test_TimesliceIndex.cxx - test/test_TMessageSerializer.cxx - test/test_TableBuilder.cxx - test/test_TimeParallelPipelining.cxx - test/test_TypeTraits.cxx - test/test_Variants.cxx - test/test_WorkflowHelpers.cxx - test/test_WorkflowSerialization.cxx - test/test_DeviceSpecHelpers.cxx - ) +o2_add_test(unittest_DataSpecUtils NAME test_Framework_unittest_DataSpecUtils + SOURCES test/unittest_DataSpecUtils.cxx + COMPONENT_NAME Framework + LABELS framework + PUBLIC_LINK_LIBRARIES O2::Framework) -set(BENCH_SRCS - test/benchmark_ContextRegistry.cxx - test/benchmark_DataDescriptorMatcher.cxx - test/benchmark_DataRelayer.cxx - test/benchmark_DeviceMetricsInfo.cxx - test/benchmark_InputRecord.cxx - test/benchmark_TableBuilder.cxx - ) +o2_add_test(unittest_SimpleOptionsRetriever NAME + test_Framework_unittest_SimpleOptionsRetriever + SOURCES test/unittest_SimpleOptionsRetriever.cxx + COMPONENT_NAME Framework + LABELS framework + PUBLIC_LINK_LIBRARIES O2::Framework) -set(WORKFLOW_SRCS - test/test_CustomGUIGL.cxx - test/test_SimpleStatefulProcessing01.cxx - #test/test_GenericSource.cxx - test/test_CustomGUISokol.cxx - #test/test_Task.cxx - test/test_Forwarding.cxx - test/test_SingleDataSource.cxx - test/test_ParallelPipeline.cxx - test/test_DataAllocator.cxx - test/test_SimpleRDataFrameProcessing.cxx - test/test_ParallelProducer.cxx - test/test_SimpleTimer.cxx - test/test_CallbackService.cxx - #test/test_CCDBFetcher.cxx - test/test_DanglingOutputs.cxx - test/test_BoostSerializedProcessing.cxx - test/test_DanglingInputs.cxx - test/test_SimpleStringProcessing.cxx - test/test_SimpleDataProcessingDevice01.cxx - ) +# benchmarks -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME O2FrameworkCore_benchmark_bucket - TEST_SRCS ${BENCH_SRCS} -) +foreach(b + ContextRegistry + DataDescriptorMatcher + DataRelayer + DeviceMetricsInfo + InputRecord + TableBuilder) + o2_add_test(benchmark_${b} NAME test_Framework_benchmark_${b} + SOURCES test/benchmark_${b}.cxx + COMPONENT_NAME Framework + LABELS framework benchmark + PUBLIC_LINK_LIBRARIES O2::Framework benchmark::benchmark) +endforeach() -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} - TIMEOUT 30 -) +# #####################################################@ -# Workflows have to be executed with command line option --run -# The merging functionality would simply dump the configuration on std output because of -# the connected log pipe -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${WORKFLOW_SRCS} - TIMEOUT 30 - COMMAND_LINE_ARGS --run -) +foreach(w + BoostSerializedProcessing + CallbackService + CustomGUIGL + CustomGUISokol + DanglingInputs + DanglingOutputs + DataAllocator + Forwarding + ParallelPipeline + ParallelProducer + SimpleDataProcessingDevice01 + SimpleRDataFrameProcessing + SimpleStatefulProcessing01 + SimpleStringProcessing + SimpleTimer + SingleDataSource) + o2_add_test(${w} NAME test_Framework_test_${w} + SOURCES test/test_${w}.cxx + COMPONENT_NAME Framework + LABELS framework workflow + PUBLIC_LINK_LIBRARIES O2::Framework + TIMEOUT 30 + COMMAND_LINE_ARGS --run) +endforeach() # specific tests which needs command line options -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} +o2_add_test( + ProcessorOptions NAME test_Framework_test_ProcessorOptions + SOURCES test/test_ProcessorOptions.cxx + COMPONENT_NAME Framework + LABELS framework workflow TIMEOUT 60 - - TEST_SRCS - test/test_ProcessorOptions.cxx - + PUBLIC_LINK_LIBRARIES O2::Framework COMMAND_LINE_ARGS - --global-config require-me - --run - # Note: the group switch makes process consumer parse only the group arguments - --consumer "--global-config consumer-config --local-option hello-aliceo2 --a-boolean3 --an-int2 20 --a-double2 22." -) + --global-config require-me --run + # Note: the group switch makes process consumer parse only the group + arguments --consumer + "--global-config consumer-config --local-option hello-aliceo2 --a-boolean3 --an-int2 20 --a-double2 22." + ) diff --git a/Framework/DebugGUI/CMakeLists.txt b/Framework/DebugGUI/CMakeLists.txt index 02d72b7c072c3..1370b168a147d 100644 --- a/Framework/DebugGUI/CMakeLists.txt +++ b/Framework/DebugGUI/CMakeLists.txt @@ -1,75 +1,43 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". -# -# See http://alice-o2.web.cern.ch/ for full licensing information. -# +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. - - - -if (GLFW_FOUND) - set(MODULE_BUCKET_NAME glfw_bucket) +if(GLFW_FOUND) set(GUI_BACKEND - src/imgui_impl_glfw_gl3.cpp - src/gl3w.c - src/Sokol3DUtils.cxx - src/GL3DUtils.cxx - src/HandMade3DImpl.cxx - src/DebugGUI.cxx - ) + src/imgui_impl_glfw_gl3.cpp + src/gl3w.c + src/Sokol3DUtils.cxx + src/GL3DUtils.cxx + src/HandMade3DImpl.cxx + src/DebugGUI.cxx) + set(GUI_TARGET glfw) else() - set(MODULE_BUCKET_NAME headless_bucket) - set(GUI_BACKEND - src/Dummy3DUtils.cxx - src/DummyDebugGUI.cxx - ) + set(GUI_BACKEND src/Dummy3DUtils.cxx src/DummyDebugGUI.cxx) + set(GUI_TARGET "") endif() -set(MODULE_NAME "DebugGUI") -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/imgui.cpp - src/imgui_draw.cpp - src/imgui_extras.cpp - ${GUI_BACKEND} - ) - -set(HEADERS - include/DebugGUI/imconfig.h - include/DebugGUI/imgui.h - include/DebugGUI/imgui_extras.h) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -# TODO: feature of macro, it deletes the variables we pass to it, set them again -# this has to be fixed in the macro implementation -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -if (GLFW_FOUND) -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_ImGUI" - SOURCES test/test_ImGUI.cpp test/imgui_demo.cpp - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) +o2_add_library(DebugGUI + SOURCES src/imgui.cpp src/imgui_draw.cpp src/imgui_extras.cpp + ${GUI_BACKEND} + PUBLIC_LINK_LIBRARIES O2::FrameworkFoundation ${GUI_TARGET}) + +if(GLFW_FOUND) + o2_add_executable(imgui + SOURCES + SOURCES test/test_ImGUI.cpp test/imgui_demo.cpp + PUBLIC_LINK_LIBRARIES O2::DebugGUI + COMPONENT_NAME Framework) endif() -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_DebugGUI_test_ImGUIHeadless" - SOURCES test/test_ImGUIHeadless.cpp test/imgui_demo.cpp - - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) -add_test_wrap(NAME test_DebugGUI_test_ImGUIHeadless COMMAND test_DebugGUI_test_ImGUIHeadless) -target_link_libraries(test_DebugGUI_test_ImGUIHeadless Boost::unit_test_framework) -set_tests_properties(test_DebugGUI_test_ImGUIHeadless PROPERTIES TIMEOUT 30) +o2_add_test(ImGUIHeadless + SOURCES test/test_ImGUIHeadless.cpp test/imgui_demo.cpp + PUBLIC_LINK_LIBRARIES O2::DebugGUI + COMPONENT_NAME Framework + LABELS gui + TIMEOUT 30) diff --git a/Framework/Foundation/CMakeLists.txt b/Framework/Foundation/CMakeLists.txt index 26838faa6df8e..20b7728fc6156 100644 --- a/Framework/Foundation/CMakeLists.txt +++ b/Framework/Foundation/CMakeLists.txt @@ -1,38 +1,16 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See http://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(MODULE_NAME "FrameworkFoundation") -set(MODULE_BUCKET_NAME O2FrameworkFoundation_bucket) +o2_add_header_only_library(FrameworkFoundation) -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS src/Traits.cxx) -set(HEADERS - include/Framework/CompilerBuiltins.h - include/Framework/FunctionalHelpers.h - include/Framework/Signpost.h - include/Framework/Traits.h - include/Framework/VariantHelpers.h -) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME O2FrameworkFoundation_bucket - TEST_SRCS test/test_Traits.cxx -) - -install(FILES ${HEADERS} DESTINATION include/Framework) +o2_add_test(test_Traits NAME test_FrameworkFoundation_test_Traits + COMPONENT_NAME FrameworkFoundation + SOURCES test/test_Traits.cxx + PUBLIC_LINK_LIBRARIES O2::FrameworkFoundation) diff --git a/Framework/Logger/CMakeLists.txt b/Framework/Logger/CMakeLists.txt index b836b51796089..617e4bdf57341 100644 --- a/Framework/Logger/CMakeLists.txt +++ b/Framework/Logger/CMakeLists.txt @@ -1,34 +1,23 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See http://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(MODULE_NAME "FrameworkLogger") -set(MODULE_BUCKET_NAME O2FrameworkLogger_bucket) +o2_add_library(FrameworkLogger + SOURCES src/Logger.cxx + PUBLIC_LINK_LIBRARIES FairLogger::FairLogger) # FIXME: should be + # changed to {fmt} + # once we have that + # as a dependency -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS src/Logger.cxx) -set(HEADERS - include/Framework/Logger.h -) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME O2FrameworkLogger_bucket - TEST_SRCS test/unittest_Logger.cxx -) - -install(FILES ${HEADERS} DESTINATION include/Framework) +# FIXME: the NAME parameter is just there to ease the comparison with previous +# test names, can be omitted later on +o2_add_test(Logger NAME test_FrameworkLogger_unittest_Logger + SOURCES test/unittest_Logger.cxx + COMPONENT_NAME framework + PUBLIC_LINK_LIBRARIES O2::FrameworkLogger) diff --git a/Framework/TestWorkflows/CMakeLists.txt b/Framework/TestWorkflows/CMakeLists.txt index 97821545812da..594b58bc508e9 100644 --- a/Framework/TestWorkflows/CMakeLists.txt +++ b/Framework/TestWorkflows/CMakeLists.txt @@ -1,173 +1,121 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See http://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. - -set(MODULE_NAME "TestWorkflows") -set(MODULE_BUCKET_NAME FrameworkApplication_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) -set(SRCS - src/dummy.cxx - ) - -set(HEADERS - src/o2_sim_its_ALP3.h - src/o2_sim_tpc.h - ) - -## TODO: feature of macro, it deletes the variables we pass to it, set them again -## this has to be fixed in the macro implementation -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-dummy-workflow" - SOURCES "src/o2DummyWorkflow.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_o2RootMessageWorkflow" - SOURCES "src/test_o2RootMessageWorkflow.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-diamond-workflow" - SOURCES "src/o2DiamondWorkflow.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-parallel-workflow" - SOURCES "src/o2ParallelWorkflow.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-flp-qualification" - SOURCES "src/flpQualification.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-sync-reconstruction-dummy" - SOURCES "src/o2SyncReconstructionDummy.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-aod-dummy-workflow" - SOURCES "src/o2AODDummy.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-d0-analysis" - SOURCES "src/o2D0Analysis.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-simple-tracks-analysis" - SOURCES "src/o2SimpleTracksAnalysis.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-analysis-task-example" - SOURCES "src/o2AnalysisTaskExample.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-data-query-workflow" - SOURCES "src/o2DataQueryWorkflow.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_MakeDPLObjects" - SOURCES "test/test_MakeDPLObjects.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_RawDeviceInjector" - SOURCES "src/test_RawDeviceInjector.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "test_CompletionPolicies" - SOURCES "src/test_CompletionPolicies.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-datasampling-pod-and-root" - SOURCES "src/dataSamplingPodAndRoot.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-datasampling-parallel" - SOURCES "src/dataSamplingParallel.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-datasampling-time-pipeline" - SOURCES "src/dataSamplingTimePipeline.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -# These should be enabled only if one uses the full O2 default -if (PYTHIA8_INCLUDE_DIR) - O2_FRAMEWORK_WORKFLOW( - WORKFLOW_NAME "o2ITSClusterizers" - DETECTOR_BUCKETS its_simulation_bucket - its_reconstruction_bucket - passive_detector_bucket - generators_base_bucket - generators_bucket - run_bucket - SOURCES src/test_o2ITSCluserizer.cxx src/o2_sim_its_ALP3.cxx - ) - - O2_FRAMEWORK_WORKFLOW( - WORKFLOW_NAME "o2TPCSimulation" - DETECTOR_BUCKETS tpc_simulation_bucket - tpc_reconstruction_bucket - passive_detector_bucket - generators_base_bucket - generators_bucket - run_bucket - SOURCES src/test_o2TPCSimulation.cxx src/o2_sim_tpc.cxx - ) -ENDIF(PYTHIA8_INCLUDE_DIR) +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# FIXME Is this one supposed to be a header only library (in which case the .h +# to be installed should be in include/TestWorkflows) or not a library at all ? +# o2_add_library(TestWorkflows SOURCES src/dummy.cxx +# +# set(HEADERS src/o2_sim_its_ALP3.h src/o2_sim_tpc.h ) +# + +o2_add_executable(dummy-workflow + SOURCES src/o2DummyWorkflow.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(o2rootmessage-workflow + SOURCES "src/test_o2RootMessageWorkflow.cxx" + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(diamond-workflow + SOURCES src/o2DiamondWorkflow.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(parallel-workflow + SOURCES src/o2ParallelWorkflow.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(flp-qualification + SOURCES src/flpQualification.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(sync-reconstruction-dummy + SOURCES src/o2SyncReconstructionDummy.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(aod-dummy-workflow + SOURCES src/o2AODDummy.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(d0-analysis + SOURCES src/o2D0Analysis.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(simple-tracks-analysis + SOURCES src/o2SimpleTracksAnalysis.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(analysis-task-example + SOURCES src/o2AnalysisTaskExample.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(data-query-workflow + SOURCES src/o2DataQueryWorkflow.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +# FIXME: given its name, should this one be a test instead of an executable ? +o2_add_executable(test_MakeDPLObjects + SOURCES test/test_MakeDPLObjects.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +# FIXME: given its name, should this one be a test instead of an executable ? +o2_add_executable(test_RawDeviceInjector + SOURCES src/test_RawDeviceInjector.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +# FIXME: given its name, should this one be a test instead of an executable ? +o2_add_executable(test_CompletionPolicies + SOURCES src/test_CompletionPolicies.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(datasampling-pod-and-root + SOURCES src/dataSamplingPodAndRoot.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(datasampling-parallel + SOURCES src/dataSamplingParallel.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +o2_add_executable(datasampling-time-pipeline + SOURCES src/dataSamplingTimePipeline.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME TestWorkflows) + +if(BUILD_SIMULATION) + o2_add_executable( + ITSClusterizers + COMPONENT_NAME TestWorkflows + PUBLIC_LINK_LIBRARIES O2::ITSSimulation O2::ITSReconstruction + O2::DetectorsPassive O2::Generators O2::Framework + SOURCES src/test_o2ITSCluserizer.cxx src/o2_sim_its_ALP3.cxx) + + o2_add_executable(TPCSimulation + COMPONENT_NAME TestWorkflows + PUBLIC_LINK_LIBRARIES O2::TPCSimulation + O2::TPCReconstruction + O2::DetectorsPassive O2::Generators + O2::Framework + SOURCES src/test_o2TPCSimulation.cxx src/o2_sim_tpc.cxx) +endif() diff --git a/Framework/Utils/CMakeLists.txt b/Framework/Utils/CMakeLists.txt index f28b751f25148..a643a7a3ed2f1 100644 --- a/Framework/Utils/CMakeLists.txt +++ b/Framework/Utils/CMakeLists.txt @@ -1,70 +1,58 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See http://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. - -set(MODULE_NAME "DPLUtils") -set(MODULE_BUCKET_NAME DPLUtils_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) -set(SRCS - src/Utils.cxx - src/DPLBroadcaster.cxx - src/DPLGatherer.cxx - src/DPLMerger.cxx - src/DPLRouter.cxx - test/DPLBroadcasterMerger.cxx - test/DPLOutputTest.cxx - ) - -set(HEADERS - include/${MODULE_NAME}/Utils.h - include/${MODULE_NAME}/RootTreeReader.h - include/${MODULE_NAME}/RootTreeWriter.h - include/${MODULE_NAME}/MakeRootTreeWriterSpec.h - ) - -## TODO: feature of macro, it deletes the variables we pass to it, set them again -## this has to be fixed in the macro implementation -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -O2_FRAMEWORK_WORKFLOW( - WORKFLOW_NAME "test_DPLBroadcasterMerger" - DETECTOR_BUCKETS DPLUtils_bucket - SOURCES src/Utils.cxx test/test_DPLBroadcasterMerger.cxx test/DPLBroadcasterMerger.cxx src/DPLMerger.cxx src/DPLBroadcaster.cxx -) - -O2_FRAMEWORK_WORKFLOW( - WORKFLOW_NAME "test_DPLOutputTest" - DETECTOR_BUCKETS DPLUtils_bucket - SOURCES src/Utils.cxx test/test_DPLOutputTest.cxx test/DPLOutputTest.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS - test/test_RootTreeWriter.cxx - - TIMEOUT 60 -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS - test/test_RootTreeReader.cxx - test/test_RootTreeWriterWorkflow.cxx - - TIMEOUT 60 - COMMAND_LINE_ARGS - --run -) +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(DPLUtils + SOURCES src/Utils.cxx + src/DPLBroadcaster.cxx + src/DPLGatherer.cxx + src/DPLMerger.cxx + src/DPLRouter.cxx + test/DPLBroadcasterMerger.cxx + test/DPLOutputTest.cxx + PUBLIC_LINK_LIBRARIES O2::Framework) + +o2_add_test(DPLBroadcasterMerger + SOURCES test/test_DPLBroadcasterMerger.cxx src/Utils.cxx + test/DPLBroadcasterMerger.cxx src/DPLMerger.cxx + src/DPLBroadcaster.cxx + PUBLIC_LINK_LIBRARIES O2::DPLUtils + COMPONENT_NAME DPLUtils + LABELS dplutils) + +o2_add_test(DPLOutput + SOURCES test/test_DPLOutputTest.cxx src/Utils.cxx + test/DPLOutputTest.cxx + PUBLIC_LINK_LIBRARIES O2::DPLUtils + COMPONENT_NAME DPLUtils + LABELS long dplutils) + +o2_add_test(RootTreeWriter + SOURCES test/test_RootTreeWriter.cxx + PUBLIC_LINK_LIBRARIES O2::DPLUtils + COMPONENT_NAME DPLUtils + LABELS dplutils) + +o2_add_test(RootTreeWriterWorkflow + NO_BOOST_TEST + SOURCES test/test_RootTreeWriterWorkflow.cxx + PUBLIC_LINK_LIBRARIES O2::DPLUtils + COMPONENT_NAME DPLUtils + LABELS dplutils + COMMAND_LINE_ARGS --run) +# FIXME: re-enable this when random failures understood +set_property(TEST Framework/Utils/test/test_RootTreeWriterWorkflow.cxx + PROPERTY DISABLED TRUE) + +o2_add_test(RootTreeReader + SOURCES test/test_RootTreeReader.cxx + PUBLIC_LINK_LIBRARIES O2::DPLUtils + COMPONENT_NAME DPLUtils + LABELS dplutils + COMMAND_LINE_ARGS --run) diff --git a/GPU/CMakeLists.txt b/GPU/CMakeLists.txt index 54a7a7ababa83..f38de4d1cadee 100644 --- a/GPU/CMakeLists.txt +++ b/GPU/CMakeLists.txt @@ -1,25 +1,27 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(ALIGPU_BUILD_TYPE "O2") -#option(ENABLE_CUDA "Build GPU tracker using CUDA" OFF) -option(ENABLE_OPENCL "Build GPU tracker using OpenCL" OFF) -option(ENABLE_HIP "Build GPU tracker using HIP" OFF) +# Subdirectories will be compiled with O2 / AliRoot / Standalone To simplify the +# CMake, variables are defined for Sources / Headers first. Then, the actual +# CMake build scripts use these variables. +# +# SRCS: Common Sources for all builds HDRS_CINT: Headers for ROOT dictionary +# (always) HDRS_CINT_ALIROOT: Headers for ROOT dictionary (only in AliRoot) +# HDRS_CINT_O2: Headers for ROOT dictionary (only for O2) HDRS_INSTALL: Headers +# for installation only -# Libraries -add_subdirectory(Common) -add_subdirectory(GPUTracking) +if(NOT ALIGPU_BUILD_TYPE STREQUAL "O2") + add_subdirectory(Common) +endif() add_subdirectory(TPCFastTransformation) -add_subdirectory(TPCSpaceChargeBase) +add_subdirectory(GPUTracking) +if(NOT ALIGPU_BUILD_TYPE STREQUAL "Standalone") + add_subdirectory(TPCSpaceChargeBase) +endif() diff --git a/GPU/Common/CMakeLists.txt b/GPU/Common/CMakeLists.txt index 8944590662acf..acc841d2d7083 100644 --- a/GPU/Common/CMakeLists.txt +++ b/GPU/Common/CMakeLists.txt @@ -1,20 +1,18 @@ -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - set(MODULE O2GPUCommon) -elseif(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - set(MODULE GPUCommon) -endif() - -set(SRCS - GPUCommon.cxx -) +set(MODULE GPUCommon) -set (HDRS - FlatObject.h -) +set(HDRS_CINT FlatObject.h) -set (HDRS2 +set(HDRS_INSTALL GPUCommonAlgorithm.h GPUCommonDef.h GPUCommonDefAPI.h @@ -26,37 +24,47 @@ set (HDRS2 GPUDef.h GPUDefConstantsAndSettings.h GPUDefGPUParameters.h - GPUDefOpenCL12Templates.h -) + GPUDefOpenCL12Templates.h) + +if(ALIGPU_BUILD_TYPE STREQUAL "O2") + o2_add_library(${MODULE} + TARGETVARNAME targetName + PUBLIC_LINK_LIBRARIES FairLogger::FairLogger ROOT::RIO + PUBLIC_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}) + + o2_target_root_dictionary(${MODULE} + HEADERS ${HDRS_CINT} + LINKDEF GPUCommonLinkDef.h) + + target_compile_definitions(${targetName} PRIVATE GPUCA_O2_LIB + GPUCA_TPC_GEOMETRY_O2 HAVE_O2HEADERS) + + install(FILES ${HDRS_CINT} ${HDRS_INSTALL} DESTINATION include/GPU) +endif() -#Default cmake build script for AliRoot if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - # Add a library to the project using the specified source files - add_library_tested(${MODULE} SHARED ${SRCS}) + add_definitions(-DGPUCA_ALIROOT_LIB) - # Additional compilation flags - set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS "") + set(SRCS ${SRCS} GPUCommon.cxx) - # System dependent: Modify the way the library is build - if(${CMAKE_SYSTEM} MATCHES Darwin) - set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") - endif(${CMAKE_SYSTEM} MATCHES Darwin) + # Add a library to the project using the specified source files + add_library_tested(Ali${MODULE} SHARED ${SRCS}) - # Installation - install(TARGETS ${MODULE} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) + # Additional compilation flags + set_target_properties(Ali${MODULE} PROPERTIES COMPILE_FLAGS "") - install(FILES ${HDRS} ${HDRS2} DESTINATION include) + # System dependent: Modify the way the library is build + if(${CMAKE_SYSTEM} MATCHES Darwin) + set_target_properties(Ali${MODULE} + PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + endif(${CMAKE_SYSTEM} MATCHES Darwin) + + # Installation + install(TARGETS Ali${MODULE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + + install(FILES ${HDRS_CINT} ${HDRS_INSTALL} DESTINATION include) endif() -#Default cmake build script for O2 -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - Set(HEADERS ${HDRS}) - Set(LINKDEF GPUCommonLinkDef.h) - Set(LIBRARY_NAME ${MODULE}) - set(BUCKET_NAME GPUCommon_bucket) +if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") - O2_GENERATE_LIBRARY() - install(FILES ${HDRS} ${HDRS2} DESTINATION include/GPU) endif() diff --git a/GPU/GPUTracking/Base/cuda/CMakeLists.txt b/GPU/GPUTracking/Base/cuda/CMakeLists.txt index 241c68f75f8ce..52cbab6fc2251 100644 --- a/GPU/GPUTracking/Base/cuda/CMakeLists.txt +++ b/GPU/GPUTracking/Base/cuda/CMakeLists.txt @@ -1,135 +1,70 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** - -cmake_minimum_required(VERSION 3.9) - -# Module -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - set(MODULE O2GPUTrackingCUDA) -elseif(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - set(MODULE GPUTrackingCUDA) -endif() -set(DEFINITIONS ${DEFINITIONS} GPUCA_GPULIBRARY=CUDA) - -option(CUDA_GCCBIN "GCC binary to use for compiling host part of CUDA code for systems with multiple GCC versions installed" OFF) - -get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) -if (NOT CUDA IN_LIST LANGUAGES) #We need to handle finding CUDA in AliRoot case - if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") - set(CMAKE_CUDA_FLAGS "-Xptxas -O0 -Xcompiler -O0") - else() - set(CMAKE_CUDA_FLAGS "-Xptxas -O4 -Xcompiler -O4 -use_fast_math") - endif() - if(CUDA_GCCBIN) - message(STATUS "Using as CUDA GCC version: ${CUDA_GCCBIN}") - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --compiler-bindir ${CUDA_GCCBIN}") - endif() - enable_language(CUDA) - if(CUDA_GCCBIN) - #Ugly hack!: Otherwise CUDA includes unwanted old GCC libraries leading to version conflicts - set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "$ENV{CUDA_PATH}/lib64") - endif() - set(CMAKE_CUDA_STANDARD 14) - set(CMAKE_CUDA_STANDARD_REQUIRED ON) - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr -DENABLE_CUDA --compiler-options \"${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}} -std=c++14\"") -endif() - -#Another ugly hack!: nvcc dies due to O2 link flags, so we strip them for device linkage -set(CMAKE_CUDA_DEVICE_LINK_LIBRARY " -Xcompiler=-fPIC -Wno-deprecated-gpu-targets -shared -dlink -o ") +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) -if (NOT CUDA IN_LIST LANGUAGES) - message(FATAL_ERROR "CMake could not find CUDA (${LANGUAGES})") -endif() -message( STATUS "Building GPUTracking with CUDA support" ) +set(MODULE GPUTrackingCUDA) -#for convenience -set(GPUDIR ${CMAKE_SOURCE_DIR}/GPU/GPUTracking) +message(STATUS "Building GPUTracking with CUDA support") -# Module include folder -include_directories(${GPUDIR}/Base/cuda) +set(SRCS GPUReconstructionCUDA.cu) +set(HDRS GPUReconstructionCUDA.h GPUReconstructionCUDAInternals.h) -# Additional include folders in alphabetical order except ROOT -include_directories(SYSTEM ${ROOT_INCLUDE_DIR}) -if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - include_directories(${CMAKE_SOURCE_DIR}/HLT/BASE) -else() #if we do not build for AliRoot, for the time being we still need some dummy headers for some definitions - include_directories(${GPUDIR}/HLTHeaders ${GPUDIR}/Standalone/include) -endif() -if(ALIGPU_BUILD_TYPE STREQUAL "O2") #We need to add src dirs of O2 to include cxx files for CUDA compilation - include_directories(${CMAKE_SOURCE_DIR}/Detectors/TRD/base/src) - include_directories(${CMAKE_SOURCE_DIR}/Detectors/Base/src) -endif() +if(ALIGPU_BUILD_TYPE STREQUAL "O2") + o2_add_library( + ${MODULE} + SOURCES ${SRCS} + PRIVATE_INCLUDE_DIRECTORIES + ${CMAKE_SOURCE_DIR}/Detectors/Base/src + ${CMAKE_SOURCE_DIR}/Detectors/TRD/base/src + ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/tracking/cuda/include + PUBLIC_LINK_LIBRARIES O2::GPUTracking + TARGETVARNAME targetName) -# Sources in alphabetical order -set(SRCS - GPUReconstructionCUDA.cu - ) + target_compile_definitions( + ${targetName} PUBLIC GPUCA_GPULIBRARY=CUDA + $) -# Headers from sources -set(CINTHDRS - GPUReconstructionCUDA.h - ) + target_compile_options(${targetName} PUBLIC --expt-relaxed-constexpr) -set(HDRS - ${CINTHDRS} - GPUReconstructionCUDAInternals.h - ) + set_target_properties(${targetName} PROPERTIES LINKER_LANGUAGE CXX) -foreach (def ${DEFINITIONS}) - add_definitions(-D${def}) -endforeach() + install(FILES ${HDRS} DESTINATION include/GPU) +endif() -#Default cmake build script for AliRoot if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - # Generate the dictionary - # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument - get_directory_property(incdirs INCLUDE_DIRECTORIES) - generate_dictionary("${MODULE}" "" "${CINTHDRS}" "${incdirs}") + add_definitions(-DGPUCA_GPULIBRARY=CUDA) - # Generate the ROOT map - # Dependecies - generate_rootmap("${MODULE}" "" "") + # Generate the dictionary + get_directory_property(incdirs INCLUDE_DIRECTORIES) + message(STATUS "TEST ${incdirs}") + generate_dictionary("Ali${MODULE}" "" "GPUReconstructionCUDA.h" + "${incdirs} .") - # Add a library to the project using the specified source files - add_library_tested(${MODULE} SHARED ${SRCS} G__${MODULE}.cxx) - #CUDA run-time and driver - target_link_libraries(${MODULE} GPUTracking) + # Generate the ROOT map Dependecies + generate_rootmap("Ali${MODULE}" "" "") - # Additional compilation flags - set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS "") + # Add a library to the project using the specified source files + add_library_tested(Ali${MODULE} SHARED ${SRCS} G__Ali${MODULE}.cxx) + # CUDA run-time and driver + target_link_libraries(Ali${MODULE} AliGPUTracking) - # Installation - install(TARGETS ${MODULE} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) + # Additional compilation flags + set_target_properties(Ali${MODULE} PROPERTIES COMPILE_FLAGS "") - install(FILES ${HDRS} DESTINATION include) -endif() + # Installation + install(TARGETS Ali${MODULE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) -#Default cmake build script for O2 -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - set(LIBRARY_NAME ${MODULE}) - set(BUCKET_NAME GPUTrackingCUDA_bucket) - - O2_GENERATE_LIBRARY() - install(FILES ${HDRS} DESTINATION include/GPU) - - target_link_libraries(${MODULE} ${CUDA_LIBRARIES} O2GPUTracking) - set_target_properties(${MODULE} PROPERTIES LINKER_LANGUAGE CXX) + install(FILES ${HDRS} DESTINATION include) endif() -#Another hack, the above hack removes also the CUDA libraries that are actually needed... -target_link_libraries(${MODULE} "-lcudart -lcuda -lcudadevrt") +if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") + add_definitions(-DGPUCA_GPULIBRARY=CUDA) + add_library(${MODULE} SHARED ${SRCS}) + install(TARGETS GPUTrackingCUDA) +endif() diff --git a/GPU/GPUTracking/Base/hip/CMakeLists.txt b/GPU/GPUTracking/Base/hip/CMakeLists.txt index d58064141c6f9..4d2cd8f7c52c4 100644 --- a/GPU/GPUTracking/Base/hip/CMakeLists.txt +++ b/GPU/GPUTracking/Base/hip/CMakeLists.txt @@ -1,130 +1,76 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** - -cmake_minimum_required(VERSION 3.9) - -# Module -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - set(MODULE O2GPUTrackingHIP) -elseif(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - set(MODULE GPUTrackingHIP) - if(NOT DEFINED HIP_PATH) - if(NOT DEFINED ENV{HIP_PATH}) - set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to which HIP has been installed") - else() - set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to which HIP has been installed") - endif() - endif() - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${HIP_PATH}/cmake") - if(NOT DEFINED HCC_PATH) - # Workaround to fix a potential FindHIP bug: find HCC_PATH ourselves - set(_HCC_PATH "${HIP_PATH}/../hcc") - get_filename_component(HCC_PATH ${_HCC_PATH} ABSOLUTE CACHE) - unset(_HCC_PATH) - endif() - find_package(HIP REQUIRED) - if(HIP_FOUND) - message(STATUS "Found HIP: " ${HIP_VERSION}) - else() - message(FATAL_ERROR "Could not find HIP. Ensure that HIP is either installed in /opt/rocm/hip or the variable HIP_PATH is set to point to the right location.") - endif() - add_definitions(-DENABLE_HIP) -endif() -set(DEFINITIONS ${DEFINITIONS} GPUCA_GPULIBRARY=HIP) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(CMAKE_CXX_COMPILER ${HIP_PATH}/bin/hipcc) -if(HIP_AMDGPUTARGET) -add_compile_options(--amdgpu-target=${HIP_AMDGPUTARGET}) -add_link_options(--amdgpu-target=${HIP_AMDGPUTARGET}) -endif() -add_compile_options(--amdgpu-target=gfx906 -Wno-unused-command-line-argument -Wno-invalid-constexpr) +set(MODULE GPUTrackingHIP) -message( STATUS "Building GPUTracking with HIP support" ) +set(CMAKE_CXX_COMPILER ${hip_HIPCC_EXECUTABLE}) -#for convenience -set(GPUDIR ${CMAKE_SOURCE_DIR}/GPU/GPUTracking) +message(STATUS "Building GPUTracking with HIP support") -# Module include folder -include_directories(${GPUDIR}/Base/hip) +set(SRCS GPUReconstructionHIP.hip.cpp) +set(HDRS GPUReconstructionHIP.h GPUReconstructionHIPInternals.h) -# Additional include folders in alphabetical order except ROOT -include_directories(SYSTEM ${ROOT_INCLUDE_DIR}) -if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - include_directories(${CMAKE_SOURCE_DIR}/HLT/BASE) -else() #if we do not build for AliRoot, for the time being we still need some dummy headers for some definitions - include_directories(${GPUDIR}/HLTHeaders ${GPUDIR}/Standalone/include) -endif() -if(ALIGPU_BUILD_TYPE STREQUAL "O2") #We need to add src dirs of O2 to include cxx files for HIP compilation - include_directories(${CMAKE_SOURCE_DIR}/Detectors/TRD/base/src) - include_directories(${CMAKE_SOURCE_DIR}/Detectors/Base/src) +if(ALIGPU_BUILD_TYPE STREQUAL "O2") + o2_add_library( + ${MODULE} + SOURCES ${SRCS} + PUBLIC_LINK_LIBRARIES O2::GPUTracking hip::host hip::device + PUBLIC_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/Detectors/TRD/base/src + ${CMAKE_SOURCE_DIR}/Detectors/Base/src + TARGETVARNAME targetName) + + target_compile_definitions( + ${targetName} PUBLIC GPUCA_GPULIBRARY=HIP + $) + + install(FILES ${HDRS} DESTINATION include/GPU) endif() -# Sources in alphabetical order -set(SRCS - GPUReconstructionHIP.hip.cpp - ) - -# Headers from sources -set(CINTHDRS - GPUReconstructionHIP.h - ) - -set(HDRS - ${CINTHDRS} - GPUReconstructionHIPInternals.h - ) - -foreach (def ${DEFINITIONS}) - add_definitions(-D${def}) -endforeach() - -#Default cmake build script for AliRoot if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - # Generate the dictionary - # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument - get_directory_property(incdirs INCLUDE_DIRECTORIES) - generate_dictionary("${MODULE}" "" "${CINTHDRS}" "${incdirs}") + add_definitions(-DGPUCA_GPULIBRARY=HIP) - # Generate the ROOT map - # Dependecies - generate_rootmap("${MODULE}" "" "") + # Generate the dictionary + get_directory_property(incdirs INCLUDE_DIRECTORIES) + generate_dictionary("Ali${MODULE}" "" "GPUReconstructionHIP.h" "${incdirs} .") - # Add a library to the project using the specified source files - add_library_tested(${MODULE} SHARED ${SRCS} G__${MODULE}.cxx) - #HIP run-time and driver - target_link_libraries(${MODULE} GPUTracking) + # Generate the ROOT map Dependecies + generate_rootmap("Ali${MODULE}" "" "") - # Additional compilation flags - set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS "") + # Add a library to the project using the specified source files + add_library_tested(Ali${MODULE} SHARED ${SRCS} G__Ali${MODULE}.cxx) + # HIP run-time and driver + target_link_libraries(Ali${MODULE} AliGPUTracking) - # Installation - install(TARGETS ${MODULE} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) + # Additional compilation flags + set_target_properties(Ali${MODULE} PROPERTIES COMPILE_FLAGS "") - install(FILES ${HDRS} DESTINATION include) -endif() + # Installation + install(TARGETS Ali${MODULE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) -#Default cmake build script for O2 -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - Set(LIBRARY_NAME ${MODULE}) - set(BUCKET_NAME GPUTrackingHIP_bucket) + install(FILES ${HDRS} DESTINATION include) + set(targetName "Ali${MODULE}") +endif() - O2_GENERATE_LIBRARY() - install(FILES ${HDRS} DESTINATION include/GPU) +if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") + add_definitions(-DGPUCA_GPULIBRARY=HIP) + add_library(${MODULE} SHARED ${SRCS}) + set(targetName "${MODULE}") + install(TARGETS GPUTrackingHIP) +endif() - target_link_libraries(${MODULE} ${HIP_LIBRARIES} O2GPUTracking) - set_target_properties(${MODULE} PROPERTIES LINKER_LANGUAGE CXX) +if(HIP_AMDGPUTARGET) + target_link_options(${targetName} PUBLIC --amdgpu-target=${HIP_AMDGPUTARGET}) endif() + +target_compile_options(${targetName} + PUBLIC -Wno-unused-command-line-argument + -Wno-invalid-constexpr + -Wno-ignored-optimization-argument + -Wno-unused-private-field) diff --git a/GPU/GPUTracking/Base/opencl/CMakeLists.txt b/GPU/GPUTracking/Base/opencl/CMakeLists.txt index 8a219947ead6c..8a93beddcab6d 100644 --- a/GPU/GPUTracking/Base/opencl/CMakeLists.txt +++ b/GPU/GPUTracking/Base/opencl/CMakeLists.txt @@ -1,153 +1,130 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** - -# Module -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - set(MODULE O2GPUTrackingOpenCL) -elseif(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - set(MODULE GPUTrackingOpenCL) -endif() -set(DEFINITIONS ${DEFINITIONS} GPUCA_GPULIBRARY=OCL) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -# AMD APP SDK required for OpenCL tracker; it's using specific -# extensions (currently) not provided by other vendors. -# either set cmake variable via "-D$AMDAPPSDKROOT=/path/to/amdappsdkroot" -# or via environment variable $AMDAPPSDKROOT -if(NOT AMDAPPSDKROOT) - set(AMDAPPSDKROOT $ENV{AMDAPPSDKROOT}) -endif() +set(MODULE GPUTrackingOpenCL) + +# AMD APP SDK required for OpenCL tracker as it's using specific extensions +# (currently) not provided by other vendors if(NOT AMDAPPSDKROOT) - message(FATAL_ERROR "AMDAPPSDKROOT not set. Please install AMD APP SDK and set $AMDAPPSDKROOT or disable ENABLE_OPENCL.") + message( + FATAL_ERROR + "AMDAPPSDKROOT not set. Please install AMD APP SDK and set $AMDAPPSDKROOT or disable ENABLE_OPENCL1." + ) endif() -message(STATUS "Building GPUTracking with OpenCL support" ) - -#convenience variables -set(GPUDIR ${CMAKE_SOURCE_DIR}/GPU/GPUTracking) - -#libdir path -link_directories(${AMDAPPSDKROOT}/lib/x86_64) - -# build the OpenCL compile wrapper: -# -- checks the correct vendor implementation (AMD) -# -- builds binary code (blob) for the found platform(s) -add_executable(opencl_compiler ${GPUDIR}/Standalone/makefiles/makefile_opencl_compiler.cpp) -target_link_libraries(opencl_compiler OpenCL) - -#convenience variables -set(CL_SRC ${GPUDIR}/Base/opencl/GPUReconstructionOCL.cl ) -set(CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.bin ) -set(CL_INC - -I${GPUDIR}/HLTHeaders - -I${GPUDIR}/SliceTracker - -I${GPUDIR}/Merger - -I${GPUDIR}/Base - -I${GPUDIR}/TRDTracking - -I${GPUDIR}/Merger - -I${GPUDIR}/Standalone - -I${CMAKE_SOURCE_DIR}/GPU/Common -) - -foreach (def ${DEFINITIONS}) - set(CL_DEF ${CL_DEF} -D${def}) -endforeach() +message(STATUS "Building GPUTracking with OpenCL support") +# convenience variables +if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") + set(GPUDIR ${CMAKE_SOURCE_DIR}/../) +else() + set(GPUDIR ${CMAKE_SOURCE_DIR}/GPU/GPUTracking) +endif() +set(CL_SRC ${GPUDIR}/Base/opencl/GPUReconstructionOCL.cl) +set(CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.bin) + +# build the OpenCL compile wrapper : +# +# * checks the correct vendor implementation (AMD) +# * builds binary code (blob) for the found platform(s) +add_executable(opencl_compiler + ${GPUDIR}/Standalone/makefiles/makefile_opencl_compiler.cpp) +target_link_libraries(opencl_compiler PUBLIC OpenCL::OpenCL) +set_property(TARGET opencl_compiler + PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) # executes OpenCL compiler wrapper to build binary object add_custom_command( - OUTPUT ${CL_BIN} - COMMAND opencl_compiler -output-file ${CL_BIN} ${CL_SRC} -- ${CL_INC} ${CL_DEF} -x clc++ - MAIN_DEPENDENCY ${CL_SRC} -) - + OUTPUT ${CL_BIN} + COMMAND LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ + $ + -output-file + ${CL_BIN} + ${CL_SRC} + -- + -I${GPUDIR}/HLTHeaders + -I${GPUDIR}/SliceTracker + -I${GPUDIR}/Merger + -I${GPUDIR}/Base + -I${GPUDIR}/TRDTracking + -I${GPUDIR}/Merger + -I${GPUDIR}/Standalone + -I${GPUDIR}/../Common + "-D$, -D>" + -DGPUCA_GPULIBRARY=OCL1 + -x + clc++ + MAIN_DEPENDENCY ${CL_SRC}) + +# cmake-format: off add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.S COMMAND cat ${GPUDIR}/Standalone/makefiles/include.S | sed "s/FILENAMEMOD/_makefile_opencl_program_Base_opencl_GPUReconstructionOCL_cl/g" | sed "s/FILENAMENORMAL/GPUReconstructionOCLCode.bin/g" > ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.S MAIN_DEPENDENCY ${GPUDIR}/Standalone/makefiles/include.S ) +# cmake-format: on + +# make cmake compile the assembler file, add proper dependency on included +# binary code +set_source_files_properties( + ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.S + PROPERTIES + LANGUAGE + CXX + OBJECT_DEPENDS + "${CL_BIN};${GPUDIR}/Standalone/makefiles/include.S") + +set(SRCS GPUReconstructionOCL.cxx + ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.S) +set(HDRS GPUReconstructionOCL.h GPUReconstructionOCLInternals.h) -# make cmake compile the assembler file, add proper dependency on included binary code -set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.S PROPERTIES LANGUAGE CXX OBJECT_DEPENDS "${CL_BIN};${GPUDIR}/Standalone/makefiles/include.S") - -# Module include folder -include_directories(${GPUDIR}/Base/opencl - ${GPUDIR}/Standalone/makefiles - ${CMAKE_CURRENT_BINARY_DIR} - ) - -# Additional include folders in alphabetical order except ROOT -include_directories(SYSTEM ${ROOT_INCLUDE_DIR}) -include_directories(${AMDAPPSDKROOT}/include) -if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - include_directories(${CMAKE_SOURCE_DIR}/HLT/BASE) -else() #if we do not build for AliRoot, for the time being we still need some dummy headers for some definitions - include_directories(${GPUDIR}/HLTHeaders ${GPUDIR}/Standalone/include) +if(ALIGPU_BUILD_TYPE STREQUAL "O2") + o2_add_library(${MODULE} + SOURCES ${SRCS} + PUBLIC_LINK_LIBRARIES OpenCL::OpenCL O2::GPUTracking + TARGETVARNAME targetName) + + target_compile_definitions( + ${targetName} PRIVATE GPUCA_GPULIBRARY=OCL1 + $) + # the compile_defitions are not propagated automatically on purpose (they are + # declared PRIVATE) so we are not leaking them outside of the GPU** + # directories + + install(FILES ${HDRS} DESTINATION include) endif() -# Sources in alphabetical order -set(SRCS - GPUReconstructionOCL.cxx - ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.S - ) - -# Headers from sources -set(CINTHDRS - GPUReconstructionOCL.h -) - -set(HDRS - ${CINTHDRS} - GPUReconstructionOCLInternals.h - ) - -foreach (def ${DEFINITIONS}) - add_definitions(-D${def}) -endforeach() - -#Default cmake build script for AliRoot if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - # Generate the dictionary - # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument - get_directory_property(incdirs INCLUDE_DIRECTORIES) - generate_dictionary("${MODULE}" "" "${CINTHDRS}" "${incdirs}") + add_definitions(-DGPUCA_GPULIBRARY=OCL1) - # Generate the ROOT map - generate_rootmap("${MODULE}" "" "") + # Generate the dictionary + get_directory_property(incdirs INCLUDE_DIRECTORIES) + generate_dictionary("Ali${MODULE}" "" "GPUReconstructionOCL.h" "${incdirs} .") - # Add a library to the project using the specified source files - add_library_tested(${MODULE} SHARED ${SRCS} G__${MODULE}.cxx) - # AMD OpenCL run-time and driver - target_link_libraries(${MODULE} OpenCL GPUTracking) + # Generate the ROOT map + generate_rootmap("Ali${MODULE}" "" "") - # Installation - install(TARGETS ${MODULE} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) + # Add a library to the project using the specified source files + add_library_tested(Ali${MODULE} SHARED ${SRCS} G__Ali${MODULE}.cxx) + # AMD OpenCL run-time and driver + target_link_libraries(Ali${MODULE} OpenCL AliGPUTracking) - install(FILES ${HDRS} DESTINATION include) -endif() + # Installation + install(TARGETS Ali${MODULE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) -#Default cmake build script for O2 -if(ALIGPU_BUILD_TYPE STREQUAL "O2") -#We do not need the dictionary for the standalone library files - set(LIBRARY_NAME ${MODULE}) - set(BUCKET_NAME GPUTrackingOCL_bucket) - - O2_GENERATE_LIBRARY() - install(FILES ${HDRS} DESTINATION include/GPU) + install(FILES ${HDRS} DESTINATION include) +endif() - target_link_libraries(${MODULE} OpenCL O2GPUTracking) +if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") + add_definitions(-DGPUCA_GPULIBRARY=OCL1) + add_library(${MODULE} SHARED ${SRCS}) + install(TARGETS GPUTrackingOpenCL) endif() diff --git a/GPU/GPUTracking/CMakeLists.txt b/GPU/GPUTracking/CMakeLists.txt index e5177f993529b..99ccccaf09301 100644 --- a/GPU/GPUTracking/CMakeLists.txt +++ b/GPU/GPUTracking/CMakeLists.txt @@ -1,49 +1,31 @@ -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - set(DEFINITIONS ${DEFINITIONS} GPUCA_ALIROOT_LIB) -endif() +set(MODULE GPUTracking) -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - set(DEFINITIONS ${DEFINITIONS} GPUCA_O2_LIB GPUCA_TPC_GEOMETRY_O2 HAVE_O2HEADERS) - if (OPENGL_FOUND AND GLFW_FOUND AND GLEW_FOUND AND OPENGL_GLU_FOUND AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(GPUCA_EVENT_DISPLAY ON) - endif() - set(GPUCA_QA ON) -endif() - -if(OpenMP_CXX_FOUND) - message(STATUS "GPU: Using OpenMP: ${OpenMP_CXX_SPEC_DATE}") - set(DEFINITIONS ${DEFINITIONS} GPUCA_HAVE_OPENMP) -endif() - -include_directories(. SliceTracker Merger Base Global TRDTracking ITS dEdx TPCConvert DataCompression ../Common ../TPCFastTransformation Standalone) - -if (ENABLE_CUDA OR ENABLE_OPENCL OR ENABLE_HIP) - if (CMAKE_SYSTEM_NAME MATCHES Darwin) - message(WARNING "GPU Tracking disabled on MacOS") - else() - if(ENABLE_CUDA) - add_subdirectory(Base/cuda) - endif() - if(ENABLE_OPENCL) - add_subdirectory(Base/opencl) - endif() - if (ENABLE_HIP) - add_subdirectory(Base/hip) - endif() - endif() -endif() - -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - set(MODULE O2GPUTracking) -elseif(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - set(MODULE GPUTracking) +if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") + if(ENABLE_CUDA OR ENABLE_OPENCL1 OR ENABLE_OPENCL2 OR ENABLE_HIP) + cmake_minimum_required(VERSION 3.13 FATAL_ERROR) + find_package(O2GPU) + endif() +else() + if(OPENGL_FOUND + AND GLFW_FOUND + AND GLEW_FOUND + AND OPENGL_GLU_FOUND + AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(GPUCA_EVENT_DISPLAY ON) + endif() + set(GPUCA_QA ON) endif() -include_directories(Standalone/display Standalone/qa) - -#SRCs processed by CINT and added to HDRS set(SRCS SliceTracker/GPUTPCTrack.cxx SliceTracker/GPUTPCBaseTrackParam.cxx @@ -74,8 +56,7 @@ set(SRCS TRDTracking/GPUTRDTracker.cxx TRDTracking/GPUTRDTrackletWord.cxx TRDTracking/GPUTRDTrackerGPU.cxx - Base/GPUParam.cxx -) + Base/GPUParam.cxx) set(SRCS_NO_CINT Base/GPUDataTypes.cxx @@ -89,16 +70,12 @@ set(SRCS_NO_CINT Base/GPUReconstructionConvert.cxx Global/GPUChain.cxx Global/GPUChainTracking.cxx - Standalone/utils/timer.cpp -) + Standalone/utils/timer.cpp) -set(SRCS_NO_H - SliceTracker/GPUTPCTrackerDump.cxx - Global/GPUChainTrackingDebugAndProfiling.cxx -) +set(SRCS_NO_H SliceTracker/GPUTPCTrackerDump.cxx + Global/GPUChainTrackingDebugAndProfiling.cxx) -#Extra headers to install -set(HDRS +set(HDRS_INSTALL SliceTracker/GPUTPCMCInfo.h SliceTracker/GPUTPCHit.h SliceTracker/GPUTPCHitId.h @@ -116,9 +93,6 @@ set(HDRS TRDTracking/GPUTRDTrackPoint.h TRDTracking/GPUTRDTrackletLabels.h Base/GPUReconstructionIncludes.h -) -#Not processed by ROOT -set(HDRS2 SliceTracker/GPUTPCDef.h SliceTracker/GPUTPCGeometry.h SliceTracker/GPULogging.h @@ -132,193 +106,273 @@ set(HDRS2 Base/GPUReconstructionKernels.h Base/GPUReconstructionIncludesITS.h Base/GPUReconstructionHelpers.h - Base/GPUOutputControl.h -) + Base/GPUOutputControl.h) -#Some extra files / includes / settings needed for the build for AliRoot if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - include_directories(SYSTEM ${ROOT_INCLUDE_DIR}) - include_directories(${CMAKE_SOURCE_DIR}/HLT/BASE - ${CMAKE_SOURCE_DIR}/HLT/BASE/util - ${CMAKE_SOURCE_DIR}/HLT/TPCLib - ${CMAKE_SOURCE_DIR}/HLT/TPCLib/transform - ${CMAKE_SOURCE_DIR}/HLT/TPCLib/comp - ${CMAKE_SOURCE_DIR}/HLT/TRD - ${CMAKE_SOURCE_DIR}/TRD/TRDbase - ${CMAKE_SOURCE_DIR}/STEER/STEERBase - ${CMAKE_SOURCE_DIR}/STEER/STEER - ${CMAKE_SOURCE_DIR}/STEER/ESD - ${CMAKE_SOURCE_DIR}/STEER/CDB - ${CMAKE_SOURCE_DIR}/TPC/TPCbase - ${CMAKE_SOURCE_DIR}/TPC/TPCcalib - ${CMAKE_SOURCE_DIR}/TPC/TPCrec - ) - - set(SRCS ${SRCS} - Merger/GPUTPCGlobalMergerComponent.cxx - SliceTracker/GPUTPCTrackerComponent.cxx - Merger/GPUTPCGMTracksToTPCSeeds.cxx - DataCompression/AliHLTTPCClusterStatComponent.cxx - TRDTracking/GPUTRDTrackerComponent.cxx - TRDTracking/GPUTRDTrackletReaderComponent.cxx - - Global/AliHLTGPUDumpComponent.cxx - ) - - set (SRCS_NO_CINT ${SRCS_NO_CINT} - ${CMAKE_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCGeometry.cxx - ${CMAKE_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCLog.cxx - ${CMAKE_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCDefinitions.cxx - ${CMAKE_SOURCE_DIR}/HLT/TRD/AliHLTTRDDefinitions.cxx - ) - - set (HDRS2 ${HDRS2} - SliceTracker/GPUTPCDefinitions.h - ) - - ALICE_UseVc() -else() #if we do not build for AliRoot, for the time being we still need some dummy headers for some definitions - include_directories(HLTHeaders) + set(SRCS + ${SRCS} + Merger/GPUTPCGlobalMergerComponent.cxx + SliceTracker/GPUTPCTrackerComponent.cxx + Merger/GPUTPCGMTracksToTPCSeeds.cxx + DataCompression/AliHLTTPCClusterStatComponent.cxx + TRDTracking/GPUTRDTrackerComponent.cxx + TRDTracking/GPUTRDTrackletReaderComponent.cxx + Global/AliHLTGPUDumpComponent.cxx) + + set(SRCS_NO_CINT ${SRCS_NO_CINT} + ${CMAKE_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCGeometry.cxx + ${CMAKE_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCLog.cxx + ${CMAKE_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCDefinitions.cxx + ${CMAKE_SOURCE_DIR}/HLT/TRD/AliHLTTRDDefinitions.cxx) + + set(HDRS_INSTALL + ${HDRS_INSTALL} + SliceTracker/GPUTPCDefinitions.h + ITS/GPUITSFitter.h + ITS/GPUITSFitterKernels.h + ITS/GPUITSTrack.h + TPCConvert/GPUTPCConvert.h + TPCConvert/GPUTPCConvertKernel.h + DataCompression/GPUTPCCompression.h + DataCompression/GPUTPCCompressionTrackModel.h + DataCompression/GPUTPCCompressionKernels.h + DataCompression/TPCClusterDecompressor.h + DataCompression/GPUTPCClusterStatistics.h) +else() + set(SRCS_NO_CINT + ${SRCS_NO_CINT} + Standalone/display/GPUDisplayBackend.cpp + Global/GPUChainITS.cxx + ITS/GPUITSFitter.cxx + ITS/GPUITSFitterKernels.cxx + dEdx/GPUdEdx.cxx + TPCConvert/GPUTPCConvert.cxx + TPCConvert/GPUTPCConvertKernel.cxx + DataCompression/GPUTPCCompression.cxx + DataCompression/GPUTPCCompressionTrackModel.cxx + DataCompression/GPUTPCCompressionKernels.cxx + DataCompression/TPCClusterDecompressor.cxx + DataCompression/GPUTPCClusterStatistics.cxx) + set(HDRS_INSTALL ${HDRS_INSTALL} Interface/GPUO2InterfaceConfiguration.h + ITS/GPUITSTrack.h dEdx/GPUdEdxInfo.h) endif() -#Some extra files / includes / settings needed for the build for O2 if(ALIGPU_BUILD_TYPE STREQUAL "O2") - set(SRCS ${SRCS} - Interface/GPUO2Interface.cxx - ) - set(SRCS_NO_CINT ${SRCS_NO_CINT} - Standalone/display/GPUDisplayBackend.cpp - Global/GPUChainITS.cxx - ITS/GPUITSFitter.cxx - ITS/GPUITSFitterKernels.cxx - dEdx/GPUdEdx.cxx - TPCConvert/GPUTPCConvert.cxx - TPCConvert/GPUTPCConvertKernel.cxx - DataCompression/GPUTPCCompression.cxx - DataCompression/GPUTPCCompressionTrackModel.cxx - DataCompression/GPUTPCCompressionKernels.cxx - DataCompression/TPCClusterDecompressor.cxx - DataCompression/GPUTPCClusterStatistics.cxx - ) - set (HDRS2 ${HDRS2} - Interface/GPUO2InterfaceConfiguration.h - ITS/GPUITSTrack.h - dEdx/GPUdEdxInfo.h - ) -else() #Need at least the header installed, as it is part of constant memory - set (HDRS2 ${HDRS2} - ITS/GPUITSFitter.h - ITS/GPUITSFitterKernels.h - ITS/GPUITSTrack.h - TPCConvert/GPUTPCConvert.h - TPCConvert/GPUTPCConvertKernel.h - DataCompression/GPUTPCCompression.h - DataCompression/GPUTPCCompressionTrackModel.h - DataCompression/GPUTPCCompressionKernels.h - DataCompression/TPCClusterDecompressor.h - DataCompression/GPUTPCClusterStatistics.h - ) + set(SRCS ${SRCS} Interface/GPUO2Interface.cxx) + set(HDRS_CINT_O2 ${HDRS_CINT_O2} Interface/GPUO2Interface.h) endif() -if (GPUCA_EVENT_DISPLAY) - message(STATUS "Building GPU Event Display") - set(SRCS_NO_CINT ${SRCS_NO_CINT} - Standalone/utils/qsem.cpp - Standalone/display/GPUDisplay.cpp - Standalone/display/GPUDisplayBackendGlfw.cpp - ) - set(SRCS_NO_H ${SRCS_NO_H} - Standalone/display/GPUDisplayQuaternion.cpp - Standalone/display/GPUDisplayInterpolation.cpp - Standalone/display/GPUDisplayKeys.cpp - ) - set(DEFINITIONS ${DEFINITIONS} BUILD_EVENT_DISPLAY) +if(GPUCA_EVENT_DISPLAY) + set(SRCS_NO_CINT ${SRCS_NO_CINT} Standalone/utils/qsem.cpp + Standalone/display/GPUDisplay.cpp + Standalone/display/GPUDisplayBackendGlfw.cpp) + set(SRCS_NO_H ${SRCS_NO_H} Standalone/display/GPUDisplayQuaternion.cpp + Standalone/display/GPUDisplayInterpolation.cpp + Standalone/display/GPUDisplayKeys.cpp) else() - set(HDRS2 ${HDRS2} Standalone/display/GPUDisplay.h) + set(HDRS_INSTALL ${HDRS_INSTALL} Standalone/display/GPUDisplay.h) endif() -if (GPUCA_QA) - message(STATUS "Building GPU QA") - set(SRCS_NO_CINT ${SRCS_NO_CINT} Standalone/qa/GPUQA.cpp) - set(DEFINITIONS ${DEFINITIONS} BUILD_QA) +if(GPUCA_QA) + set(SRCS_NO_CINT ${SRCS_NO_CINT} Standalone/qa/GPUQA.cpp) else() - set(HDRS2 ${HDRS2} Standalone/qa/GPUQA.h) + set(HDRS_INSTALL ${HDRS_INSTALL} Standalone/qa/GPUQA.h) endif() -if (GPUCA_EVENT_DISPLAY OR GPUCA_QA) - set(HDRS2 ${HDRS2} Standalone/qconfigoptions.h) +if(GPUCA_EVENT_DISPLAY OR GPUCA_QA) + set(HDRS_INSTALL ${HDRS_INSTALL} Standalone/qconfigoptions.h) +endif() + +string(REPLACE ".cxx" ".h" HDRS_CINT_ALIROOT "${SRCS}") +string(REPLACE ".cxx" ".h" HDRS_TMP "${SRCS_NO_CINT}") +set(HDRS_INSTALL ${HDRS_INSTALL} ${HDRS_TMP}) +unset(HDRS_TMP) + +if(ALIGPU_BUILD_TYPE STREQUAL "O2") + o2_add_library(${MODULE} + TARGETVARNAME targetName + PUBLIC_LINK_LIBRARIES O2::GPUCommon + O2::DataFormatsTPC + O2::TRDBase + O2::ITStracking + O2::TPCFastTransformation + O2::DebugGUI + PUBLIC_INCLUDE_DIRECTORIES SliceTracker + Base + TPCConvert + dEdx + ITS + TRDTracking + Standalone + Standalone/qa + Standalone/display + Global + HLTHeaders + Interface + Merger + DataCompression + TARGETVARNAME targetName + SOURCES ${SRCS} ${SRCS_NO_CINT} ${SRCS_NO_H}) + + target_include_directories( + ${targetName} + PRIVATE $) + + o2_target_root_dictionary(${MODULE} + HEADERS ${HDRS_CINT_O2} + LINKDEF GPUTrackingLinkDef_O2.h) + + o2_add_test(${MODULE} + PUBLIC_LINK_LIBRARIES O2::${MODULE} + SOURCES ctest/testGPUTracking.cxx + COMPONENT_NAME GPU + LABELS gpu) + + target_compile_definitions(${targetName} PRIVATE GPUCA_O2_LIB + GPUCA_TPC_GEOMETRY_O2 HAVE_O2HEADERS) + + install(FILES ${HDRS_CINT_ALIROOT} ${HDRS_CINT_O2} ${HDRS_INSTALL} + DESTINATION include/GPU) endif() -string(REPLACE ".cxx" ".h" HDRSSRCA "${SRCS}") -string(REPLACE ".cpp" ".h" HDRSSRC "${HDRSSRCA}") -set(HDRS ${HDRS} ${HDRSSRC}) -string(REPLACE ".cxx" ".h" HDRSSRCA "${SRCS_NO_CINT}") -string(REPLACE ".cpp" ".h" HDRSSRC "${HDRSSRCA}") -set(HDRS2 ${HDRS2} ${HDRSSRC}) -set(SRCS ${SRCS} ${SRCS_NO_CINT} ${SRCS_NO_H}) -foreach (def ${DEFINITIONS}) - add_definitions(-D${def}) -endforeach() - -#Default cmake build script for AliRoot if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - # Generate the dictionary - # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument - get_directory_property(incdirs INCLUDE_DIRECTORIES) - generate_dictionary_flat("${MODULE}" "GPUTrackingLinkDef_AliRoot.h" "${HDRS}" "${incdirs}") - - # Generate the ROOT map - # Dependecies - set(LIBDEPS STEERBase STEER ESD CDB HLTbase TPCbase TPCrec TPCcalib TRDbase AliTPCFastTransformation) - generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/GPUTrackingLinkDef_AliRoot.h") - # Don't pass Vc to root - set(LIBDEPS ${LIBDEPS} Vc) - - # Add a library to the project using the specified source files - add_library_tested(${MODULE} SHARED ${SRCS} G__${MODULE}.cxx) - target_link_libraries(${MODULE} ${LIBDEPS}) - - # Additional compilation flags - set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS "") - - # System dependent: Modify the way the library is build - if(${CMAKE_SYSTEM} MATCHES Darwin) - set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") - endif(${CMAKE_SYSTEM} MATCHES Darwin) - - # Installation - install(TARGETS ${MODULE} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) - - install(FILES ${HDRS} ${HDRS2} DESTINATION include) - install(DIRECTORY Standalone/utils DESTINATION include FILES_MATCHING PATTERN *.h) + add_definitions(-DGPUCA_ALIROOT_LIB) + include_directories(Standalone/display Standalone/qa) + include_directories(SYSTEM ${ROOT_INCLUDE_DIR}) + include_directories(${CMAKE_SOURCE_DIR}/HLT/BASE + ${CMAKE_SOURCE_DIR}/HLT/BASE/util + ${CMAKE_SOURCE_DIR}/HLT/TPCLib + ${CMAKE_SOURCE_DIR}/HLT/TPCLib/transform + ${CMAKE_SOURCE_DIR}/HLT/TPCLib/comp + ${CMAKE_SOURCE_DIR}/HLT/TRD + ${CMAKE_SOURCE_DIR}/TRD/TRDbase + ${CMAKE_SOURCE_DIR}/STEER/STEERBase + ${CMAKE_SOURCE_DIR}/STEER/STEER + ${CMAKE_SOURCE_DIR}/STEER/ESD + ${CMAKE_SOURCE_DIR}/STEER/CDB + ${CMAKE_SOURCE_DIR}/TPC/TPCbase + ${CMAKE_SOURCE_DIR}/TPC/TPCcalib + ${CMAKE_SOURCE_DIR}/TPC/TPCrec + ${CMAKE_SOURCE_DIR}/GPU/Common + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/SliceTracker + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Merger + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Global + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/dEdx + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/ITS + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/TPCConvert + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/TRDTracking + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Standalone + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/cuda + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/hip + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/opencl + ${CMAKE_SOURCE_DIR}/GPU/TPCFastTransformation) + alice_usevc() + + # Generate the dictionary + get_directory_property(incdirs INCLUDE_DIRECTORIES) + generate_dictionary_flat("Ali${MODULE}" "GPUTrackingLinkDef_AliRoot.h" + "${HDRS_CINT_ALIROOT}" "${incdirs}") + + # Generate the ROOT map Dependecies + set(LIBDEPS + STEERBase + STEER + ESD + CDB + HLTbase + TPCbase + TPCrec + TPCcalib + TRDbase + AliTPCFastTransformation) + generate_rootmap("Ali${MODULE}" "${LIBDEPS}" + "${CMAKE_CURRENT_SOURCE_DIR}/GPUTrackingLinkDef_AliRoot.h") + # Don't pass Vc to root + set(LIBDEPS ${LIBDEPS} Vc) + + # Add a library to the project using the specified source files + add_library_tested(Ali${MODULE} + SHARED + ${SRCS} + ${SRCS_NO_CINT} + ${SRCS_NO_H} + G__Ali${MODULE}.cxx) + target_link_libraries(Ali${MODULE} ${LIBDEPS}) + + # Additional compilation flags + set_target_properties(Ali${MODULE} PROPERTIES COMPILE_FLAGS "") + + # System dependent: Modify the way the library is build + if(${CMAKE_SYSTEM} MATCHES Darwin) + set_target_properties(Ali${MODULE} + PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + endif(${CMAKE_SYSTEM} MATCHES Darwin) + + # Installation + install(TARGETS Ali${MODULE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + + install(FILES ${HDRS_CINT_ALIROOT} ${HDRS_INSTALL} DESTINATION include) + install(DIRECTORY Standalone/utils + DESTINATION include + FILES_MATCHING + PATTERN *.h) + + set(targetName Ali${MODULE}) + add_library(O2::${MODULE} ALIAS Ali${MODULE}) endif() -#Default cmake build script for O2 -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - Set(HEADERS ${HDRS}) - Set(LINKDEF GPUTrackingLinkDef_O2.h) - Set(LIBRARY_NAME ${MODULE}) - set(BUCKET_NAME GPUTracking_bucket) - - O2_GENERATE_LIBRARY() - install(FILES ${HDRS} ${HDRS2} DESTINATION include/GPU) - install(DIRECTORY Standalone/utils DESTINATION include/GPU FILES_MATCHING PATTERN *.h) - - set(TEST_SRCS - ctest/testGPUTracking.cxx - ) - - O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} - ) - if (OpenMP_CXX_FOUND) - target_link_libraries(${MODULE} OpenMP::OpenMP_CXX) +if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") + add_library(${MODULE} SHARED ${SRCS} ${SRCS_NO_CINT} ${SRCS_NO_H}) + set(targetName ${MODULE}) + add_library(O2::${MODULE} ALIAS ${MODULE}) +endif() + +if(GPUCA_EVENT_DISPLAY) + message(STATUS "Building GPU Event Display") + target_compile_definitions(${targetName} PRIVATE BUILD_EVENT_DISPLAY) + target_link_libraries(${targetName} + PUBLIC ${GLEW_LIBRARIES} ${GLFW_LIBRARIES} OpenGL::GL + OpenGL::GLU) +endif() + +if(GPUCA_QA) + message(STATUS "Building GPU QA") + target_compile_definitions(${targetName} PRIVATE BUILD_QA) +endif() + +if(OpenMP_CXX_FOUND) + message(STATUS "GPU: Using OpenMP: ${OpenMP_CXX_SPEC_DATE}") + target_compile_definitions(${targetName} PRIVATE GPUCA_HAVE_OPENMP) + target_link_libraries(${targetName} PUBLIC OpenMP::OpenMP_CXX) +endif() + +if(CUDA_ENABLED) + target_compile_definitions(${targetName} PRIVATE CUDA_ENABLED) +endif() +if(OPENCL1_ENABLED) + target_compile_definitions(${targetName} PRIVATE OPENCL1_ENABLED) +endif() +if(OPENCL2_ENABLED) + target_compile_definitions(${targetName} PRIVATE OPENCL2_ENABLED) +endif() +if(HIP_ENABLED) + target_compile_definitions(${targetName} PRIVATE HIP_ENABLED) +endif() + +if(CUDA_ENABLED OR OPENCL1_ENABLED OR HIP_ENABLED) + if(CMAKE_SYSTEM_NAME MATCHES Darwin) + message(WARNING "GPU Tracking disabled on MacOS") + else() + if(CUDA_ENABLED) + add_subdirectory(Base/cuda) + endif() + if(OPENCL1_ENABLED) + add_subdirectory(Base/opencl) endif() - if (GPUCA_EVENT_DISPLAY) - target_link_libraries(${MODULE} ${GLEW_LIBRARIES} ${GLFW_LIBRARIES} OpenGL::GL OpenGL::GLU) + if(HIP_ENABLED) + add_subdirectory(Base/hip) endif() + endif() endif() diff --git a/GPU/GPUTracking/Standalone/CMakeLists.txt b/GPU/GPUTracking/Standalone/CMakeLists.txt new file mode 100644 index 0000000000000..0bcd3865099fb --- /dev/null +++ b/GPU/GPUTracking/Standalone/CMakeLists.txt @@ -0,0 +1,110 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +cmake_minimum_required(VERSION 3.13 FATAL_ERROR) + +set(ALIGPU_BUILD_TYPE "Standalone") +add_definitions(-DGPUCA_STANDALONE -DHAVE_O2HEADERS) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set( + CMAKE_CXX_FLAGS + "-O3 -march=native -ggdb -minline-all-stringops -ftracer -funroll-loops -fprefetch-loop-arrays -ffast-math -fno-stack-protector -Werror -Wall -Wextra -Wshadow -Wno-unused-function -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-write-strings" + ) +add_definitions(-DNDEBUG) + +find_package(OpenMP REQUIRED) +find_package(GLFW NAMES glfw3 CONFIG REQUIRED) +find_package(GLEW REQUIRED) +find_package(GLUT REQUIRED) +find_package(OpenGL REQUIRED) +find_package(Vc REQUIRED) +find_package(ROOT CONFIG REQUIRED) +find_package(fmt REQUIRED) +find_package(Clang REQUIRED) +find_package(LLVM REQUIRED) +find_package(X11 REQUIRED) + +find_package(O2GPU) + +include_directories(. + SliceTracker + HLTHeaders + Merger + Base + Global + TRDTracking + ITS + dEdx + TPCConvert + DataCompression + Common + TPCFastTransformation + display + qa + ../../../Common/Constants/include + ../../../Common/MathUtils/include + ../../../DataFormats/common/include + ../../../Detectors/TPC/base/include + ../../../DataFormats/Detectors/TPC/include + ../../../DataFormats/common/include + ../../../Detectors/TRD/base/include + ../../../Detectors/TRD/base/src + ../../../Detectors/ITSMFT/ITS/tracking/include + ../../../Detectors/ITSMFT/ITS/tracking/cuda/include + ../../../Detectors/ITSMFT/ITS/tracking/cuda/src + ../../../DataFormats/Detectors/ITSMFT/ITS/include + ../../../DataFormats/Reconstruction/include + ../../../DataFormats/simulation/include + ../../../Detectors/Base/src + ../../../Detectors/Base/include + ../../../DataFormats/Detectors/Common/include) + +add_subdirectory(../../ GPU) + +add_executable(ca standalone.cxx utils/qconfig.cpp qa/genEvents.cpp + Base/GPUReconstructionTimeframe.cxx) + +target_sources( + ca + PRIVATE + ../../..//DataFormats/simulation/src/MCCompLabel.cxx + ../../..//Detectors/ITSMFT/ITS/tracking/src/PrimaryVertexContext.cxx + ../../..//Detectors/ITSMFT/ITS/tracking/src/Cluster.cxx + ../../..//Detectors/ITSMFT/ITS/tracking/src/ClusterLines.cxx + ../../..//Detectors/ITSMFT/ITS/tracking/src/TrackerTraitsCPU.cxx + ../../..//Detectors/ITSMFT/ITS/tracking/src/VertexerTraits.cxx + ../../..//Detectors/ITSMFT/ITS/tracking/src/ROframe.cxx + ../../..//Detectors/ITSMFT/ITS/tracking/src/Road.cxx + ../../..//Detectors/TRD/base/src/TRDGeometryBase.cxx + ../../..//Detectors/Base/src/MatLayerCylSet.cxx + ../../..//Detectors/Base/src/MatLayerCyl.cxx + ../../..//Detectors/Base/src/Ray.cxx) + +target_sources(GPUTracking PUBLIC display/GPUDisplayBackendX11.cpp + display/GPUDisplayBackendGlut.cpp) + +target_link_libraries(GPUTracking + PUBLIC TPCFastTransformation + ROOT::Core + ROOT::RIO + ROOT::Hist + ROOT::Gui + Vc::Vc + X11::X11 + glfw + glut) +target_link_libraries(ca PUBLIC GPUTracking) +target_compile_definitions( + ca PUBLIC $) + +install(TARGETS ca GPUTracking TPCFastTransformation) diff --git a/GPU/GPUTracking/Standalone/config_common.mak b/GPU/GPUTracking/Standalone/config_common.mak index 4afbcbe1e8bd1..d67a2195a5c16 100644 --- a/GPU/GPUTracking/Standalone/config_common.mak +++ b/GPU/GPUTracking/Standalone/config_common.mak @@ -61,8 +61,7 @@ endif ifneq (${CONFIG_O2DIR}, ) DEFINES += HAVE_O2HEADERS -INCLUDEPATHS += O2Headers \ - ${CONFIG_O2DIR}/Common/Constants/include \ +INCLUDEPATHS += ${CONFIG_O2DIR}/Common/Constants/include \ ${CONFIG_O2DIR}/Common/MathUtils/include \ ${CONFIG_O2DIR}/DataFormats/common/include \ ${CONFIG_O2DIR}/Detectors/TPC/base/include \ @@ -85,13 +84,13 @@ DEFINES += GPUCA_TPC_GEOMETRY_O2 endif ifeq ($(BUILD_CUDA), 1) -DEFINES += BUILD_CUDA +DEFINES += CUDA_ENABLED endif ifeq ($(BUILD_OPENCL), 1) -DEFINES += BUILD_OPENCL +DEFINES += OPENCL1_ENABLED endif ifeq ($(BUILD_HIP), 1) -DEFINES += BUILD_HIP +DEFINES += HIP_ENABLED endif ifeq ($(BUILD_EVENT_DISPLAY), 1) DEFINES += BUILD_EVENT_DISPLAY diff --git a/GPU/GPUTracking/Standalone/qconfigoptions.h b/GPU/GPUTracking/Standalone/qconfigoptions.h index e5ee04f13192d..6a111923f6d0f 100644 --- a/GPU/GPUTracking/Standalone/qconfigoptions.h +++ b/GPU/GPUTracking/Standalone/qconfigoptions.h @@ -87,17 +87,17 @@ AddHelp("help", 'h') EndConfig() BeginConfig(structConfigStandalone, configStandalone) -#if defined(BUILD_CUDA) || defined(BUILD_OPENCL) || defined(BUILD_HIP) +#if defined(CUDA_ENABLED) || defined(OPENCL1_ENABLED) || defined(HIP_ENABLED) AddOption(runGPU, bool, true, "gpu", 'g', "Use GPU for processing", message("GPU processing: %s")) #else AddOption(runGPU, bool, false, "gpu", 'g', "Use GPU for processing", message("GPU processing: %s")) #endif AddOptionSet(runGPU, bool, false, "cpu", 'c', "Use CPU for processing", message("CPU enabled")) -#if defined(BUILD_CUDA) +#if defined(CUDA_ENABLED) AddOption(gpuType, const char*, "CUDA", "gpuType", 0, "GPU type (CUDA / HIP / OCL)") -#elif defined(BUILD_OPENCL) +#elif defined(OPENCL1_ENABLED) AddOption(gpuType, const char*, "OCL", "gpuType", 0, "GPU type (CUDA / HIP / OCL)") -#elif defined(BUILD_HIP) +#elif defined(HIP_ENABLED) AddOption(gpuType, const char*, "HIP", "gpuType", 0, "GPU type (CUDA / HIP / OCL)") #else AddOption(gpuType, const char*, "", "gpuType", 0, "GPU type (CUDA / HIP / OCL)") diff --git a/GPU/GPUTracking/Standalone/standalone.cxx b/GPU/GPUTracking/Standalone/standalone.cxx index 9030794488fc2..28d8c73c7e176 100644 --- a/GPU/GPUTracking/Standalone/standalone.cxx +++ b/GPU/GPUTracking/Standalone/standalone.cxx @@ -213,7 +213,7 @@ int ReadConfiguration(int argc, char** argv) outputmemory.reset(new char[configStandalone.outputcontrolmem]); } -#if !(defined(BUILD_CUDA) || defined(BUILD_OPENCL) || defined(BUILD_HIP)) +#if !(defined(CUDA_ENABLED) || defined(OPENCL1_ENABLED) || defined(HIP_ENABLED)) if (configStandalone.runGPU) { printf("GPU disables at build time!\n"); printf("Press a key to exit!\n"); diff --git a/GPU/TPCFastTransformation/CMakeLists.txt b/GPU/TPCFastTransformation/CMakeLists.txt index 66dbd0945566d..26fa6a574fe1d 100644 --- a/GPU/TPCFastTransformation/CMakeLists.txt +++ b/GPU/TPCFastTransformation/CMakeLists.txt @@ -1,14 +1,14 @@ -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) - -if(${ALIGPU_BUILD_TYPE} STREQUAL "O2") -set(MODULE O2TPCFastTransformation) -elseif(${ALIGPU_BUILD_TYPE} STREQUAL "ALIROOT") -set(MODULE AliTPCFastTransformation) -add_definitions(-DGPUCA_ALIROOT_LIB) -endif() - -include_directories(.) -include_directories(../Common) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +set(MODULE TPCFastTransformation) set(SRCS IrregularSpline1D.cxx @@ -17,111 +17,103 @@ set(SRCS IrregularSpline2D3DCalibrator.cxx TPCFastTransformGeo.cxx TPCDistortionIRS.cxx - TPCFastTransform.cxx -) + TPCFastTransform.cxx) -set (HDRS - ../Common/GPUCommonDef.h -) +string(REPLACE ".cxx" ".h" HDRS_CINT_O2 "${SRCS}") +set(HDRS_CINT_O2 ${HDRS_CINT_O2} RegularSpline1D.h) -#Some extra files / includes / settings needed for the build for AliRoot -if(${ALIGPU_BUILD_TYPE} STREQUAL "ALIROOT") - set (SRCS ${SRCS} - TPCFastTransformManager.cxx - TPCFastTransformQA.cxx - ${AliRoot_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCGeometry.cxx - ${AliRoot_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCLog.cxx - ) - set (HDRS - ${HDRS} - TPCFastTransformManager.h - TPCFastTransformQA.h - ) - - # Enable Vc - ALICE_UseVc() - - include_directories(SYSTEM ${ROOT_INCLUDE_DIR}) - include_directories(${AliRoot_SOURCE_DIR}/HLT/BASE - ${AliRoot_SOURCE_DIR}/HLT/TPCLib - ${AliRoot_SOURCE_DIR}/TPC/TPCbase - ${AliRoot_SOURCE_DIR}/STEER/STEERBase - ) +if(${ALIGPU_BUILD_TYPE} STREQUAL "O2") + o2_add_library(${MODULE} + TARGETVARNAME targetName + SOURCES ${SRCS} + PUBLIC_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR} + PUBLIC_LINK_LIBRARIES O2::GPUCommon Vc::Vc ROOT::Core) -endif() + o2_target_root_dictionary(${MODULE} + HEADERS ${HDRS_CINT_O2} + LINKDEF TPCFastTransformationLinkDef_O2.h) + + target_compile_definitions(${targetName} PRIVATE GPUCA_O2_LIB + GPUCA_TPC_GEOMETRY_O2 HAVE_O2HEADERS) -if (NOT ROOT_VERSION_MAJOR EQUAL 5) - set (HDRS ${HDRS} - ../Common/FlatObject.h - IrregularSpline1D.h - IrregularSpline2D3D.h - SemiregularSpline2D3D.h - IrregularSpline2D3DCalibrator.h - RegularSpline1D.h - TPCFastTransformGeo.h - TPCFastTransform.h - TPCDistortionIRS.h - ) + install(FILES ${HDRS_CINT_O2} DESTINATION include/GPU) + file(COPY ${HDRS_CINT_O2} DESTINATION ${CMAKE_BINARY_DIR}/stage/include/GPU) endif() -#Default cmake build script for AliRoot if(${ALIGPU_BUILD_TYPE} STREQUAL "ALIROOT") - # Generate the dictionary - # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument - get_directory_property(incdirs INCLUDE_DIRECTORIES) - generate_dictionary("${MODULE}" "TPCFastTransformationLinkDef_AliRoot.h" "${HDRS}" "${incdirs}") - - # Generate the ROOT map - # Dependecies - set(LIBDEPS STEERBase HLTbase TPCbase) - generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/TPCFastTransformationLinkDef_AliRoot.h") - # Don't pass Vc to root - set(LIBDEPS ${LIBDEPS} Vc) - - # Add a library to the project using the specified source files - add_library_tested(${MODULE} SHARED ${SRCS} G__${MODULE}.cxx) - target_link_libraries(${MODULE} ${LIBDEPS}) - - # Additional compilation flags - set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS "") - - # System dependent: Modify the way the library is build - if(${CMAKE_SYSTEM} MATCHES Darwin) - set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") - endif(${CMAKE_SYSTEM} MATCHES Darwin) - - # Installation - install(TARGETS ${MODULE} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) - - install(FILES ${HDRS} DESTINATION include) + add_definitions(-DGPUCA_ALIROOT_LIB) + + set(SRCS ${SRCS} TPCFastTransformManager.cxx TPCFastTransformQA.cxx + ${AliRoot_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCGeometry.cxx + ${AliRoot_SOURCE_DIR}/HLT/TPCLib/AliHLTTPCLog.cxx) + set(HDRS_CINT ${HDRS_CINT} TPCFastTransformManager.h TPCFastTransformQA.h) + + # Enable Vc + alice_usevc() + + include_directories(SYSTEM ${ROOT_INCLUDE_DIR}) + include_directories(${AliRoot_SOURCE_DIR}/GPU/TPCFastTransformation + ${AliRoot_SOURCE_DIR}/GPU/Common + ${AliRoot_SOURCE_DIR}/HLT/BASE + ${AliRoot_SOURCE_DIR}/HLT/TPCLib + ${AliRoot_SOURCE_DIR}/TPC/TPCbase + ${AliRoot_SOURCE_DIR}/STEER/STEERBase) + + # Generate the dictionary + get_directory_property(incdirs INCLUDE_DIRECTORIES) + generate_dictionary("Ali${MODULE}" "TPCFastTransformationLinkDef_AliRoot.h" + "${HDRS_CINT}" "${incdirs}") + + # Generate the ROOT map Dependecies + set(LIBDEPS STEERBase HLTbase TPCbase) + generate_rootmap( + "Ali${MODULE}" "${LIBDEPS}" + "${CMAKE_CURRENT_SOURCE_DIR}/TPCFastTransformationLinkDef_AliRoot.h") + # Don't pass Vc to root + set(LIBDEPS ${LIBDEPS} Vc) + + # Add a library to the project using the specified source files + add_library_tested(Ali${MODULE} SHARED ${SRCS} G__Ali${MODULE}.cxx) + target_link_libraries(Ali${MODULE} ${LIBDEPS}) + + # Additional compilation flags + set_target_properties(Ali${MODULE} PROPERTIES COMPILE_FLAGS "") + + # System dependent: Modify the way the library is build + if(${CMAKE_SYSTEM} MATCHES Darwin) + set_target_properties(Ali${MODULE} + PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + endif(${CMAKE_SYSTEM} MATCHES Darwin) + + # Installation + install(TARGETS Ali${MODULE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + + install(FILES ${HDRS_CINT_O2} DESTINATION include) endif() -#Default cmake build script for O2 -if(${ALIGPU_BUILD_TYPE} STREQUAL "O2") - string(REPLACE ".cxx" ".h" HDRS "${SRCS}") - set (HDRS - ${HDRS} - ../Common/GPUCommonDef.h - RegularSpline1D.h - ) - - Set(HEADERS ${HDRS}) - Set(LINKDEF TPCFastTransformationLinkDef_O2.h) - Set(LIBRARY_NAME ${MODULE}) - set(BUCKET_NAME TPCFastTransformation_bucket) - - O2_GENERATE_LIBRARY() - install(FILES ${HDRS} DESTINATION include/GPU) - -# set(TEST_SRCS -# ctest/testGPUTracking.cxx -# ) - -# O2_GENERATE_TESTS( -# MODULE_LIBRARY_NAME ${LIBRARY_NAME} -# BUCKET_NAME ${BUCKET_NAME} -# TEST_SRCS ${TEST_SRCS} -# ) +if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") + add_library(${MODULE} SHARED ${SRCS}) endif() + +foreach(m + IrregularSpline1DTest.C + IrregularSpline2D3DCalibratorTest.C + IrregularSpline2D3DTest.C + RegularSpline1DTest.C + SemiregularSpline2D3DTest.C + fastTransformQA.C) + o2_add_test_root_macro(macro/${m} + PUBLIC_LINK_LIBRARIES O2::TPCFastTransformation + PUBLIC_INCLUDE_DIRECTORIES + ${CMAKE_BINARY_DIR}/stage/include + LABELS gpu tpc) +endforeach() + +# +# FIXME: this one is misplaced : it depends (at least) on TPCSimulation which is +# built after GPU... +# +# o2_add_test_root_macro(macro/generateTPCDistortionNTuple.C +# PUBLIC_LINK_LIBRARIES O2::TPCFastTransformation O2::DataFormatsTPC +# O2::TPCSimulation PUBLIC_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/stage/include +# LABELS gpu tpc) diff --git a/GPU/TPCSpaceChargeBase/CMakeLists.txt b/GPU/TPCSpaceChargeBase/CMakeLists.txt index 7f306a3226c19..3743bb73ff6d4 100644 --- a/GPU/TPCSpaceChargeBase/CMakeLists.txt +++ b/GPU/TPCSpaceChargeBase/CMakeLists.txt @@ -1,76 +1,78 @@ -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +set(MODULE TPCSpaceChargeBase) + +set(SRCS + AliTPC3DCylindricalInterpolator.cxx + AliTPC3DCylindricalInterpolatorIrregular.cxx + AliTPCLookUpTable3DInterpolatorD.cxx + AliTPCLookUpTable3DInterpolatorIrregularD.cxx + AliTPCPoissonSolver.cxx + AliTPCSpaceCharge3DCalc.cxx) +string(REPLACE ".cxx" ".h" HDRS_CINT "${SRCS}") if(${ALIGPU_BUILD_TYPE} STREQUAL "O2") -set(MODULE O2TPCSpaceChargeBase) -elseif(${ALIGPU_BUILD_TYPE} STREQUAL "ALIROOT") -set(MODULE AliTPCSpaceChargeBase) -endif() + o2_add_library(TPCSpaceChargeBase + TARGETVARNAME targetName + PUBLIC_LINK_LIBRARIES ROOT::Matrix ROOT::Hist + PUBLIC_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR} + SOURCES ${SRCS}) -include_directories(SYSTEM ${ROOT_INCLUDE_DIR}) -include_directories(.) + o2_target_root_dictionary(TPCSpaceChargeBase + HEADERS ${HDRS_CINT} + LINKDEF TPCSpaceChargeBaseLinkDef.h) + + o2_add_test(SpaceChargeBase + SOURCES ctest/testTPCSpaceChargeBase.cxx + COMPONENT_NAME gpu + LABELS gpu + PUBLIC_LINK_LIBRARIES O2::TPCSpaceChargeBase) + + target_compile_definitions(${targetName} PRIVATE GPUCA_O2_LIB) + + install(FILES ${HDRS_CINT} DESTINATION include/GPU) +endif() -set(SRCS - AliTPC3DCylindricalInterpolator.cxx - AliTPC3DCylindricalInterpolatorIrregular.cxx - AliTPCLookUpTable3DInterpolatorD.cxx - AliTPCLookUpTable3DInterpolatorIrregularD.cxx - AliTPCPoissonSolver.cxx - AliTPCSpaceCharge3DCalc.cxx -) -string(REPLACE ".cxx" ".h" HDRS "${SRCS}") - -#Default cmake build script for AliRoot if(${ALIGPU_BUILD_TYPE} STREQUAL "ALIROOT") + add_definitions(-DGPUCA_ALIROOT_LIB) + include_directories(SYSTEM ${ROOT_INCLUDE_DIR}) + include_directories(${AliRoot_SOURCE_DIR}/GPU/TPCSpaceChargeBase) + # Generate the dictionary - # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument get_directory_property(incdirs INCLUDE_DIRECTORIES) - generate_dictionary("${MODULE}" "TPCSpaceChargeBaseLinkDef.h" "${HDRS}" "${incdirs}") + generate_dictionary("Ali${MODULE}" "TPCSpaceChargeBaseLinkDef.h" + "${HDRS_CINT}" "${incdirs}") set(ROOT_DEPENDENCIES Core Hist MathCore Matrix Physics) - # Generate the ROOT map - # Dependecies + # Generate the ROOT map Dependecies set(LIBDEPS ${ROOT_DEPENDENCIES}) - generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/TPCSpaceChargeBaseLinkDef.h") + generate_rootmap("Ali${MODULE}" "${LIBDEPS}" + "${CMAKE_CURRENT_SOURCE_DIR}/TPCSpaceChargeBaseLinkDef.h") # Add a library to the project using the specified source files - add_library_tested(${MODULE} SHARED ${SRCS} G__${MODULE}.cxx) - target_link_libraries(${MODULE} ${LIBDEPS}) + add_library_tested(Ali${MODULE} SHARED ${SRCS} G__Ali${MODULE}.cxx) + target_link_libraries(Ali${MODULE} ${LIBDEPS}) # Additional compilation flags - set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS "") + set_target_properties(Ali${MODULE} PROPERTIES COMPILE_FLAGS "") # System dependent: Modify the way the library is build if(${CMAKE_SYSTEM} MATCHES Darwin) - set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + set_target_properties(Ali${MODULE} + PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif(${CMAKE_SYSTEM} MATCHES Darwin) # Installation - install(TARGETS ${MODULE} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - ) + install(TARGETS Ali${MODULE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) - install(FILES ${HDRS} DESTINATION include) -endif() - -#Default cmake build script for O2 -if(${ALIGPU_BUILD_TYPE} STREQUAL "O2") - Set(HEADERS ${HDRS}) - Set(LINKDEF TPCSpaceChargeBaseLinkDef.h) - Set(LIBRARY_NAME ${MODULE}) - set(BUCKET_NAME TPCSpaceChargeBase_bucket) - - O2_GENERATE_LIBRARY() - install(FILES ${HDRS} DESTINATION include/GPU) - - set(TEST_SRCS - ctest/testTPCSpaceChargeBase.cxx - ) - - O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} - ) + install(FILES ${HDRS_CINT} DESTINATION include) endif() diff --git a/Generators/CMakeLists.txt b/Generators/CMakeLists.txt index 6efc01755f988..0365787a4622d 100644 --- a/Generators/CMakeLists.txt +++ b/Generators/CMakeLists.txt @@ -1,57 +1,65 @@ -# Create a library called "libGen" which includes the source files given in -# the array . -# The extension is already found. Any number of sources could be listed here. -set(MODULE_NAME "Generators") - -FILE(GLOB INSTALL_SHARE "share/external/*.C") -INSTALL(FILES ${INSTALL_SHARE} DESTINATION share/Generators/external/) -SET(IGNORE_MACROS ${CMAKE_SOURCE_FILE}/share/Generators/external/hijing.C) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Generator.cxx - src/GeneratorTGenerator.cxx - src/GeneratorFromFile.cxx - src/Pythia6Generator.cxx - src/PDG.cxx - src/PrimaryGenerator.cxx - src/InteractionDiamondParam.cxx - src/BoxGunParam.cxx - ) -set(HEADERS - include/${MODULE_NAME}/Generator.h - include/${MODULE_NAME}/GeneratorTGenerator.h - include/${MODULE_NAME}/GeneratorFromFile.h - include/${MODULE_NAME}/Pythia6Generator.h - include/${MODULE_NAME}/PDG.h - include/${MODULE_NAME}/PrimaryGenerator.h - include/${MODULE_NAME}/InteractionDiamondParam.h - include/${MODULE_NAME}/BoxGunParam.h - ) -if (HAVESIMULATION) - set(HEADERS ${HEADERS} - include/${MODULE_NAME}/GeneratorFactory.h - ) - set(SRCS ${SRCS} - src/GeneratorFactory.cxx - ) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +if(pythia_FOUND) + set(pythiaTarget pythia FairRoot::Gen) +endif() + +o2_add_library(Generators + SOURCES src/Generator.cxx + src/GeneratorTGenerator.cxx + src/GeneratorFromFile.cxx + src/Pythia6Generator.cxx + src/PDG.cxx + src/PrimaryGenerator.cxx + src/InteractionDiamondParam.cxx + src/BoxGunParam.cxx + $<$:src/Pythia8Generator.cxx> + $<$:src/GeneratorFactory.cxx> + PUBLIC_LINK_LIBRARIES FairRoot::Base O2::SimConfig + O2::SimulationDataFormat ${pythiaTarget} + TARGETVARNAME targetName) + +if(pythia_FOUND) + target_compile_definitions(${targetName} PUBLIC GENERATORS_WITH_PYTHIA8) endif() - -if (PYTHIA8_INCLUDE_DIR) - set(SRCS ${SRCS} - src/Pythia8Generator.cxx - ) - set(HEADERS ${HEADERS} - include/${MODULE_NAME}/Pythia8Generator.h - ) - set(BUCKET_NAME generators_bucket) -else (PYTHIA8_INCLUDE_DIR) - message(STATUS "module 'Generators' requires Pythia8 ... deactivated") - set(BUCKET_NAME generators_base_bucket) -endif (PYTHIA8_INCLUDE_DIR) - -set(LINKDEF src/GeneratorsLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) - -O2_GENERATE_LIBRARY() + +set(headers + include/Generators/Generator.h + include/Generators/GeneratorTGenerator.h + include/Generators/GeneratorFromFile.h + include/Generators/Pythia6Generator.h + include/Generators/PDG.h + include/Generators/PrimaryGenerator.h + include/Generators/InteractionDiamondParam.h + include/Generators/BoxGunParam.h) + +if(pythia_FOUND) + list(APPEND headers include/Generators/Pythia8Generator.h + include/Generators/GeneratorFactory.h) +endif() + +o2_target_root_dictionary(Generators HEADERS ${headers}) + +o2_add_test_root_macro(share/external/extgen.C + PUBLIC_LINK_LIBRARIES O2::Generators FairRoot::Base + LABELS generators) +if(pythia6_FOUND) + o2_add_test_root_macro(share/external/pythia6.C + PUBLIC_LINK_LIBRARIES O2::Generators pythia6 + LABELS generators) +endif() +o2_add_test_root_macro(share/external/tgenerator.C + PUBLIC_LINK_LIBRARIES O2::Generators + LABELS generators) + +install(FILES share/external/extgen.C share/external/pythia6.C + share/external/tgenerator.C + DESTINATION share/Generators/external/) diff --git a/README.md b/README.md index c663eba28377a..58970f1b6678f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ - -ALICE O2 software {#mainpage} -=================== +# ALICE O2 software {#mainpage} + [![codecov](https://codecov.io/gh/AliceO2Group/AliceO2/branch/dev/graph/badge.svg)](https://codecov.io/gh/AliceO2Group/AliceO2/branches/dev) [![JIRA](https://img.shields.io/badge/JIRA-Report%20issue-blue.svg)](https://alice.its.cern.ch/jira/secure/CreateIssue.jspa?pid=11201&issuetype=1) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1493334.svg)](https://doi.org/10.5281/zenodo.1493334) @@ -11,41 +10,50 @@ ALICE O2 software {#mainpage} [![](http://ali-ci.cern.ch/repo/buildstatus/AliceO2Group/AliceO2/dev/build_o2_macos.svg)](https://ali-ci.cern.ch/repo/logs/AliceO2Group/AliceO2/dev/latest/build_o2_macos/fullLog.txt) [![](http://ali-ci.cern.ch/repo/buildstatus/AliceO2Group/AliceO2/dev/build_o2checkcode_o2.svg)](https://ali-ci.cern.ch/repo/logs/AliceO2Group/AliceO2/dev/latest/build_o2checkcode_o2/fullLog.txt) [![](http://ali-ci.cern.ch/repo/buildstatus/AliceO2Group/AliceO2/dev/build_O2_o2-dev-fairroot.svg)](https://ali-ci.cern.ch/repo/logs/AliceO2Group/AliceO2/dev/latest/build_O2_o2-dev-fairroot/fullLog.txt) + ### Scope + The ALICE O2 software repository contains the framework, as well as the detector specific, code for the reconstruction, calibration and simulation for the ALICE experiment at CERN for Run 3 and 4. It also encompasses the commonalities such as the data format, and the global algorithms like the global tracking. Other repositories in AliceO2Group contain a number of large common modules, for instance for Monitoring or Configuration. ### Website + The main entry point for O2 information is [here](http://alice-o2.web.cern.ch/). A quickstart page can be found under [https://aliceo2group.github.io/](https://aliceo2group.github.io/). ### Building / Installation + In order to build and install O2 with aliBuild you can follow [this tutorial](http://alisw.github.io/alibuild/o2-tutorial.html). ### Issue tracking system -We use JIRA to track issues. [Report a bug here](https://alice.its.cern.ch/jira/secure/CreateIssue.jspa?pid=11201&issuetype=1). -Add the JIRA issue key (e.g. `O2-XYZ`) to the PR title or in a commit message to have the PR/commit appear in the JIRA ticket. + +We use JIRA to track issues. [Report a bug here](https://alice.its.cern.ch/jira/secure/CreateIssue.jspa?pid=11201&issuetype=1). +Add the JIRA issue key (e.g. `O2-XYZ`) to the PR title or in a commit message to have the PR/commit appear in the JIRA ticket. ### Coding guidelines + The Coding Guidelines are [here](https://github.com/AliceO2Group/CodingGuidelines). See [below](###Formatting) how to format your code accordingly. ### Doxygen + Documentation pages: [https://aliceo2group.github.io/AliceO2/](https://aliceo2group.github.io/AliceO2/). -`make doc` will generate the doxygen documentation. +`cmake --build . --target doc` will generate the doxygen documentation. To access the resulting documentation, open doc/html/index.html in your -build directory. To install the documentation when calling `make install` +build directory. To install the documentation when calling `cmake --build . -- install` (or `cmake --install` for CMake >= 3.15) turn on the variable `DOC_INSTALL`. The instruction how to add the documentation pages (README.md) are available [here](doc/DoxygenInstructions.md). ### Build system (cmake) and directory structure + The code organisation is described [here](doc/CodeOrganization.md). The build system (cmake) is described [here](doc/CMakeInstructions.md). ### Formatting + Rules and instructions are available in the repository [CodingGuidelines](https://github.com/AliceO2Group/CodingGuidelines). diff --git a/Steer/CMakeLists.txt b/Steer/CMakeLists.txt index 331026fcc2a1e..f0f1109117fb5 100644 --- a/Steer/CMakeLists.txt +++ b/Steer/CMakeLists.txt @@ -1,36 +1,35 @@ -set(MODULE_NAME "Steer") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/O2MCApplication.cxx - src/InteractionSampler.cxx - src/HitProcessingManager.cxx -) - -set(HEADERS - include/${MODULE_NAME}/InteractionSampler.h - include/${MODULE_NAME}/HitProcessingManager.h - include/${MODULE_NAME}/O2RunSim.h - include/${MODULE_NAME}/O2MCApplication.h - include/${MODULE_NAME}/O2MCApplicationBase.h -) - -set(LINKDEF src/SteerLinkDef.h) -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME steer_bucket) - -O2_GENERATE_LIBRARY() - -set(TEST_SRCS - test/testInteractionSampler.cxx - test/testHitProcessingManager.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME steer_bucket - TEST_SRCS ${TEST_SRCS} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(Steer + SOURCES src/O2MCApplication.cxx src/InteractionSampler.cxx + src/HitProcessingManager.cxx + PUBLIC_LINK_LIBRARIES O2::CommonDataFormat + O2::SimulationDataFormat + O2::ITSMFTSimulation O2::TPCSimulation) + +o2_target_root_dictionary(Steer + HEADERS include/Steer/InteractionSampler.h + include/Steer/HitProcessingManager.h + include/Steer/O2RunSim.h + include/Steer/O2MCApplication.h + include/Steer/O2MCApplicationBase.h) + +o2_add_test(InteractionSampler + PUBLIC_LINK_LIBRARIES O2::Steer + SOURCES test/testInteractionSampler.cxx + LABELS steer) + +o2_add_test(HitProcessingManager + PUBLIC_LINK_LIBRARIES O2::Steer + SOURCES test/testHitProcessingManager.cxx + LABELS steer) add_subdirectory(DigitizerWorkflow) diff --git a/Steer/DigitizerWorkflow/CMakeLists.txt b/Steer/DigitizerWorkflow/CMakeLists.txt index 0a58298eb054a..b7a6c02dcce94 100644 --- a/Steer/DigitizerWorkflow/CMakeLists.txt +++ b/Steer/DigitizerWorkflow/CMakeLists.txt @@ -1,47 +1,49 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See https://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -set(MODULE_NAME "DigitizerWorkflow") -set(MODULE_BUCKET_NAME digitizer_workflow_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -## TODO: feature of macro, it deletes the variables we pass to it, set them again -## this has to be fixed in the macro implementation -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_EXECUTABLE( - EXE_NAME o2-sim-digitizer-workflow - - SOURCES - src/SimpleDigitizerWorkflow.cxx - src/SimReaderSpec.cxx - src/CollisionTimePrinter.cxx - src/MIDDigitizerSpec.cxx - src/TPCDigitizerSpec.cxx - src/TPCDigitRootWriterSpec.cxx - src/ITSMFTDigitizerSpec.cxx - src/ITSMFTDigitWriterSpec.cxx - src/TOFDigitizerSpec.cxx - src/TOFDigitWriterSpec.cxx - src/TOFClusterizerSpec.cxx - src/TOFClusterWriterSpec.cxx - src/FITDigitizerSpec.cxx - src/FITDigitWriterSpec.cxx - src/EMCALDigitizerSpec.cxx - src/EMCALDigitWriterSpec.cxx - src/HMPIDDigitizerSpec.cxx - src/MCHDigitizerSpec.cxx - src/TRDDigitizerSpec.cxx - src/ZDCDigitizerSpec.cxx - src/GRPUpdaterSpec.cxx - - BUCKET_NAME ${MODULE_BUCKET_NAME} -) +o2_add_executable(digitizer-workflow + COMPONENT_NAME sim + SOURCES src/CollisionTimePrinter.cxx + src/EMCALDigitWriterSpec.cxx + src/EMCALDigitizerSpec.cxx + src/FITDigitWriterSpec.cxx + src/FITDigitizerSpec.cxx + src/GRPUpdaterSpec.cxx + src/HMPIDDigitizerSpec.cxx + src/ITSMFTDigitWriterSpec.cxx + src/ITSMFTDigitizerSpec.cxx + src/MCHDigitizerSpec.cxx + src/MIDDigitizerSpec.cxx + src/SimReaderSpec.cxx + src/SimpleDigitizerWorkflow.cxx + src/TOFClusterWriterSpec.cxx + src/TOFClusterizerSpec.cxx + src/TOFDigitWriterSpec.cxx + src/TOFDigitizerSpec.cxx + src/TPCDigitRootWriterSpec.cxx + src/TPCDigitizerSpec.cxx + src/TRDDigitizerSpec.cxx + src/ZDCDigitizerSpec.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + O2::Steer + O2::EMCALSimulation + O2::FITSimulation + O2::HMPIDSimulation + O2::ITSMFTSimulation + O2::ITSSimulation + O2::MCHSimulation + O2::MFTSimulation + O2::MIDSimulation + O2::TOFSimulation + O2::TOFReconstruction + O2::TPCSimulation + O2::TPCWorkflow + O2::TRDSimulation + O2::ZDCSimulation) diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index e597d9adf4cd2..bfc1764cefd71 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -1,12 +1,26 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + if(ALIROOT) - add_subdirectory (hough) + # FIXME: not tested + add_subdirectory(hough) endif(ALIROOT) -add_subdirectory (aliceHLTwrapper) -add_subdirectory (O2Device) -add_subdirectory (O2MessageMonitor) -add_subdirectory (DataFlow) -add_subdirectory (Publishers) -add_subdirectory (DataCompression) -# add_subdirectory (MCStepLogger) -add_subdirectory (PCG) -add_subdirectory (Mergers) + +add_subdirectory(aliceHLTwrapper) +add_subdirectory(O2MessageMonitor) +add_subdirectory(DataFlow) +add_subdirectory(Publishers) +add_subdirectory(DataCompression) +add_subdirectory(Mergers) + +# * add_subdirectory (O2Device) // already included in src/CMakeLists.txt as it +# is needed earlier +# * add_subdirectory (PCG) // already included in src/CMakeLists.txt as it is +# needed earlier diff --git a/Utilities/DataCompression/CMakeLists.txt b/Utilities/DataCompression/CMakeLists.txt index 01a11b9361550..214a4f5e85c2c 100644 --- a/Utilities/DataCompression/CMakeLists.txt +++ b/Utilities/DataCompression/CMakeLists.txt @@ -1,50 +1,36 @@ -# @author Matthias Richter -# @brief cmake setup for module Utilities/DataCompression - -set(MODULE_NAME "DataCompression") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - ) - -set(LIBRARY_NAME ${MODULE_NAME}) - -set(BUCKET_NAME utility_datacompression_bucket) - -#O2_GENERATE_LIBRARY() - -Set(Exe_Names - ) - -set(Exe_Source - ) - -list(LENGTH Exe_Names _length) -if (LENGTH) -math(EXPR _length ${_length}-1) - -ForEach (_file RANGE 0 ${_length}) - list(GET Exe_Names ${_file} _name) - list(GET Exe_Source ${_file} _src) - O2_GENERATE_EXECUTABLE( - EXE_NAME ${_name} - SOURCES ${_src} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - ) -EndForEach (_file RANGE 0 ${_length}) -endif() - -set(TEST_SRCS - test/test_dc_primitives.cxx - test/test_Fifo.cxx - test/test_DataGenerator.cxx - test/test_HuffmanCodec.cxx - test/test_DataDeflater.cxx -) - -O2_GENERATE_TESTS( - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_test(dc_primitives + SOURCES test/test_dc_primitives.cxx + COMPONENT_NAME DataCompression + LABELS utils) + +o2_add_test(Fifo + SOURCES test/test_Fifo.cxx + COMPONENT_NAME DataCompression + PUBLIC_LINK_LIBRARIES Threads::Threads + LABELS utils) + +o2_add_test(DataGenerator + SOURCES test/test_DataGenerator.cxx + COMPONENT_NAME DataCompression + LABELS utils) + +o2_add_test(HuffmanCodec + SOURCES test/test_HuffmanCodec.cxx + COMPONENT_NAME DataCompression + PUBLIC_LINK_LIBRARIES O2::CommonUtils Boost::filesystem + LABELS utils) + +o2_add_test(DataDeflater + SOURCES test/test_DataDeflater.cxx + COMPONENT_NAME DataCompression + LABELS utils) diff --git a/Utilities/DataFlow/CMakeLists.txt b/Utilities/DataFlow/CMakeLists.txt index 3dc84fab4d304..05e9e26bd0c31 100644 --- a/Utilities/DataFlow/CMakeLists.txt +++ b/Utilities/DataFlow/CMakeLists.txt @@ -1,100 +1,87 @@ -# @author Matthias Richter -# @brief cmake setup for module Utilities/DataFlow - -set(MODULE_NAME "DataFlow") -# the bucket contains the following dependencies -# - common_boost_bucket -# - Base -# - Headers -# - O2device -# - dl -# the 'dl' dependency is needed as the device boilerplate code in -# runSimpleMQStateMachine.h uses dlopen etc. Probably this hidden -# dependency can be avoided by including the to some compiled FairMQ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# the bucket contains the following dependencies - common_boost_bucket - Base - +# Headers - O2device - dl the 'dl' dependency is needed as the device +# boilerplate code in runSimpleMQStateMachine.h uses dlopen etc. Probably this +# hidden dependency can be avoided by including the to some compiled FairMQ # library -set(MODULE_BUCKET_NAME O2DeviceApplication_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/FakeTimeframeBuilder.cxx - src/FakeTimeframeGeneratorDevice.cxx - src/HeartbeatSampler.cxx - src/SubframeBuilderDevice.cxx - src/TimeframeParser.cxx - src/TimeframeReaderDevice.cxx - src/TimeframeValidatorDevice.cxx - src/TimeframeWriterDevice.cxx - src/EPNReceiverDevice.cxx - src/FLPSenderDevice.cxx - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -# TODO: feature of macro, it deletes the variables we pass to it, set them again -# this has to be fixed in the macro implementation -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -Set(Exe_Names - o2-fake-timeframegenerator-device - o2-heartbeat-sampler - o2-subframebuilder-device - o2-timeframe-reader-device - o2-timeframe-validator-device - o2-timeframe-writer-device - o2-epn-receiver-device - o2-flp-sender-device - ) - -set(Exe_Source - src/runFakeTimeframeGeneratorDevice.cxx - src/runHeartbeatSampler.cxx - src/runSubframeBuilderDevice.cxx - src/runTimeframeReaderDevice.cxx - src/runTimeframeValidatorDevice.cxx - src/runTimeframeWriterDevice.cxx - src/runEPNReceiver.cxx - src/runFLPSender.cxx - ) - -list(LENGTH Exe_Names _length) -math(EXPR _length ${_length}-1) - -ForEach (_file RANGE 0 ${_length}) - list(GET Exe_Names ${_file} _name) - list(GET Exe_Source ${_file} _src) - O2_GENERATE_EXECUTABLE( - EXE_NAME ${_name} - SOURCES ${_src} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} - ) -EndForEach (_file RANGE 0 ${_length}) - - -O2_GENERATE_EXECUTABLE( - EXE_NAME o2-timeframe-validation-tool - SOURCES src/TimeframeValidationTool - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -set(TEST_SRCS - test/test_TimeframeParser.cxx - test/test_SubframeUtils01.cxx - test/test_PayloadMerger01.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS}) - -O2_GENERATE_MAN(NAME o2-timeframe-reader-device) -O2_GENERATE_MAN(NAME o2-timeframe-writer-device) -O2_GENERATE_MAN(NAME o2-subframebuilder-device) +o2_add_library(DataFlow + SOURCES src/FakeTimeframeBuilder.cxx + src/FakeTimeframeGeneratorDevice.cxx + src/HeartbeatSampler.cxx + src/SubframeBuilderDevice.cxx + src/TimeframeParser.cxx + src/TimeframeReaderDevice.cxx + src/TimeframeValidatorDevice.cxx + src/TimeframeWriterDevice.cxx + src/EPNReceiverDevice.cxx + src/FLPSenderDevice.cxx + PUBLIC_LINK_LIBRARIES O2::Headers O2::TimeFrame FairMQ::FairMQ + O2::Device) + +o2_target_man_page(DataFlow NAME o2-timeframe-reader-device) +o2_target_man_page(DataFlow NAME o2-timeframe-writer-device) +o2_target_man_page(DataFlow NAME o2-subframebuilder-device) + +o2_add_executable(fake-timeframegenerator-device + SOURCES src/runFakeTimeframeGeneratorDevice + PUBLIC_LINK_LIBRARIES O2::DataFlow) + +o2_add_executable(heartbeat-sampler + SOURCES src/runHeartbeatSampler + PUBLIC_LINK_LIBRARIES O2::DataFlow) + +o2_add_executable(subframebuilder-device + SOURCES src/runSubframeBuilderDevice + PUBLIC_LINK_LIBRARIES O2::DataFlow) + +o2_add_executable(timeframe-reader-device + SOURCES src/runTimeframeReaderDevice + PUBLIC_LINK_LIBRARIES O2::DataFlow) + +o2_add_executable(timeframe-validator-device + SOURCES src/runTimeframeValidatorDevice + PUBLIC_LINK_LIBRARIES O2::DataFlow) + +o2_add_executable(timeframe-writer-device + SOURCES src/runTimeframeWriterDevice + PUBLIC_LINK_LIBRARIES O2::DataFlow) + +o2_add_executable(epn-receiver-device + SOURCES src/runEPNReceiver + PUBLIC_LINK_LIBRARIES O2::DataFlow) + +o2_add_executable(flp-sender-device + SOURCES src/runFLPSender + PUBLIC_LINK_LIBRARIES O2::DataFlow) + +o2_add_executable(timeframe-validation-tool + SOURCES src/TimeframeValidationTool + PUBLIC_LINK_LIBRARIES O2::DataFlow) + +o2_add_test(TimeframeParser + SOURCES test/test_TimeframeParser + PUBLIC_LINK_LIBRARIES O2::DataFlow + COMPONENT_NAME dataflow + LABELS utils) + +o2_add_test(SubframeUtils01 + SOURCES test/test_SubframeUtils01 + PUBLIC_LINK_LIBRARIES O2::DataFlow + COMPONENT_NAME dataflow + LABELS utils) + +o2_add_test(PayloadMerger01 + SOURCES test/test_PayloadMerger01 + PUBLIC_LINK_LIBRARIES O2::DataFlow + COMPONENT_NAME dataflow + LABELS utils) diff --git a/Utilities/MCStepLogger/CMakeLists.txt b/Utilities/MCStepLogger/CMakeLists.txt index 2bc5892439775..f63a845c7bcdb 100644 --- a/Utilities/MCStepLogger/CMakeLists.txt +++ b/Utilities/MCStepLogger/CMakeLists.txt @@ -1,9 +1,18 @@ -# @author Sandro Wenzel -# @brief cmake setup for module Utilities/MCStepLogger +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# @author Sandro Wenzel @brief cmake setup for module Utilities/MCStepLogger set(MODULE_NAME "MCStepLogger") set(MODULE_BUCKET_NAME mcsteplogger_bucket) -O2_SETUP(NAME ${MODULE_NAME}) +o2_setup(NAME ${MODULE_NAME}) set(SRCS src/MCStepInterceptor.cxx @@ -14,68 +23,111 @@ set(SRCS src/MCAnalysisManager.cxx src/MCAnalysisFileWrapper.cxx src/MCAnalysisUtilities.cxx - src/ROOTIOUtilities.cxx - ) + src/ROOTIOUtilities.cxx) set(HEADERS - include/${MODULE_NAME}/StepInfo.h - include/${MODULE_NAME}/MetaInfo.h - include/${MODULE_NAME}/MCAnalysis.h - include/${MODULE_NAME}/BasicMCAnalysis.h - include/${MODULE_NAME}/MCAnalysisManager.h - include/${MODULE_NAME}/MCAnalysisFileWrapper.h - include/${MODULE_NAME}/MCAnalysisUtilities.h - include/${MODULE_NAME}/ROOTIOUtilities.h - ) + include/${MODULE_NAME}/StepInfo.h + include/${MODULE_NAME}/MetaInfo.h + include/${MODULE_NAME}/MCAnalysis.h + include/${MODULE_NAME}/BasicMCAnalysis.h + include/${MODULE_NAME}/MCAnalysisManager.h + include/${MODULE_NAME}/MCAnalysisFileWrapper.h + include/${MODULE_NAME}/MCAnalysisUtilities.h + include/${MODULE_NAME}/ROOTIOUtilities.h) set(LIBRARY_NAME ${MODULE_NAME}) set(BUCKET_NAME ${MODULE_BUCKET_NAME}) set(LINKDEF src/MCStepLoggerLinkDef.h) +o2_generate_library() -O2_GENERATE_LIBRARY() - -O2_GENERATE_EXECUTABLE( - EXE_NAME mcStepAnalysis - SOURCES src/analyseMCSteps.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) +o2_generate_executable(EXE_NAME + mcStepAnalysis + SOURCES + src/analyseMCSteps.cxx + MODULE_LIBRARY_NAME + ${LIBRARY_NAME} + BUCKET_NAME + ${BUCKET_NAME}) -O2_GENERATE_EXECUTABLE( - EXE_NAME runTestBasicMCAnalysis - SOURCES src/basicMCAnalysisCI.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) +o2_generate_executable(EXE_NAME + runTestBasicMCAnalysis + SOURCES + src/basicMCAnalysisCI.cxx + MODULE_LIBRARY_NAME + ${LIBRARY_NAME} + BUCKET_NAME + ${BUCKET_NAME}) # check correct functioning of the logger and the MC analysis chain -if (HAVESIMULATION) - add_test_wrap(NAME mcloggertest COMMAND ${CMAKE_BINARY_DIR}/bin/o2-sim-tpc -n 1 -e TGeant3) +if(BUILD_SIMULATION) + add_test_wrap(NAME + mcloggertest + COMMAND + ${CMAKE_BINARY_DIR}/bin/o2-sim-tpc + -n + 1 + -e + TGeant3) # tests if the logger was active - set_tests_properties(mcloggertest PROPERTIES PASS_REGULAR_EXPRESSION "VolName.*COUNT") - if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set_tests_properties(mcloggertest + PROPERTIES PASS_REGULAR_EXPRESSION "VolName.*COUNT") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(PRELOAD "DYLD_INSERT_LIBRARIES") else() set(PRELOAD "LD_PRELOAD") endif() - set_tests_properties(mcloggertest PROPERTIES ENVIRONMENT ${PRELOAD}=${CMAKE_BINARY_DIR}/lib/libMCStepLogger${CMAKE_SHARED_LIBRARY_SUFFIX}) - set_property(TEST mcloggertest APPEND PROPERTY ENVIRONMENT VMCWORKDIR=${CMAKE_SOURCE_DIR}) + set_tests_properties( + mcloggertest + PROPERTIES + ENVIRONMENT + ${PRELOAD}=${CMAKE_BINARY_DIR}/lib/libMCStepLogger${CMAKE_SHARED_LIBRARY_SUFFIX} + ) + set_property(TEST mcloggertest + APPEND + PROPERTY ENVIRONMENT VMCWORKDIR=${CMAKE_SOURCE_DIR}) - # check whether StepLogger output can be written to ROOT file - # fix output file name for logged data + # check whether StepLogger output can be written to ROOT file fix output file + # name for logged data set(STEPLOGGER_ROOTFILE "MCStepLoggerOutput_test.root") - add_test_wrap(NAME mcloggertest_tofile COMMAND ${CMAKE_BINARY_DIR}/bin/runTPC -n 1 -e TGeant3) - set_tests_properties(mcloggertest_tofile PROPERTIES ENVIRONMENT ${PRELOAD}=${CMAKE_BINARY_DIR}/lib/libMCStepLogger${CMAKE_SHARED_LIBRARY_SUFFIX}) + add_test_wrap(NAME + mcloggertest_tofile + COMMAND + ${CMAKE_BINARY_DIR}/bin/runTPC + -n + 1 + -e + TGeant3) + set_tests_properties( + mcloggertest_tofile + PROPERTIES + ENVIRONMENT + ${PRELOAD}=${CMAKE_BINARY_DIR}/lib/libMCStepLogger${CMAKE_SHARED_LIBRARY_SUFFIX} + ) # set environment accordingly - set_property(TEST mcloggertest_tofile APPEND PROPERTY ENVIRONMENT VMCWORKDIR=${CMAKE_SOURCE_DIR} MCSTEPLOG_TTREE=1 MCSTEPLOG_OUTFILE=${STEPLOGGER_ROOTFILE}) + set_property(TEST mcloggertest_tofile + APPEND + PROPERTY ENVIRONMENT VMCWORKDIR=${CMAKE_SOURCE_DIR} + MCSTEPLOG_TTREE=1 + MCSTEPLOG_OUTFILE=${STEPLOGGER_ROOTFILE}) - # check for working analysis - # fix output file name for analysis + # check for working analysis fix output file name for analysis set(MCANALYSIS_ROOTFILE "BasicMCAnalysis.root") - add_test_wrap(NAME basicmcanalysis COMMAND ${CMAKE_BINARY_DIR}/bin/mcStepAnalysis analyze -f ${STEPLOGGER_ROOTFILE} -o ${MCANALYSIS_ROOTFILE} -l testLabel) + add_test_wrap(NAME + basicmcanalysis + COMMAND + ${CMAKE_BINARY_DIR}/bin/mcStepAnalysis + analyze + -f + ${STEPLOGGER_ROOTFILE} + -o + ${MCANALYSIS_ROOTFILE} + -l + testLabel) set_tests_properties(basicmcanalysis PROPERTIES DEPENDS mcloggertest_tofile) # set environment accordingly - set_property(TEST basicmcanalysis APPEND PROPERTY ENVIRONMENT VMCWORKDIR=${CMAKE_SOURCE_DIR}) + set_property(TEST basicmcanalysis + APPEND + PROPERTY ENVIRONMENT VMCWORKDIR=${CMAKE_SOURCE_DIR}) endif() diff --git a/Utilities/Mergers/CMakeLists.txt b/Utilities/Mergers/CMakeLists.txt index a727772a8acda..d5345df2b5410 100644 --- a/Utilities/Mergers/CMakeLists.txt +++ b/Utilities/Mergers/CMakeLists.txt @@ -1,66 +1,43 @@ -# Copyright CERN and copyright holders of ALICE O2. This software is -# distributed under the terms of the GNU General Public License v3 (GPL -# Version 3), copied verbatim in the file "COPYING". +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". # -# See https://alice-o2.web.cern.ch/ for full licensing information. +# See http://alice-o2.web.cern.ch/license for full licensing information. # # In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. - -set(MODULE_NAME "Mergers") - -# todo create bucket -set(MODULE_BUCKET_NAME mergers_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/Merger.cxx - src/MergerInfrastructureBuilder.cxx - src/MergerCache.cxx - src/MergerBuilder.cxx - ) - -set(HEADERS - include/Mergers/Merger.h - include/Mergers/MergerConfig.h - include/Mergers/MergeInterface.h - include/Mergers/MergeInterfaceOverrideExample.h - include/Mergers/MergerInfrastructureBuilder.h - include/Mergers/MergerBuilder.h - include/Mergers/MergerCache.h - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) -set(LINKDEF include/Mergers/LinkDef.h) - -O2_GENERATE_LIBRARY() - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-mergers-topology-example" - SOURCES "src/mergersTopologyExample.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -O2_GENERATE_EXECUTABLE( - EXE_NAME "o2-mergers-benchmark-topology" - SOURCES "src/mergersBenchmarkTopology.cxx" - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${MODULE_BUCKET_NAME} -) - -set(TEST_SRCS - test/test_InfrastructureBuilder.cxx - ) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# FIXME: the LinkDef should not be in the public area + +o2_add_library(Mergers + SOURCES src/Merger.cxx src/MergerInfrastructureBuilder.cxx + src/MergerCache.cxx src/MergerBuilder.cxx + PUBLIC_LINK_LIBRARIES O2::Framework) + +o2_target_root_dictionary( + Mergers + HEADERS include/Mergers/Merger.h + include/Mergers/MergerConfig.h + include/Mergers/MergeInterface.h + include/Mergers/MergeInterfaceOverrideExample.h + include/Mergers/MergerInfrastructureBuilder.h + include/Mergers/MergerBuilder.h + include/Mergers/MergerCache.h + LINKDEF include/Mergers/LinkDef.h) + +o2_add_executable(topology-example + SOURCES src/mergersTopologyExample.cxx + COMPONENT_NAME mergers + PUBLIC_LINK_LIBRARIES O2::Mergers) + +o2_add_executable(benchmark-topology + SOURCES src/mergersBenchmarkTopology.cxx + COMPONENT_NAME mergers + PUBLIC_LINK_LIBRARIES O2::Mergers) + +o2_add_test(InfrastructureBuilder + SOURCES test/test_InfrastructureBuilder.cxx + COMPONENT_NAME mergers + PUBLIC_LINK_LIBRARIES O2::Mergers + LABELS utils) diff --git a/Utilities/O2Device/CMakeLists.txt b/Utilities/O2Device/CMakeLists.txt index 45b27786c59dd..b98ba7bf4b2bf 100644 --- a/Utilities/O2Device/CMakeLists.txt +++ b/Utilities/O2Device/CMakeLists.txt @@ -1,30 +1,20 @@ -# @author Mikolaj Krzewicki - -set(MODULE_NAME "O2Device") - -O2_SETUP(NAME ${MODULE_NAME}) - -# Define the source and header files -set(SRCS - src/O2Device.cxx -) - -set(HEADERS - include/${MODULE_NAME}/O2Device.h - include/${MODULE_NAME}/Utilities.h -) - -set(TEST_SRCS - test/test_O2Device.cxx -) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME O2Device_bucket) - -O2_GENERATE_LIBRARY() - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(Device + SOURCES src/O2Device.cxx + PUBLIC_LINK_LIBRARIES FairMQ::FairMQ O2::MemoryResources + O2::Headers ms_gsl::ms_gsl + AliceO2::Monitoring) + +o2_add_test(O2Device + SOURCES test/test_O2Device.cxx + PUBLIC_LINK_LIBRARIES O2::Device + COMPONENT_NAME Device) diff --git a/Utilities/O2MessageMonitor/CMakeLists.txt b/Utilities/O2MessageMonitor/CMakeLists.txt index cd6278d3146d8..e705802c1028b 100644 --- a/Utilities/O2MessageMonitor/CMakeLists.txt +++ b/Utilities/O2MessageMonitor/CMakeLists.txt @@ -1,39 +1,23 @@ -# @author Mikolaj Krzewicki - -set(MODULE_NAME "O2MessageMonitor") - -O2_SETUP(NAME ${MODULE_NAME}) - -# Define the source and header files -set(SRCS - src/O2MessageMonitor.cxx -) - -set(HEADERS - include/${MODULE_NAME}/O2MessageMonitor.h -) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME O2MessageMonitor_bucket) - -O2_GENERATE_LIBRARY() - -# Define application -O2_GENERATE_EXECUTABLE( - EXE_NAME o2-message-monitor - SOURCES src/runO2MessageMonitor.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} -) - -ADD_DEFINITIONS() - -set(TEST_SRCS - test/O2MessageMonitorTest.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +o2_add_library(MessageMonitor + SOURCES src/O2MessageMonitor.cxx + PUBLIC_LINK_LIBRARIES FairLogger::FairLogger FairMQ::FairMQ + O2::Device) + +o2_add_executable(message-monitor + SOURCES src/runO2MessageMonitor.cxx + PUBLIC_LINK_LIBRARIES O2::MessageMonitor) + +o2_add_test(O2MessageMonitorTest + SOURCES test/O2MessageMonitorTest.cxx + PUBLIC_LINK_LIBRARIES O2::MessageMonitor + LABELS utils) diff --git a/Utilities/PCG/CMakeLists.txt b/Utilities/PCG/CMakeLists.txt index b91a2632a3d71..d53bec96dff6d 100644 --- a/Utilities/PCG/CMakeLists.txt +++ b/Utilities/PCG/CMakeLists.txt @@ -1 +1,13 @@ -# @author Piotr Konopka \ No newline at end of file +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# @author Piotr Konopka + +o2_add_header_only_library(PCG) diff --git a/Utilities/Publishers/CMakeLists.txt b/Utilities/Publishers/CMakeLists.txt index 9f473f74cb5f4..5308ec1250739 100644 --- a/Utilities/Publishers/CMakeLists.txt +++ b/Utilities/Publishers/CMakeLists.txt @@ -1,53 +1,18 @@ -# @author Matthias Richter -# @brief cmake setup for module Utilities/Publishers - -set(MODULE_NAME "Publishers") -# the bucket contains the following dependencies -# - common_boost_bucket -# - Base -# - Headers -# - O2device -# - dl -# the 'dl' dependency is needed as the device boilerplate code in -# runSimpleMQStateMachine.h uses dlopen etc. Probably this hidden -# dependency can be avoided by including the to some compiled FairMQ -# library -set(MODULE_BUCKET_NAME O2DeviceApplication_bucket) - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/DataPublisherDevice.cxx - ) - -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -O2_GENERATE_LIBRARY() - -# TODO: feature of macro, it deletes the variables we pass to it, set them again -# this has to be fixed in the macro implementation -set(LIBRARY_NAME ${MODULE_NAME}) -set(BUCKET_NAME ${MODULE_BUCKET_NAME}) - -Set(Exe_Names - o2-datapublisher-device - ) - -set(Exe_Source - src/runDataPublisherDevice.cxx - ) - -list(LENGTH Exe_Names _length) -math(EXPR _length ${_length}-1) - -ForEach (_file RANGE 0 ${_length}) - list(GET Exe_Names ${_file} _name) - list(GET Exe_Source ${_file} _src) - O2_GENERATE_EXECUTABLE( - EXE_NAME ${_name} - SOURCES ${_src} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - ) -EndForEach (_file RANGE 0 ${_length}) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# FIXME: do we actually need a library here ? +o2_add_library(Publishers + SOURCES src/DataPublisherDevice.cxx + PUBLIC_LINK_LIBRARIES O2::Device) + +o2_add_executable(datapublisher-device + PUBLIC_LINK_LIBRARIES O2::Publishers + SOURCES src/runDataPublisherDevice.cxx) diff --git a/Utilities/aliceHLTwrapper/CMakeLists.txt b/Utilities/aliceHLTwrapper/CMakeLists.txt index 60d5706584d85..4487ca73b1de1 100644 --- a/Utilities/aliceHLTwrapper/CMakeLists.txt +++ b/Utilities/aliceHLTwrapper/CMakeLists.txt @@ -1,60 +1,46 @@ -# @author Matthias Richter -# @brief cmake setup for module devices/aliceHLTwrapper - -set(MODULE_NAME "aliceHLTwrapper") - -O2_SETUP(NAME ${MODULE_NAME}) - -set(SRCS - src/SystemInterface.cxx - src/HOMERFactory.cxx - src/WrapperDevice.cxx - src/Component.cxx - src/MessageFormat.cxx - src/EventSampler.cxx - ) - -set(LIBRARY_NAME ${MODULE_NAME}) - -set(BUCKET_NAME O2DeviceApplication_bucket) - -O2_GENERATE_LIBRARY() - -Set(Exe_Names - o2-alicehlt-wrapper-device - o2-alicehlt-eventsampler-device - o2-alicehlt-runcomponent - ) - -set(Exe_Source - src/aliceHLTWrapper.cxx - src/aliceHLTEventSampler.cxx - src/runComponent.cxx - ) - -list(LENGTH Exe_Names _length) -math(EXPR _length ${_length}-1) - -ForEach (_file RANGE 0 ${_length}) - list(GET Exe_Names ${_file} _name) - list(GET Exe_Source ${_file} _src) - O2_GENERATE_EXECUTABLE( - EXE_NAME ${_name} - SOURCES ${_src} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - ) -EndForEach (_file RANGE 0 ${_length}) - -set(TEST_SRCS - test/testMessageFormat.cxx -) - -O2_GENERATE_TESTS( - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - TEST_SRCS ${TEST_SRCS} -) - -O2_GENERATE_MAN(NAME o2-alicehlt-wrapper-device) -O2_GENERATE_MAN(NAME AliceHLTComponents) +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# @author Matthias Richter @brief cmake setup for module +# devices/aliceHLTwrapper + +o2_add_library(aliceHLTwrapper + SOURCES src/SystemInterface.cxx + src/HOMERFactory.cxx + src/WrapperDevice.cxx + src/Component.cxx + src/MessageFormat.cxx + src/EventSampler.cxx + PUBLIC_LINK_LIBRARIES FairMQ::FairMQ O2::Headers O2::Device + Boost::thread) + +o2_target_man_page(aliceHLTwrapper NAME o2-alicehlt-wrapper-device) +o2_target_man_page(aliceHLTwrapper NAME AliceHLTComponents) + +o2_add_executable(wrapper-device + SOURCES src/aliceHLTWrapper.cxx + COMPONENT_NAME alicehlt + PUBLIC_LINK_LIBRARIES O2::aliceHLTwrapper) + +o2_add_executable(eventsampler-device + SOURCES src/aliceHLTEventSampler.cxx + COMPONENT_NAME alicehlt + PUBLIC_LINK_LIBRARIES O2::aliceHLTwrapper) + +o2_add_executable(runcomponent + SOURCES src/runComponent.cxx + COMPONENT_NAME alicehlt + PUBLIC_LINK_LIBRARIES O2::aliceHLTwrapper) + +o2_add_test(MessageFormat + COMPONENT_NAME alicehlt + SOURCES test/testMessageFormat.cxx + PUBLIC_LINK_LIBRARIES O2::aliceHLTwrapper + LABELS utils) diff --git a/Utilities/hough/CMakeLists.txt b/Utilities/hough/CMakeLists.txt index 1c2aebd0c107e..12c3adcc99d92 100644 --- a/Utilities/hough/CMakeLists.txt +++ b/Utilities/hough/CMakeLists.txt @@ -1,26 +1,33 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + set(MODULE_NAME "hough") -O2_SETUP(NAME ${MODULE_NAME}) +o2_setup(NAME ${MODULE_NAME}) -Set(Exe_Names - runHough -) +set(Exe_Names runHough) -set(Exe_Source - runHough.cxx -) +set(Exe_Source runHough.cxx) set(BUCKET_NAME hough_bucket) list(LENGTH Exe_Names _length) math(EXPR _length ${_length}-1) -ForEach(_file RANGE 0 ${_length}) +foreach(_file RANGE 0 ${_length}) list(GET Exe_Names ${_file} _name) list(GET Exe_Source ${_file} _src) - O2_GENERATE_EXECUTABLE( - EXE_NAME ${_name} - SOURCES ${_src} - BUCKET_NAME ${BUCKET_NAME} - ) -EndForEach(_file RANGE 0 ${_length}) + o2_generate_executable(EXE_NAME + ${_name} + SOURCES + ${_src} + BUCKET_NAME + ${BUCKET_NAME}) +endforeach(_file RANGE 0 ${_length}) diff --git a/cmake/AddRootDictionary.cmake b/cmake/AddRootDictionary.cmake new file mode 100644 index 0000000000000..fcfc2a308de20 --- /dev/null +++ b/cmake/AddRootDictionary.cmake @@ -0,0 +1,178 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +# +# add_root_dictionary generates one dictionary to be added to a target. +# +# Besides the dictionary source itself two files are also generated : a rootmap +# file and a pcm file. Those two will be installed alongside the target's +# library file +# +# arguments : +# +# * 1st parameter (required) is the target the dictionary should be added to +# +# * HEADERS (required) is a list of relative filepaths needed for the dictionary +# definition +# +# * LINKDEF (required) is a single relative filepath to the LINKDEF file needed +# by rootcling. +# +# LINKDEF and HEADERS must contain relative paths only (relative to the +# CMakeLists.txt that calls this add_root_dictionary function). +# +# The target must be of course defined _before_ calling this function (i.e. +# add_library(target ...) has been called). +# +# In addition : +# +# * target_include_directories _must_ have be called as well, in order to be +# able to compute the list of include directories needed to _compile_ the +# dictionary +# +# Note also that the generated dictionary is added to PRIVATE SOURCES list of +# the target. +# +function(add_root_dictionary target) + cmake_parse_arguments(PARSE_ARGV + 1 + A + "" + "LINKDEF" + "HEADERS;BASENAME") + if(A_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}") + endif() + + if(A_BASENAME) + message(STATUS "BASENAME parameter is deprecated. Will be ignored") + endif() + + set(required_args "LINKDEF;HEADERS") + foreach(required_arg IN LISTS required_args) + if(NOT A_${required_arg}) + message(FATAL_ERROR "Missing required argument: ${required_arg}") + endif() + endforeach() + + # check all given filepaths are relative ones + foreach(h ${A_HEADERS} ${A_LINKDEF}) + if(IS_ABSOLUTE ${h}) + message( + FATAL_ERROR "add_root_dictionary only accepts relative paths, but the" + "following path is absolute : ${h}") + endif() + endforeach() + + # convert all relative paths to absolute ones. LINKDEF must be the last one. + foreach(h ${A_HEADERS} ${A_LINKDEF}) + get_filename_component(habs ${CMAKE_CURRENT_LIST_DIR}/${h} ABSOLUTE) + list(APPEND headers ${habs}) + endforeach() + + # check all given filepaths actually exist + foreach(h ${headers}) + get_filename_component(f ${h} ABSOLUTE) + if(NOT EXISTS ${f}) + message( + FATAL_ERROR + "add_root_dictionary was given an inexistant input include ${f}") + endif() + endforeach() + + # Generate the pcm and rootmap files alongside the library + get_property(lib_output_dir + TARGET ${target} + PROPERTY LIBRARY_OUTPUT_DIRECTORY) + if(NOT lib_output_dir) + set(lib_output_dir ${CMAKE_CURRENT_BINARY_DIR}) + endif() + + # Define the names of generated files + get_property(basename TARGET ${target} PROPERTY OUTPUT_NAME) + if(NOT basename) + set(basename ${target}) + endif() + set(dictionary G__${basename}) + set(dictionaryFile ${CMAKE_CURRENT_BINARY_DIR}/${dictionary}.cxx) + set(pcmBase ${dictionary}_rdict.pcm) + set(pcmFile ${lib_output_dir}/${pcmBase}) + set(rootmapFile ${lib_output_dir}/lib${basename}.rootmap) + + # get the list of compile_definitions and split it into -Dxxx pieces but only + # if non empty + set(prop "$") + set(defs $<$:-D$>) + + # Build the LD_LIBRARY_PATH required to get rootcling running fine + # + # Need at least root core library + get_filename_component(LD_LIBRARY_PATH ${ROOT_Core_LIBRARY} DIRECTORY) + # and possibly toolchain libs if we are using a toolchain + if(DEFINED ENV{GCC_TOOLCHAIN_ROOT}) + set(LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:$ENV{GCC_TOOLCHAIN_ROOT}/lib") + set(LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:$ENV{GCC_TOOLCHAIN_ROOT}/lib64") + endif() + + # add a custom command to generate the dictionary using rootcling + # cmake-format: off + add_custom_command( + OUTPUT ${dictionaryFile} ${pcmFile} ${rootmapFile} + VERBATIM + COMMAND + ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ${ROOT_rootcling_CMD} + -f + ${dictionaryFile} + -inlineInputHeader + -rmf ${rootmapFile} + -rml $ + $,\;-I>> + # the generator expression above gets the list of all include + # directories that might be required using the transitive dependencies + # of the target ${target} and prepend each item of that list with -I + "${defs}" + ${incdirs} ${headers} + COMMAND + ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${pcmBase} ${pcmFile} + COMMAND_EXPAND_LISTS + DEPENDS ${headers}) + # cmake-format: on + + # add dictionary source to the target sources + target_sources(${target} PRIVATE ${dictionaryFile}) + + get_property(libs TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES) + if(NOT ROOT::RIO IN_LIST libs) + # add ROOT::IO if not already there as a target that has a Root dictionary + # has to depend on ... Root + target_link_libraries(${target} PUBLIC ROOT::RIO) + endif() + + # Get the list of include directories that will be required to compile the + # dictionary itself and add them as private include directories + foreach(h IN LISTS A_HEADERS) + if(IS_ABSOLUTE ${h}) + message(FATAL_ERROR "Path ${h} should be relative, not absolute") + endif() + get_filename_component(a ${h} ABSOLUTE) + string(REPLACE "${h}" "" d "${a}") + list(APPEND dirs ${d}) + endforeach() + list(REMOVE_DUPLICATES dirs) + target_include_directories(${target} PRIVATE ${dirs}) + + # will install the rootmap and pcm files alongside the target's lib + get_filename_component(dict ${dictionaryFile} NAME_WE) + install(FILES ${rootmapFile} ${pcmFile} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +endfunction() diff --git a/cmake/O2AddExecutable.cmake b/cmake/O2AddExecutable.cmake new file mode 100644 index 0000000000000..3424adf2aad78 --- /dev/null +++ b/cmake/O2AddExecutable.cmake @@ -0,0 +1,126 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +# +# o2_add_executable(basename SOURCES ...) add an executable with the given +# sources. +# +# * SOURCES (required) gives the list of source files to compile into the +# executable +# * PUBLIC_LINK_LIBRARIES (needed in most cases) indicates the list of targets +# this executable depends on. +# +# The installed executable will be named o2[-exeType][-component_name]-basename +# +# where : +# +# * exeType is `test` if IS_TEST is set, `bench` if IS_BENCHMARK is set or void +# otherwise +# * COMPONENT_NAME (optional) is typically used to indicate a subsystem name for +# regular executables (e.g. o2-tpc-... or o2-mch-...) or the origin target for +# tests (to help locate the source file in the source directory hierarchy, +# e.g. o2-test-DataFormats-...) +# +# Note that the _target_ corresponding to the executable will be named +# O2exe[-exeType][component]-basename and can be retrieved with the +# TARGETVARNAME parameter if needed. +# +# For instance after a call to: +# +# o2_add_executable(toto SOURCES ... TARGETVARNAME titi IS_TEST) +# +# ${titi} will contain something like `O2exe-test-toto` (for the exact naming +# see the o2_name_target function) and an executable named o2-test-toto will be +# created upon build) + +function(o2_add_executable baseTargetName) + + cmake_parse_arguments(PARSE_ARGV + 1 + A + "IS_TEST;NO_INSTALL;IS_BENCHMARK" + "COMPONENT_NAME;TARGETVARNAME" + "SOURCES;PUBLIC_LINK_LIBRARIES") + + if(A_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Got trailing arguments ${A_UNPARSED_ARGUMENTS}") + endif() + + # set the executable name following our coding convention + if(A_IS_TEST) + set(exeType -test) + elseif(A_IS_BENCHMARK) + set(exeType -bench) + endif() + + if(A_COMPONENT_NAME) + string(TOLOWER ${A_COMPONENT_NAME} component) + set(comp -${component}) + endif() + set(exeName o2${exeType}${comp}-${baseTargetName}) + + if(A_IS_TEST) + set(isTest "IS_TEST") + endif() + if(A_IS_BENCH) + set(isBench "IS_BENCH") + endif() + + # get the target name. the convention might be different from the executable + # convention. + o2_name_target(${baseTargetName} + NAME + targetName + IS_EXE + ${isTest} + ${isBench}) + + set(target ${targetName}) + + if(A_TARGETVARNAME) + set(${A_TARGETVARNAME} ${target} PARENT_SCOPE) + endif() + + # add the executable with its sources + add_executable(${target} ${A_SOURCES}) + + # set the executable output name + set_property(TARGET ${target} PROPERTY OUTPUT_NAME ${exeName}) + + if(A_IS_TEST) + # tests go in a separate directory + get_filename_component(outdir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../tests + ABSOLUTE) + set_property(TARGET ${target} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${outdir}) + endif() + + # use its dependencies + foreach(lib IN LISTS A_PUBLIC_LINK_LIBRARIES) + if(NOT TARGET ${lib}) + message( + FATAL_ERROR "Trying to add a dependency on non-existing target ${lib}") + endif() + target_link_libraries(${target} PUBLIC ${lib}) + endforeach() + + if(NOT A_NO_INSTALL) + # install the executable + + if(A_IS_TEST) + install(TARGETS ${target} + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${testsDir}) + else() + install(TARGETS ${target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif() + endif() + +endfunction() diff --git a/cmake/O2AddHeaderOnlyLibrary.cmake b/cmake/O2AddHeaderOnlyLibrary.cmake new file mode 100644 index 0000000000000..a461bf8faf8a0 --- /dev/null +++ b/cmake/O2AddHeaderOnlyLibrary.cmake @@ -0,0 +1,66 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +# o2_add_header_only_library creates a header-only target. +# +# * INCLUDE_DIRECTORIES the relative path(s) to the headers of that library if +# not specified will be set as "include" simply (which should work just fine +# in most cases) +# +function(o2_add_header_only_library baseTargetName) + + cmake_parse_arguments(PARSE_ARGV + 1 + A + "" + "" + "INCLUDE_DIRECTORIES;INTERFACE_LINK_LIBRARIES") + + if(A_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}") + endif() + + o2_name_target(${baseTargetName} NAME target) + + # define the target and its O2:: alias + add_library(${target} INTERFACE) + add_library(O2::${baseTargetName} ALIAS ${target}) + + # set the export name so that packages using O2 can reference the target as + # O2::${baseTargetName} as well (assuming the export is installed with + # namespace O2::) + set_property(TARGET ${target} PROPERTY EXPORT_NAME ${baseTargetName}) + + if(NOT A_INCLUDE_DIRECTORIES) + get_filename_component(dir include ABSOLUTE) + if(EXISTS ${dir}) + set(A_INCLUDE_DIRECTORIES $) + else() + set(A_INCLUDE_DIRECTORIES $) + endif() + endif() + + target_include_directories( + ${target} + INTERFACE $) + + if(A_INTERFACE_LINK_LIBRARIES) + target_link_libraries(${target} INTERFACE ${A_INTERFACE_LINK_LIBRARIES}) + endif() + install(DIRECTORY ${A_INCLUDE_DIRECTORIES}/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + install(TARGETS ${target} + EXPORT O2Targets + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +endfunction() diff --git a/cmake/O2AddLibrary.cmake b/cmake/O2AddLibrary.cmake new file mode 100644 index 0000000000000..eab07bb264853 --- /dev/null +++ b/cmake/O2AddLibrary.cmake @@ -0,0 +1,164 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +include(O2NameTarget) + +# +# o2_add_library(baseTargetName SOURCES c1.cxx c2.cxx .....) defines a new +# target of type "library" composed of the given sources. It also defines an +# alias named O2::baseTargetName. The generated library will be called +# libO2[baseTargetName].(dylib|so|.a) (for exact naming see the o2_name_target +# function). +# +# The library will be static or shared depending on the BUILD_SHARED_LIBS option +# (which is normally ON for O2 project) +# +# Parameters: +# +# * SOURCES (required) : the list of source files to compile into this library +# +# * PUBLIC_LINK_LIBRARIES (needed in most cases) : the list of targets this +# library depends on (e.g. ROOT::Hist, O2::CommonConstants). It is recommended +# to use the fully qualified target name (i.e. including the namespace part) +# even for internal (O2) targets. +# +# * PUBLIC_INCLUDE_DIRECTORIES (not needed in most cases) : the list of include +# directories where to find the include files needed to compile this library +# and that will be needed as well by the consumers of that library. By default +# the include subdirectory of the current source directory is taken into +# account, which should cover most of the use cases. Use this parameter only +# for special cases then. Note that if you do specify this parameter it +# replaces the default, it does not add to them. +# +# * PRIVATE_INCLUDE_DIRECTORIES (not needed in most cases) : the list of include +# directories where to find the include files needed to compile this library, +# but that will _not_ be needed by its consumers. But default we add the +# ${CMAKE_CURRENT_BINARY_DIR} here to cover use case of generated headers +# (e.g. by protobuf). Note that if you do specify this parameter it replaces +# the default, it does not add to them. +# +function(o2_add_library baseTargetName) + + cmake_parse_arguments( + PARSE_ARGV + 1 + A + "" + "TARGETVARNAME" + "SOURCES;PUBLIC_INCLUDE_DIRECTORIES;PUBLIC_LINK_LIBRARIES;PRIVATE_INCLUDE_DIRECTORIES" + ) + + if(A_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}") + endif() + + o2_name_target(${baseTargetName} NAME targetName) + set(target ${targetName}) + + # define the target and its O2:: alias + add_library(${target} ${A_SOURCES}) + add_library(O2::${baseTargetName} ALIAS ${target}) + + # set the export name so that packages using O2 can reference the target as + # O2::${baseTargetName} as well (assuming the export is installed with + # namespace O2::) + set_property(TARGET ${target} PROPERTY EXPORT_NAME ${baseTargetName}) + + # output name of the lib will be libO2[baseTargetName].(so|dylib|a) + set_property(TARGET ${target} PROPERTY OUTPUT_NAME O2${baseTargetName}) + + if(A_TARGETVARNAME) + set(${A_TARGETVARNAME} ${target} PARENT_SCOPE) + endif() + + # Start by adding the dependencies to other targets + if(A_PUBLIC_LINK_LIBRARIES) + foreach(L IN LISTS A_PUBLIC_LINK_LIBRARIES) + if(NOT TARGET ${L}) + message( + FATAL_ERROR "Trying to add a dependency on non-existing target ${L}") + endif() + target_link_libraries(${target} PUBLIC ${L}) + endforeach() + endif() + + # set the public include directories if available + if(A_PUBLIC_INCLUDE_DIRECTORIES) + foreach(d IN LISTS A_PUBLIC_INCLUDE_DIRECTORIES) + get_filename_component(adir ${d} ABSOLUTE) + if(NOT IS_DIRECTORY ${adir}) + message( + FATAL_ERROR "Trying to append non existing include directory ${d}") + endif() + target_include_directories(${target} PUBLIC $) + endforeach() + else() + # use sane default (if it exists) + if(IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include) + target_include_directories( + ${target} + PUBLIC $) + endif() + endif() + + # set the private include directories if available + if(A_PRIVATE_INCLUDE_DIRECTORIES) + foreach(d IN LISTS A_PRIVATE_INCLUDE_DIRECTORIES) + get_filename_component(adir ${d} ABSOLUTE) + if(NOT IS_DIRECTORY ${adir}) + message( + FATAL_ERROR "Trying to append non existing include directory ${d}") + endif() + target_include_directories(${target} PRIVATE $) + endforeach() + else() + # use sane(?) default + target_include_directories( + ${target} + PRIVATE $) + get_filename_component(adir ${CMAKE_CURRENT_LIST_DIR}/src ABSOLUTE) + if(EXISTS ${adir}) + target_include_directories( + ${target} + PRIVATE $) + endif() + endif() + + if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/include/${baseTargetName}) + + # The INCLUDES DESTINATION adds ${CMAKE_INSTALL_INCLUDEDIR} to the + # INTERFACE_INCLUDE_DIRECTORIES property + # + # The EXPORT must come first in the list of parameters + # + install(TARGETS ${target} + EXPORT O2Targets + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + # install all the includes found in + # ${CMAKE_CURRENT_LIST_DIR}/include/${baseTargetName} as those are public + # headers + install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/${baseTargetName} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + else() + + # The EXPORT must come first in the list of parameters + # + install(TARGETS ${target} + EXPORT O2Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + endif() + +endfunction() diff --git a/cmake/O2AddTest.cmake b/cmake/O2AddTest.cmake new file mode 100644 index 0000000000000..6f55f9007db45 --- /dev/null +++ b/cmake/O2AddTest.cmake @@ -0,0 +1,123 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +include(O2AddExecutable) +include(O2AddTestWrapper) + +# +# o2_add_test(testName SOURCES ...) adds a test. The test itself (in the CTest +# sense) is a wrapper around an executable. Both the test wrapper and the +# executable are setup by this function. +# +# If BUILD_TESTING if not set this function does nothing at all. +# +# The test name is the name of the first source file in SOURCES, unless the NAME +# parameter is given (see below). +# +# This function accepts two sets of parameters : one for the executable and one +# for the test wrapper. +# +# Parameters of the test executable : +# +# * NO_BOOST_TEST : we assume most of the tests are using the Boost::Test +# framework and thus link the test with the Boost::unit_test_framework target. +# If the test is known to not depend on Boost::Test, then the NO_BOOST_TEST +# option can be given to forego this dependency +# * INSTALL : by default tests are _not_ installed. If that option is present +# then the test is installed (under ${CMAKE_INSTALL_PREFIX}/tests, not in +# ${CMAKE_INSTALL_PREFIX}/bin like other binaries) +# +# Parameters of the test wrapper : +# +# * NAME: if given, will be used verbatim as the test name +# * MAX_ATTEMPTS : the number of time the test will be tried (upon failures) +# before it is actually considered as failed +# * TIMEOUT : the number of seconds allowed for the test to run. Past this time +# failure is assumed. +# * NON_FATAL : true if the failing of this test is not causing the CI to fail +# * ENVIRONMENT: extra environment needed by the test to run properly +# +function(o2_add_test) + + if(NOT BUILD_TESTING) + return() + endif() + + cmake_parse_arguments( + PARSE_ARGV + 1 + A + "INSTALL;NO_BOOST_TEST;NON_FATAL" + "COMPONENT_NAME;MAX_ATTEMPTS;TIMEOUT;WORKING_DIRECTORY;NAME" + "SOURCES;PUBLIC_LINK_LIBRARIES;COMMAND_LINE_ARGS;LABELS;CONFIGURATIONS;ENVIRONMENT" + ) + + if(A_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}") + endif() + + set(testName ${ARGV0}) + + set(linkLibraries ${A_PUBLIC_LINK_LIBRARIES}) + + if(NOT A_NO_BOOST_TEST) + set(linkLibraries ${linkLibraries} Boost::unit_test_framework) + if(A_COMMAND_LINE_ARGS) + # Boost test programs are to be called like this : + # + # testProgram -- arg1 arg2 ... + # + # if they have arguments. + set(A_COMMAND_LINE_ARGS "--" ${A_COMMAND_LINE_ARGS}) + endif() + endif() + + set(noInstall NO_INSTALL) + + if(A_INSTALL) + set(noInstall "") + endif() + + # create the executable + o2_add_executable(${testName} + SOURCES ${A_SOURCES} + PUBLIC_LINK_LIBRARIES ${linkLibraries} + COMPONENT_NAME ${A_COMPONENT_NAME} + IS_TEST ${noInstall} TARGETVARNAME targetName) + + set(nonFatal "") + if(NON_FATAL) + set(nonFatal NON_FATAL) + endif() + + # create a test with a script wrapping the executable above + set(name "") + if(A_NAME) + set(name ${A_NAME}) + else() + list(GET A_SOURCES 0 firstSource) + get_filename_component(src ${firstSource} ABSOLUTE) + file(RELATIVE_PATH name ${CMAKE_SOURCE_DIR} ${src}) + endif() + + o2_add_test_wrapper(TARGET ${targetName} + NAME ${name} + DONT_FAIL_ON_TIMEOUT + MAX_ATTEMPTS ${A_MAX_ATTEMPTS} + TIMEOUT ${A_TIMEOUT} ${nonFatal} + WORKING_DIRECTORY ${A_WORKING_DIRECTORY} + COMMAND_LINE_ARGS ${A_COMMAND_LINE_ARGS} + LABELS ${A_LABELS} + CONFIGURATIONS ${A_CONFIGURATIONS} + ENVIRONMENT "${A_ENVIRONMENT}") +endfunction() diff --git a/cmake/O2AddTestRootMacro.cmake b/cmake/O2AddTestRootMacro.cmake new file mode 100644 index 0000000000000..d89466e616073 --- /dev/null +++ b/cmake/O2AddTestRootMacro.cmake @@ -0,0 +1,146 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +# +# o2_add_test_root_macro generate one or two tests for one root macro. +# +# * one test is trying to load the macro within a root.exe session using ".L +# macro.C" +# * one test is trying to compile the macro using ".L macro.C++" +# +# * arg LOAD_ONLY: if present we generate only the test to load the macro (i.e. +# we skip the compilation test) +# * arg COMPILE_ONLY: if present we generate only the test to compile the +# libration (i.e. we skip the loading test) +# * arg NON_FATAL: if present mark the test as non_fatal, i.e. it won't +# invalidate the build +# * arg ENVIRONMENT: sets the running environment for the generated test(s). +# * arg PUBLIC_LINK_LIBRARIES: the list of targets this macro is depending on. +# Required to be able to specify correctly the include and library paths to +# test the (compiled version of) the macro. +# +# **************** +# +# DEV NOTES: +# +# LIMITATION: the tests generated by this function currently only work fine +# under the proper environment. +# +# WHY: attempts to compute the environment of the root process (so that tests +# could be run without having to setup the env. beforehand) proved to be a bit +# difficult. +# +# While computing ROOT_INCLUDE_PATH is just a matter of using the proper +# generator expression on each of the dependencies : list(APPEND incdir +# $) computing the list of +# directories to be used for LD_LIBRARY_PATH is a lot more complex. There is +# currently no $ that would +# give us, _transitively_, all the libraries directories. And computing them +# ourselves (recursively) is quite time consuming... +# +function(o2_add_test_root_macro) + + if(NOT BUILD_TESTING) + return() + endif() + + if(NOT BUILD_TEST_ROOT_MACROS) + return() + endif() + + cmake_parse_arguments( + PARSE_ARGV + 1 + A + "NON_FATAL;LOAD_ONLY;COMPILE_ONLY" + "" + "ENVIRONMENT;PUBLIC_LINK_LIBRARIES;PUBLIC_INCLUDE_DIRECTORIES;LABELS") + + if(A_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}") + endif() + + get_filename_component(macroFileName ${ARGV0} ABSOLUTE) + + if(NOT EXISTS ${macroFileName}) + message( + FATAL_ERROR + "Requested a test macro for non existing macro ${macroFileName}") + return() + endif() + + file(RELATIVE_PATH testName ${CMAKE_SOURCE_DIR} ${macroFileName}) + + if(${A_IS_NON_FATAL}) + set(nonFatal "NON_FATAL") + endif() + + list(APPEND incdir $ENV{ROOT_INCLUDE_PATH}) + list(APPEND incdir ${A_PUBLIC_INCLUDE_DIRECTORIES}) + + # Get all the include dir dependencies + foreach(t IN LISTS A_PUBLIC_LINK_LIBRARIES) + if(NOT TARGET ${t}) + message( + WARNING + "Trying to use non-existing target ${t} for ${testName} test so I won't be able to generate that test." + ) + return() + endif() + list(APPEND dependencies ${t}) + endforeach() + + list(LENGTH dependencies nofDeps) + if(${nofDeps} GREATER 0) + list(REMOVE_DUPLICATES dependencies) + foreach(t IN LISTS dependencies) + list(APPEND incdir $) + endforeach() + # FIXME: once CMake 3.15 is out, use $ to dedupe the + # includePath list + set(includePath $) + endif() + + list(APPEND testEnv "ROOT_HIST=0") + list(APPEND testEnv "${A_ENVIRONMENT}") + + if(NOT A_COMPILE_ONLY) + o2_add_test_wrapper(COMMAND ${CMAKE_BINARY_DIR}/test-root-macro.sh + NAME ${testName} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ${nonFatal} + COMMAND_LINE_ARGS ${macroFileName} 0 "${includePath}" + LABELS "macro;${A_LABELS}") + + set_property(TEST ${testName} PROPERTY ENVIRONMENT "${testEnv}") + + set(LIST_OF_ROOT_MACRO_TESTS + "${LIST_OF_ROOT_MACRO_TESTS};${testName}" + CACHE INTERNAL "") + endif() + + if(NOT A_LOAD_ONLY) + + o2_add_test_wrapper(COMMAND ${CMAKE_BINARY_DIR}/test-root-macro.sh + NAME ${testName}_compiled + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ${nonFatal} + COMMAND_LINE_ARGS ${macroFileName} 1 "${includePath}" + LABELS "macro;macro_compiled;${A_LABELS}") + + set_property(TEST ${testName}_compiled PROPERTY ENVIRONMENT "${testEnv}") + set(LIST_OF_ROOT_MACRO_TESTS_COMPILED + "${LIST_OF_ROOT_MACRO_TESTS_COMPILED};${testName}" + CACHE INTERNAL "") + + endif() + +endfunction() diff --git a/cmake/O2AddTestWrapper.cmake b/cmake/O2AddTestWrapper.cmake new file mode 100644 index 0000000000000..77c6ac492ef87 --- /dev/null +++ b/cmake/O2AddTestWrapper.cmake @@ -0,0 +1,136 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +# +# o2_add_test_wrapper +# +# Same as o2_add_test() but optionally retry up to MAX_ATTEMPTS times upon +# failure. This is achieved by using a shell script wrapper. +# +# * TARGET or COMMAND (required) is either a target name or the full path to the +# executable to be wrapped +# +# * NAME (optional): the test name. If not present it is derived from the +# target name (if TARGET was used) or from the executable name (if COMMAND was +# given) +# +# * WORKING_DIRECTORY (optional) the wrapper will cd into this directory before +# running the executable +# * DONT_FAIL_ON_TIMEOUT (optional) indicate the test will not fail on timeouts +# * MAX_ATTEMPTS (optional) the maximum number of attempts +# * TIMEOUT (optional) the test timeout (for each attempt) +# * COMMAND_LINE_ARGS (optional) extra arguments to the test executable, if +# needed +# * NON_FATAL (optional) mark the test as non criticial for the CI +# * ENVIRONMENT: extra environment needed by the test to run properly +# +function(o2_add_test_wrapper) + + if(NOT BUILD_TESTING) + return() + endif() + + cmake_parse_arguments( + PARSE_ARGV + 0 + "A" + "DONT_FAIL_ON_TIMEOUT;NON_FATAL" + "TARGET;COMMAND;WORKING_DIRECTORY;MAX_ATTEMPTS;TIMEOUT;NAME" + "COMMAND_LINE_ARGS;LABELS;CONFIGURATIONS;ENVIRONMENT") + + if(A_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}") + endif() + + if(A_TARGET AND A_COMMAND) + message(FATAL_ERROR "Should only use one of COMMAND or TARGET") + endif() + + if(NOT A_TARGET AND NOT A_COMMAND) + message(FATAL_ERROR "Must give at least one of COMMAND or TARGET") + endif() + + if(A_TARGET) + if(NOT TARGET ${A_TARGET}) + message(FATAL_ERROR "${A_TARGET} is not a target") + endif() + set(testExe $) + endif() + + if(A_COMMAND) + set(testExe ${A_COMMAND}) + endif() + + if(A_NAME) + set(testName "${A_NAME}") + else() + if(A_COMMAND) + get_filename_component(testName ${testExe} NAME_WE) + else() + set(testName ${A_TARGET}) + endif() + endif() + + if("${A_MAX_ATTEMPTS}" GREATER 1) + # Warn only for tests where retry has been requested + message( + WARNING "Test ${testName} will be retried max ${A_MAX_ATTEMPTS} times") + endif() + if(A_NON_FATAL) + message(WARNING "Failure of test ${testName} will not be fatal") + endif() + + if(NOT A_TIMEOUT) + set(A_TIMEOUT 100) # default timeout (seconds) + endif() + if(NOT A_MAX_ATTEMPTS) + set(A_MAX_ATTEMPTS 1) # default number of attempts + endif() + if(A_DONT_FAIL_ON_TIMEOUT) + set(A_DONT_FAIL_ON_TIMEOUT "--dont-fail-on-timeout") + else() + set(A_DONT_FAIL_ON_TIMEOUT "") + endif() + if(A_NON_FATAL) + set(A_NON_FATAL "--non-fatal") + else() + set(A_NON_FATAL "") + endif() + math(EXPR ctestTimeout "(20 + ${A_TIMEOUT}) * ${A_MAX_ATTEMPTS}") + + add_test(NAME "${testName}" + COMMAND "${CMAKE_BINARY_DIR}/tests-wrapper.sh" + "--name" + "${testName}" + "--max-attempts" + "${A_MAX_ATTEMPTS}" + "--timeout" + "${A_TIMEOUT}" + ${A_DONT_FAIA_ON_TIMEOUT} + ${A_NON_FATAL} + "--" + ${testExe} + ${A_COMMAND_LINE_ARGS} + WORKING_DIRECTORY "${A_WORKING_DIRECTORY}" + CONFIGURATIONS "${A_CONFIGURATIONS}") + + set_tests_properties(${testName} PROPERTIES TIMEOUT ${ctestTimeout}) + if(A_LABELS) + foreach(A IN LISTS A_LABELS) + set_property(TEST ${testName} APPEND PROPERTY LABELS ${A}) + endforeach() + endif() + if(A_ENVIRONMENT) + set_tests_properties(${testName} PROPERTIES ENVIRONMENT ${A_ENVIRONMENT}) + endif() +endfunction() diff --git a/cmake/O2BuildSanityChecks.cmake b/cmake/O2BuildSanityChecks.cmake new file mode 100644 index 0000000000000..95a6afaa82d4e --- /dev/null +++ b/cmake/O2BuildSanityChecks.cmake @@ -0,0 +1,29 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +function(o2_build_sanity_checks) + if(NOT UNIX) + message( + FATAL_ERROR + "You're not on an UNIX system. The project was up to now only tested on UNIX systems, so we break here. IF you want to go on please edit the CMakeLists.txt in the source directory." + ) + endif() + + if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + message(FATAL_ERROR "In-source builds are not allowed.") + endif() + + if(NOT CMAKE_BUILD_TYPE) + message(WARNING "CMAKE_BUILD_TYPE not set : will use Debug") + set(CMAKE_BUILD_TYPE Debug) + endif() +endfunction() diff --git a/cmake/O2CheckCXXFeatures.cmake b/cmake/O2CheckCXXFeatures.cmake new file mode 100644 index 0000000000000..532d1df9761e0 --- /dev/null +++ b/cmake/O2CheckCXXFeatures.cmake @@ -0,0 +1,21 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +function(o2_check_cxx_features) + # FIXME: missing the make_unique here compared to previous version + foreach(FEAT "cxx_aggregate_default_initializers" "cxx_binary_literals" + "cxx_generic_lambdas" "cxx_user_literals") + if(NOT "${FEAT}" IN_LIST CMAKE_CXX_COMPILE_FEATURES) + message(FATAL_ERROR "We miss ${FEAT} feature with this compiler") + endif() + endforeach() +endfunction() diff --git a/cmake/O2DataFile.cmake b/cmake/O2DataFile.cmake new file mode 100644 index 0000000000000..9b7932ee2404c --- /dev/null +++ b/cmake/O2DataFile.cmake @@ -0,0 +1,61 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# +# o2_data_file(COPY src DESTINATION dest) is a convenience function to copy and +# install src into dest in a single command. dest should be a relative path. +# +# The install occurs only in the installation phase (if any) and puts src into +# ${CMAKE_INSTALL_DATADIR}/dest +# +# The copy always happens at configure time and puts src into +# ${CMAKE_BINARY_DIR}/stage/{CMAKE_INSTALL_DATADIR}/dest +# +# Note that when src denotes directories src and src/ means different things : +# +# o2_add_file(COPY src/ DESTINATION dest) will copy the _content_ of src into +# dest, while o2_add_file(COPY src DESTINATION dest) will copy the directory src +# into dest. +# +function(o2_data_file) + + cmake_parse_arguments(PARSE_ARGV + 0 + A + "" + "DESTINATION" + "COPY") + + if(A_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}") + endif() + + if(IS_ABSOLUTE ${A_DESTINATION}) + message(FATAL_ERROR "DESTINATION should be a relative path") + endif() + + foreach(D IN LISTS A_COPY) + get_filename_component(adir ${D} ABSOLUTE) + if(IS_DIRECTORY ${adir}) + install(DIRECTORY ${D} + DESTINATION ${CMAKE_INSTALL_DATADIR}/${A_DESTINATION}) + else() + + install(FILES ${D} DESTINATION ${CMAKE_INSTALL_DATADIR}/${A_DESTINATION}) + endif() + endforeach() + + file( + COPY ${A_COPY} + DESTINATION + ${CMAKE_BINARY_DIR}/stage/${CMAKE_INSTALL_DATADIR}/${A_DESTINATION}) + +endfunction() diff --git a/cmake/O2DefineOptions.cmake b/cmake/O2DefineOptions.cmake new file mode 100644 index 0000000000000..19bf39f9b7b3c --- /dev/null +++ b/cmake/O2DefineOptions.cmake @@ -0,0 +1,29 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +function(o2_define_options) + + option(BUILD_SHARED_LIBS "Build shared libs" ON) + + option(BUILD_EXAMPLES "Build examples" ON) + + option(BUILD_TEST_ROOT_MACROS + "Build the tests toload and compile the Root macros" ON) + + option( + BUILD_SIMULATION_DEFAULT + "Default behavior for simulation (disregarded if BUILD_SIMULATION is defined)" + ON) + # for the complete picture of how BUILD_SIMULATION is handled see + # ../dependencies/O2SimulationDependencies.cmake + +endfunction() diff --git a/cmake/O2DefineOutputPaths.cmake b/cmake/O2DefineOutputPaths.cmake new file mode 100644 index 0000000000000..a5d7bb9563778 --- /dev/null +++ b/cmake/O2DefineOutputPaths.cmake @@ -0,0 +1,36 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +function(o2_define_output_paths) + + # Set CMAKE_INSTALL_LIBDIR explicitly to lib (to avoid lib64 on CC7) + set(CMAKE_INSTALL_LIBDIR lib PARENT_SCOPE) + + include(GNUInstallDirs) + + if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/stage/${CMAKE_INSTALL_BINDIR} + PARENT_SCOPE) + endif() + if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/stage/${CMAKE_INSTALL_LIBDIR} + PARENT_SCOPE) + endif() + if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/stage/${CMAKE_INSTALL_LIBDIR} + PARENT_SCOPE) + endif() + +endfunction() diff --git a/cmake/O2DefineRPATH.cmake b/cmake/O2DefineRPATH.cmake new file mode 100644 index 0000000000000..372f8e6d12530 --- /dev/null +++ b/cmake/O2DefineRPATH.cmake @@ -0,0 +1,46 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +include(GNUInstallDirs) + +# +# o2_define_rpath defines our RPATH settings +# +function(o2_define_rpath) + + if(APPLE) + set(basePoint @loader_path) + else() + set(basePoint $ORIGIN) + endif() + + # use, i.e. do not skip, the full RPATH in the _build_ tree + set(CMAKE_SKIP_BUILD_RPATH FALSE PARENT_SCOPE) + # when building, do not use the install RPATH already (will only be used when + # actually installing), unless we are on a Mac (where the install is otherwise + # pretty slow) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE PARENT_SCOPE) + if(APPLE) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE PARENT_SCOPE) + endif() + + # add to the install RPATH the (automatically determined) parts of the RPATH + # that point to directories outside the build tree + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE PARENT_SCOPE) + + # specify libraries directory relative to binaries one. + file(RELATIVE_PATH relDir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + + set(CMAKE_INSTALL_RPATH ${basePoint} ${basePoint}/${relDir} PARENT_SCOPE) + +endfunction() diff --git a/cmake/O2Dependencies.cmake b/cmake/O2Dependencies.cmake deleted file mode 100644 index bf29d46df5e48..0000000000000 --- a/cmake/O2Dependencies.cmake +++ /dev/null @@ -1,2727 +0,0 @@ - -########## DEPENDENCIES lookup ############ - -function(guess_append_libpath _libname _root) - # Globally adds, as library path, the path of library ${_libname} searched - # under ${_root}/lib and ${_root}/lib64. The purpose is to work around broken - # external CMake config files, hardcoding full paths of their dependencies - # not being relocated properly, leading to broken builds if reusing builds - # produced under different hosts/paths. - unset(_lib CACHE) # force find_library to look again - find_library(_lib "${_libname}" HINTS "${_root}" "${_root}/.." NO_DEFAULT_PATH PATH_SUFFIXES lib lib64) - if(_lib) - get_filename_component(_libdir "${_lib}" DIRECTORY) - message(STATUS "Adding library path: ${_libdir}") - link_directories(${_libdir}) - else() - message(WARNING "Cannot find library ${_libname} under ${_root}") - endif() -endfunction() - -find_package(ROOT 6.06.00 REQUIRED) -find_package(Vc REQUIRED) -find_package(Pythia8) -find_package(Pythia6) - -# Installed via CMake. Note: we work around hardcoded full paths in the CMake -# config files not being relocated properly by appending library paths. -guess_append_libpath(geant321 "${Geant3_DIR}") -find_package(Geant3 NO_MODULE) -guess_append_libpath(G4run "${Geant4_DIR}") -find_package(Geant4 NO_MODULE) -guess_append_libpath(geant4vmc "${GEANT4_VMC_DIR}") -find_package(Geant4VMC NO_MODULE) -guess_append_libpath(BaseVGM "${VGM_DIR}") - -find_package(VGM NO_MODULE) -find_package(CERNLIB) -find_package(HEPMC) -# FIXME: the way, iwyu is integrated now conflicts with the possibility to add -# custom rules for individual modules, e.g. the custom targets introduced in -# PR #886 depending on some header files conflict with the IWYU setup -# disable package for the moment -#find_package(IWYU) - -find_package(Boost 1.59 COMPONENTS container thread system timer program_options random filesystem chrono exception regex serialization log log_setup unit_test_framework date_time signals iostreams REQUIRED) -# for the guideline support library -include_directories(${MS_GSL_INCLUDE_DIR}) - -find_package(AliRoot) -find_package(FairRoot REQUIRED) -find_package(FairMQ REQUIRED) -find_package(FairLogger REQUIRED) -find_package(fmt) -find_package(DDS) -cmake_policy(SET CMP0077 NEW) -set(protobuf_MODULE_COMPATIBLE TRUE) -find_package(protobuf CONFIG REQUIRED) -find_package(InfoLogger REQUIRED) -find_package(Configuration REQUIRED) -find_package(Monitoring REQUIRED) -find_package(Common REQUIRED) -find_package(RapidJSON REQUIRED) -find_package(GLFW) -find_package(GLEW) -find_package(OpenGL) -find_package(benchmark QUIET) -find_package(Arrow) -find_package(CURL REQUIRED) -find_package(OpenMP) - -if (DDS_FOUND) - add_definitions(-DENABLE_DDS) - add_definitions(-DDDS_FOUND) - set(OPTIONAL_DDS_LIBRARIES ${DDS_INTERCOM_LIBRARY_SHARED} ${DDS_PROTOCOL_LIBRARY_SHARED} ${DDS_USER_DEFAULTS_LIBRARY_SHARED}) - set(OPTIONAL_DDS_INCLUDE_DIR ${DDS_INCLUDE_DIR}) -endif () - -set(CUDA_MINIMUM_VERSION "10.1") -if(DEFINED ENABLE_CUDA AND NOT ENABLE_CUDA) - message(STATUS "CUDA explicitly disabled") -else() - include(CheckLanguage) - check_language(CUDA) - if(CMAKE_CUDA_COMPILER) - if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") - set(CMAKE_CUDA_FLAGS "-Xptxas -O0 -Xcompiler -O0") - else() - set(CMAKE_CUDA_FLAGS "-Xptxas -O4 -Xcompiler -O4 -use_fast_math") - endif() - if(CUDA_GCCBIN) - message(STATUS "Using as CUDA GCC version: ${CUDA_GCCBIN}") - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --compiler-bindir ${CUDA_GCCBIN}") - endif() - enable_language(CUDA) - get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) - if(NOT CUDA IN_LIST LANGUAGES) - message(FATAL_ERROR "CUDA was found but cannot be enabled for some reason") - endif() - if (CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "${CUDA_MINIMUM_VERSION}") - message(FATAL_ERROR "CUDA version ${CMAKE_CUDA_COMPILER_VERSION} found, but at least ${CUDA_MINIMUM_VERSION} required") - endif() - set(ENABLE_CUDA ON) - if(CUDA_GCCBIN) - #Ugly hack! Otherwise CUDA includes unwanted old GCC libraries leading to version conflicts - set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "$ENV{CUDA_PATH}/lib64") - endif() - add_definitions(-DENABLE_CUDA) - set(CMAKE_CUDA_STANDARD 14) - set(CMAKE_CUDA_STANDARD_REQUIRED ON) - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr --compiler-options \"${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}} -std=c++14\"") - elseif(ENABLE_CUDA) - message(FATAL_ERROR "CUDA explicitly enabled but could not be found") - endif() -endif() - -if (ENABLE_HIP) - if(NOT DEFINED HIP_PATH) - if(NOT DEFINED ENV{HIP_PATH}) - set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to which HIP has been installed") - else() - set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to which HIP has been installed") - endif() - endif() - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${HIP_PATH}/cmake") - if(NOT DEFINED HCC_PATH) - # Workaround to fix a potential FindHIP bug: find HCC_PATH ourselves - set(_HCC_PATH "${HIP_PATH}/../hcc") - get_filename_component(HCC_PATH ${_HCC_PATH} ABSOLUTE CACHE) - unset(_HCC_PATH) - endif() - find_package(HIP REQUIRED) - add_definitions(-DENABLE_HIP) -endif() - -# todo this should really not be needed. ROOT, Pythia, and FairRoot should comply with CMake best practices -# todo but they do not properly return DEPENDENCIES with absolute path. -link_directories( - ${ROOT_LIBRARY_DIR} - ${FAIRROOT_LIBRARY_DIR} - ${Boost_LIBRARY_DIRS} -) -if(Pythia6_FOUND) - link_directories( - ${Pythia6_LIBRARY_DIR} - ) -endif() -if(PYTHIA8_FOUND) - link_directories( - ${PYTHIA8_LIB_DIR} - ) -endif() - -########## General definitions and flags ########## - -if(APPLE) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,error") # avoid undefined in our libs -elseif(UNIX) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") # avoid undefined in our libs -endif() - -########## Bucket definitions ############ -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() -set(_boost_incdir) -set(_fairmq_incdir) - -o2_define_bucket( - NAME - glfw_bucket - - DEPENDENCIES - O2FrameworkFoundation_bucket - ${GLFW_LIBRARIES} - - INCLUDE_DIRECTORIES - ${GLFW_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - headless_bucket - - DEPENDENCIES - O2FrameworkFoundation_bucket -) - -o2_define_bucket( - NAME - common_vc_bucket - - DEPENDENCIES - ${Vc_LIBRARIES} - - INCLUDE_DIRECTORIES - ${Vc_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - common_boost_bucket - - DEPENDENCIES - Boost::system - Boost::log - Boost::log_setup - Boost::program_options - Boost::thread - - SYSTEMINCLUDE_DIRECTORIES - ${Boost_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - rapidjson_bucket - - SYSTEMINCLUDE_DIRECTORIES - ${RAPIDJSON_INCLUDE_DIRS} - ) - -o2_define_bucket( - NAME - arrow_bucket - - DEPENDENCIES - common_boost_bucket - ${ARROW_SHARED_LIB} - - SYSTEMINCLUDE_DIRECTORIES - ${ARROW_INCLUDE_DIR} - ) - -o2_define_bucket( - NAME - ExampleModule1_bucket - - DEPENDENCIES # library names and other buckets - common_boost_bucket - - INCLUDE_DIRECTORIES -) - -o2_define_bucket( - NAME - ExampleModule2_bucket - - DEPENDENCIES # library names - ExampleModule1 # another module - ExampleModule1_bucket # another bucket - Core Hist # ROOT - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Examples/ExampleModule1/include # another module's include dir -) - -o2_define_bucket( - NAME - O2Device_bucket - - DEPENDENCIES - common_boost_bucket - Boost::chrono - Boost::date_time - Boost::random - Boost::regex - Base - O2Headers - O2MemoryResources - FairTools - O2Headers - fairmq_bucket - AliceO2::Monitoring - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - O2DeviceApplication_bucket - - DEPENDENCIES - Base - O2Headers - O2TimeFrame - O2Device - dl -) - -o2_define_bucket( - NAME - InfoLogger_bucket - DEPENDENCIES - ${InfoLogger_LIBRARIES} - - SYSTEMINCLUDE_DIRECTORIES - ${InfoLogger_INCLUDE_DIRS} -) - -o2_define_bucket( - NAME - O2FrameworkFoundation_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Framework/Foundation/include -) - -o2_define_bucket( - NAME - O2FrameworkLogger_bucket - - DEPENDENCIES - FairLogger::FairLogger - fmt::fmt - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Framework/Logger/include -) - -o2_define_bucket( - NAME - O2FrameworkCore_bucket - - DEPENDENCIES - arrow_bucket - O2FrameworkFoundation_bucket - O2FrameworkLogger_bucket - common_utils_bucket - ROOTDataFrame - ROOTVecOps - Base - O2Headers - Core - Tree - TreePlayer - Net - O2DebugGUI - AliceO2::Monitoring - AliceO2::Configuration - InfoLogger_bucket - AliceO2::Common - CURL::libcurl - rapidjson_bucket - - SYSTEMINCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Utilities/PCG/include -) - -o2_define_bucket( - NAME - O2FrameworkCore_benchmark_bucket - - DEPENDENCIES - O2FrameworkCore_bucket - $,benchmark::benchmark,$<0:"">> -) - -o2_define_bucket( - NAME - FrameworkApplication_bucket - - DEPENDENCIES - O2FrameworkCore_bucket - O2Framework - Hist -) - -o2_define_bucket( - NAME - DPLUtils_bucket - - DEPENDENCIES - O2FrameworkCore_bucket - Core - O2Headers - O2Framework - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Framework/Utils/include -) - -o2_define_bucket( - NAME - O2MessageMonitor_bucket - - DEPENDENCIES - O2Device_bucket - O2Device -) - -# module DataFormats/Headers -o2_define_bucket( - NAME - data_format_headers_bucket - - DEPENDENCIES - pmr_bucket - Boost::container - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/DataFormats/Headers/include - ${CMAKE_SOURCE_DIR}/DataFormats/MemoryResources/include -) - -# module DataFormats/Detectors/TPC -o2_define_bucket( - NAME - data_format_TPC_bucket - - DEPENDENCIES - data_format_headers_bucket - data_format_reconstruction_bucket - O2ReconstructionDataFormats - O2Headers - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/Reconstruction/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/TPC/include - ${CMAKE_SOURCE_DIR}/Algorithm/include -) - -o2_define_bucket( - NAME - data_format_TOF_bucket - - DEPENDENCIES - data_format_reconstruction_bucket - O2ReconstructionDataFormats - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/DataFormats/Reconstruction/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/TOF/include -) - -o2_define_bucket( - NAME - TimeFrame_bucket - - DEPENDENCIES - Base - O2Headers - fairroot_base_bucket - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${FAIRROOT_INCLUDE_DIR}/fairmq # temporary fix, until bucket system works with imported targets - ${CMAKE_SOURCE_DIR}/DataFormats/Headers/include - ${CMAKE_SOURCE_DIR}/DataFormats/MemoryResources/include -) - -o2_define_bucket( - NAME - O2DataProcessingApplication_bucket - - DEPENDENCIES - O2DeviceApplication_bucket - O2Framework - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Framework/Core/include -) - -o2_define_bucket( - NAME - flp2epn_bucket - - DEPENDENCIES - common_boost_bucket - Boost::chrono - Boost::date_time - Boost::random - Boost::regex - Base - FairTools - O2Headers - fairmq_bucket - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - flp2epndistrib_bucket - - DEPENDENCIES - flp2epn_bucket - - INCLUDE_DIRECTORIES -) - -o2_define_bucket( - NAME - common_math_bucket - - DEPENDENCIES - common_boost_bucket - fairmq_bucket - Base FairTools Core MathCore Matrix Minuit Hist Geom GenVector RIO - GPUCommon_bucket - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Common/Constants/include -) - -o2_define_bucket( - NAME - common_field_bucket - - DEPENDENCIES - fairroot_base_bucket - Base ParBase Core RIO O2MathUtils Geom - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include -) - -o2_define_bucket( - NAME - configuration_bucket - - DEPENDENCIES - common_boost_bucket - root_base_bucket - O2DetectorsCommonDataFormats - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - CCDB_bucket - - DEPENDENCIES - dl - common_boost_bucket - Boost::filesystem - protobuf::libprotobuf - Base - FairTools - ParBase - ParMQ - fairmq_bucket - pthread Core Tree XMLParser Hist Net RIO z - ${CURL_LIBRARIES} - common_utils_bucket - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Common/Utils/include - ${CMAKE_SOURCE_DIR}/Utilities/O2Device/include - - SYSTEMINCLUDE_DIRECTORIES - ${PROTOBUF_INCLUDE_DIR} - ${CURL_INCLUDE_DIRS} -) - -o2_define_bucket( - NAME - root_base_bucket - - DEPENDENCIES - Core RIO GenVector # ROOT - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} -) - -# module DataFormats/MemoryResources -o2_define_bucket( - NAME - pmr_bucket - - DEPENDENCIES - Boost::container - fairmq_bucket -) - -o2_define_bucket( - NAME - fairroot_geom - - DEPENDENCIES - FairTools - Base GeoBase ParBase Geom Core VMC Tree - common_boost_bucket - O2FrameworkLogger_bucket - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${FAIRROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - fairroot_base_bucket - - DEPENDENCIES - root_base_bucket - fairroot_geom - Base - FairTools - fairmq_bucket - common_boost_bucket - Boost::thread - Boost::serialization - pthread - O2MemoryResources - O2FrameworkLogger_bucket - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - root_physics_bucket - - DEPENDENCIES - EG Physics # ROOT - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - data_format_simulation_bucket - - DEPENDENCIES - fairroot_base_bucket - root_physics_bucket - common_math_bucket - data_format_detectors_common_bucket - O2DetectorsCommonDataFormats - detectors_base_bucket - O2DetectorsBase - RIO - O2SimConfig - GPUCommon_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/Common/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/Base/include/ - ${CMAKE_SOURCE_DIR}/Common/SimConfig/include/ - - ${MS_GSL_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - steer_bucket - - DEPENDENCIES - data_format_simulation_bucket - O2SimulationDataFormat - O2ITSMFTSimulation - RIO - Net - O2SimConfig - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/TPC/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/Common/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${MS_GSL_INCLUDE_DIR} - ${FAIRROOT_INCLUDE_DIR}/fairmq -) - - -o2_define_bucket( - NAME - data_format_simulation_test_bucket - - DEPENDENCIES - data_format_simulation_bucket - O2SimulationDataFormat -) - -o2_define_bucket( - NAME - data_format_reconstruction_bucket - - DEPENDENCIES - fairroot_base_bucket - root_physics_bucket - data_format_detectors_common_bucket - O2DetectorsCommonDataFormats - O2CommonDataFormat - GPUCommon_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/DataFormats/Reconstruction/include/ - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/Common/include/ - ${CMAKE_SOURCE_DIR}/DataFormats/common/include/ - ${MS_GSL_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - data_format_detectors_common_bucket - - DEPENDENCIES - fairroot_base_bucket - root_physics_bucket - common_math_bucket - data_format_headers_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/Common/include/ -) - -o2_define_bucket( - NAME - detectors_base_bucket - - DEPENDENCIES - fairroot_base_bucket - root_physics_bucket - data_format_reconstruction_bucket - common_utils_bucket - GPUCommon_bucket - O2GPUCommon - O2ReconstructionDataFormats - O2DataFormatsParameters - O2CommonUtils - O2Field - fairmq_bucket - Net - VMC # ROOT - Geom - common_utils_bucket - O2CommonUtils - - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Common/Field/include - ${CMAKE_SOURCE_DIR}/Common/Constants/include - ${CMAKE_SOURCE_DIR}/DataFormats/Parameters/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include -) - -o2_define_bucket( - NAME - itsmft_base_bucket - - DEPENDENCIES - fairroot_base_bucket - configuration_bucket - MathCore - Geom - RIO - Hist - ParBase - O2Field - O2SimulationDataFormat - O2SimConfig - O2CommonDataFormat - detectors_base_bucket - O2DetectorsBase - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/Base/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include - ${CMAKE_SOURCE_DIR}/Common/SimConfig/include/ -) - -o2_define_bucket( - NAME - mcsteplogger_bucket - - DEPENDENCIES - dl - root_base_bucket - VMC - EG - Tree - Hist - Graf - Gpad - Geom - common_boost_bucket - Boost::unit_test_framework - O2FrameworkLogger_bucket - rapidjson_bucket - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - itsmft_simulation_bucket - - DEPENDENCIES - itsmft_base_bucket - data_format_itsmft_bucket - configuration_bucket - Graf - Gpad - O2DetectorsBase - O2SimulationDataFormat - O2ITSMFTBase - O2DataFormatsITSMFT - O2SimConfig - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/base/include - ${CMAKE_SOURCE_DIR}/Common/SimConfig/include -) - -o2_define_bucket( - NAME - itsmft_reconstruction_bucket - - DEPENDENCIES - itsmft_base_bucket - data_format_itsmft_bucket - common_utils_bucket - # - Graf - Gpad - O2DetectorsBase - O2DataFormatsITSMFT - O2ITSMFTBase - O2CommonUtils - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/base/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/ITSMFT/common/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include -) - -o2_define_bucket( - NAME - its_base_bucket - - DEPENDENCIES - itsmft_base_bucket - O2ITSMFTBase - O2DetectorsBase - O2SimulationDataFormat - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/base/include - ${MS_GSL_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - its_simulation_bucket - - DEPENDENCIES - its_base_bucket - itsmft_simulation_bucket - Graf - Gpad - O2ITSMFTBase - O2ITSMFTSimulation - O2ITSBase - O2DetectorsBase - O2SimulationDataFormat - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/base/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include -) - -o2_define_bucket( - NAME - its_reconstruction_bucket - - DEPENDENCIES - its_base_bucket - data_format_itsmft_bucket - data_format_its_bucket - itsmft_reconstruction_bucket - # - O2ITSMFTBase - O2ITSMFTReconstruction - O2ITSBase - O2DetectorsBase - O2DataFormatsITS - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/reconstruction/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/base/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/ITSMFT/ITS/include -) - -o2_define_bucket( - NAME - its_tracking_bucket - - DEPENDENCIES - data_format_its_bucket - GPUCommon_bucket - # - O2DataFormatsITS - O2DetectorsBase - O2ITSBase - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/tracking/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/ITSMFT/ITS/include -) - -o2_define_bucket( - NAME - its_tracking_CUDA_bucket - - DEPENDENCIES - # - cuda - cudart - cudadevrt - O2ITStracking - - INCLUDE_DIRECTORIES - ${CUB_ROOT} - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/tracking/include -) - -o2_define_bucket( - NAME - ITS_workflow_bucket - - DEPENDENCIES - O2Framework - its_reconstruction_bucket - O2ITSReconstruction - O2ITStracking - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/workflow/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/reconstruction/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/tracking/include -) - -o2_define_bucket( - NAME - ITSMFT_workflow_bucket - - DEPENDENCIES - O2Framework - data_format_itsmft_bucket - itsmft_reconstruction_bucket - O2ITSMFTReconstruction - O2DataFormatsITSMFT - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/workflow/include -) - - -o2_define_bucket( - NAME - fit_workflow_bucket - - DEPENDENCIES - data_format_fit_bucket - fit_reconstruction_bucket - O2Framework - O2T0Reconstruction - O2DataFormatsFITT0 - O2DataFormatsFITV0 - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/FIT/workflow/include -) - -o2_define_bucket( - NAME - GlobalTracking_workflow_bucket - - DEPENDENCIES - O2Framework - O2ReconstructionDataFormats - O2GlobalTracking - O2TPCWorkflow - O2ITSWorkflow - O2ITSMFTWorkflow - O2FITWorkflow - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/GlobalTrackingWorkflow/include -) - -o2_define_bucket( - NAME - hitanalysis_bucket - - DEPENDENCIES - O2ITSSimulation - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include - - SYSTEMINCLUDE_DIRECTORIES - ${Boost_INCLUDE_DIR} - ) - -o2_define_bucket( - NAME - mergers_bucket - - DEPENDENCIES - Base - O2Headers - O2Framework - Core - Hist - arrow_bucket - fairmq_bucket - O2FrameworkCore_bucket - - INCLUDE_DIRECTORIES - ${MS_GSL_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/MemoryResources/include - ${CMAKE_SOURCE_DIR}/DataFormats/Headers/include - ${CMAKE_SOURCE_DIR}/Framework/Core/include - ${CMAKE_SOURCE_DIR}/Utilities/Mergers/include -) - -o2_define_bucket( - NAME - tpc_base_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket - common_vc_bucket - common_math_bucket - data_format_TPC_bucket - data_format_common_bucket - ParBase - O2MathUtils - O2CCDB - Core Hist Gpad - O2SimulationDataFormat - O2CommonDataFormat - O2DataFormatsTPC - O2SimConfig - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/CCDB/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/TPC/include - ${CMAKE_SOURCE_DIR}/Common/SimConfig/include -) - -o2_define_bucket( - NAME - tpc_simulation_bucket - - DEPENDENCIES - tpc_base_bucket - data_format_TPC_bucket - detectors_base_bucket - TPCSpaceChargeBase_bucket - O2Field - O2DetectorsBase - O2Generators - O2TPCBase - O2SimulationDataFormat - O2DataFormatsTPC - O2TPCSpaceChargeBase - Geom - MathCore - O2MathUtils - RIO - Hist - O2DetectorsPassive - Gen - Base - TreePlayer - O2Steer - # Core - # root_base_bucket - # fairroot_geom - # ${GENERATORS_LIBRARY} - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/Passive/include - ${CMAKE_SOURCE_DIR}/Detectors/TPC/base/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Common/Field/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/TPC/include - ${CMAKE_SOURCE_DIR}/Steer/include - ${MS_GSL_INCLUDE_DIR} -) - - -o2_define_bucket( - NAME - tpc_reconstruction_bucket - - DEPENDENCIES - tpc_base_bucket - data_format_TPC_bucket - data_format_detectors_common_bucket - TPCFastTransformation_bucket - O2DetectorsCommonDataFormats - O2DetectorsBase - O2TPCBase - O2DataFormatsTPC - O2SimulationDataFormat - O2CommonDataFormat - O2ReconstructionDataFormats - Geom - MathCore - RIO - Hist - O2DetectorsPassive - Gen - Base - TreePlayer - O2GPUTracking - O2TPCFastTransformation - O2TPCSimulation - #the dependency on TPCSimulation should be removed at some point - #perhaps 'Cluster' can be moved to base, or so - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/Passive/include - ${CMAKE_SOURCE_DIR}/Detectors/TPC/base/include - ${CMAKE_SOURCE_DIR}/Detectors/TPC/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/DataFormats/Reconstruction/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/TPC/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/Common/include - ${CMAKE_SOURCE_DIR}/DataFormats/Headers/include - ${CMAKE_SOURCE_DIR}/TRD/base/include - ${MS_GSL_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - tpc_calibration_bucket - - DEPENDENCIES - tpc_base_bucket - data_format_TPC_bucket - tpc_reconstruction_bucket - O2DetectorsBase - O2DataFormatsTPC - O2TPCBase - O2TPCReconstruction - O2MathUtils - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/TPC/base/include - ${CMAKE_SOURCE_DIR}/Detectors/TPC/reconstruction/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/TPC/include -) - -o2_define_bucket( - NAME - tpc_monitor_bucket - - DEPENDENCIES - O2DetectorsBase - O2TPCBase - O2TPCCalibration - O2TPCReconstruction - tpc_base_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/TPC/base/include - ${CMAKE_SOURCE_DIR}/Detectors/TPC/calibration/include - ${CMAKE_SOURCE_DIR}/Detectors/TPC/reconstruction/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/TPC/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/DataFormats/Headers/include - ${Vc_INCLUDE_DIR} - ${Boost_INCLUDE_DIR} - ${FAIRROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - TPC_workflow_bucket - - DEPENDENCIES - O2TPCReconstruction - O2Framework - O2DPLUtils - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Algorithm/include - ) - -# base bucket for generators not needing any external stuff -o2_define_bucket( - NAME - generators_base_bucket - - DEPENDENCIES - Base O2SimulationDataFormat MathCore RIO Tree - fairroot_base_bucket - # Gen is generator module from FairRoot - Gen - O2SimConfig - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Common/SimConfig/include -) - -o2_define_bucket( - NAME - generators_bucket - - DEPENDENCIES - generators_base_bucket - pythia8 - - INCLUDE_DIRECTORIES - ${PYTHIA8_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - hough_bucket - - DEPENDENCIES - Core RIO Gpad Hist HLTbase AliHLTUtil AliHLTTPC AliHLTUtil - common_boost_bucket - Boost::filesystem - dl - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - mft_base_bucket - - DEPENDENCIES - itsmft_base_bucket - O2ITSMFTBase - O2ITSMFTSimulation - O2DetectorsBase - Graf - Gpad - XMLIO - common_utils_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/base/include - -) - -o2_define_bucket( - NAME - mft_simulation_bucket - - DEPENDENCIES - mft_base_bucket - itsmft_simulation_bucket - O2ITSMFTBase - O2ITSMFTSimulation - O2MFTBase - O2DetectorsBase - O2SimulationDataFormat - common_utils_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/MFT/base/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include -) - -o2_define_bucket( - NAME - mft_reconstruction_bucket - - DEPENDENCIES - mft_base_bucket - itsmft_reconstruction_bucket - data_format_mft_bucket - O2ITSMFTBase - O2ITSMFTReconstruction - O2MFTBase - O2MFTSimulation - O2DetectorsBase - O2DataFormatsITSMFT - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/ITSMFT/common/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/common/reconstruction/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/MFT/base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/MFT/simulation/include - -) - -o2_define_bucket( - NAME - tof_base_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket - Geom - MathCore - Matrix - Physics - ParBase - VMC - Geom - O2SimulationDataFormat - O2CommonDataFormat - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include -) - -o2_define_bucket( - NAME - trd_base_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket - Geom - Gpad - Graf - MathCore - Matrix - Physics - ParBase - VMC - Geom - O2SimulationDataFormat - O2CommonDataFormat - data_format_detectors_common_bucket - O2DetectorsCommonDataFormats - GPUCommon_bucket - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include -) - -o2_define_bucket( - NAME - emcal_base_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket - Geom - MathCore - Matrix - Physics - ParBase - VMC - Geom - O2SimulationDataFormat - O2CommonDataFormat - data_format_common_bucket - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include -) - -o2_define_bucket( - NAME - passive_detector_bucket - - DEPENDENCIES - fairroot_geom - O2Field - O2DetectorsBase - O2SimConfig - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Common/Field/include - ${CMAKE_SOURCE_DIR}/Detectors/Passive/include - ${CMAKE_SOURCE_DIR}/Common/SimConfig/include -) - -o2_define_bucket( - NAME - emcal_simulation_bucket - - DEPENDENCIES - emcal_base_bucket - root_base_bucket - fairroot_geom - RIO - Graf - Gpad - Matrix - Physics - O2EMCALBase - O2DetectorsBase - detectors_base_bucket - O2SimulationDataFormat - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/EMCAL/base/include -) - -o2_define_bucket( - NAME - emcal_calib_bucket - - DEPENDENCIES - emcal_base_bucket - root_base_bucket - Hist - O2EMCALBase - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/EMCAL/base/include - ${CMAKE_SOURCE_DIR}/Detectors/EMCAL/calib/include -) - -o2_define_bucket( - NAME - tof_simulation_bucket - - DEPENDENCIES - tof_base_bucket - root_base_bucket - detectors_base_bucket - fairroot_geom - RIO - Graf - Gpad - Matrix - Physics - O2TOFBase - O2DetectorsBase - O2SimulationDataFormat - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/TOF/base/include - ${MS_GSL_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - tof_reconstruction_bucket - - DEPENDENCIES - tof_base_bucket - root_base_bucket - fairroot_geom - RIO - Graf - Gpad - Matrix - Physics - O2TOFBase - O2DetectorsBase - O2SimulationDataFormat - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/TOF/base/include - ${MS_GSL_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - tof_reconstruction_bucket - - DEPENDENCIES - tof_base_bucket - root_base_bucket - data_format_TOF_bucket - fairroot_geom - RIO - Graf - Gpad - Matrix - Physics - O2TOFBase - O2DetectorsBase - O2SimulationDataFormat - O2DataFormatsTOF - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/TOF/base/include -# ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/TOF/include - ${MS_GSL_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - fit_base_bucket - - DEPENDENCIES # library names - root_base_bucket - fairroot_geom - root_base_bucket - fairroot_base_bucket - Matrix - Physics - Geom - Core Hist # ROOT - O2CommonDataFormat - detectors_base_bucket - O2DetectorsBase - O2SimulationDataFormat - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/common/base/include - - ) - -o2_define_bucket( - NAME - fit_simulation_bucket - - DEPENDENCIES # library names - data_format_fit_bucket - fit_base_bucket - root_base_bucket - fairroot_geom - O2DataFormatsFITT0 - O2DataFormatsFITV0 - RIO - Graf - Gpad - Matrix - Physics - O2T0Base - O2V0Base - O2FDDBase - O2DetectorsBase - detectors_base_bucket - O2SimulationDataFormat - Core Hist # ROOT - O2CommonDataFormat - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/FIT/T0/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/FIT/V0/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/common/simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/common/base/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/T0/base/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/V0/base/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/FDD/base/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/T0/simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/V0/simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/FDD/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include -) - -o2_define_bucket( - NAME - hmpid_base_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket - Geom - MathCore - Matrix - Physics - ParBase - VMC - Geom - O2SimulationDataFormat - O2CommonDataFormat - O2CommonUtils - data_format_common_bucket - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Detectors/HMPID/base/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include -) - -o2_define_bucket( - NAME - zdc_base_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket - Geom - VMC - O2SimulationDataFormat - O2CommonDataFormat - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Detectors/ZDC/base/include -) - - -o2_define_bucket( - NAME - fit_reconstruction_bucket - - DEPENDENCIES - fit_base_bucket - data_format_fit_bucket - O2T0Base - O2V0Base - O2FDDBase - O2DataFormatsFITT0 - O2DataFormatsFITV0 - O2DetectorsBase - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/FIT/T0/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/FIT/V0/include - ${CMAKE_SOURCE_DIR}/Detectors/FIT/T0/reconstruction/include -) - -o2_define_bucket( - NAME - data_format_fit_bucket - - DEPENDENCIES - fit_base_bucket - O2T0Base - O2V0Base - O2FDDBase - O2DetectorsBase - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/FIT/include -) - -o2_define_bucket( - NAME - hmpid_simulation_bucket - - DEPENDENCIES # library names - hmpid_base_bucket - O2HMPIDBase - root_base_bucket - detectors_base_bucket - fairroot_geom - RIO - Graf - Gpad - Matrix - Physics - O2DetectorsBase - O2SimulationDataFormat - Core Hist # ROOT - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/HMPID/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include -) - - -o2_define_bucket( - NAME - zdc_simulation_bucket - - DEPENDENCIES # library names - zdc_base_bucket - O2ZDCBase - detectors_base_bucket - fairroot_geom - RIO - O2DetectorsBase - O2SimulationDataFormat - Core - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ZDC/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include -) - - -o2_define_bucket( - NAME - phos_base_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket - Geom - MathCore - Matrix - Physics - ParBase - VMC - Geom - data_format_simulation_bucket - O2SimulationDataFormat - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include -) - -o2_define_bucket( - NAME - phos_simulation_bucket - - DEPENDENCIES - phos_base_bucket - root_base_bucket - fairroot_geom - detectors_base_bucket - RIO - Graf - Gpad - Matrix - Physics - O2PHOSBase - O2DetectorsBase - O2SimulationDataFormat - - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/PHOS/base/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - -) - -o2_define_bucket( - NAME - phos_reconstruction_bucket - - DEPENDENCIES - phos_base_bucket - phos_simulation_bucket - root_base_bucket - O2PHOSBase - fairroot_geom - RIO - Graf - Gpad - Matrix - Physics - - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/PHOS/base/include - ${CMAKE_SOURCE_DIR}/Detectors/PHOS/reconstruction/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - -) - -o2_define_bucket( - NAME - cpv_base_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket - Geom - MathCore - Matrix - Physics - ParBase - VMC - Geom - data_format_simulation_bucket - O2SimulationDataFormat - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include -) - -o2_define_bucket( - NAME - cpv_simulation_bucket - - DEPENDENCIES - cpv_base_bucket - root_base_bucket - fairroot_geom - detectors_base_bucket - RIO - Graf - Gpad - Matrix - Physics - O2CPVBase - O2DetectorsBase - O2SimulationDataFormat - - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Detectors/CPV/base/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - -) - - -o2_define_bucket( - NAME - event_visualisation_base_bucket - - DEPENDENCIES - root_base_bucket - O2EventVisualisationDataConverter - Graf3d - Eve - RGL - Gui - O2CCDB - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/CCDB/include - ${CMAKE_SOURCE_DIR}/EventVisualisation/DataConverter/include - - SYSTEMINCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - spacepoint_calib_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket - MathCore - Matrix - tpc_base_bucket - common_utils_bucket - common_math_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/TPC/calibration/SpacePoints/include -) - -o2_define_bucket( - NAME - trd_simulation_bucket - - DEPENDENCIES - trd_base_bucket - root_base_bucket - fairroot_geom - RIO - Graf - Gpad - Matrix - Physics - O2TRDBase - O2DetectorsBase - detectors_base_bucket - O2SimulationDataFormat - common_utils_bucket - O2CommonUtils - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/TRD/base/include -) - -# a bucket for "global" executables/macros -o2_define_bucket( - NAME - run_bucket - - DEPENDENCIES - #-- buckets follow - fairroot_base_bucket - - #-- precise modules follow - O2SimConfig - O2SimSetup - O2DetectorsPassive - O2TPCSimulation - O2TPCReconstruction - O2ITSSimulation - O2MFTSimulation - O2MCHSimulation - O2MIDSimulation - O2TRDSimulation - O2EMCALSimulation - O2TOFSimulation - O2T0Simulation - O2V0Simulation - O2FDDSimulation - O2HMPIDSimulation - O2PHOSSimulation - O2CPVSimulation - O2PHOSReconstruction - O2ZDCSimulation - O2Field - O2Generators - O2DataFormatsParameters - O2Framework -) - -# a bucket for "global" executables/macros -o2_define_bucket( - NAME - digitizer_workflow_bucket - - DEPENDENCIES - #-- buckets follow - fairroot_base_bucket - fit_simulation_bucket - #-- precise modules follow - O2Steer - O2Framework - O2DetectorsCommonDataFormats - O2CommonDataFormat - O2TPCSimulation - O2TPCWorkflow - O2DataFormatsTPC - O2ITSSimulation - O2MFTSimulation - O2ITSMFTBase - O2TOFSimulation - O2TOFReconstruction - O2FITSimulation - O2T0Simulation - O2FDDSimulation - O2EMCALSimulation - O2HMPIDBase - O2HMPIDSimulation - O2MCHBase - O2MCHSimulation - O2TRDBase - O2TRDSimulation - O2MIDSimulation - O2ZDCSimulation -) - -o2_define_bucket( - NAME - event_visualisation_detectors_bucket - - DEPENDENCIES - root_base_bucket - O2EventVisualisationBase - O2EventVisualisationDataConverter - Graf3d - Eve - RGL - Gui - O2CCDB - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/EventVisualisation/Base/include - ${CMAKE_SOURCE_DIR}/EventVisualisation/DataConverter/include - - SYSTEMINCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - event_visualisation_view_bucket - - DEPENDENCIES - root_base_bucket - O2EventVisualisationBase - O2EventVisualisationDetectors - O2EventVisualisationDataConverter - Graf3d - Eve - RGL - Gui - O2CCDB - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/CCDB/include - ${CMAKE_SOURCE_DIR}/EventVisualisation/Base/include - ${CMAKE_SOURCE_DIR}/EventVisualisation/Detectors/include - ${CMAKE_SOURCE_DIR}/EventVisualisation/DataConverter/include - - SYSTEMINCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} -) - -o2_define_bucket( -NAME - event_visualisation_data_converter_bucket - - DEPENDENCIES - root_base_bucket - Graf3d - Eve - RGL - Gui - O2CCDB - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/CCDB/include - - SYSTEMINCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - Algorithm_bucket - - DEPENDENCIES - O2Headers - common_boost_bucket - - INCLUDE_DIRECTORIES -) - -o2_define_bucket( - NAME - data_parameters_bucket - - DEPENDENCIES - Core - data_format_detectors_common_bucket - O2DetectorsCommonDataFormats - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Common/Constants/include - ${CMAKE_SOURCE_DIR}/Common/Types/include - ${CMAKE_SOURCE_DIR}/Detectors/Common/include/DetectorsCommonDataFormats -) - -o2_define_bucket( - NAME - common_utils_bucket - - DEPENDENCIES - Core Tree - O2ReconstructionDataFormats # for test dependency only - common_boost_bucket - Boost::iostreams - O2DataFormatsMID - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${Boost_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Common/Utils/include - ${CMAKE_SOURCE_DIR}/include/ReconstructionDataFormats # for test dependency only -) - -o2_define_bucket( - NAME - data_format_common_bucket - - DEPENDENCIES - GPUCommon_bucket - fairroot_base_bucket - Core RIO - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/Common/Constants/include - ${CMAKE_SOURCE_DIR}/GPU/Common -) - -o2_define_bucket( - NAME - mch_base_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket -) - -o2_define_bucket( - NAME - mch_simulation_bucket - - DEPENDENCIES - root_base_bucket - fairroot_base_bucket - O2DetectorsBase - detectors_base_bucket - O2SimulationDataFormat - rapidjson_bucket - mch_mapping_interface_bucket - mch_mapping_impl3_bucket - O2MCHMappingImpl3 - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${MS_GSL_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - mch_simulation_test_bucket - - DEPENDENCIES - $,benchmark::benchmark,$<0:"">> - mch_simulation_bucket - mch_mapping_impl3_bucket - O2MCHMappingImpl3 - O2MCHSimulation -) - -o2_define_bucket( - NAME - mch_preclustering_bucket - - DEPENDENCIES - fairroot_base_bucket - O2MCHBase - O2Framework - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MCH/Base/include -) - -o2_define_bucket( - NAME - data_format_itsmft_bucket - - DEPENDENCIES - data_format_reconstruction_bucket - # - O2ReconstructionDataFormats - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/ITSMFT/common/include - ${CMAKE_SOURCE_DIR}/DataFormats/Reconstruction/include -) - -o2_define_bucket( - NAME - data_format_its_bucket - - DEPENDENCIES - data_format_common_bucket - data_format_reconstruction_bucket - # - O2ReconstructionDataFormats - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/ITSMFT/ITS/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/ITSMFT/common/include - ${CMAKE_SOURCE_DIR}/DataFormats/Reconstruction/include - ${CMAKE_SOURCE_DIR}/Common/Constants/include -) - -o2_define_bucket( - NAME - data_format_mft_bucket - - DEPENDENCIES - data_format_reconstruction_bucket - # - O2ReconstructionDataFormats - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/ITSMFT/MFT/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/ITSMFT/common/include - ${CMAKE_SOURCE_DIR}/DataFormats/Reconstruction/include - ${CMAKE_SOURCE_DIR}/Common/Constants/include -) - -o2_define_bucket( - NAME - global_tracking_bucket - - DEPENDENCIES - data_format_simulation_bucket - data_format_reconstruction_bucket - data_format_common_bucket - data_format_TPC_bucket - data_format_TOF_bucket - data_format_fit_bucket - its_reconstruction_bucket - data_format_itsmft_bucket - common_field_bucket - detectors_base_bucket - its_base_bucket - tpc_base_bucket - tpc_reconstruction_bucket - tof_base_bucket - GPUTracking_bucket - data_parameters_bucket - common_utils_bucket - common_math_bucket - # - O2SimulationDataFormat - O2ReconstructionDataFormats - O2CommonDataFormat - O2ITSReconstruction - O2TPCReconstruction - O2DataFormatsITSMFT - O2DataFormatsFITT0 - O2DetectorsBase - O2DataFormatsTPC - O2DataFormatsTOF - O2DataFormatsParameters - O2ITSBase - O2TPCBase - O2TOFBase - O2CommonUtils - O2MathUtils - O2Field - O2GPUTracking - O2TPCFastTransformation - RIO - Core - Geom - - INCLUDE_DIRECTORIES - ${FAIRROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/DataFormats/Reconstruction/include - ${CMAKE_SOURCE_DIR}/DataFormats/common/include - ${CMAKE_SOURCE_DIR}/DataFormats/simulation/include - ${CMAKE_SOURCE_DIR}/Common/Field/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/ITSMFT/common/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/FIT/T0/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/base/include - ${CMAKE_SOURCE_DIR}/Detectors/TPC/base/include - ${CMAKE_SOURCE_DIR}/Detectors/TOF/base/include - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Common/Utils/include - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/Common/Constants/include - ${CMAKE_SOURCE_DIR}/DataFormats/Parameters/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/TPC/include - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Interface - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Merger - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/SliceTracker -) - -o2_define_bucket( - NAME - mch_contour_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MCH/Contour/include -) - -o2_define_bucket( - NAME - mch_mapping_interface_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MCH/Mapping/Interface/include -) - -o2_define_bucket( - NAME - mch_mapping_impl3_bucket - - DEPENDENCIES - mch_mapping_interface_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MCH/Mapping/Impl3/src - ${CMAKE_BINARY_DIR}/Detectors/MUON/MCH/Mapping/Impl3 # for the mchmappingimpl3_export.h generated file - - SYSTEMINCLUDE_DIRECTORIES - ${Boost_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - mch_mapping_segcontour_bucket - - DEPENDENCIES - mch_contour_bucket - mch_mapping_impl3_bucket - Boost::program_options - O2MCHMappingImpl3 - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MCH/Mapping/SegContour/include - - SYSTEMINCLUDE_DIRECTORIES - ${Boost_INCLUDE_DIR} -) - -o2_define_bucket( - NAME - mch_mapping_test_bucket - - DEPENDENCIES - $,benchmark::benchmark,$<0:"">> - mch_mapping_segcontour_bucket - O2MCHMappingSegContour3 - rapidjson_bucket -) - -o2_define_bucket( - NAME - data_format_mid_bucket - - DEPENDENCIES - Boost::serialization - common_math_bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Common/MathUtils/include - ${CMAKE_SOURCE_DIR}/DataFormats/Detectors/MUON/MID/include -) - -o2_define_bucket( - NAME - mid_base_bucket - - DEPENDENCIES - data_format_mid_bucket - O2DataFormatsMID - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MID/Base/include -) - -o2_define_bucket( - NAME - mid_base_test_bucket - - DEPENDENCIES - rapidjson_bucket - Boost::unit_test_framework - mid_base_bucket - O2MIDBase -) - -o2_define_bucket( - NAME - mid_clustering_bucket - - DEPENDENCIES - fairroot_base_bucket - O2MIDBase -) - -o2_define_bucket( - NAME - mid_clustering_test_bucket - - DEPENDENCIES - Boost::unit_test_framework - $,benchmark::benchmark,$<0:"">> - mid_clustering_bucket - O2MIDClustering -) - -o2_define_bucket( - NAME - mid_simulation_bucket - - DEPENDENCIES - mid_base_bucket - root_base_bucket - fairroot_base_bucket - O2DetectorsBase - detectors_base_bucket - data_format_simulation_bucket - O2SimulationDataFormat - O2MIDBase - O2MIDClustering - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MID/Clustering/include -) - -o2_define_bucket( - NAME - mid_simulation_test_bucket - - DEPENDENCIES - Boost::unit_test_framework - $,benchmark::benchmark,$<0:"">> - rapidjson_bucket - O2MIDBase - O2MIDSimulation - O2MIDClustering - O2MIDTracking - O2MIDTestingSimTools - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MID/Simulation/src - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MID/Clustering/src -) - -o2_define_bucket( - NAME - mid_testingSimTools_bucket - - DEPENDENCIES - O2MIDBase -) - -o2_define_bucket( - NAME - mid_tracking_bucket - - DEPENDENCIES - fairroot_base_bucket - O2MIDBase -) - -o2_define_bucket( - NAME - mid_tracking_test_bucket - - DEPENDENCIES - Boost::unit_test_framework - $,benchmark::benchmark,$<0:"">> - mid_tracking_bucket - mid_testingSimTools_bucket - O2MIDTracking - O2MIDTestingSimTools - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MID/TestingSimTools/include -) - - -o2_define_bucket( - NAME - simulation_setup_bucket - - DEPENDENCIES - ${Geant3_LIBRARIES} - ${Geant4_LIBRARIES} - ${Geant4VMC_LIBRARIES} - ${VGM_LIBRARIES} - fairroot_geom - O2SimulationDataFormat - O2DetectorsPassive - pythia6 # this is needed by Geant3 and EGPythia6 - EGPythia6 # this is needed by Geant4 (TPythia6Decayer) - - INCLUDE_DIRECTORIES - ${Geant4VMC_INCLUDE_DIRS} - ${Geant4_INCLUDE_DIRS} - ${Geant3_INCLUDE_DIRS} - ${FAIRROOT_INCLUDE_DIR} - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/Common/SimConfig/include -) - -o2_define_bucket( - NAME - utility_datacompression_bucket - - DEPENDENCIES - O2CommonUtils - common_boost_bucket - - INCLUDE_DIRECTORIES -) - -o2_define_bucket( - NAME - mch_tracking_bucket - - DEPENDENCIES - fairroot_base_bucket - O2Field - O2MCHBase - O2Framework - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Common/Field/include - ${CMAKE_SOURCE_DIR}/Detectors/MUON/MCH/Base/include -) - -o2_define_bucket( - NAME - GPUCommon_bucket - - DEPENDENCIES - Core - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/GPU/Common -) - -o2_define_bucket( - NAME - TPCFastTransformation_bucket - - DEPENDENCIES - dl - pthread - root_base_bucket - common_vc_bucket - GPUCommon_bucket - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/GPU/TPCFastTransformation -) - -o2_define_bucket( - NAME - GPUTracking_bucket - - DEPENDENCIES - dl - pthread - root_base_bucket - common_vc_bucket - O2TRDBase - O2ITStracking - GPUCommon_bucket - TPCFastTransformation_bucket - O2TPCFastTransformation - data_format_TPC_bucket - Gpad - RIO - Graf - glfw_bucket - O2DebugGUI - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Global - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/SliceTracker - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Merger - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/TRDTracking - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Interface - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/HLTHeaders - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Standalone - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/ITS - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/dEdx - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/TPCConvert - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/DataCompression - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/ - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Standalone/display - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Standalone/qa - ${CMAKE_SOURCE_DIR}/Framework/Core/include - ${CMAKE_SOURCE_DIR}/Detectors/Base/include - ${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/tracking/include - ${CMAKE_SOURCE_DIR}/Detectors/TRD/base/include -) - -o2_define_bucket( - NAME - GPUTrackingHIP_bucket - - DEPENDENCIES - GPUTracking_bucket -) - -o2_define_bucket( - NAME - GPUTrackingCUDA_bucket - - DEPENDENCIES - GPUTracking_bucket - O2ITStrackingCUDA -) - -o2_define_bucket( - NAME - GPUTrackingOCL_bucket - - DEPENDENCIES - GPUTracking_bucket -) - -o2_define_bucket( - NAME - TPCSpaceChargeBase_bucket - - DEPENDENCIES - root_base_bucket Hist MathCore Matrix Physics GPUCommon_bucket - - INCLUDE_DIRECTORIES - ${ROOT_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/GPU/TPCSpaceChargeBase -) - -o2_define_bucket( - NAME - mid_workflow_bucket - - DEPENDENCIES - fairroot_base_bucket - DPLUtils_bucket - - O2Framework - O2DPLUtils - O2DataFormatsMID - O2MIDClustering - O2MIDSimulation - O2MIDTracking - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Detectors/MID/Workflow/include -) diff --git a/cmake/O2DumpTargetProperties.cmake b/cmake/O2DumpTargetProperties.cmake new file mode 100644 index 0000000000000..45db6c168b90f --- /dev/null +++ b/cmake/O2DumpTargetProperties.cmake @@ -0,0 +1,268 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +# message(FATAL_ERROR "there is a CMake module to do that!") + +function(o2_dump_target_properties) + set(target ${ARGV0}) + get_property(targetType TARGET ${target} PROPERTY TYPE) + message(STATUS "--------------------------------------------------------") + message(STATUS "Properties of target ${target} of type ${targetType}") + message(STATUS) + set(properties + INTERFACE_COMPILE_DEFINITIONS + INTERFACE_COMPILE_FEATURES + INTERFACE_COMPILE_OPTIONS + INTERFACE_INCLUDE_DIRECTORIES + INTERFACE_LINK_DEPENDS + INTERFACE_LINK_DIRECTORIES + INTERFACE_LINK_LIBRARIES + INTERFACE_LINK_OPTIONS + INTERFACE_POSITION_INDEPENDENT_CODE + INTERFACE_SOURCES + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES) + if(NOT ${targetType} STREQUAL "INTERFACE_LIBRARY") + list(APPEND properties + ALIASED_TARGET + ARCHIVE_OUTPUT_DIRECTORY_Debug + ARCHIVE_OUTPUT_DIRECTORY + ARCHIVE_OUTPUT_NAME_Debug + ARCHIVE_OUTPUT_NAME + AUTOGEN_BUILD_DIR + AUTOGEN_ORIGIN_DEPENDS + AUTOGEN_PARALLEL + AUTOGEN_TARGET_DEPENDS + AUTOMOC_COMPILER_PREDEFINES + AUTOMOC_DEPEND_FILTERS + AUTOMOC_EXECUTABLE + AUTOMOC_MACRO_NAMES + AUTOMOC_MOC_OPTIONS + AUTOMOC + AUTOUIC + AUTOUIC_EXECUTABLE + AUTOUIC_OPTIONS + AUTOUIC_SEARCH_PATHS + AUTORCC + AUTORCC_EXECUTABLE + AUTORCC_OPTIONS + BINARY_DIR + BUILD_RPATH + BUILD_RPATH_USE_ORIGIN + BUILD_WITH_INSTALL_NAME_DIR + BUILD_WITH_INSTALL_RPATH + BUNDLE_EXTENSION + BUNDLE + C_EXTENSIONS + C_STANDARD + C_STANDARD_REQUIRED + COMMON_LANGUAGE_RUNTIME + COMPATIBLE_INTERFACE_BOOL + COMPATIBLE_INTERFACE_NUMBER_MAX + COMPATIBLE_INTERFACE_NUMBER_MIN + COMPATIBLE_INTERFACE_STRING + COMPILE_DEFINITIONS + COMPILE_FEATURES + COMPILE_FLAGS + COMPILE_OPTIONS + COMPILE_PDB_NAME + COMPILE_PDB_NAME_Debug + COMPILE_PDB_OUTPUT_DIRECTORY + COMPILE_PDB_OUTPUT_DIRECTORY_Debug + Debug_OUTPUT_NAME + Debug_POSTFIX + CROSSCOMPILING_EMULATOR + CUDA_PTX_COMPILATION + CUDA_SEPARABLE_COMPILATION + CUDA_RESOLVE_DEVICE_SYMBOLS + CUDA_EXTENSIONS + CUDA_STANDARD + CUDA_STANDARD_REQUIRED + CXX_EXTENSIONS + CXX_STANDARD + CXX_STANDARD_REQUIRED + DEBUG_POSTFIX + DEFINE_SYMBOL + DEPLOYMENT_REMOTE_DIRECTORY + DEPLOYMENT_ADDITIONAL_FILES + DOTNET_TARGET_FRAMEWORK_VERSION + EchoString + ENABLE_EXPORTS + EXCLUDE_FROM_ALL + EXCLUDE_FROM_DEFAULT_BUILD_Debug + EXCLUDE_FROM_DEFAULT_BUILD + EXPORT_NAME + EXPORT_PROPERTIES + FOLDER + Fortran_FORMAT + Fortran_MODULE_DIRECTORY + FRAMEWORK + FRAMEWORK_VERSION + GENERATOR_FILE_NAME + GHS_INTEGRITY_APP + GHS_NO_SOURCE_GROUP_FILE + GNUtoMS + HAS_CXX + IMPLICIT_DEPENDS_INCLUDE_TRANSFORM + IMPORTED_COMMON_LANGUAGE_RUNTIME + IMPORTED_CONFIGURATIONS + IMPORTED_GLOBAL + IMPORTED_IMPLIB_Debug + IMPORTED_IMPLIB + IMPORTED_LIBNAME_Debug + IMPORTED_LIBNAME + IMPORTED_LINK_DEPENDENT_LIBRARIES_Debug + IMPORTED_LINK_DEPENDENT_LIBRARIES + IMPORTED_LINK_INTERFACE_LANGUAGES_Debug + IMPORTED_LINK_INTERFACE_LANGUAGES + IMPORTED_LINK_INTERFACE_LIBRARIES_Debug + IMPORTED_LINK_INTERFACE_LIBRARIES + IMPORTED_LINK_INTERFACE_MULTIPLICITY_Debug + IMPORTED_LINK_INTERFACE_MULTIPLICITY + IMPORTED_LOCATION_Debug + IMPORTED_LOCATION + IMPORTED_NO_SONAME_Debug + IMPORTED_NO_SONAME + IMPORTED_OBJECTS_Debug + IMPORTED_OBJECTS + IMPORTED + IMPORTED_SONAME_Debug + IMPORTED_SONAME + IMPORT_PREFIX + IMPORT_SUFFIX + INCLUDE_DIRECTORIES + INSTALL_NAME_DIR + INSTALL_RPATH + INSTALL_RPATH_USE_LINK_PATH + INTERFACE_AUTOUIC_OPTIONS + INTERFACE_COMPILE_DEFINITIONS + INTERFACE_COMPILE_FEATURES + INTERFACE_COMPILE_OPTIONS + INTERFACE_INCLUDE_DIRECTORIES + INTERFACE_LINK_DEPENDS + INTERFACE_LINK_DIRECTORIES + INTERFACE_LINK_LIBRARIES + INTERFACE_LINK_OPTIONS + INTERFACE_POSITION_INDEPENDENT_CODE + INTERFACE_SOURCES + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES + INTERPROCEDURAL_OPTIMIZATION_Debug + INTERPROCEDURAL_OPTIMIZATION + IOS_INSTALL_COMBINED + JOB_POOL_COMPILE + JOB_POOL_LINK + LABELS + _CLANG_TIDY + _COMPILER_LAUNCHER + _CPPCHECK + _CPPLINT + _INCLUDE_WHAT_YOU_USE + _VISIBILITY_PRESET + LIBRARY_OUTPUT_DIRECTORY_Debug + LIBRARY_OUTPUT_DIRECTORY + LIBRARY_OUTPUT_NAME_Debug + LIBRARY_OUTPUT_NAME + LINK_DEPENDS_NO_SHARED + LINK_DEPENDS + LINKER_LANGUAGE + LINK_DIRECTORIES + LINK_FLAGS_Debug + LINK_FLAGS + LINK_INTERFACE_LIBRARIES_Debug + LINK_INTERFACE_LIBRARIES + LINK_INTERFACE_MULTIPLICITY_Debug + LINK_INTERFACE_MULTIPLICITY + LINK_LIBRARIES + LINK_OPTIONS + LINK_SEARCH_END_STATIC + LINK_SEARCH_START_STATIC + LINK_WHAT_YOU_USE + MACOSX_BUNDLE_INFO_PLIST + MACOSX_BUNDLE + MACOSX_FRAMEWORK_INFO_PLIST + MACOSX_RPATH + MANUALLY_ADDED_DEPENDENCIES + MAP_IMPORTED_CONFIG_Debug + NAME + NO_SONAME + NO_SYSTEM_FROM_IMPORTED + OSX_ARCHITECTURES_Debug + OSX_ARCHITECTURES + OUTPUT_NAME_Debug + OUTPUT_NAME + PDB_NAME_Debug + PDB_NAME + PDB_OUTPUT_DIRECTORY_Debug + PDB_OUTPUT_DIRECTORY + POSITION_INDEPENDENT_CODE + PREFIX + PRIVATE_HEADER + PROJECT_LABEL + PUBLIC_HEADER + RESOURCE + RULE_LAUNCH_COMPILE + RULE_LAUNCH_CUSTOM + RULE_LAUNCH_LINK + RUNTIME_OUTPUT_DIRECTORY_Debug + RUNTIME_OUTPUT_DIRECTORY + RUNTIME_OUTPUT_NAME_Debug + RUNTIME_OUTPUT_NAME + SKIP_BUILD_RPATH + SOURCE_DIR + SOURCES + SOVERSION + STATIC_LIBRARY_FLAGS_Debug + STATIC_LIBRARY_FLAGS + STATIC_LIBRARY_OPTIONS + SUFFIX + TYPE + VERSION + VISIBILITY_INLINES_HIDDEN + WIN32_EXECUTABLE + WINDOWS_EXPORT_ALL_SYMBOLS + XCODE_EXPLICIT_FILE_TYPE + XCODE_PRODUCT_TYPE + XCODE_SCHEME_ADDRESS_SANITIZER + XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN + XCODE_SCHEME_ARGUMENTS + XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER + XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS + XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE + XCODE_SCHEME_ENVIRONMENT + XCODE_SCHEME_EXECUTABLE + XCODE_SCHEME_GUARD_MALLOC + XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP + XCODE_SCHEME_MALLOC_GUARD_EDGES + XCODE_SCHEME_MALLOC_SCRIBBLE + XCODE_SCHEME_MALLOC_STACK + XCODE_SCHEME_THREAD_SANITIZER + XCODE_SCHEME_THREAD_SANITIZER_STOP + XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER + XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP + XCODE_SCHEME_ZOMBIE_OBJECTS + XCTEST) + + get_property(imported TARGET ${target} PROPERTY IMPORTED) + if(${imported}) + list(APPEND properties LOCATION_Debug LOCATION) + + endif() + + endif() + foreach(prop IN LISTS properties) + get_property(is_set TARGET ${target} PROPERTY ${prop} SET) + if(is_set) + get_property(value TARGET ${target} PROPERTY ${prop}) + message(STATUS "${prop} = ${value}") + message(STATUS) + endif() + endforeach() +endfunction() diff --git a/cmake/O2NameTarget.cmake b/cmake/O2NameTarget.cmake new file mode 100644 index 0000000000000..c96e6ffecf0a7 --- /dev/null +++ b/cmake/O2NameTarget.cmake @@ -0,0 +1,62 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +# +# o2_name_target(baseName NAME var ...) gives a project specific name to the +# target of the given baseName. The computed name is retrieved in the variable +# "var". +# +# * NAME var: will contain the computed name of the target +# * IS_TEST: present to denote the target is a test executable +# * IS_BENCH: present to denote the target is a benchmark executable +# * IS_EXE: present to denote the target is an executable (and not a library) +# +function(o2_name_target baseTargetName) + + cmake_parse_arguments(PARSE_ARGV + 1 + A + "IS_TEST;IS_BENCH;IS_EXE" + "NAME;COMPONENT_NAME" + "") + + if(A_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}") + endif() + + if(NOT A_NAME) + message(FATAL_ERROR "Parameter NAME is mandatory") + endif() + + # get the target "type" (lib or exe,test,bench) + if(A_IS_TEST) + set(targetType test) + elseif(A_IS_BENCHMARK) + set(targetType bench) + elseif(A_IS_EXE) + set(targetType exe) + else() + set(targetType lib) + endif() + + # get the component part if present + if(A_COMPONENT_NAME) + string(TOLOWER ${A_COMPONENT_NAME} component) + set(comp -${component}) + endif() + + set(${A_NAME} + ${PROJECT_NAME}${targetType}${comp}-${baseTargetName} + PARENT_SCOPE) + +endfunction() diff --git a/cmake/O2ReportNonTestedMacros.cmake b/cmake/O2ReportNonTestedMacros.cmake new file mode 100644 index 0000000000000..2fd32000d4767 --- /dev/null +++ b/cmake/O2ReportNonTestedMacros.cmake @@ -0,0 +1,52 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +# +# Print a list of the Root macros that exists in the repository but for which +# the o2_add_test_root_macro function has not been called. +# +function(o2_report_non_tested_macros) + file(GLOB_RECURSE listOfMacros RELATIVE ${CMAKE_SOURCE_DIR} *.C) + list(LENGTH listOfMacros nmacros) + foreach(m ${listOfMacros}) + if(NOT ${m} IN_LIST LIST_OF_ROOT_MACRO_TESTS) + list(APPEND notTested ${m}) + endif() + if(NOT ${m} IN_LIST LIST_OF_ROOT_MACRO_TESTS_COMPILED) + list(APPEND notTestedCompiled ${m}) + endif() + endforeach() + list(LENGTH notTested n) + list(LENGTH notTestedCompiled nc) + if(${n} GREATER 0) + message( + STATUS + "WARNING : ${n}(L) and ${nc}(C) over ${nmacros} Root macros are NOT tested (L for loading, C for compilation) " + ) + message(STATUS) + foreach(m ${listOfMacros}) + set(loading " ") + set(compile " ") + if(${m} IN_LIST LIST_OF_ROOT_MACRO_TESTS) + set(loading "L") + endif() + if(${m} IN_LIST LIST_OF_ROOT_MACRO_TESTS_COMPILED) + set(compile "C") + endif() + if(NOT ${m} IN_LIST LIST_OF_ROOT_MACRO_TESTS_COMPILED + OR NOT ${m} IN_LIST LIST_OF_ROOT_MACRO_TESTS) + message(STATUS "[${loading}] [${compile}] ${m}") + endif() + endforeach() + message(STATUS) + endif() +endfunction() diff --git a/cmake/O2TargetManPage.cmake b/cmake/O2TargetManPage.cmake new file mode 100644 index 0000000000000..0c311d41755a5 --- /dev/null +++ b/cmake/O2TargetManPage.cmake @@ -0,0 +1,78 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +# Generate a man page +# +# Make sure we have nroff. If that is not the case we will not generate man +# pages +find_program(NROFF_FOUND nroff) + +function(o2_target_man_page target) + if(NOT NROFF_FOUND) + return() + endif() + cmake_parse_arguments(PARSE_ARGV + 1 + A + "" + "NAME;SECTION" + "") + + # check the target exists + if(NOT TARGET ${target}) + # try with out naming conventions + set(baseTargetName ${target}) + o2_name_target(${baseTargetName} NAME target) + if(NOT TARGET ${target}) + # not a library, maybe an executable ? + o2_name_target(${baseTargetName} NAME target IS_EXE) + if(NOT TARGET ${target}) + message(FATAL_ERROR "Target ${target} does not exist") + endif() + endif() + endif() + + if(NOT A_SECTION) + set(A_SECTION 1) + endif() + if(NOT A_NAME) + message( + FATAL_ERROR + "You must provide the name of the input man file in doc/.
.in" + ) + endif() + if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/${A_NAME}.${A_SECTION}.in) + message( + FATAL_ERROR + "Input file ${CMAKE_CURRENT_SOURCE_DIR}/doc/${A_NAME}.${A_SECTION}.in does not exist" + ) + endif() + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${A_NAME}.${A_SECTION} + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/doc/${A_NAME}.${A_SECTION}.in + COMMAND nroff + -Tascii + -man + ${CMAKE_CURRENT_SOURCE_DIR}/doc/${A_NAME}.${A_SECTION}.in + > + ${CMAKE_CURRENT_BINARY_DIR}/${A_NAME}.${A_SECTION} + VERBATIM) + # the prefix man. for the target name avoids circular dependencies for the man + # pages added at top level. Simply droping the dependency for those does not + # invoke the custom command on all systems. + set(CUSTOM_TARGET_NAME man.${A_NAME}.${A_SECTION}) + add_custom_target(${CUSTOM_TARGET_NAME} + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${A_NAME}.${A_SECTION}) + add_dependencies(${target} ${CUSTOM_TARGET_NAME}) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${A_NAME}.${A_SECTION} + DESTINATION ${CMAKE_INSTALL_DATADIR}/man/man${A_SECTION}) +endfunction() diff --git a/cmake/O2TargetRootDictionary.cmake b/cmake/O2TargetRootDictionary.cmake new file mode 100644 index 0000000000000..33a31b8b6f117 --- /dev/null +++ b/cmake/O2TargetRootDictionary.cmake @@ -0,0 +1,100 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +include(AddRootDictionary) + +# +# o2_target_root_dictionary generates one dictionary to be added to a target. +# +# arguments : +# +# * 1st parameter (required) is the _basename_ of the associated target (see +# o2_add_library for the definition of basename). +# +# * HEADERS (required, see below) is a list of relative filepaths needed for the +# dictionary definition +# +# * LINKDEF is a single relative filepath to the LINKDEF file needed by +# rootcling. +# +# * if the LINKDEF parameter is not present but there is a src/[target]LinkDef.h +# file then that file is used as LINKDEF. +# +# LINKDEF and HEADERS must contain relative paths only (relative to the +# CMakeLists.txt that calls this o2_target_root_dictionary function). +# +# The target must be of course defined _before_ calling this function (i.e. +# add_library(target ...) has been called). +# +# In addition : +# +# * target_include_directories _must_ have be called as well, in order to be +# able to compute the list of include directories needed to _compile_ the +# dictionary +# +# Besides the dictionary source itself two files are also generated : a rootmap +# file and a pcm file. Those two will be installed alongside the target's +# library file +# +# Note also that the generated dictionary is added to PRIVATE SOURCES list of +# the target. +# + +function(o2_target_root_dictionary baseTargetName) + cmake_parse_arguments(PARSE_ARGV + 1 + A + "" + "LINKDEF" + "HEADERS") + + if(A_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR "Unexpected unparsed arguments: ${A_UNPARSED_ARGUMENTS}") + endif() + + if(${ARGC} LESS 1) + message( + FATAL_ERROR + "Wrong number of arguments. At least target name must be present") + endif() + + o2_name_target(${baseTargetName} NAME target) + + # check the target exists + if(NOT TARGET ${target}) + message(FATAL_ERROR "Target ${target} does not exist") + endif() + + # we _require_ the list of input headers to be explicitely given to us. if we + # don't have one that's an error + if(NOT DEFINED A_HEADERS) + message(FATAL_ERROR "You must provide the HEADERS parameter") + endif() + + # ensure we have a LinkDef we need a LINKDEF + if(NOT A_LINKDEF) + if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/src/${baseTargetName}LinkDef.h) + message( + FATAL_ERROR + "You did not specify a LinkDef and the default one src/${baseTargetName}LinkDef.h does not exist" + ) + else() + set(A_LINKDEF src/${baseTargetName}LinkDef.h) + endif() + endif() + + # now that we have the O2 specific stuff computed, delegate the actual work to + # the add_root_dictionary function + add_root_dictionary(${target} HEADERS ${A_HEADERS} LINKDEF ${A_LINKDEF}) + +endfunction() diff --git a/cmake/O2Utils.cmake b/cmake/O2Utils.cmake deleted file mode 100644 index a3c26395e72ac..0000000000000 --- a/cmake/O2Utils.cmake +++ /dev/null @@ -1,693 +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 the variable to be used within parsing of this module - set(MODULE_NAME ${PARSED_ARGS_NAME}) - - # add a local target for the man page generation and make the - # global man target dpending on it - add_custom_target(${PARSED_ARGS_NAME}.man ALL) - add_dependencies(man ${PARSED_ARGS_NAME}.man) -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 in `cmake/O2Dependencies.cmake'.") - 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 (LOCAL_RESULT_inc_dirs${LOCAL_VARIABLE_EXTENSION} AND 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 (LOCAL_RESULT_systeminc_dirs${LOCAL_VARIABLE_EXTENSION} AND 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 (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 (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 (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}") - list(REMOVE_DUPLICATES RESULT_libs) - list(REMOVE_DUPLICATES RESULT_inc_dirs) - list(REMOVE_DUPLICATES RESULT_systeminc_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" ) - - if("${LIBRARY_NAME}" MATCHES "O2") - set(Int_LIB ${LIBRARY_NAME}) - else() - set(Int_LIB "O2${LIBRARY_NAME}") - endif() - 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(NOT HEADERS) - message(FATAL_ERROR "GENERATE_LIBRARY(\"${LIBRARY_NAME}\") : HEADERS variable must set if LINKDEF is provided.") - endif() - 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 - ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src # internal headers - ${CMAKE_CURRENT_SOURCE_DIR} # For the modules that generate a dictionary - ) - - ############### install the library ################### - install(TARGETS ${Int_LIB} DESTINATION lib) - - # public header files must be in include/${MODULE_NAME}, make sure there - # are no header files directly in include - # TODO: this should probably be combined with what has been defined as - # HEADERS. - file(GLOB PUBLIC_HEADERS_IN_WRONG_PLACE ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) - if(PUBLIC_HEADERS_IN_WRONG_PLACE) - Message("found header files: ${PUBLIC_HEADERS_IN_WRONG_PLACE}") - Message(FATAL_ERROR "public header files required to be in 'include/'") - endif() - # Install all the public headers - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/${MODULE_NAME}) - install(DIRECTORY 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") - # note: LIBRARY_NAME is not mandatory - - ####################################################### - # check that the module/directory name and application name can be distinguished - # on case insensitive file systems - string(FIND ${CMAKE_CURRENT_BINARY_DIR} "/" CURRENT_BINARY_DIR_START REVERSE) - string(LENGTH ${CMAKE_CURRENT_BINARY_DIR} CURRENT_BINARY_DIR_LENGTH) - math(EXPR CURRENT_BINARY_DIR_START "${CURRENT_BINARY_DIR_START}+1") - math(EXPR CURRENT_BINARY_DIR_LENGTH "${CURRENT_BINARY_DIR_LENGTH}-${CURRENT_BINARY_DIR_START}") - string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} ${CURRENT_BINARY_DIR_START} ${CURRENT_BINARY_DIR_LENGTH} CURRENT_BINARY_DIR_NAME) - string(TOLOWER ${CURRENT_BINARY_DIR_NAME} CURRENT_BINARY_DIR_NAME_LOWER) - string(TOLOWER ${PARSED_ARGS_EXE_NAME} EXE_NAME_LOWER) - if (CURRENT_BINARY_DIR_NAME_LOWER STREQUAL EXE_NAME_LOWER) - message(FATAL_ERROR "module name ${CURRENT_BINARY_DIR_NAME} and application name ${PARSED_ARGS_EXE_NAME} can not be distinguished on case-insensitive file systems. Please choose different names to avoid compilation errors") - endif() - set(MODULE_LIBNAME ${PARSED_ARGS_MODULE_LIBRARY_NAME}) - if("${MODULE_LIBNAME}" STREQUAL "") - else() - # Add O2 tag to library name (if needed) - if("${MODULE_LIBNAME}" MATCHES "O2") - else() - set(MODULE_LIBNAME "O2${MODULE_LIBNAME}") - endif() - endif() - - ############### 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 ${MODULE_LIBNAME} - ) - - if (NOT ${PARSED_ARGS_NO_INSTALL}) - ############### install the executable ################# - - get_filename_component(filename ${PARSED_ARGS_EXE_NAME} NAME) - string(REGEX MATCH "^test" isTest ${filename}) - if(NOT "${isTest}" STREQUAL "") - install(TARGETS ${PARSED_ARGS_EXE_NAME} DESTINATION tests) - else() - install(TARGETS ${PARSED_ARGS_EXE_NAME} DESTINATION bin) - endif() - - ############### install the library ################### - install(TARGETS ${MODULE_LIBNAME} DESTINATION lib) - endif () - -endfunction(O2_GENERATE_EXECUTABLE) - -function(O2_FRAMEWORK_WORKFLOW) - cmake_parse_arguments( - PARSED_ARGS - "NO_INSTALL" # bool args - "WORKFLOW_NAME" # mono-valued arguments - "DETECTOR_BUCKETS;SOURCES" # multi-valued arguments - ${ARGN} # arguments - ) - -CHECK_VARIABLE(PARSED_ARGS_WORKFLOW_NAME "You must provide an executable name") - CHECK_VARIABLE(PARSED_ARGS_DETECTOR_BUCKETS "You must provide a bucket name") - CHECK_VARIABLE(PARSED_ARGS_SOURCES "You must provide the list of sources") - - ############### build the executable ##################### - ADD_EXECUTABLE(${PARSED_ARGS_WORKFLOW_NAME} ${PARSED_ARGS_SOURCES}) - FOREACH(bucket ${PARSED_ARGS_DETECTOR_BUCKETS}) - O2_TARGET_LINK_BUCKET( - TARGET ${PARSED_ARGS_WORKFLOW_NAME} - BUCKET ${bucket} - EXE TRUE - ) - ENDFOREACH() - O2_TARGET_LINK_BUCKET( - TARGET ${PARSED_ARGS_WORKFLOW_NAME} - BUCKET FrameworkApplication_bucket - EXE TRUE - ) - set(MODULE_LIBNAME ${PARSED_ARGS_MODULE_LIBRARY_NAME}) - if("${MODULE_LIBNAME}" STREQUAL "") - else() - # Add O2 tag to library name (if needed) - if("${MODULE_LIBNAME}" MATCHES "O2") - else() - set(MODULE_LIBNAME "O2${MODULE_LIBNAME}") - endif() - endif() - if (NOT ${PARSED_ARGS_NO_INSTALL}) - ############### install the executable ################# - install(TARGETS ${PARSED_ARGS_EXE_NAME} DESTINATION bin) - - ############### install the library ################### - install(TARGETS ${MODULE_LIBNAME} DESTINATION lib) - endif () - -endfunction(O2_FRAMEWORK_WORKFLOW) - -#------------------------------------------------------------------------------ -# add_test_wrap -# Same as add_test() but optionally retry up to MAX_ATTEMPTS times upon failure. -# This is achieved by using a shell script wrapper -# arg NAME -# arg COMMAND -# arg WORKING_DIRECTORY -# arg CONFIGURATIONS -# arg DONT_FAIL_ON_TIMEOUT - if specified, it will not fail on timeouts -# arg MAX_ATTEMPTS - the maximum number of attempts -# arg TIMEOUT - the maximum number of attempts -function(add_test_wrap) - cmake_parse_arguments(PARSE_ARGV 0 "L" - "DONT_FAIL_ON_TIMEOUT;NON_FATAL" - "NAME;WORKING_DIRECTORY;MAX_ATTEMPTS;TIMEOUT" - "COMMAND;CONFIGURATIONS") - if("${L_MAX_ATTEMPTS}" GREATER 1) - # Warn only for tests where retry has been requested - message(WARNING "Test ${L_NAME} will be retried max ${L_MAX_ATTEMPTS} times") - endif() - if(L_NON_FATAL) - message(WARNING "Failure of test ${L_NAME} will not be fatal") - endif() - - if(NOT L_TIMEOUT) - set(L_TIMEOUT 100) # default timeout (seconds) - endif() - if(NOT L_MAX_ATTEMPTS) - set(L_MAX_ATTEMPTS 1) # default number of attempts - endif() - if(L_DONT_FAIL_ON_TIMEOUT) - set(L_DONT_FAIL_ON_TIMEOUT "--dont-fail-on-timeout") - else() - set(L_DONT_FAIL_ON_TIMEOUT "") - endif() - if(L_NON_FATAL) - set(L_NON_FATAL "--non-fatal") - else() - set(L_NON_FATAL "") - endif() - math(EXPR CTEST_TIMEOUT "(20 + ${L_TIMEOUT}) * ${L_MAX_ATTEMPTS}") - - if(WIN32) - # Shell script does not work on Windows. Use plain add_test() with no retry, use plain timeout - add_test(NAME "${L_NAME}" - COMMAND ${L_COMMAND} - WORKING_DIRECTORY "${L_WORKING_DIRECTORY}" - CONFIGURATIONS "${L_CONFIGURATIONS}") - set_tests_properties(${L_NAME} PROPERTIES TIMEOUT ${L_TIMEOUT}) - else() - add_test(NAME "${L_NAME}" - COMMAND "${CMAKE_BINARY_DIR}/tests-wrapper.sh" "--name" "${L_NAME}" "--max-attempts" "${L_MAX_ATTEMPTS}" "--timeout" "${L_TIMEOUT}" ${L_DONT_FAIL_ON_TIMEOUT} ${L_NON_FATAL} "--" ${L_COMMAND} - WORKING_DIRECTORY "${L_WORKING_DIRECTORY}" - CONFIGURATIONS "${L_CONFIGURATIONS}") - set_tests_properties(${L_NAME} PROPERTIES TIMEOUT ${CTEST_TIMEOUT}) - endif() -endfunction() - -#------------------------------------------------------------------------------ -# 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;MAX_ATTEMPTS" # 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}) - - set(MODULE_LIBNAME ${PARSED_ARGS_MODULE_LIBRARY_NAME}) - if("${MODULE_LIBNAME}" STREQUAL "") - else() - # Add O2 tag to library name (if needed) - if("${MODULE_LIBNAME}" MATCHES "O2") - else() - set(MODULE_LIBNAME "O2${MODULE_LIBNAME}") - endif() - endif() - - O2_GENERATE_EXECUTABLE( - EXE_NAME ${test_name} - SOURCES ${test} - MODULE_LIBRARY_NAME ${MODULE_LIBNAME} - BUCKET_NAME ${PARSED_ARGS_BUCKET_NAME} - NO_INSTALL FALSE - ) - target_link_libraries(${test_name} Boost::unit_test_framework) - add_test_wrap(NAME ${test_name} - DONT_FAIL_ON_TIMEOUT - MAX_ATTEMPTS "${PARSED_ARGS_MAX_ATTEMPTS}" - TIMEOUT "${PARSED_ARGS_TIMEOUT}" - COMMAND ${test_name} ${PARSED_ARGS_COMMAND_LINE_ARGS}) - 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}) - # Add O2 tag to library name (if needed) - if("${LIBRARY_NAME}" MATCHES "O2") - set(Int_LIB ${LIBRARY_NAME}) - else() - set(Int_LIB "O2${LIBRARY_NAME}") - endif() - - 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) - list(REMOVE_DUPLICATES RESULT_libs) - list(REMOVE_DUPLICATES Int_INC) - list(REMOVE_DUPLICATES 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 lib${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) - -# Generate a man page -# Make sure we have nroff. If that is not the case -# we will not generate man pages -find_program( - NROFF_FOUND - nroff) - -function(O2_GENERATE_MAN) - cmake_parse_arguments( - PARSED_ARGS - "" # bool args - "NAME;SECTION;MODULE" # mono-valued arguments - "" # multi-valued arguments - ${ARGN} # arguments - ) - if(NOT PARSED_ARGS_SECTION) - set(PARSED_ARGS_SECTION 1) - endif() - CHECK_VARIABLE(PARSED_ARGS_NAME "You must provide the name of the input man file in doc/.
.in") - if(NROFF_FOUND) - ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PARSED_ARGS_NAME}.${PARSED_ARGS_SECTION} - MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/doc/${PARSED_ARGS_NAME}.${PARSED_ARGS_SECTION}.in - COMMAND nroff -Tascii -man ${CMAKE_CURRENT_SOURCE_DIR}/doc/${PARSED_ARGS_NAME}.${PARSED_ARGS_SECTION}.in > ${CMAKE_CURRENT_BINARY_DIR}/${PARSED_ARGS_NAME}.${PARSED_ARGS_SECTION} - VERBATIM - ) - # the prefix man. for the target name avoids circular dependencies for the - # man pages added at top level. Simply droping the dependency for those - # does not invoke the custom command on all systems. - set(CUSTOM_TARGET_NAME man.${PARSED_ARGS_NAME}.${PARSED_ARGS_SECTION}) - ADD_CUSTOM_TARGET(${CUSTOM_TARGET_NAME} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PARSED_ARGS_NAME}.${PARSED_ARGS_SECTION}) - if (PARSED_ARGS_MODULE) - # add to the man target of specified module - add_dependencies(${PARSED_ARGS_MODULE}.man ${CUSTOM_TARGET_NAME}) - elseif(MODULE_NAME) - # add to the man target of current module - add_dependencies(${MODULE_NAME}.man ${CUSTOM_TARGET_NAME}) - else() - # add to top level target otherwise - add_dependencies(man ${CUSTOM_TARGET_NAME}) - endif() - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PARSED_ARGS_NAME}.${PARSED_ARGS_SECTION} DESTINATION share/man/man${PARSED_ARGS_SECTION}) - endif(NROFF_FOUND) -endfunction(O2_GENERATE_MAN) diff --git a/cmake/modules/CheckCXX14Features.cmake b/cmake/modules/CheckCXX14Features.cmake deleted file mode 100644 index d9f16010c7259..0000000000000 --- a/cmake/modules/CheckCXX14Features.cmake +++ /dev/null @@ -1,104 +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" # -################################################################################ - -#blame: Mikolaj Krzewicki, mkrzewic@cern.ch -#based on the work by Rolf Eike Beer and Andreas Weis for the FairRoot project - -# - Check which parts of the C++14 standard the compiler supports -# -# When found it will set the following variables -# one for each feature check (to be set at the end of the file when invoking tests) -# -# HAS_CXX14_MAKE_UNIQUE - make_unique support -# HAS_CXX14_AGGREGATE-INITIALIZATION - aggregate initialization support -# HAS_CXX14_BINARY-LITERALS - binary literals support -# HAS_CXX14_GENERIC-LAMBDA - generic lambdas support -# HAS_CXX14_USER-DEFINED-LITERALS - user defined literals support - -# -# Each feature may have up to 3 checks, every one of them in it's own file -# FEATURE.cpp - example that must build and return 0 when run -# FEATURE_fail.cpp - example that must build, but may not return 0 when run -# FEATURE_fail_compile.cpp - example that must fail compilation -# -# The first one is mandatory, the latter 2 are optional and do not depend on -# each other (i.e. only one may be present). -# - -if (NOT CMAKE_CXX_COMPILER_LOADED) - message(FATAL_ERROR "CheckCXX14Features modules only works if language CXX is enabled") -endif () - -cmake_minimum_required(VERSION 2.8.2) - -### Check for needed compiler flags -include(CheckCXXCompilerFlag) -check_cxx_compiler_flag("-std=c++14" _HAS_CXX14_FLAG) -if (NOT _HAS_CXX14_FLAG) - message(FATAL_ERROR "Compiler does not support -std=c++14 option") -endif () - -function(cxx14_check_feature FEATURE_NAME RESULT_VAR) - if (NOT DEFINED ${RESULT_VAR}) - set(_bindir "${CMAKE_CURRENT_BINARY_DIR}/cxx14/cxx14_${FEATURE_NAME}") - - set(_SRCFILE_BASE ${CheckCXX14SrcDir}/cxx14-test-${FEATURE_NAME}) - set(_LOG_NAME "\"${FEATURE_NAME}\"") - message(STATUS "Checking C++14 support for ${_LOG_NAME}") - - set(_SRCFILE "${_SRCFILE_BASE}.cxx") - set(_SRCFILE_FAIL "${_SRCFILE_BASE}_fail.cxx") - set(_SRCFILE_FAIL_COMPILE "${_SRCFILE_BASE}_fail_compile.cxx") - - if (CROSS_COMPILING) - try_compile(${RESULT_VAR} "${_bindir}" "${_SRCFILE}") - if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) - try_compile(${RESULT_VAR} "${_bindir}_fail" "${_SRCFILE_FAIL}") - endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) - else (CROSS_COMPILING) - try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR - "${_bindir}" "${_SRCFILE}") - if (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) - set(${RESULT_VAR} TRUE) - else (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) - set(${RESULT_VAR} FALSE) - endif (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) - if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) - try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR - "${_bindir}_fail" "${_SRCFILE_FAIL}") - if (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) - set(${RESULT_VAR} TRUE) - else (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) - set(${RESULT_VAR} FALSE) - endif (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) - endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) - endif (CROSS_COMPILING) - if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE}) - try_compile(_TMP_RESULT "${_bindir}_fail_compile" "${_SRCFILE_FAIL_COMPILE}") - if (_TMP_RESULT) - set(${RESULT_VAR} FALSE) - else (_TMP_RESULT) - set(${RESULT_VAR} TRUE) - endif (_TMP_RESULT) - endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE}) - - if (${RESULT_VAR}) - message(STATUS "Checking C++14 support for ${_LOG_NAME}: works") - else (${RESULT_VAR}) - message(FATAL_ERROR "Checking C++14 support for ${_LOG_NAME}: not supported") - endif (${RESULT_VAR}) - set(${RESULT_VAR} ${${RESULT_VAR}} CACHE INTERNAL "C++14 support for ${_LOG_NAME}") - endif (NOT DEFINED ${RESULT_VAR}) -endfunction(cxx14_check_feature) - -cxx14_check_feature("make_unique" HAS_CXX14_MAKE_UNIQUE) -cxx14_check_feature("aggregate-initialization" HAS_CXX14_AGGREGATE-INITIALIZATION) -cxx14_check_feature("binary-literals" HAS_CXX14_BINARY-LITERALS) -cxx14_check_feature("generic-lambda" HAS_CXX14_GENERIC-LAMBDA) -cxx14_check_feature("user-defined-literals" HAS_CXX14_USER-DEFINED-LITERALS) - diff --git a/cmake/modules/FindAliRoot.cmake b/cmake/modules/FindAliRoot.cmake deleted file mode 100644 index 39eb7e686f244..0000000000000 --- a/cmake/modules/FindAliRoot.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# ************************************************************************** -# * Copyright(c) 1998-2015, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** - -set(AliRoot_FOUND FALSE) - -if(ALIROOT) - - # Check if AliRoot is really installed there - if(EXISTS ${ALIROOT}/bin/aliroot AND EXISTS ${ALIROOT}/lib AND EXISTS ${ALIROOT}/include) - - # TODO this is really not the way it should be done - include_directories( - ${ALIROOT}/include - ${ALIROOT}/include/pythia - ) - # TODO neither is this - link_directories(${ALIROOT}/lib) - - set(AliRoot_FOUND TRUE) - - message(STATUS "AliRoot ... - found ${ALIROOT}") - - else() - - message(STATUS "AliRoot ... - not found") - - endif() -endif(ALIROOT) - -if(NOT AliRoot_FOUND) - if(AliRoot_FIND_REQUIRED) - message(FATAL_ERROR "Please point to the AliRoot Core installation using -DALIROOT=") - endif(AliRoot_FIND_REQUIRED) -endif(NOT AliRoot_FOUND) diff --git a/cmake/modules/FindArrow.cmake b/cmake/modules/FindArrow.cmake deleted file mode 100644 index 3d5d37a909616..0000000000000 --- a/cmake/modules/FindArrow.cmake +++ /dev/null @@ -1,122 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# - Find ARROW (arrow/api.h, libarrow.a, libarrow.so) -# This module defines -# ARROW_INCLUDE_DIR, directory containing headers -# ARROW_STATIC_LIB, path to libarrow.a -# ARROW_SHARED_LIB, path to libarrow's shared library -# ARROW_FOUND, whether arrow has been found - -if (DEFINED ENV{ARROW_HOME}) - set(ARROW_HOME "$ENV{ARROW_HOME}") -endif() - -if ("${ARROW_HOME}" STREQUAL "") - # PARQUET-955. If the user has set $ARROW_HOME in the environment, we respect - # this, otherwise try to locate the pkgconfig in the system environment - if (ARROW_FOUND) - # We found the pkgconfig - set(ARROW_INCLUDE_DIR ${ARROW_INCLUDE_DIRS}) - - if (COMMAND pkg_get_variable) - pkg_get_variable(ARROW_ABI_VERSION arrow abi_version) - else() - set(ARROW_ABI_VERSION "") - endif() - if (ARROW_ABI_VERSION STREQUAL "") - set(ARROW_SHARED_LIB_SUFFIX "") - else() - set(ARROW_SHARED_LIB_SUFFIX ".${ARROW_ABI_VERSION}") - endif() - - set(ARROW_LIB_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}arrow) - - if (APPLE) - set(ARROW_SHARED_LIB ${ARROW_LIBDIR}/${ARROW_LIB_NAME}${ARROW_SHARED_LIB_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) - else() - set(ARROW_SHARED_LIB ${ARROW_LIBDIR}/${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}${ARROW_SHARED_LIB_SUFFIX}) - endif() - set(ARROW_STATIC_LIB ${ARROW_LIBDIR}/${ARROW_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}) - endif() -else() - set(ARROW_HOME "${ARROW_HOME}") - - if (MSVC AND NOT ARROW_MSVC_STATIC_LIB_SUFFIX) - set(ARROW_MSVC_STATIC_LIB_SUFFIX _static) - endif() - - set(ARROW_SEARCH_HEADER_PATHS - ${ARROW_HOME}/include - ) - - set(ARROW_SEARCH_LIB_PATH - ${ARROW_HOME}/lib - ) - - find_path(ARROW_INCLUDE_DIR arrow/array.h PATHS - ${ARROW_SEARCH_HEADER_PATHS} - # make sure we don't accidentally pick up a different version - NO_DEFAULT_PATH - ) - - find_library(ARROW_LIB_PATH NAMES arrow arrow${ARROW_MSVC_STATIC_LIB_SUFFIX} - PATHS - ${ARROW_SEARCH_LIB_PATH} - NO_DEFAULT_PATH) - - if (ARROW_INCLUDE_DIR AND (PARQUET_MINIMAL_DEPENDENCY OR ARROW_LIB_PATH)) - set(ARROW_FOUND TRUE) - set(ARROW_HEADER_NAME arrow/api.h) - set(ARROW_HEADER ${ARROW_INCLUDE_DIR}/${ARROW_HEADER_NAME}) - set(ARROW_LIB_NAME arrow) - - get_filename_component(ARROW_LIBS ${ARROW_LIB_PATH} DIRECTORY) - set(ARROW_STATIC_LIB ${ARROW_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${ARROW_LIB_NAME}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(ARROW_SHARED_LIB ${ARROW_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(ARROW_SHARED_IMPLIB ${ARROW_LIBS}/${ARROW_LIB_NAME}.lib) - endif () -endif() - -if (ARROW_FOUND) - if (NOT Arrow_FIND_QUIETLY) - message(STATUS "Arrow include path: ${ARROW_INCLUDE_DIR}") - if (PARQUET_MINIMAL_DEPENDENCY) - message(STATUS "Found the Arrow header: ${ARROW_HEADER}") - else () - message(STATUS "Found the Arrow library: ${ARROW_LIB_PATH}") - endif () - endif () -else() - if (NOT Arrow_FIND_QUIETLY) - set(ARROW_ERR_MSG "Could not find the Arrow library. Looked for headers") - set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_HEADER_PATHS}, and for libs") - set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_LIB_PATH}") - if (Arrow_FIND_REQUIRED) - message(FATAL_ERROR "${ARROW_ERR_MSG}") - else (Arrow_FIND_REQUIRED) - message(STATUS "${ARROW_ERR_MSG}") - endif (Arrow_FIND_REQUIRED) - endif () -endif() - -mark_as_advanced( - ARROW_FOUND - ARROW_INCLUDE_DIR - ARROW_STATIC_LIB - ARROW_SHARED_LIB -) diff --git a/cmake/modules/FindFairMQInFairRoot.cmake b/cmake/modules/FindFairMQInFairRoot.cmake deleted file mode 100644 index 60aef797bfde1..0000000000000 --- a/cmake/modules/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/modules/FindGLFW.cmake b/cmake/modules/FindGLFW.cmake deleted file mode 100644 index d761b655380b5..0000000000000 --- a/cmake/modules/FindGLFW.cmake +++ /dev/null @@ -1,278 +0,0 @@ -# -# Copyright 2013 Pixar -# -# Licensed under the Apache License, Version 2.0 (the "Apache License") -# with the following modification; you may not use this file except in -# compliance with the Apache License and the following modification to it: -# Section 6. Trademarks. is deleted and replaced with: -# -# 6. Trademarks. This License does not grant permission to use the trade -# names, trademarks, service marks, or product names of the Licensor -# and its affiliates, except as required to comply with Section 4(c) of -# the License and to reproduce the content of the NOTICE file. -# -# You may obtain a copy of the Apache License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the Apache License with the above modification is -# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the Apache License for the specific -# language governing permissions and limitations under the Apache License. -# - -# Copyright 2017 Giulio Eulisse -# -# Modified to allow for optional installation in case X11 libraries are -# not found. Same terms as above apply. - -# Try to find GLFW library and include path. -# Once done this will define -# -# GLFW_FOUND -# GLFW_INCLUDE_DIR -# GLFW_LIBRARIES -# - - -find_path( GLFW_INCLUDE_DIR - NAMES - GLFW/glfw3.h - HINTS - "${GLFW_LOCATION}/include" - "$ENV{GLFW_LOCATION}/include" - PATHS - "$ENV{PROGRAMFILES}/GLFW/include" - "${OPENGL_INCLUDE_DIR}" - /usr/openwin/share/include - /usr/openwin/include - /usr/X11R6/include - /usr/include/X11 - /opt/graphics/OpenGL/include - /opt/graphics/OpenGL/contrib/libglfw - /usr/local/include - /usr/include/GL - /usr/include - DOC - "The directory where GLFW/glfw3.h resides" -) - -# -# XXX: Do we still need to search for GL/glfw.h? -# -find_path( GLFW_INCLUDE_DIR - NAMES - GL/glfw.h - HINTS - "${GLFW_LOCATION}/include" - "$ENV{GLFW_LOCATION}/include" - PATHS - "$ENV{PROGRAMFILES}/GLFW/include" - "${OPENGL_INCLUDE_DIR}" - /usr/openwin/share/include - /usr/openwin/include - /usr/X11R6/include - /usr/include/X11 - /opt/graphics/OpenGL/include - /opt/graphics/OpenGL/contrib/libglfw - /usr/local/include - /usr/include/GL - /usr/include - DOC - "The directory where GL/glfw.h resides" -) - -# This will be set to yes, if any of the X11 libraries -# is not present -set(GLFW_MISSING_DEPENDENCIES FALSE) - -if (WIN32) - if(CYGWIN) - find_library( GLFW_glfw_LIBRARY - NAMES - glfw32 - HINTS - "${GLFW_LOCATION}/lib" - "${GLFW_LOCATION}/lib/x64" - "$ENV{GLFW_LOCATION}/lib" - PATHS - "${OPENGL_LIBRARY_DIR}" - /usr/lib - /usr/lib/w32api - /usr/local/lib - /usr/X11R6/lib - DOC - "The GLFW library" - ) - else() - find_library( GLFW_glfw_LIBRARY - NAMES - glfw32 - glfw32s - glfw - glfw3 - HINTS - "${GLFW_LOCATION}/lib" - "${GLFW_LOCATION}/lib/x64" - "${GLFW_LOCATION}/lib-msvc110" - "${GLFW_LOCATION}/lib-vc2012" - "$ENV{GLFW_LOCATION}/lib" - "$ENV{GLFW_LOCATION}/lib/x64" - "$ENV{GLFW_LOCATION}/lib-msvc110" - "$ENV{GLFW_LOCATION}/lib-vc2012" - PATHS - "$ENV{PROGRAMFILES}/GLFW/lib" - "${OPENGL_LIBRARY_DIR}" - DOC - "The GLFW library" - ) - endif() -else () - if (APPLE) - find_library( GLFW_glfw_LIBRARY glfw - NAMES - glfw - glfw3 - HINTS - "${GLFW_LOCATION}/lib" - "${GLFW_LOCATION}/lib/cocoa" - "$ENV{GLFW_LOCATION}/lib" - "$ENV{GLFW_LOCATION}/lib/cocoa" - PATHS - /usr/local/lib - ) - set(GLFW_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") - set(GLFW_corevideo_LIBRARY "-framework CoreVideo" CACHE STRING "CoreVideo framework for OSX") - set(GLFW_iokit_LIBRARY "-framework IOKit" CACHE STRING "IOKit framework for OSX") - else () - # (*)NIX - - find_package(Threads) - if (NOT Threads_FOUND) - set(GLFW_MISSING_DEPENDENCIES TRUE) - message("Threads not found") - endif() - - find_package(X11) - if (NOT X11_FOUND) - set(GLFW_MISSING_DEPENDENCIES TRUE) - message("X11 not found") - endif() - - if(NOT X11_Xrandr_FOUND) - set(GLFW_MISSING_DEPENDENCIES TRUE) - message("Xrandr library not found - required for GLFW") - endif() - - if(NOT X11_xf86vmode_FOUND) - set(GLFW_MISSING_DEPENDENCIES TRUE) - message("xf86vmode library not found - required for GLFW") - endif() - - if(NOT X11_Xcursor_FOUND) - set(GLFW_MISSING_DEPENDENCIES TRUE) - message("Xcursor library not found - required for GLFW") - endif() - - if(NOT X11_Xinerama_FOUND) - set(GLFW_MISSING_DEPENDENCIES TRUE) - message("Xinerama library not found - required for GLFW") - endif() - - if(NOT X11_Xi_FOUND) - set(GLFW_MISSING_DEPENDENCIES TRUE) - message("Xi library not found - required for GLFW") - endif() - - list(APPEND GLFW_x11_LIBRARY "${X11_Xrandr_LIB}" "${X11_Xxf86vm_LIB}" "${X11_Xcursor_LIB}" "${X11_Xinerama_LIB}" "${X11_Xi_LIB}" "${X11_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}" -lrt -ldl) - - find_library( GLFW_glfw_LIBRARY - NAMES - glfw - glfw3 - HINTS - "${GLFW_LOCATION}/lib" - "$ENV{GLFW_LOCATION}/lib" - "${GLFW_LOCATION}/lib/x11" - "$ENV{GLFW_LOCATION}/lib/x11" - PATHS - /usr/lib64 - /usr/lib - /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} - /usr/local/lib64 - /usr/local/lib - /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} - /usr/openwin/lib - /usr/X11R6/lib - DOC - "The GLFW library" - ) - endif (APPLE) -endif (WIN32) - -set( GLFW_FOUND "NO" ) - -if(GLFW_INCLUDE_DIR) - - if(GLFW_glfw_LIBRARY) - if (NOT GLFW_MISSING_DEPENDENCIES) - set( GLFW_LIBRARIES "${GLFW_glfw_LIBRARY}" - "${GLFW_x11_LIBRARY}" - "${GLFW_cocoa_LIBRARY}" - "${GLFW_iokit_LIBRARY}" - "${GLFW_corevideo_LIBRARY}" ) - set( GLFW_FOUND "YES" ) - set (GLFW_LIBRARY "${GLFW_LIBRARIES}") - set (GLFW_INCLUDE_PATH "${GLFW_INCLUDE_DIR}") - endif(NOT GLFW_MISSING_DEPENDENCIES) - endif(GLFW_glfw_LIBRARY) - - - # Tease the GLFW_VERSION numbers from the lib headers - function(parseVersion FILENAME VARNAME) - set(PATTERN "^#define ${VARNAME}.*$") - file(STRINGS "${GLFW_INCLUDE_DIR}/${FILENAME}" TMP REGEX ${PATTERN}) - string(REGEX MATCHALL "[0-9]+" TMP ${TMP}) - set(${VARNAME} ${TMP} PARENT_SCOPE) - endfunction() - - - if(EXISTS "${GLFW_INCLUDE_DIR}/GL/glfw.h") - - parseVersion(GL/glfw.h GLFW_VERSION_MAJOR) - parseVersion(GL/glfw.h GLFW_VERSION_MINOR) - parseVersion(GL/glfw.h GLFW_VERSION_REVISION) - - elseif(EXISTS "${GLFW_INCLUDE_DIR}/GLFW/glfw3.h") - - parseVersion(GLFW/glfw3.h GLFW_VERSION_MAJOR) - parseVersion(GLFW/glfw3.h GLFW_VERSION_MINOR) - parseVersion(GLFW/glfw3.h GLFW_VERSION_REVISION) - - endif() - - if(${GLFW_VERSION_MAJOR} OR ${GLFW_VERSION_MINOR} OR ${GLFW_VERSION_REVISION}) - set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}.${GLFW_VERSION_REVISION}") - set(GLFW_VERSION_STRING "${GLFW_VERSION}") - mark_as_advanced(GLFW_VERSION) - endif() - -endif(GLFW_INCLUDE_DIR) - -include(FindPackageHandleStandardArgs) - -find_package_handle_standard_args(GLFW - REQUIRED_VARS - GLFW_INCLUDE_DIR - GLFW_LIBRARIES - VERSION_VAR - GLFW_VERSION -) - -mark_as_advanced( - GLFW_INCLUDE_DIR - GLFW_LIBRARIES - GLFW_glfw_LIBRARY - GLFW_cocoa_LIBRARY -) diff --git a/cmake/modules/FindHIP.cmake b/cmake/modules/FindHIP.cmake deleted file mode 100644 index d2377e9adb888..0000000000000 --- a/cmake/modules/FindHIP.cmake +++ /dev/null @@ -1,579 +0,0 @@ -############################################################################### -# FindHIP.cmake -############################################################################### - -############################################################################### -# SET: Variable defaults -############################################################################### -# User defined flags -set(HIP_HIPCC_FLAGS "" CACHE STRING "Semicolon delimited flags for HIPCC") -set(HIP_HCC_FLAGS "" CACHE STRING "Semicolon delimited flags for HCC") -set(HIP_NVCC_FLAGS "" CACHE STRING "Semicolon delimted flags for NVCC") -mark_as_advanced(HIP_HIPCC_FLAGS HIP_HCC_FLAGS HIP_NVCC_FLAGS) -set(_hip_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo) -list(REMOVE_DUPLICATES _hip_configuration_types) -foreach(config ${_hip_configuration_types}) - string(TOUPPER ${config} config_upper) - set(HIP_HIPCC_FLAGS_${config_upper} "" CACHE STRING "Semicolon delimited flags for HIPCC") - set(HIP_HCC_FLAGS_${config_upper} "" CACHE STRING "Semicolon delimited flags for HCC") - set(HIP_NVCC_FLAGS_${config_upper} "" CACHE STRING "Semicolon delimited flags for NVCC") - mark_as_advanced(HIP_HIPCC_FLAGS_${config_upper} HIP_HCC_FLAGS_${config_upper} HIP_NVCC_FLAGS_${config_upper}) -endforeach() -option(HIP_HOST_COMPILATION_CPP "Host code compilation mode" ON) -option(HIP_VERBOSE_BUILD "Print out the commands run while compiling the HIP source file. With the Makefile generator this defaults to VERBOSE variable specified on the command line, but can be forced on with this option." OFF) -mark_as_advanced(HIP_HOST_COMPILATION_CPP) - -############################################################################### -# Set HIP CMAKE Flags -############################################################################### -# Copy the invocation styles from CXX to HIP -set(CMAKE_HIP_ARCHIVE_CREATE ${CMAKE_CXX_ARCHIVE_CREATE}) -set(CMAKE_HIP_ARCHIVE_APPEND ${CMAKE_CXX_ARCHIVE_APPEND}) -set(CMAKE_HIP_ARCHIVE_FINISH ${CMAKE_CXX_ARCHIVE_FINISH}) -set(CMAKE_SHARED_LIBRARY_SONAME_HIP_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG}) -set(CMAKE_SHARED_LIBRARY_CREATE_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}) -set(CMAKE_SHARED_LIBRARY_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) -#set(CMAKE_SHARED_LIBRARY_LINK_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}) -set(CMAKE_SHARED_LIBRARY_RUNTIME_HIP_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}) -set(CMAKE_SHARED_LIBRARY_RUNTIME_HIP_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP}) -set(CMAKE_SHARED_LIBRARY_LINK_STATIC_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_STATIC_CXX_FLAGS}) -set(CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_CXX_FLAGS}) - -# Set the CMake Flags to use the HCC Compilier. -set(CMAKE_HIP_CREATE_SHARED_LIBRARY "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_PATH} -o ") -set(CMAKE_HIP_CREATE_SHARED_MODULE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_PATH} -o -shared" ) -set(CMAKE_HIP_LINK_EXECUTABLE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_PATH} -o ") - -############################################################################### -# FIND: HIP and associated helper binaries -############################################################################### -# HIP is supported on Linux only -if(UNIX AND NOT APPLE AND NOT CYGWIN) - # Search for HIP installation - if(NOT HIP_ROOT_DIR) - # Search in user specified path first - find_path( - HIP_ROOT_DIR - NAMES hipconfig - PATHS - ENV ROCM_PATH - ENV HIP_PATH - PATH_SUFFIXES bin - DOC "HIP installed location" - NO_DEFAULT_PATH - ) - # Now search in default path - find_path( - HIP_ROOT_DIR - NAMES hipconfig - PATHS - /opt/rocm - /opt/rocm/hip - PATH_SUFFIXES bin - DOC "HIP installed location" - ) - - # Check if we found HIP installation - if(HIP_ROOT_DIR) - # If so, fix the path - string(REGEX REPLACE "[/\\\\]?bin[64]*[/\\\\]?$" "" HIP_ROOT_DIR ${HIP_ROOT_DIR}) - # And push it back to the cache - set(HIP_ROOT_DIR ${HIP_ROOT_DIR} CACHE PATH "HIP installed location" FORCE) - endif() - if(NOT EXISTS ${HIP_ROOT_DIR}) - if(HIP_FIND_REQUIRED) - message(FATAL_ERROR "Specify HIP_ROOT_DIR") - elseif(NOT HIP_FIND_QUIETLY) - message("HIP_ROOT_DIR not found or specified") - endif() - endif() - endif() - - # Find HIPCC executable - find_program( - HIP_HIPCC_EXECUTABLE - NAMES hipcc - PATHS - "${HIP_ROOT_DIR}" - ENV ROCM_PATH - ENV HIP_PATH - /opt/rocm - /opt/rocm/hip - PATH_SUFFIXES bin - NO_DEFAULT_PATH - ) - if(NOT HIP_HIPCC_EXECUTABLE) - # Now search in default paths - find_program(HIP_HIPCC_EXECUTABLE hipcc) - endif() - mark_as_advanced(HIP_HIPCC_EXECUTABLE) - - # Find HIPCONFIG executable - find_program( - HIP_HIPCONFIG_EXECUTABLE - NAMES hipconfig - PATHS - "${HIP_ROOT_DIR}" - ENV ROCM_PATH - ENV HIP_PATH - /opt/rocm - /opt/rocm/hip - PATH_SUFFIXES bin - NO_DEFAULT_PATH - ) - if(NOT HIP_HIPCONFIG_EXECUTABLE) - # Now search in default paths - find_program(HIP_HIPCONFIG_EXECUTABLE hipconfig) - endif() - mark_as_advanced(HIP_HIPCONFIG_EXECUTABLE) - - # Find HIPCC_CMAKE_LINKER_HELPER executable - find_program( - HIP_HIPCC_CMAKE_LINKER_HELPER - NAMES hipcc_cmake_linker_helper - PATHS - "${HIP_ROOT_DIR}" - ENV ROCM_PATH - ENV HIP_PATH - /opt/rocm - /opt/rocm/hip - PATH_SUFFIXES bin - NO_DEFAULT_PATH - ) - if(NOT HIP_HIPCC_CMAKE_LINKER_HELPER) - # Now search in default paths - find_program(HIP_HIPCC_CMAKE_LINKER_HELPER hipcc_cmake_linker_helper) - endif() - mark_as_advanced(HIP_HIPCC_CMAKE_LINKER_HELPER) - - if(HIP_HIPCONFIG_EXECUTABLE AND NOT HIP_VERSION) - # Compute the version - execute_process( - COMMAND ${HIP_HIPCONFIG_EXECUTABLE} --version - OUTPUT_VARIABLE _hip_version - ERROR_VARIABLE _hip_error - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE - ) - if(NOT _hip_error) - set(HIP_VERSION ${_hip_version} CACHE STRING "Version of HIP as computed from hipcc") - else() - set(HIP_VERSION "0.0.0" CACHE STRING "Version of HIP as computed by FindHIP()") - endif() - mark_as_advanced(HIP_VERSION) - endif() - if(HIP_VERSION) - string(REPLACE "." ";" _hip_version_list "${HIP_VERSION}") - list(GET _hip_version_list 0 HIP_VERSION_MAJOR) - list(GET _hip_version_list 1 HIP_VERSION_MINOR) - list(GET _hip_version_list 2 HIP_VERSION_PATCH) - set(HIP_VERSION_STRING "${HIP_VERSION}") - endif() - - if(HIP_HIPCONFIG_EXECUTABLE AND NOT HIP_PLATFORM) - # Compute the platform - execute_process( - COMMAND ${HIP_HIPCONFIG_EXECUTABLE} --platform - OUTPUT_VARIABLE _hip_platform - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - set(HIP_PLATFORM ${_hip_platform} CACHE STRING "HIP platform as computed by hipconfig") - mark_as_advanced(HIP_PLATFORM) - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - HIP - REQUIRED_VARS - HIP_ROOT_DIR - HIP_HIPCC_EXECUTABLE - HIP_HIPCONFIG_EXECUTABLE - HIP_PLATFORM - VERSION_VAR HIP_VERSION - ) - -############################################################################### -# MACRO: Locate helper files -############################################################################### -macro(HIP_FIND_HELPER_FILE _name _extension) - set(_hip_full_name "${_name}.${_extension}") - get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - set(HIP_${_name} "${CMAKE_CURRENT_LIST_DIR}/FindHIP/${_hip_full_name}") - if(NOT EXISTS "${HIP_${_name}}") - set(error_message "${_hip_full_name} not found in ${CMAKE_CURRENT_LIST_DIR}/FindHIP") - if(HIP_FIND_REQUIRED) - message(FATAL_ERROR "${error_message}") - else() - if(NOT HIP_FIND_QUIETLY) - message(STATUS "${error_message}") - endif() - endif() - endif() - # Set this variable as internal, so the user isn't bugged with it. - set(HIP_${_name} ${HIP_${_name}} CACHE INTERNAL "Location of ${_full_name}" FORCE) -endmacro() - -############################################################################### -hip_find_helper_file(run_make2cmake cmake) -hip_find_helper_file(run_hipcc cmake) -############################################################################### - -############################################################################### -# MACRO: Reset compiler flags -############################################################################### -macro(HIP_RESET_FLAGS) - unset(HIP_HIPCC_FLAGS) - unset(HIP_HCC_FLAGS) - unset(HIP_NVCC_FLAGS) - foreach(config ${_hip_configuration_types}) - string(TOUPPER ${config} config_upper) - unset(HIP_HIPCC_FLAGS_${config_upper}) - unset(HIP_HCC_FLAGS_${config_upper}) - unset(HIP_NVCC_FLAGS_${config_upper}) - endforeach() -endmacro() - -############################################################################### -# MACRO: Separate the options from the sources -############################################################################### -macro(HIP_GET_SOURCES_AND_OPTIONS _sources _cmake_options _hipcc_options _hcc_options _nvcc_options) - set(${_sources}) - set(${_cmake_options}) - set(${_hipcc_options}) - set(${_hcc_options}) - set(${_nvcc_options}) - set(_hipcc_found_options FALSE) - set(_hcc_found_options FALSE) - set(_nvcc_found_options FALSE) - foreach(arg ${ARGN}) - if("x${arg}" STREQUAL "xHIPCC_OPTIONS") - set(_hipcc_found_options TRUE) - set(_hcc_found_options FALSE) - set(_nvcc_found_options FALSE) - elseif("x${arg}" STREQUAL "xHCC_OPTIONS") - set(_hipcc_found_options FALSE) - set(_hcc_found_options TRUE) - set(_nvcc_found_options FALSE) - elseif("x${arg}" STREQUAL "xNVCC_OPTIONS") - set(_hipcc_found_options FALSE) - set(_hcc_found_options FALSE) - set(_nvcc_found_options TRUE) - elseif( - "x${arg}" STREQUAL "xEXCLUDE_FROM_ALL" OR - "x${arg}" STREQUAL "xSTATIC" OR - "x${arg}" STREQUAL "xSHARED" OR - "x${arg}" STREQUAL "xMODULE" - ) - list(APPEND ${_cmake_options} ${arg}) - else() - if(_hipcc_found_options) - list(APPEND ${_hipcc_options} ${arg}) - elseif(_hcc_found_options) - list(APPEND ${_hcc_options} ${arg}) - elseif(_nvcc_found_options) - list(APPEND ${_nvcc_options} ${arg}) - else() - # Assume this is a file - list(APPEND ${_sources} ${arg}) - endif() - endif() - endforeach() -endmacro() - -############################################################################### -# MACRO: Add include directories to pass to the hipcc command -############################################################################### -set(HIP_HIPCC_INCLUDE_ARGS_USER "") -macro(HIP_INCLUDE_DIRECTORIES) - foreach(dir ${ARGN}) - list(APPEND HIP_HIPCC_INCLUDE_ARGS_USER $<$:-I${dir}>) - endforeach() -endmacro() - -############################################################################### -# FUNCTION: Helper to avoid clashes of files with the same basename but different paths -############################################################################### -function(HIP_COMPUTE_BUILD_PATH path build_path) - # Convert to cmake style paths - file(TO_CMAKE_PATH "${path}" bpath) - if(IS_ABSOLUTE "${bpath}") - string(FIND "${bpath}" "${CMAKE_CURRENT_BINARY_DIR}" _binary_dir_pos) - if(_binary_dir_pos EQUAL 0) - file(RELATIVE_PATH bpath "${CMAKE_CURRENT_BINARY_DIR}" "${bpath}") - else() - file(RELATIVE_PATH bpath "${CMAKE_CURRENT_SOURCE_DIR}" "${bpath}") - endif() - endif() - - # Remove leading / - string(REGEX REPLACE "^[/]+" "" bpath "${bpath}") - # Avoid absolute paths by removing ':' - string(REPLACE ":" "_" bpath "${bpath}") - # Avoid relative paths that go up the tree - string(REPLACE "../" "__/" bpath "${bpath}") - # Avoid spaces - string(REPLACE " " "_" bpath "${bpath}") - # Strip off the filename - get_filename_component(bpath "${bpath}" PATH) - - set(${build_path} "${bpath}" PARENT_SCOPE) -endfunction() - -############################################################################### -# MACRO: Parse OPTIONS from ARGN & set variables prefixed by _option_prefix -############################################################################### -macro(HIP_PARSE_HIPCC_OPTIONS _option_prefix) - set(_hip_found_config) - foreach(arg ${ARGN}) - # Determine if we are dealing with a per-configuration flag - foreach(config ${_hip_configuration_types}) - string(TOUPPER ${config} config_upper) - if(arg STREQUAL "${config_upper}") - set(_hip_found_config _${arg}) - # Clear arg to prevent it from being processed anymore - set(arg) - endif() - endforeach() - if(arg) - list(APPEND ${_option_prefix}${_hip_found_config} "${arg}") - endif() - endforeach() -endmacro() - -############################################################################### -# MACRO: Try and include dependency file if it exists -############################################################################### -macro(HIP_INCLUDE_HIPCC_DEPENDENCIES dependency_file) - set(HIP_HIPCC_DEPEND) - set(HIP_HIPCC_DEPEND_REGENERATE FALSE) - - # Create the dependency file if it doesn't exist - if(NOT EXISTS ${dependency_file}) - file(WRITE ${dependency_file} "# Generated by: FindHIP.cmake. Do not edit.\n") - endif() - # Include the dependency file - include(${dependency_file}) - - # Verify the existence of all the included files - if(HIP_HIPCC_DEPEND) - foreach(f ${HIP_HIPCC_DEPEND}) - if(NOT EXISTS ${f}) - # If they aren't there, regenerate the file again - set(HIP_HIPCC_DEPEND_REGENERATE TRUE) - endif() - endforeach() - else() - # No dependencies, so regenerate the file - set(HIP_HIPCC_DEPEND_REGENERATE TRUE) - endif() - - # Regenerate the dependency file if needed - if(HIP_HIPCC_DEPEND_REGENERATE) - set(HIP_HIPCC_DEPEND ${dependency_file}) - file(WRITE ${dependency_file} "# Generated by: FindHIP.cmake. Do not edit.\n") - endif() -endmacro() - -############################################################################### -# MACRO: Prepare cmake commands for the target -############################################################################### -macro(HIP_PREPARE_TARGET_COMMANDS _target _format _generated_files _source_files) - set(_hip_flags "") - string(TOUPPER "${CMAKE_BUILD_TYPE}" _hip_build_configuration) - if(HIP_HOST_COMPILATION_CPP) - set(HIP_C_OR_CXX CXX) - else() - set(HIP_C_OR_CXX C) - endif() - set(generated_extension ${CMAKE_${HIP_C_OR_CXX}_OUTPUT_EXTENSION}) - - # Initialize list of includes with those specified by the user. Append with - # ones specified to cmake directly. - set(HIP_HIPCC_INCLUDE_ARGS ${HIP_HIPCC_INCLUDE_ARGS_USER}) - - # Add the include directories - set(include_directories_generator "$") - list(APPEND HIP_HIPCC_INCLUDE_ARGS "$<$:-I$>") - - get_directory_property(_hip_include_directories INCLUDE_DIRECTORIES) - list(REMOVE_DUPLICATES _hip_include_directories) - if(_hip_include_directories) - foreach(dir ${_hip_include_directories}) - list(APPEND HIP_HIPCC_INCLUDE_ARGS $<$:-I${dir}>) - endforeach() - endif() - - HIP_GET_SOURCES_AND_OPTIONS(_hip_sources _hip_cmake_options _hipcc_options _hcc_options _nvcc_options ${ARGN}) - HIP_PARSE_HIPCC_OPTIONS(HIP_HIPCC_FLAGS ${_hipcc_options}) - HIP_PARSE_HIPCC_OPTIONS(HIP_HCC_FLAGS ${_hcc_options}) - HIP_PARSE_HIPCC_OPTIONS(HIP_NVCC_FLAGS ${_nvcc_options}) - - # Add the compile definitions - set(compile_definition_generator "$") - list(APPEND HIP_HIPCC_FLAGS "$<$:-D$>") - - # Check if we are building shared library. - set(_hip_build_shared_libs FALSE) - list(FIND _hip_cmake_options SHARED _hip_found_SHARED) - list(FIND _hip_cmake_options MODULE _hip_found_MODULE) - if(_hip_found_SHARED GREATER -1 OR _hip_found_MODULE GREATER -1) - set(_hip_build_shared_libs TRUE) - endif() - list(FIND _hip_cmake_options STATIC _hip_found_STATIC) - if(_hip_found_STATIC GREATER -1) - set(_hip_build_shared_libs FALSE) - endif() - - # If we are building a shared library, add extra flags to HIP_HIPCC_FLAGS - if(_hip_build_shared_libs) - list(APPEND HIP_HCC_FLAGS "-fPIC") - list(APPEND HIP_NVCC_FLAGS "--shared -Xcompiler '-fPIC'") - endif() - - # Set host compiler - set(HIP_HOST_COMPILER "${CMAKE_${HIP_C_OR_CXX}_COMPILER}") - - # Set compiler flags - set(_HIP_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CMAKE_${HIP_C_OR_CXX}_FLAGS})") - set(_HIP_HIPCC_FLAGS "set(HIP_HIPCC_FLAGS ${HIP_HIPCC_FLAGS})") - set(_HIP_HCC_FLAGS "set(HIP_HCC_FLAGS ${HIP_HCC_FLAGS})") - set(_HIP_NVCC_FLAGS "set(HIP_NVCC_FLAGS ${HIP_NVCC_FLAGS})") - foreach(config ${_hip_configuration_types}) - string(TOUPPER ${config} config_upper) - set(_HIP_HOST_FLAGS "${_HIP_HOST_FLAGS}\nset(CMAKE_HOST_FLAGS_${config_upper} ${CMAKE_${HIP_C_OR_CXX}_FLAGS_${config_upper}})") - set(_HIP_HIPCC_FLAGS "${_HIP_HIPCC_FLAGS}\nset(HIP_HIPCC_FLAGS_${config_upper} ${HIP_HIPCC_FLAGS_${config_upper}})") - set(_HIP_HCC_FLAGS "${_HIP_HCC_FLAGS}\nset(HIP_HCC_FLAGS_${config_upper} ${HIP_HCC_FLAGS_${config_upper}})") - set(_HIP_NVCC_FLAGS "${_HIP_NVCC_FLAGS}\nset(HIP_NVCC_FLAGS_${config_upper} ${HIP_NVCC_FLAGS_${config_upper}})") - endforeach() - - # Reset the output variable - set(_hip_generated_files "") - set(_hip_source_files "") - - # Iterate over all arguments and create custom commands for all source files - foreach(file ${ARGN}) - # Ignore any file marked as a HEADER_FILE_ONLY - get_source_file_property(_is_header ${file} HEADER_FILE_ONLY) - # Allow per source file overrides of the format. Also allows compiling non .cu files. - get_source_file_property(_hip_source_format ${file} HIP_SOURCE_PROPERTY_FORMAT) - if((${file} MATCHES "\\.cu$" OR _hip_source_format) AND NOT _is_header) - set(host_flag FALSE) - else() - set(host_flag TRUE) - endif() - - if(NOT host_flag) - # Determine output directory - HIP_COMPUTE_BUILD_PATH("${file}" hip_build_path) - set(hip_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_target}.dir/${hip_build_path}") - - get_filename_component(basename ${file} NAME) - set(generated_file_path "${hip_compile_output_dir}/${CMAKE_CFG_INTDIR}") - set(generated_file_basename "${_target}_generated_${basename}${generated_extension}") - - # Set file names - set(generated_file "${generated_file_path}/${generated_file_basename}") - set(cmake_dependency_file "${hip_compile_output_dir}/${generated_file_basename}.depend") - set(custom_target_script_pregen "${hip_compile_output_dir}/${generated_file_basename}.cmake.pre-gen") - set(custom_target_script "${hip_compile_output_dir}/${generated_file_basename}.cmake") - - # Set properties for object files - set_source_files_properties("${generated_file}" - PROPERTIES - EXTERNAL_OBJECT true # This is an object file not to be compiled, but only be linked - ) - - # Don't add CMAKE_CURRENT_SOURCE_DIR if the path is already an absolute path - get_filename_component(file_path "${file}" PATH) - if(IS_ABSOLUTE "${file_path}") - set(source_file "${file}") - else() - set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}") - endif() - - # Bring in the dependencies - HIP_INCLUDE_HIPCC_DEPENDENCIES(${cmake_dependency_file}) - - # Configure the build script - configure_file("${HIP_run_hipcc}" "${custom_target_script_pregen}" @ONLY) - file(GENERATE - OUTPUT "${custom_target_script}" - INPUT "${custom_target_script_pregen}" - ) - set(main_dep DEPENDS ${source_file}) - if(CMAKE_GENERATOR MATCHES "Makefiles") - set(verbose_output "$(VERBOSE)") - elseif(HIP_VERBOSE_BUILD) - set(verbose_output ON) - else() - set(verbose_output OFF) - endif() - - # Create up the comment string - file(RELATIVE_PATH generated_file_relative_path "${CMAKE_BINARY_DIR}" "${generated_file}") - set(hip_build_comment_string "Building HIPCC object ${generated_file_relative_path}") - - # Build the generated file and dependency file - add_custom_command( - OUTPUT ${generated_file} - # These output files depend on the source_file and the contents of cmake_dependency_file - ${main_dep} - DEPENDS ${HIP_HIPCC_DEPEND} - DEPENDS ${custom_target_script} - # Make sure the output directory exists before trying to write to it. - COMMAND ${CMAKE_COMMAND} -E make_directory "${generated_file_path}" - COMMAND ${CMAKE_COMMAND} ARGS - -D verbose:BOOL=${verbose_output} - -D build_configuration:STRING=${_hip_build_configuration} - -D "generated_file:STRING=${generated_file}" - -P "${custom_target_script}" - WORKING_DIRECTORY "${hip_compile_output_dir}" - COMMENT "${hip_build_comment_string}" - ) - - # Make sure the build system knows the file is generated - set_source_files_properties(${generated_file} PROPERTIES GENERATED TRUE) - list(APPEND _hip_generated_files ${generated_file}) - list(APPEND _hip_source_files ${file}) - endif() - endforeach() - - # Set the return parameter - set(${_generated_files} ${_hip_generated_files}) - set(${_source_files} ${_hip_source_files}) -endmacro() - -############################################################################### -# HIP_ADD_EXECUTABLE -############################################################################### -macro(HIP_ADD_EXECUTABLE hip_target) - # Separate the sources from the options - HIP_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _hipcc_options _hcc_options _nvcc_options ${ARGN}) - HIP_PREPARE_TARGET_COMMANDS(${hip_target} OBJ _generated_files _source_files ${_sources} HIPCC_OPTIONS ${_hipcc_options} HCC_OPTIONS ${_hcc_options} NVCC_OPTIONS ${_nvcc_options}) - if(_source_files) - list(REMOVE_ITEM _sources ${_source_files}) - endif() - if("x${HCC_HOME}" STREQUAL "x") - set(HCC_HOME "/opt/rocm/hcc") - endif() - set(CMAKE_HIP_LINK_EXECUTABLE "${HIP_HIPCC_CMAKE_LINKER_HELPER} ${HCC_HOME} -o ") - add_executable(${hip_target} ${_cmake_options} ${_generated_files} ${_sources}) - set_target_properties(${hip_target} PROPERTIES LINKER_LANGUAGE HIP) -endmacro() - -############################################################################### -# HIP_ADD_LIBRARY -############################################################################### -macro(HIP_ADD_LIBRARY hip_target) - # Separate the sources from the options - HIP_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _hipcc_options _hcc_options _nvcc_options ${ARGN}) - HIP_PREPARE_TARGET_COMMANDS(${hip_target} OBJ _generated_files _source_files ${_sources} ${_cmake_options} HIPCC_OPTIONS ${_hipcc_options} HCC_OPTIONS ${_hcc_options} NVCC_OPTIONS ${_nvcc_options}) - if(_source_files) - list(REMOVE_ITEM _sources ${_source_files}) - endif() - add_library(${hip_target} ${_cmake_options} ${_generated_files} ${_sources}) - set_target_properties(${hip_target} PROPERTIES LINKER_LANGUAGE ${HIP_C_OR_CXX}) -endmacro() - -# vim: ts=4:sw=4:expandtab:smartindent diff --git a/cmake/modules/FindHIP/run_hipcc.cmake b/cmake/modules/FindHIP/run_hipcc.cmake deleted file mode 100644 index 4dc2572e981f0..0000000000000 --- a/cmake/modules/FindHIP/run_hipcc.cmake +++ /dev/null @@ -1,168 +0,0 @@ -############################################################################### -# Runs commands using HIPCC -############################################################################### - -############################################################################### -# This file runs the hipcc commands to produce the desired output file -# along with the dependency file needed by CMake to compute dependencies. -# -# Input variables: -# -# verbose:BOOL=<> OFF: Be as quiet as possible (default) -# ON : Describe each step -# build_configuration:STRING=<> Build configuration. Defaults to Debug. -# generated_file:STRING=<> File to generate. Mandatory argument. - -if(NOT build_configuration) - set(build_configuration Debug) -endif() -if(NOT generated_file) - message(FATAL_ERROR "You must specify generated_file on the command line") -endif() - -# Set these up as variables to make reading the generated file easier -set(HIP_HIPCC_EXECUTABLE "@HIP_HIPCC_EXECUTABLE@") # path -set(HIP_HIPCONFIG_EXECUTABLE "@HIP_HIPCONFIG_EXECUTABLE@") #path -set(HIP_HOST_COMPILER "@HIP_HOST_COMPILER@") # path -set(CMAKE_COMMAND "@CMAKE_COMMAND@") # path -set(HIP_run_make2cmake "@HIP_run_make2cmake@") # path -set(HCC_HOME "@HCC_HOME@") #path - -@HIP_HOST_FLAGS@ -@_HIP_HIPCC_FLAGS@ -@_HIP_HCC_FLAGS@ -@_HIP_NVCC_FLAGS@ -set(HIP_HIPCC_INCLUDE_ARGS "@HIP_HIPCC_INCLUDE_ARGS@") # list (needs to be in quotes to handle spaces properly) - -set(cmake_dependency_file "@cmake_dependency_file@") # path -set(source_file "@source_file@") # path -set(host_flag "@host_flag@") # bool - -# Determine compiler and compiler flags -execute_process(COMMAND ${HIP_HIPCONFIG_EXECUTABLE} --platform OUTPUT_VARIABLE HIP_PLATFORM OUTPUT_STRIP_TRAILING_WHITESPACE) -if(NOT host_flag) - set(__CC ${HIP_HIPCC_EXECUTABLE}) - if(HIP_PLATFORM STREQUAL "hcc") - if(NOT "x${HCC_HOME}" STREQUAL "x") - set(ENV{HCC_HOME} ${HCC_HOME}) - endif() - set(__CC_FLAGS ${HIP_HIPCC_FLAGS} ${HIP_HCC_FLAGS} ${HIP_HIPCC_FLAGS_${build_configuration}} ${HIP_HCC_FLAGS_${build_configuration}}) - else() - set(__CC_FLAGS ${HIP_HIPCC_FLAGS} ${HIP_NVCC_FLAGS} ${HIP_HIPCC_FLAGS_${build_configuration}} ${HIP_NVCC_FLAGS_${build_configuration}}) - endif() -else() - set(__CC ${HIP_HOST_COMPILER}) - set(__CC_FLAGS ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}}) -endif() -set(__CC_INCLUDES ${HIP_HIPCC_INCLUDE_ARGS}) - -# hip_execute_process - Executes a command with optional command echo and status message. -# status - Status message to print if verbose is true -# command - COMMAND argument from the usual execute_process argument structure -# ARGN - Remaining arguments are the command with arguments -# HIP_result - Return value from running the command -macro(hip_execute_process status command) - set(_command ${command}) - if(NOT "x${_command}" STREQUAL "xCOMMAND") - message(FATAL_ERROR "Malformed call to hip_execute_process. Missing COMMAND as second argument. (command = ${command})") - endif() - if(verbose) - execute_process(COMMAND "${CMAKE_COMMAND}" -E echo -- ${status}) - # Build command string to print - set(hip_execute_process_string) - foreach(arg ${ARGN}) - # Escape quotes if any - string(REPLACE "\"" "\\\"" arg ${arg}) - # Surround args with spaces with quotes - if(arg MATCHES " ") - list(APPEND hip_execute_process_string "\"${arg}\"") - else() - list(APPEND hip_execute_process_string ${arg}) - endif() - endforeach() - # Echo the command - execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${hip_execute_process_string}) - endif() - # Run the command - execute_process(COMMAND ${ARGN} RESULT_VARIABLE HIP_result) -endmacro() - -# Delete the target file -hip_execute_process( - "Removing ${generated_file}" - COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}" - ) - -# Generate the dependency file -hip_execute_process( - "Generating dependency file: ${cmake_dependency_file}.pre" - COMMAND "${__CC}" - -M - "${source_file}" - -o "${cmake_dependency_file}.pre" - ${__CC_FLAGS} - ${__CC_INCLUDES} - ) - -if(HIP_result) - message(FATAL_ERROR "Error generating ${generated_file}") -endif() - -# Generate the cmake readable dependency file to a temp file -hip_execute_process( - "Generating temporary cmake readable file: ${cmake_dependency_file}.tmp" - COMMAND "${CMAKE_COMMAND}" - -D "input_file:FILEPATH=${cmake_dependency_file}.pre" - -D "output_file:FILEPATH=${cmake_dependency_file}.tmp" - -D "verbose=${verbose}" - -P "${HIP_run_make2cmake}" - ) - -if(HIP_result) - message(FATAL_ERROR "Error generating ${generated_file}") -endif() - -# Copy the file if it is different -hip_execute_process( - "Copy if different ${cmake_dependency_file}.tmp to ${cmake_dependency_file}" - COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cmake_dependency_file}.tmp" "${cmake_dependency_file}" - ) - -if(HIP_result) - message(FATAL_ERROR "Error generating ${generated_file}") -endif() - -# Delete the temporary file -hip_execute_process( - "Removing ${cmake_dependency_file}.tmp and ${cmake_dependency_file}.pre" - COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${cmake_dependency_file}.pre" - ) - -if(HIP_result) - message(FATAL_ERROR "Error generating ${generated_file}") -endif() - -# Generate the output file -hip_execute_process( - "Generating ${generated_file}" - COMMAND "${__CC}" - -c - "${source_file}" - -o "${generated_file}" - ${__CC_FLAGS} - ${__CC_INCLUDES} - ) - -if(HIP_result) - # Make sure that we delete the output file - hip_execute_process( - "Removing ${generated_file}" - COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}" - ) - message(FATAL_ERROR "Error generating file ${generated_file}") -else() - if(verbose) - message("Generated ${generated_file} successfully.") - endif() -endif() -# vim: ts=4:sw=4:expandtab:smartindent diff --git a/cmake/modules/FindHIP/run_make2cmake.cmake b/cmake/modules/FindHIP/run_make2cmake.cmake deleted file mode 100644 index d2e3eb5169026..0000000000000 --- a/cmake/modules/FindHIP/run_make2cmake.cmake +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################### -# Computes dependencies using HIPCC -############################################################################### - -############################################################################### -# This file converts dependency files generated using hipcc to a format that -# cmake can understand. - -# Input variables: -# -# input_file:STRING=<> Dependency file to parse. Required argument -# output_file:STRING=<> Output file to generate. Required argument - -if(NOT input_file OR NOT output_file) - message(FATAL_ERROR "You must specify input_file and output_file on the command line") -endif() - -file(READ ${input_file} depend_text) - -if (NOT "${depend_text}" STREQUAL "") - string(REPLACE " /" "\n/" depend_text ${depend_text}) - string(REGEX REPLACE "^.*:" "" depend_text ${depend_text}) - string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text}) - - set(dependency_list "") - - foreach(file ${depend_text}) - string(REGEX REPLACE "^ +" "" file ${file}) - if(NOT EXISTS "${file}") - message(WARNING " Removing non-existent dependency file: ${file}") - set(file "") - endif() - - if(NOT IS_DIRECTORY "${file}") - get_filename_component(file_absolute "${file}" ABSOLUTE) - list(APPEND dependency_list "${file_absolute}") - endif() - endforeach() -endif() - -# Remove the duplicate entries and sort them. -list(REMOVE_DUPLICATES dependency_list) -list(SORT dependency_list) - -foreach(file ${dependency_list}) - set(hip_hipcc_depend "${hip_hipcc_depend} \"${file}\"\n") -endforeach() - -file(WRITE ${output_file} "# Generated by: FindHIP.cmake. Do not edit.\nSET(HIP_HIPCC_DEPEND\n ${hip_hipcc_depend})\n\n") -# vim: ts=4:sw=4:expandtab:smartindent diff --git a/cmake/modules/FindInfoLogger.cmake b/cmake/modules/FindInfoLogger.cmake deleted file mode 100644 index 9e162007ad763..0000000000000 --- a/cmake/modules/FindInfoLogger.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# - Tries to find the O2 InfoLogger package (include dir and library) -# Author: Barthelemy von Haller -# Author: Adam Wegrzynek -# Author: Sylvain Chapeland -# -# This module will set the following non-cached variables: -# InfoLogger_FOUND - states whether InfoLogger package has been found -# InfoLogger_INCLUDE_DIRS - InfoLogger include directory -# InfoLogger_LIBRARIES - InfoLogger library filepath -# InfoLogger_DEFINITIONS - Compiler definitions when comping code using InfoLogger -# -# Also following cached variables, but not for general use, are defined: -# INFOLOGGER_INCLUDE_DIR -# INFOLOGGER_LIBRARY -# -# This module respects following variables: -# InfoLogger_ROOT - Installation root directory (otherwise it goes through LD_LIBRARY_PATH and ENV) - -# Init -include(FindPackageHandleStandardArgs) - -# Need Common -find_package(Common REQUIRED) - -# find includes -find_path(INFOLOGGER_INCLUDE_DIR InfoLogger.hxx - HINTS ${InfoLogger_ROOT}/include ENV LD_LIBRARY_PATH PATH_SUFFIXES "../include/InfoLogger" "../../include/InfoLogger" ) - -# Remove the final "InfoLogger" -get_filename_component(INFOLOGGER_INCLUDE_DIR ${INFOLOGGER_INCLUDE_DIR} DIRECTORY) -set(InfoLogger_INCLUDE_DIRS ${INFOLOGGER_INCLUDE_DIR}) - -# find library -find_library(INFOLOGGER_LIBRARY NAMES InfoLogger HINTS ${InfoLogger_ROOT}/lib ENV LD_LIBRARY_PATH) -set(InfoLogger_LIBRARIES ${INFOLOGGER_LIBRARY} ${Common_LIBRARIES}) - -# handle the QUIETLY and REQUIRED arguments and set InfoLogger_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(InfoLogger "InfoLogger could not be found. Set InfoLogger_ROOT as root installation directory." - INFOLOGGER_LIBRARY INFOLOGGER_INCLUDE_DIR) -if(${InfoLogger_FOUND}) - set(InfoLogger_DEFINITIONS "") - message(STATUS "InfoLogger found : ${InfoLogger_LIBRARIES}") -endif() - -mark_as_advanced(INFOLOGGER_INCLUDE_DIR INFOLOGGER_LIBRARY) diff --git a/cmake/modules/FindRapidJSON.cmake b/cmake/modules/FindRapidJSON.cmake deleted file mode 100644 index d461e5769c63f..0000000000000 --- a/cmake/modules/FindRapidJSON.cmake +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (c) 2011 Milo Yip (miloyip@gmail.com) -# Copyright (c) 2013 Rafal Jeczalik (rjeczalik@gmail.com) -# Distributed under the MIT License (see license.txt file) - -# ----------------------------------------------------------------------------------- -# -# Finds the rapidjson library -# -# ----------------------------------------------------------------------------------- -# -# Variables used by this module, they can change the default behaviour. -# Those variables need to be either set before calling find_package -# or exported as environment variables before running CMake: -# -# RAPIDJSON_INCLUDEDIR - Set custom include path, useful when rapidjson headers are -# outside system paths -# RAPIDJSON_USE_SSE2 - Configure rapidjson to take advantage of SSE2 capabilities -# RAPIDJSON_USE_SSE42 - Configure rapidjson to take advantage of SSE4.2 capabilities -# -# ----------------------------------------------------------------------------------- -# -# Variables defined by this module: -# -# RAPIDJSON_FOUND - True if rapidjson was found -# RAPIDJSON_INCLUDE_DIRS - Path to rapidjson include directory -# RAPIDJSON_CXX_FLAGS - Extra C++ flags required for compilation with rapidjson -# -# ----------------------------------------------------------------------------------- -# -# Example usage: -# -# set(RAPIDJSON_USE_SSE2 ON) -# set(RAPIDJSON_INCLUDEDIR "/opt/github.com/rjeczalik/rapidjson/include") -# -# find_package(rapidjson REQUIRED) -# -# include_directories("${RAPIDJSON_INCLUDE_DIRS}") -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RAPIDJSON_CXX_FLAGS}") -# add_executable(foo foo.cc) -# -# ----------------------------------------------------------------------------------- - -foreach(opt RAPIDJSON_INCLUDEDIR RAPIDJSON_USE_SSE2 RAPIDJSON_USE_SSE42) - if(${opt} AND DEFINED ENV{${opt}} AND NOT ${opt} STREQUAL "$ENV{${opt}}") - message(WARNING "Conflicting ${opt} values: ignoring environment variable and using CMake cache entry.") - elseif(DEFINED ENV{${opt}} AND NOT ${opt}) - set(${opt} "$ENV{${opt}}") - endif() -endforeach() - -find_path( - RAPIDJSON_INCLUDE_DIRS - NAMES rapidjson/rapidjson.h - PATHS ${RAPIDJSON_INCLUDEDIR} - DOC "Include directory for the rapidjson library." -) - -mark_as_advanced(RAPIDJSON_INCLUDE_DIRS) - -if(RAPIDJSON_INCLUDE_DIRS) - set(RAPIDJSON_FOUND TRUE) -endif() - -mark_as_advanced(RAPIDJSON_FOUND) - -if(RAPIDJSON_USE_SSE42) - set(RAPIDJSON_CXX_FLAGS "-DRAPIDJSON_SSE42") - if(MSVC) - set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} /arch:SSE4.2") - else() - set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} -msse4.2") - endif() -else() - if(RAPIDJSON_USE_SSE2) - set(RAPIDJSON_CXX_FLAGS "-DRAPIDJSON_SSE2") - if(MSVC) - set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} /arch:SSE2") - else() - set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} -msse2") - endif() - endif() -endif() - -mark_as_advanced(RAPIDJSON_CXX_FLAGS) - -if(RAPIDJSON_FOUND) - if(NOT rapidjson_FIND_QUIETLY) - message(STATUS "Found rapidjson header files in ${RAPIDJSON_INCLUDE_DIRS}") - if(DEFINED RAPIDJSON_CXX_FLAGS) - message(STATUS "Found rapidjson C++ extra compilation flags: ${RAPIDJSON_CXX_FLAGS}") - endif() - endif() - if(NOT TARGET RapidJSON) - add_library(RapidJSON INTERFACE IMPORTED) - set_target_properties(RapidJSON PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${RAPIDJSON_INCLUDE_DIRS}) - endif() -elseif(rapidjson_FIND_REQUIRED) - message(FATAL_ERROR "Could not find rapidjson") -else() - message(STATUS "Optional package rapidjson was not found") -endif() - diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 847d7f21ead06..8c32b4e727e7a 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -1,16 +1,11 @@ -# ************************************************************************** -# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * -# * * -# * Author: The ALICE Off-line Project. * -# * Contributors are mentioned in the code where appropriate. * -# * * -# * Permission to use, copy, modify and distribute this software and its * -# * documentation strictly for non-commercial purposes is hereby granted * -# * without fee, provided that the above copyright notice appears in all * -# * copies and that both the copyright notice and this permission notice * -# * appear in the supporting documentation. The authors make no claims * -# * about the suitability of this software for any purpose. It is * -# * provided "as is" without express or implied warranty. * -# ************************************************************************** +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. -Install(FILES rootmanager.dat DESTINATION share/config/) +install(FILES rootmanager.dat DESTINATION share/config/) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt new file mode 100644 index 0000000000000..2e0d98db0cbf3 --- /dev/null +++ b/dependencies/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include("${CMAKE_CURRENT_LIST_DIR}/O2Dependencies.cmake") diff --git a/dependencies/FindAliRoot.cmake b/dependencies/FindAliRoot.cmake new file mode 100644 index 0000000000000..7252240bd2335 --- /dev/null +++ b/dependencies/FindAliRoot.cmake @@ -0,0 +1,43 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +set(AliRoot_FOUND FALSE) + +if(ALIROOT) + + # Check if AliRoot is really installed there + if(EXISTS ${ALIROOT}/bin/aliroot + AND EXISTS ${ALIROOT}/lib + AND EXISTS ${ALIROOT}/include) + + # TODO this is really not the way it should be done + include_directories(${ALIROOT}/include ${ALIROOT}/include/pythia) + # TODO neither is this + link_directories(${ALIROOT}/lib) + + set(AliRoot_FOUND TRUE) + + message(STATUS "AliRoot ... - found ${ALIROOT}") + + else() + + message(STATUS "AliRoot ... - not found") + + endif() +endif(ALIROOT) + +if(NOT AliRoot_FOUND) + if(AliRoot_FIND_REQUIRED) + message( + FATAL_ERROR + "Please point to the AliRoot Core installation using -DALIROOT=" + ) + endif(AliRoot_FIND_REQUIRED) +endif(NOT AliRoot_FOUND) diff --git a/dependencies/FindFairRoot.cmake b/dependencies/FindFairRoot.cmake new file mode 100644 index 0000000000000..41a2cc056f020 --- /dev/null +++ b/dependencies/FindFairRoot.cmake @@ -0,0 +1,105 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# TODO: remove this file once FairRoot correctly exports its cmake config + +find_path(FairRoot_INC FairDetector.h + PATH_SUFFIXES FairRoot/include + PATHS ${FAIRROOTPATH}/include) + +# if(NOT EXISTS ${FairRoot_INC}) set(FairRoot_FOUND FALSE) +# if(FairRoot_FIND_REQUIRED) message(FATAL_ERROR "Could not find FairRoot") +# endif() return() endif() + +get_filename_component(FairRoot_TOPDIR "${FairRoot_INC}/.." ABSOLUTE) + +set(OLD_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}) +set(CMAKE_PREFIX_PATH ${FairRoot_TOPDIR}) + +find_library(FairRoot_Tools FairTools) +find_library(FairRoot_ParBase ParBase) +find_library(FairRoot_GeoBase GeoBase) +find_library(FairRoot_Base Base) +find_library(FairRoot_ParMQ ParMQ) +find_library(FairRoot_Gen Gen) + +set(CMAKE_PREFIX_PATH ${OLD_CMAKE_PREFIX_PATH}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FairRoot + DEFAULT_MSG FairRoot_Base + FairRoot_Tools + FairRoot_ParBase + FairRoot_GeoBase + FairRoot_ParMQ + FairRoot_Gen + FairRoot_INC) + +if(NOT TARGET FairRoot::Tools) + add_library(FairRoot::Tools IMPORTED INTERFACE) + set_target_properties(FairRoot::Tools + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC} + INTERFACE_LINK_LIBRARIES ${FairRoot_Tools}) + target_link_libraries(FairRoot::Tools INTERFACE FairLogger::FairLogger) +endif() + +if(NOT TARGET FairRoot::ParBase) + add_library(FairRoot::ParBase IMPORTED INTERFACE) + set_target_properties(FairRoot::ParBase + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC} + INTERFACE_LINK_LIBRARIES ${FairRoot_ParBase}) + target_link_libraries(FairRoot::ParBase INTERFACE FairRoot::Tools) +endif() + +if(NOT TARGET FairRoot::GeoBase) + add_library(FairRoot::GeoBase IMPORTED INTERFACE) + set_target_properties(FairRoot::GeoBase + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC} + INTERFACE_LINK_LIBRARIES ${FairRoot_GeoBase}) +endif() + +if(NOT TARGET FairRoot::Base) + add_library(FairRoot::Base IMPORTED INTERFACE) + set_target_properties(FairRoot::Base + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC} + INTERFACE_LINK_LIBRARIES ${FairRoot_Base}) + target_link_libraries(FairRoot::Base + INTERFACE FairRoot::Tools FairRoot::ParBase + FairRoot::GeoBase ROOT::ROOTDataFrame) + if(TARGET arrow_shared) + # FIXME: this dependency (coming from ROOTDataFrame) should be handled in + # ROOT itself + target_link_libraries(FairRoot::Base INTERFACE arrow_shared) + endif() +endif() + +if(NOT TARGET FairRoot::ParMQ) + add_library(FairRoot::ParMQ IMPORTED INTERFACE) + set_target_properties(FairRoot::ParMQ + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC} + INTERFACE_LINK_LIBRARIES ${FairRoot_ParMQ}) + target_link_libraries(FairRoot::ParMQ + INTERFACE FairRoot::ParBase FairMQ::FairMQ) + if(TARGET arrow_shared) + # FIXME: this dependency (coming from ROOTDataFrame) should be handled in + # ROOT itself + target_link_libraries(FairRoot::ParMQ INTERFACE arrow_shared) + endif() +endif() + +if(NOT TARGET FairRoot::Gen) + add_library(FairRoot::Gen IMPORTED INTERFACE) + set_target_properties(FairRoot::Gen + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${FairRoot_INC} + INTERFACE_LINK_LIBRARIES ${FairRoot_Gen}) + target_link_libraries(FairRoot::Gen + INTERFACE FairRoot::ParBase FairRoot::Base + FairRoot::ParBase) +endif() diff --git a/dependencies/FindGeant3.cmake b/dependencies/FindGeant3.cmake new file mode 100644 index 0000000000000..88a16aa91497d --- /dev/null +++ b/dependencies/FindGeant3.cmake @@ -0,0 +1,21 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# use the the config provided by the Geant3 installation but amend the target +# geant321 with the include directories + +find_package(Geant3 NO_MODULE) +if(NOT Geant3_FOUND) + return() +endif() + +set_target_properties(geant321 + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${Geant3_INCLUDE_DIRS}") diff --git a/dependencies/FindGeant4.cmake b/dependencies/FindGeant4.cmake new file mode 100644 index 0000000000000..2e64a7c32720e --- /dev/null +++ b/dependencies/FindGeant4.cmake @@ -0,0 +1,23 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# use the Geant4Config.cmake provided by the Geant4 installation to create a +# single target geant4 with the include directories and libraries we need + +find_package(Geant4 NO_MODULE) +if(NOT Geant4_FOUND) + return() +endif() + +add_library(geant4 IMPORTED INTERFACE) + +set_target_properties(geant4 + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${Geant4_INCLUDE_DIRS}") diff --git a/dependencies/FindGeant4VMC.cmake b/dependencies/FindGeant4VMC.cmake new file mode 100644 index 0000000000000..0582428f0f433 --- /dev/null +++ b/dependencies/FindGeant4VMC.cmake @@ -0,0 +1,21 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# use the GEANT4_VMCConfig.cmake provided by the Geant4VMC installation but +# amend the target geant4vmc with the include directories + +find_package(Geant4VMC NO_MODULE) +if(NOT Geant4VMC_FOUND) + return() +endif() + +set_target_properties(geant4vmc + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${Geant4VMC_INCLUDE_DIRS}") diff --git a/dependencies/FindO2GPU.cmake b/dependencies/FindO2GPU.cmake new file mode 100644 index 0000000000000..58d2b3ccfe996 --- /dev/null +++ b/dependencies/FindO2GPU.cmake @@ -0,0 +1,156 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +if(NOT DEFINED ENABLE_CUDA) + set(ENABLE_CUDA "AUTO") +endif() +if(NOT DEFINED ENABLE_OPENCL1) + set(ENABLE_OPENCL1 "AUTO") +endif() +if(NOT DEFINED ENABLE_OPENCL2) + set(ENABLE_OPENCL2 "AUTO") +endif() +if(NOT DEFINED ENABLE_HIP) + set(ENABLE_HIP "AUTO") +endif() +string(TOUPPER "${ENABLE_CUDA}" ENABLE_CUDA) +string(TOUPPER "${ENABLE_OPENCL1}" ENABLE_OPENCL1) +string(TOUPPER "${ENABLE_OPENCL2}" ENABLE_OPENCL2) +string(TOUPPER "${ENABLE_HIP}" ENABLE_HIP) + +# Detect and enable CUDA +if(ENABLE_CUDA) + set(CUDA_MINIMUM_VERSION "10.1") + if(CUDA_GCCBIN) + message(STATUS "Using as CUDA GCC version: ${CUDA_GCCBIN}") + set(CUDA_HOST_COMPILER "${CUDA_GCCBIN}") + endif() + set(CMAKE_CUDA_STANDARD 14) + set(CMAKE_CUDA_STANDARD_REQUIRED TRUE) + include(CheckLanguage) + check_language(CUDA) + if(CMAKE_CUDA_COMPILER) + enable_language(CUDA) + get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) + if(NOT CUDA IN_LIST LANGUAGES) + message(FATAL_ERROR "CUDA was found but cannot be enabled") + endif() + + set(CMAKE_CUDA_FLAGS "--expt-relaxed-constexpr") + set(CMAKE_CUDA_FLAGS_DEBUG "-Xptxas -O0 -Xcompiler -O0") + set(CMAKE_CUDA_FLAGS_RELEASE "-Xptxas -O4 -Xcompiler -O4 -use_fast_math") + set(CMAKE_CUDA_FLAGS_RELWITHDEBINFO "${CMAKE_CUDA_FLAGS_RELEASE}") + set(CMAKE_CUDA_FLAGS_COVERAGE "${CMAKE_CUDA_FLAGS_RELEASE}") + if(CUDA_COMPUTETARGET) + set( + CMAKE_CUDA_FLAGS + "${CMAKE_CUDA_FLAGS} -gencode arch=compute_${CUDA_COMPUTETARGET},code=compute_${CUDA_COMPUTETARGET}" + ) + endif() + + set(CUDA_ENABLED ON) + message(STATUS "CUDA found (Version ${CMAKE_CUDA_COMPILER_VERSION})") + elseif(NOT ENABLE_CUDA STREQUAL "AUTO") + message(FATAL_ERROR "CUDA not found") + endif() +endif() + +# Detect and enable OpenCL 1.2 from AMD +if(ENABLE_OPENCL1 OR ENABLE_OPENCL2) + find_package(OpenCL) + if((ENABLE_OPENCL1 AND NOT ENABLE_OPENCL1 STREQUAL "AUTO") + OR (ENABLE_OPENCL2 AND NOT ENABLE_OPENCL2 STREQUAL "AUTO")) + set_package_properties(OpenCL PROPERTIES TYPE REQUIRED) + else() + set_package_properties(OpenCL PROPERTIES TYPE OPTIONAL) + endif() +endif() +if(ENABLE_OPENCL1) + if(NOT AMDAPPSDKROOT) + set(AMDAPPSDKROOT "$ENV{AMDAPPSDKROOT}") + endif() + + if(OpenCL_FOUND + AND OpenCL_VERSION_STRING VERSION_GREATER_EQUAL 1.2 + AND AMDAPPSDKROOT + AND EXISTS "${AMDAPPSDKROOT}") + set(OPENCL1_ENABLED ON) + message(STATUS "Found AMD OpenCL 1.2") + elseif(NOT ENABLE_OPENCL1 STREQUAL "AUTO") + message(FATAL_ERROR "AMD OpenCL 1.2 not available") + endif() +endif() + +# Detect and enable OpenCL 2.x +if(ENABLE_OPENCL2) + if(OpenCL_VERSION_STRING VERSION_GREATER_EQUAL 2.0 + AND Clang_FOUND + AND LLVM_FOUND + AND LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL 9.0) + set(OPENCL2_ENABLED ON) + message( + STATUS + "Found OpenCL 2 (${OpenCL_VERSION_STRING} compiled by LLVM/Clang ${LLVM_PACKAGE_VERSION})" + ) + elseif(NOT ENABLE_OPENCL2 STREQUAL "AUTO") + # message(FATAL_ERROR "OpenCL 2.x not yet implemented") + endif() +endif() + +# Detect and enable HIP +if(ENABLE_HIP) + if(NOT DEFINED HIP_PATH) + if(NOT DEFINED ENV{HIP_PATH}) + set(HIP_PATH + "/opt/rocm/hip" + CACHE PATH "Path to which HIP has been installed") + else() + set(HIP_PATH + $ENV{HIP_PATH} + CACHE PATH "Path to which HIP has been installed") + endif() + endif() + if(NOT DEFINED HCC_HOME) + if(NOT DEFINED ENV{HCC_HOME}) + set(HCC_HOME + "${HIP_PATH}/../hcc" + CACHE PATH "Path to which HCC has been installed") + else() + set(HCC_HOME + $ENV{HCC_HOME} + CACHE PATH "Path to which HCC has been installed") + endif() + endif() + + if(HIP_PATH AND EXISTS "${HIP_PATH}" AND HCC_HOME AND EXISTS "${HCC_HOME}") + get_filename_component(hip_ROOT "${HIP_PATH}" ABSOLUTE) + get_filename_component(hcc_ROOT "${HCC_HOME}" ABSOLUTE) + find_package(hip) + if(ENABLE_HIP STREQUAL "AUTO") + set_package_properties(hip PROPERTIES TYPE OPTIONAL) + else() + set_package_properties(hip PROPERTIES TYPE REQUIRED) + endif() + if(hip_HIPCC_EXECUTABLE) + set(HIP_ENABLED ON) + message(STATUS "HIP Found") + endif() + elseif(NOT ENABLE_HIP STREQUAL "AUTO") + message( + FATAL_ERROR + "HIP requested but HIP_PATH=${HIP_PATH} or HCC_HOME=${HCC_HOME} does not exist" + ) + endif() + +endif() + +# if we end up here without a FATAL, it means we have found the "O2GPU" package +set(O2GPU_FOUND TRUE) + diff --git a/dependencies/FindROOT.cmake b/dependencies/FindROOT.cmake new file mode 100644 index 0000000000000..c42be826440c5 --- /dev/null +++ b/dependencies/FindROOT.cmake @@ -0,0 +1,28 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# small adapter module to fix an issue with ROOTConfig.cmake observed on Mac +# only. +# +# FIXME: to be removed once fixed upstream +# + +find_package(${CMAKE_FIND_PACKAGE_NAME} + ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} NO_MODULE REQUIRED) + +if(APPLE AND NOT TARGET vdt) + find_library(VDT_LIB vdt PATHS ${ROOT_LIBRARY_DIR}) + if(VDT_LIB) + add_library(vdt SHARED IMPORTED) + set_target_properties(vdt PROPERTIES IMPORTED_LOCATION ${VDT_LIB}) + message( + WARNING "vdt target added by hand. Please fix this upstream in ROOT") + endif() +endif() diff --git a/dependencies/FindRapidJSON.cmake b/dependencies/FindRapidJSON.cmake new file mode 100644 index 0000000000000..2bc54f398226a --- /dev/null +++ b/dependencies/FindRapidJSON.cmake @@ -0,0 +1,37 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# +# Finds the rapidjson (header-only) library using the CONFIG file provided by +# RapidJSON and add the RapidJSON::RapidJSON imported targets on top of it +# + +find_package(RapidJSON CONFIG QUIET) + +if(NOT RapidJSON_INCLUDE_DIR) + set(RapidJSON_FOUND FALSE) + if(RapidJSON_FIND_REQUIRED) + message(FATAL_ERROR "RapidJSON not found") + endif() +else() + set(RapidJSON_FOUND TRUE) +endif() + +mark_as_advanced(RapidJSON_INCLUDE_DIR) + +get_filename_component(inc ${RapidJSON_INCLUDE_DIR} ABSOLUTE) + +if(RapidJSON_FOUND AND NOT TARGET RapidJSON::RapidJSON) + add_library(RapidJSON::RapidJSON IMPORTED INTERFACE) + set_target_properties(RapidJSON::RapidJSON + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${inc}) +endif() + +unset(inc) diff --git a/dependencies/Findcub.cmake b/dependencies/Findcub.cmake new file mode 100644 index 0000000000000..56401c4b550cd --- /dev/null +++ b/dependencies/Findcub.cmake @@ -0,0 +1,28 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +find_path(CUB_INCLUDE_DIR cub/cub.cuh PATHS ${cub_ROOT} NO_DEFAULT_PATH) + +if(NOT CUB_INCLUDE_DIR) + set(CUB_FOUND FALSE) + message(FATAL_ERROR "CUB not found") + return() +endif() + +set(CUB_FOUND TRUE) + +if(NOT TARGET cub::cub) + add_library(cub::cub INTERFACE IMPORTED) + set_target_properties(cub::cub + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + ${CUB_INCLUDE_DIR}) +endif() + +mark_as_advanced(CUB_INCLUDE_DIR) diff --git a/dependencies/Findms_gsl.cmake b/dependencies/Findms_gsl.cmake new file mode 100644 index 0000000000000..c4bffc05e8d5f --- /dev/null +++ b/dependencies/Findms_gsl.cmake @@ -0,0 +1,28 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +find_path(MS_GSL_INCLUDE_DIR gsl/gsl PATH_SUFFIXES ms_gsl/include) + +if(NOT MS_GSL_INCLUDE_DIR) + set(MS_GSL_FOUND FALSE) + message(FATAL_ERROR "MS_GSL not found") + return() +endif() + +set(MS_GSL_FOUND TRUE) + +if(NOT TARGET ms_gsl::ms_gsl) + add_library(ms_gsl::ms_gsl INTERFACE IMPORTED) + set_target_properties(ms_gsl::ms_gsl + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + ${MS_GSL_INCLUDE_DIR}) +endif() + +mark_as_advanced(MS_GSL_INCLUDE_DIR) diff --git a/dependencies/Findpythia.cmake b/dependencies/Findpythia.cmake new file mode 100644 index 0000000000000..6f6973d35b859 --- /dev/null +++ b/dependencies/Findpythia.cmake @@ -0,0 +1,43 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +find_path(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR + NAMES Pythia.h + PATH_SUFFIXES Pythia8) + +find_library(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY_SHARED + NAMES libpythia8.so libpythia8.dylib) + +find_path(${CMAKE_FIND_PACKAGE_NAME}_DATA + NAMES MainProgramSettings.xml + PATHS ${${CMAKE_FIND_PACKAGE_NAME}_ROOT}/share/Pythia8/xmldoc) + +if(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR + AND ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY_SHARED + AND ${CMAKE_FIND_PACKAGE_NAME}_DATA) + add_library(pythia SHARED IMPORTED) + get_filename_component(incdir ${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}/.. + ABSOLUTE) + set_target_properties(pythia + PROPERTIES IMPORTED_LOCATION + ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY_SHARED} + INTERFACE_INCLUDE_DIRECTORIES ${incdir}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + ${CMAKE_FIND_PACKAGE_NAME} + REQUIRED_VARS ${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR + ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY_SHARED + ${CMAKE_FIND_PACKAGE_NAME}_DATA) + +mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR + ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY_SHARED + ${CMAKE_FIND_PACKAGE_NAME}_DATA) diff --git a/dependencies/Findpythia6.cmake b/dependencies/Findpythia6.cmake new file mode 100644 index 0000000000000..872727d6f8786 --- /dev/null +++ b/dependencies/Findpythia6.cmake @@ -0,0 +1,26 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +find_library(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY_SHARED + NAMES libpythia6.so libpythia6.dylib) + +if(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY_SHARED) + add_library(pythia6 SHARED IMPORTED) + set_target_properties(pythia6 + PROPERTIES IMPORTED_LOCATION + ${${CMAKE_FIND_PACKAGE_NAME}_LIBRARY_SHARED}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + ${CMAKE_FIND_PACKAGE_NAME} + REQUIRED_VARS ${CMAKE_FIND_PACKAGE_NAME}_LIBRARY_SHARED) + +mark_as_advanced(${CMAKE_FIND_PACKAGE_NAME}_LIBRARY_SHARED) diff --git a/dependencies/O2CUDA.cmake b/dependencies/O2CUDA.cmake new file mode 100644 index 0000000000000..11e3422447730 --- /dev/null +++ b/dependencies/O2CUDA.cmake @@ -0,0 +1,70 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +message(WARNING "Reimplement me") + +if(FALSE) + # FIXME: here also, some settings look suspicious : e.g. the setting of CUDA + # flag based of CMAKE_BUILD_TYPE variable (should use $ based + # generator expressions instead. Plus CUDA is now a language "understood" by + # CMake, isn't ? + + set(CUDA_MINIMUM_VERSION "10.1") + if(DEFINED ENABLE_CUDA AND NOT ENABLE_CUDA) + message(STATUS "CUDA explicitly disabled") + else() + include(CheckLanguage) + check_language(CUDA) + + if(CMAKE_CUDA_COMPILER) + if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") + set(CMAKE_CUDA_FLAGS "-Xptxas -O0 -Xcompiler -O0") + else() + set(CMAKE_CUDA_FLAGS "-Xptxas -O4 -Xcompiler -O4 -use_fast_math") + endif() + if(CUDA_GCCBIN) + message(STATUS "Using as CUDA GCC version: ${CUDA_GCCBIN}") + set(CMAKE_CUDA_FLAGS + "${CMAKE_CUDA_FLAGS} --compiler-bindir ${CUDA_GCCBIN}") + endif() + + enable_language(CUDA) + + get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) + + if(NOT CUDA IN_LIST LANGUAGES) + message( + FATAL_ERROR "CUDA was found but cannot be enabled for some reason") + endif() + if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "${CUDA_MINIMUM_VERSION}") + message( + FATAL_ERROR + "CUDA version ${CMAKE_CUDA_COMPILER_VERSION} found, but at least ${CUDA_MINIMUM_VERSION} required" + ) + endif() + set(ENABLE_CUDA ON) + if(CUDA_GCCBIN) # Ugly hack! Otherwise CUDA includes unwanted old GCC + # libraries leading to # version conflicts + set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "$ENV{CUDA_PATH}/lib64") + endif() + add_definitions(-DENABLE_CUDA) + set(CMAKE_CUDA_STANDARD 14) + set(CMAKE_CUDA_STANDARD_REQUIRED ON) + set( + CMAKE_CUDA_FLAGS + "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr --compiler-options \"${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}} -std=c++14\"" + ) + elseif(ENABLE_CUDA) + message(FATAL_ERROR "CUDA explicitly enabled but could not be found") + endif() + endif() +endif() diff --git a/dependencies/O2Dependencies.cmake b/dependencies/O2Dependencies.cmake new file mode 100644 index 0000000000000..3d447e4ad4a58 --- /dev/null +++ b/dependencies/O2Dependencies.cmake @@ -0,0 +1,142 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +include("${CMAKE_CURRENT_LIST_DIR}/O2RecipeAdapter.cmake") + +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH}) + +if(ALIBUILD_BASEDIR) + # try autodetecting external packages from an alibuild installation zone + include(O2FindDependenciesFromAliBuild) + o2_find_dependencies_from_alibuild(${ALIBUILD_BASEDIR} LABEL ${ALIBUILD_LABEL} + QUIET) +endif() + +# Required packages +# +# Order is not completely irrelevant. For instance arrow must come before +# FairRoot (see FindFairRoot.cmake) +# +# Generally speaking we should prefer the CONFIG variant of the find_package. We +# explicitely don't use the CONFIG variant (i.e. we do use the MODULE variant) +# only for some packages XXX where we define our own FindXXX.cmake module (e.g. +# to complement and/or fix what's done in the package's XXXConfig.cmake file) + +include(FeatureSummary) + +include(FindThreads) + +find_package(arrow CONFIG) +set_package_properties(arrow PROPERTIES TYPE REQUIRED) + +find_package(Vc) +set_package_properties(Vc PROPERTIES TYPE REQUIRED) + +find_package(ROOT 6.06.00 MODULE) +set_package_properties(ROOT PROPERTIES TYPE REQUIRED) + +find_package(fmt) +set_package_properties(fmt PROPERTIES TYPE REQUIRED) + +find_package(Boost 1.59 + COMPONENTS container + thread + system + timer + program_options + random + filesystem + chrono + exception + regex + serialization + log + log_setup + unit_test_framework + date_time + signals + iostreams) +set_package_properties(Boost PROPERTIES TYPE REQUIRED) + +find_package(FairLogger CONFIG) +set_package_properties(FairLogger PROPERTIES TYPE REQUIRED) + +find_package(FairRoot MODULE) +set_package_properties(FairRoot PROPERTIES TYPE REQUIRED) + +find_package(ms_gsl MODULE) +set_package_properties(ms_gsl + PROPERTIES + TYPE REQUIRED + PURPOSE "Mainly for its span") + +find_package(FairMQ CONFIG) +set_package_properties(FairMQ PROPERTIES TYPE REQUIRED) + +find_package(protobuf CONFIG) +set_package_properties(protobuf PROPERTIES TYPE REQUIRED PURPOSE "For CCDB API") + +find_package(InfoLogger CONFIG NAMES InfoLogger libInfoLogger) +set_package_properties(InfoLogger PROPERTIES TYPE REQUIRED) + +find_package(Configuration CONFIG) +set_package_properties(Configuration PROPERTIES TYPE REQUIRED) + +find_package(Monitoring CONFIG) +set_package_properties(Monitoring PROPERTIES TYPE REQUIRED) + +find_package(Common CONFIG) +set_package_properties(Common PROPERTIES TYPE REQUIRED) + +find_package(RapidJSON MODULE) +set_package_properties(RapidJSON PROPERTIES TYPE REQUIRED) + +find_package(CURL) +set_package_properties(CURL PROPERTIES TYPE REQUIRED) + +# MC specific packages +message(STATUS "Input BUILD_SIMULATION=${BUILD_SIMULATION}") +include("${CMAKE_CURRENT_LIST_DIR}/O2SimulationDependencies.cmake") +message(STATUS "Output BUILD_SIMULATION=${BUILD_SIMULATION}") + +# Optional packages + +find_package(DDS CONFIG) +set_package_properties(DDS PROPERTIES TYPE RECOMMENDED) +find_package(benchmark CONFIG NAMES benchmark googlebenchmark) +set_package_properties(benchmark PROPERTIES TYPE OPTIONAL) +find_package(OpenMP) +set_package_properties(OpenMP PROPERTIES TYPE OPTIONAL) +find_package(GLFW NAMES glfw3 CONFIG) +set_package_properties(GLFW PROPERTIES TYPE RECOMMENDED) +find_package(AliRoot) +set_package_properties(AliRoot + PROPERTIES + TYPE OPTIONAL + PURPOSE "For very specific use cases only") + +find_package(GLEW) +set_package_properties(GLEW PROPERTIES TYPE OPTIONAL) + +find_package(OpenGL) +set_package_properties(OpenGL PROPERTIES TYPE OPTIONAL) + +find_package(Clang) +set_package_properties(Clang PROPERTIES TYPE OPTIONAL) + +find_package(LLVM) +set_package_properties(LLVM PROPERTIES TYPE OPTIONAL) + +find_package(O2GPU) + +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) + diff --git a/dependencies/O2FindDependenciesFromAliBuild.cmake b/dependencies/O2FindDependenciesFromAliBuild.cmake new file mode 100644 index 0000000000000..6cb2795804f6c --- /dev/null +++ b/dependencies/O2FindDependenciesFromAliBuild.cmake @@ -0,0 +1,185 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() +# +# o2_find_dependencies_from_alibuild(basedir ...) will locate, all our external +# dependencies from a typical alibuild installation. +# +# * basedir : the top directory of the alibuild installation, +# $HOME/alice/sw/[osname] typically +# * LABEL (`latest` by default) : the label of the installation +# +# In the example below, basedir would be ~/alice/sw/osx_x86-64 and LABEL could +# be either `label` or `label-cmake-reorg-o2` +# +# cmake-format: off +# +# ~/alice/sw +# ├── BUILD +# ├── INSTALLROOT +# ├── MIRROR +# ├── MODULES +# ├── SOURCES +# ├── SPECS +# ├── TARS +# ├── osx_x86-64 +# │   ├── FairMQ +# │   │   ├── latest -> v1.4.2-1 +# │   │   ├── latest-cmake-reorg-o2 -> v1.4.2-1 +# │   │   └── v1.4.2-1 +# │   ├── GEANT4 +# │   │   ├── latest -> v10.4.2-1 +# │   │   ├── latest-cmake-reorg-o2 -> v10.4.2-1 +# │   │   └── v10.4.2-1 +# │   ├── ROOT +# │   │   ├── latest -> v6-16-00-1 +# │   │   ├── latest-cmake-reorg-o2 -> v6-16-00-1 +# │   │   └── v6-16-00-1 +# │   ├── RapidJSON +# │   │   ├── 091de040edb3355dcf2f4a18c425aec51b906f08-1 +# │   │   ├── latest -> 091de040edb3355dcf2f4a18c425aec51b906f08-1 +# │   │   └── latest-cmake-reorg-o2 -> 091de040edb3355dcf2f4a18c425aec51b906f08-1 +# +# cmake-format: on + +function(o2_find_dependencies_from_alibuild) + + if(DEPENDENCIES_FROM_ALIBUILD_DONE) + return() + endif() + + cmake_parse_arguments(PARSE_ARGV + 1 + A + "" + "LABEL;QUIET" + "") + + set(basedir ${ARGV0}) + if(A_LABEL AND NOT "${A_LABEL}" STREQUAL "") + set(label ${A_LABEL}) + else() + set(label latest) + endif() + + macro(protected_set_root var) + if(DEFINED ${var}_ROOT) + if(NOT A_QUIET) + message(STATUS "${var}_ROOT already defined. Not autodetecting it.") + endif() + else() + if(${ARGC} LESS 2) + # if we have only one argument, use value=var + set(value ${var}) + else() + set(value ${ARGV1}) + endif() + set(dir ${basedir}/${value}/${label}) + if(IS_DIRECTORY ${dir}) + set(${var}_ROOT ${dir} CACHE STRING "top dir for ${pkg}") + if(NOT A_QUIET) + message(STATUS "Detected ${var}_ROOT=${dir}") + endif() + else() + if(NOT A_QUIET) + message( + STATUS "Could not detect ${var}_ROOT from alibuild installation") + endif() + endif() + unset(dir) + unset(value) + endif() + endmacro() + + macro(protected_set_dir var) + if(DEFINED ${var}_DIR) + if(NOT A_QUIET) + message(STATUS "${var}_DIR already defined. Not autodetecting it.") + endif() + else() + if(${ARGC} LESS 2) + # if we have only one argument, use value=var + set(value ${var}) + set(pkg ${var}) + elseif(${ARGC} LESS 3) + set(value ${ARGV1}) + set(pkg ${var}) + else() + set(value ${ARGV1}) + set(pkg ${ARGV2}) + endif() + set(dir ${basedir}/${pkg}/${label}/lib/cmake/${value}) + if(IS_DIRECTORY ${dir}) + set(${var}_DIR + ${dir} + CACHE STRING "location of cmake config for ${pkg}") + if(NOT A_QUIET) + message(STATUS "Detected ${var}_DIR=${dir}") + endif() + else() + if(NOT A_QUIET) + message( + STATUS "Could not detect ${var}_DIR from alibuild installation") + endif() + endif() + unset(dir) + endif() + endmacro() + + protected_set_root(DDS) + protected_set_root(protobuf) + protected_set_root(Common Common-O2) + protected_set_root(Configuration) + protected_set_root(Monitoring) + protected_set_root(FairMQ) + protected_set_root(FairLogger) + protected_set_root(FairRoot) + protected_set_root(InfoLogger libInfoLogger) + protected_set_root(BOOST boost) + protected_set_root(ROOT) + protected_set_root(RapidJSON) + protected_set_root(ms_gsl) + protected_set_root(ZeroMQ) + + protected_set_root(pythia) + protected_set_root(pythia6) + protected_set_root(Geant3 GEANT3) + protected_set_root(Geant4 GEANT4) + protected_set_root(Geant4VMC GEANT4_VMC) + protected_set_root(VGM vgm) + protected_set_root(HepMC HepMC3) + + protected_set_dir(arrow) + protected_set_dir(benchmark benchmark googlebenchmark) + protected_set_dir(Vc) + + protected_set_root(cub) + + find_program(brew_CMD brew) + if(brew_CMD) + execute_process(COMMAND ${brew_CMD} --PREFIX glfw + OUTPUT_VARIABLE result + OUTPUT_STRIP_TRAILING_WHITESPACE) + get_filename_component(glfw ${result}/lib/cmake ABSOLUTE) + if(EXISTS ${glfw}) + if(NOT A_QUIET) + message(STATUS "Detected GLFW_DIR=${glfw}") + endif() + set(GLFW_DIR ${glfw} PARENT_SCOPE) + endif() + endif() + + set( + DEPENDENCIES_FROM_ALIBUILD_DONE + TRUE + CACHE BOOL + "whether the dependencies where found from an alibuild installation") +endfunction() diff --git a/dependencies/O2RecipeAdapter.cmake b/dependencies/O2RecipeAdapter.cmake new file mode 100644 index 0000000000000..6174af2cced56 --- /dev/null +++ b/dependencies/O2RecipeAdapter.cmake @@ -0,0 +1,129 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# FIXME: this part should disappear when we merge all this new cmake stuff and +# we change the o2.sh recipe accordingly. +# +# We "adapt" two things here : +# +# 1. we unset most of the -D variables that were passed to cmake so our auto- +# detection has a chance to work. Should not be needed in the long run if we +# use the correct -D set from the beginning +# +# 1. we patch those tests that require some environment (most notably the O2_ROOT +# variable) to convert from O2_ROOT pointing to build tree to O2_ROOT pointing +# to install tree. Should not be needed in the long run if we consider (as we +# should, I would argue) that tests are running off the build tree, before +# installation (and are not installed, as there's probably no point in doing +# so) Should not be needed in the long run if we consider (as we should, I +# would argue) that tests are running off the build tree, before installation +# (and are not installed, as there's probably no point in doing so) +# + +function(o2_show_env var) + if(DEFINED ENV{${var}}) + file(TO_CMAKE_PATH $ENV{${var}} path) + message(STATUS "!!!") + message(STATUS "!!! ${var} is : ") + foreach(v IN LISTS path) + message(STATUS "!!! - ${v}") + endforeach() + endif() +endfunction() + +macro(o2_unset var) + message(STATUS "!!! Unsetting ${var}=${${var}}") + unset(${var}) +endmacro() + +message(STATUS "!!!") +message(STATUS "!!! Using O2RecipeAdapter - this should be only temporary") +message(STATUS "!!!") + +if(ALICEO2_MODULAR_BUILD) + # + # we use the presence of ALICEO2_MODULAR_BUILD as a signal that we are using + # the old recipe and we assume Common_O2_ROOT is defined and can be used to + # retrieve the ALIBUILD_BASEDIR + # + + if(NOT Common_O2_ROOT) + message(FATAL_ERROR "Don't know how to adapt (yet) to this situation") + endif() + get_filename_component(ALIBUILD_BASEDIR ${Common_O2_ROOT}/../.. ABSOLUTE) + message( + STATUS + "!!! Used Common_O2_ROOT location to compute ALIBUILD_BASEDIR=${ALIBUILD_BASEDIR}" + ) + + message( + STATUS "!!! Unsetting most of the -D options and detecting them instead") + message(STATUS "!!!") + + set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + + o2_unset(FairRoot_DIR) + o2_unset(ALICEO2_MODULAR_BUILD) + o2_unset(ROOTSYS) + o2_unset(Pythia6_LIBRARY_DIR) + o2_unset(Geant3_DIR) + o2_unset(Geant4_DIR) + o2_unset(VGM_DIR) + o2_unset(GEANT4_VMC_DIR) + o2_unset(FAIRROOTPATH) + o2_unset(BOOST_ROOT) + o2_unset(DDS_PATH) + o2_unset(ZMQ_DIR) + o2_unset(ZMQ_INCLUDE_DIR) + o2_unset(ALIROOT) + o2_unset(Protobuf_LIBRARY) + o2_unset(Protobuf_LITE_LIBRARY) + o2_unset(Protobuf_PROTOC_LIBRARY) + o2_unset(Protobuf_INCLUDE_DIR) + o2_unset(Protobuf_PROTOC_EXECUTABLE) + o2_unset(GSL_DIR) + o2_unset(PYTHIA8_INCLUDE_DIR) + o2_unset(HEPMC3_DIR) + o2_unset(MS_GSL_INCLUDE_DIR) + o2_unset(ALITPCCOMMON_DIR) + o2_unset(Monitoring_ROOT) + o2_unset(Configuration_ROOT) + o2_unset(InfoLogger_ROOT) + o2_unset(Common_O2_ROOT) + o2_unset(RAPIDJSON_INCLUDEDIR) + o2_unset(ARROW_HOME) + o2_unset(benchmark_DIR) + o2_unset(GLFW_LOCATION) + o2_unset(CUB_ROOT) + + o2_show_env(LD_LIBRARY_PATH) + o2_show_env(PATH) + +endif() + +if(DEFINED ENV{ALIBUILD_O2_TESTS} AND PROJECT_NAME STREQUAL "O2") + message(STATUS "!!!") + message( + STATUS + "!!! ALIBUILD_O2_TESTS detected. Will patch my tests so they work off the install tree" + ) + configure_file(${CMAKE_SOURCE_DIR}/tests/tmp-patch-tests-environment.sh.in + tmp-patch-tests-environment.sh) + install( + CODE [[ execute_process(COMMAND bash tmp-patch-tests-environment.sh) ]]) + + install(CODE + [[ execute_process(COMMAND ldd ${ROOT_rootcling_CMD}) ]]) + + install(CODE + [[ execute_process(COMMAND otool -L ${ROOT_rootcling_CMD}) ]]) +endif() + +message(STATUS "!!!") diff --git a/dependencies/O2SimulationDependencies.cmake b/dependencies/O2SimulationDependencies.cmake new file mode 100644 index 0000000000000..e0c9cd93a43c4 --- /dev/null +++ b/dependencies/O2SimulationDependencies.cmake @@ -0,0 +1,90 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# +# Note that the BUILD_SIMULATION option governs what to do with the simulation +# parts of the repository, depending on whether or not the MC simulation +# packages (pythia, geant, etc...) needed for those parts are available or not. +# +# If BUILD_SIMULATION is specified on the command line (using -D), or set in the +# cache, then it is a hard requirement : +# +# * BUILD_SIMULATION=ON and MCpackages found => BUILD_SIMULATION=ON +# * BUILD_SIMULATION=ON and MCpackages not found => FAILURE +# * BUILD_SIMULATION=OFF => BUILD_SIMULATION=OFF (regardless of MCpackages found +# or not) +# +# If on the other hand BUILD_SIMULATION is NOT specified on the command line +# then simulation is built if MCpackages are available and the default value for +# build simulation is set to ON +# +# * MCpackages found => BUILD_SIMULATION=BUILD_SIMULATION_DEFAULT +# * MCpackages not found => BUILD_SIMULATION=OFF +# + +include_guard() + +set(mcPackageRequirement OPTIONAL) +if(DEFINED BUILD_SIMULATION AND BUILD_SIMULATION) + set(mcPackageRequirement REQUIRED) +endif() + +# MC specific packages +find_package(pythia MODULE) +set_package_properties(pythia + PROPERTIES + TYPE ${mcPackageRequirement} DESCRIPTION + "the Pythia8 generator") +find_package(pythia6 MODULE) +set_package_properties(pythia6 + PROPERTIES + TYPE ${mcPackageRequirement} DESCRIPTION + "the Pythia6 legacy generator") +find_package(Geant3 MODULE) +set_package_properties(Geant3 + PROPERTIES + TYPE ${mcPackageRequirement} DESCRIPTION + "the legacy but not slow MC transport engine") +find_package(Geant4 MODULE) +set_package_properties(Geant4 + PROPERTIES + TYPE ${mcPackageRequirement} DESCRIPTION + "more recent and more complete MC transport engine") +find_package(Geant4VMC MODULE) +set_package_properties(Geant4VMC PROPERTIES TYPE ${mcPackageRequirement}) +find_package(VGM CONFIG) +set_package_properties(VGM PROPERTIES TYPE ${mcPackageRequirement}) +find_package(HepMC CONFIG) +set_package_properties(HepMC PROPERTIES TYPE ${mcPackageRequirement}) + +set(doBuildSimulation OFF) + +if(pythia_FOUND + AND pythia6_FOUND + AND Geant3_FOUND + AND Geant4_FOUND + AND Geant4VMC_FOUND + AND VGM_FOUND + AND HepMC_FOUND) + set(doBuildSimulation ON) +endif() + +if(DEFINED BUILD_SIMULATION AND BUILD_SIMULATION AND NOT doBuildSimulation) + return() +endif() + +if(NOT DEFINED BUILD_SIMULATION) + if(NOT BUILD_SIMULATION_DEFAULT) + option(BUILD_SIMULATION "Build simulation related parts" FALSE) + else() + option(BUILD_SIMULATION "Build simulation related parts" + ${doBuildSimulation}) + endif() +endif() diff --git a/doc/CMakeInstructions.md b/doc/CMakeInstructions.md index 4b0f691aaf509..cbbed3c6ed050 100644 --- a/doc/CMakeInstructions.md +++ b/doc/CMakeInstructions.md @@ -1,66 +1,330 @@ -\page refdocCMakeInstructions CMake Instructions - -CMake -===== - -## Instructions for the contributors - -A sub-module CMakeLists.txt minimally contains (see Examples/ExampleModule1) - -* The setup the system : `O2_SETUP(NAME My_Module)` -* The list of the source files in the variable SRC : `set(SRCS something.cxx)` -* The name of the library : `set(LIBRARY_NAME My_Module)` -* The name of the dependency bucket to use : `set(BUCKET_NAME My_bucket)` -* The call to generate the library : `O2_GENERATE_LIBRARY()` - -Optionally it contains (see Examples/ExampleModule2) - -* To generate a dictionary : - * The list of source files not to be used for the dictionary : `set(NO_DICT_SRCS src/Bar.cxx)` - * The list of headers (private and public) : `set(HEADERS include/${MODULE_NAME}/Foo.h)` - * The linkdef : `set(LINKDEF src/ExampleLinkDef.h)` -* To generate an executable : - ``` - O2_GENERATE_EXECUTABLE( - EXE_NAME runExampleModule1 - SOURCES src/main.cxx - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - ) - ``` - -If a new bucket is needed, it should be defined in cmake/O2Dependencies.cmake using this function : -``` -o2_define_bucket( - NAME - ExampleModule2_bucket - - DEPENDENCIES - ${Boost_PROGRAM_OPTIONS_LIBRARY} # a library - ExampleModule1 # another module - ExampleModule1_bucket # another bucket - - INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/Examples/ExampleModule1/include # another module's include dir - - SYSTEMINCLUDE_DIRECTORIES - ${Boost_INCLUDE_DIR} # a system lib include dir -) -``` - -If it needs a new external library, it should be first discussed with WP3. - -## Developers' documentation - -* Q: Why are the libraries' directories globally set in O2Dependencies.cmake ? - * A: CMake discourages the use of _link_directories_ because find_package and find_library - should return absolute paths. As a consequence little effort is put in the development of this - feature and it only exists at the global level. We can't set it on a target like the - _include_directories_ for example. -* Q: Why buckets ? - * A: The goal is to avoid a dependency nightmare. - It allows to define centrally and in an organized way the dependencies for all modules. - It also allows us to be especially careful in PRs about changes to the bucket definition file. -* Q: Why macros to build libraries and executables ? - * A: To simplify the life of the users and to make sure everyone does it the same way. It is also a way - to reuse what was made for FairRoot. +\\page refdocCMakeInstructions CMake Instructions + +# CMake + +> Note that this document describe the [new CMake system](CMakeMigration.md) : the one based on buckets has been discontinued. + +## Instructions for contributors (aka developers' documentation) + +A sub-module `CMakeLists.txt` defines one or more _targets_. +A target generally corresponds to an actual build artifact like a (static or shared) library or an executable. Targets are the cornerstone of any modern cmake build system. + +## Typical CMakeLists.txt + +A typical module's `CMakeLists.txt` contains + +- a call to [o2_add_library](../cmake/O2AddLibrary.cmake) to define a library (and its dependencies) +- call(s) to [o2_add_executable](../cmake/O2AddExecutable.cmake) to define one or more executables (and their dependencies) +- call(s) to [o2_add_test](../cmake/O2AddTest.cmake) to define one or more tests (and their dependencies) + +Optionally it might contain a call to [o2_target_root_dictionary](../cmake/O2TargetRootDictionary.cmake) if the module's library requires a Root dictionary. + +All _direct_ dependencies must be _explicitely_ defined with the `PUBLIC_LINK_LIBRARIES` keyword of the various o2_xxx functions. + +Note that despite the parameter name, the `PUBLIC_LINK_LIBRARIES` should refer to _target_ names, not library names. You _have to_ use the fully qualified `O2::targetName` and not the short `basename` you might have used to _create_ the target. Note also that if the referenced target does not exist, CMake will tell you right away at the configure stage (which is a good thing). + +Note also CMakeLists.txt should be considered as code and so the same care you put into writing code (e.g. do not repeat yourself, comments, etc...) should be applied to CMakeLists.txt. Also, like the rest of our code, we can take of the formatting using the [cmake-format](https://github.com/cheshirekow/cmake_format) tool (that tool is certainly not as robust as `clang-format` but it can get most of the job done easily). + +## Examples + +The example outputs below are from a Mac, so the shared library extension is `dylib`. On Linux it would be `so`. + +### [Ex1](../Examples/Ex1) Adding a basic library + +Using the following source dir : + + Ex1 + ├── CMakeLists.txt + ├── include + │   └── Ex1 + │   └── A.h + └── src + ├── A.cxx + ├── B.cxx + └── B.h + +With that `CMakeLists.txt` : + + o2_add_library(Ex1 SOURCES src/A.cxx src/B.cxx PUBLIC_LINK_LIBRARIES FairMQ::FairMQ) + +will define a library with 2 source files, that depends on the FairMQ::FairMQ target. + +When doing a `cmake --build .` you'll find the library in the `stage/lib` dir. For instance, on a Mac : + + > ls stage/lib/*Ex1* + stage/lib/libO2Ex1.dylib + +The built library dependencies can be inspected with `otool -L` (macos) or `ldd` (linux) + + > otool -L stage/lib/libO2Ex1.dylib + stage/lib/libO2Ex1.dylib: + @rpath/libO2Ex1.dylib (compatibility version 0.0.0, current version 0.0.0) + @rpath/libFairMQ.1.4.dylib (compatibility version 1.4.0, current version 1.4.2) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_container.dylib (compatibility version 0.0.0, current version 0.0.0) + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_program_options.dylib (compatibility version 0.0.0, current version 0.0.0) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_regex.dylib (compatibility version 0.0.0, current version 0.0.0) + @rpath/libFairLogger.1.2.dylib (compatibility version 1.2.0, current version 1.2.0) + /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4) + +Where you can find the direct dependency you've specified on `FairMQ`. The rest (boost, FairLogger) are transitive dependencies (coming from FairMQ) that CMake automatically added. + +And upon install `cmake --build . -- install` (the lonely `--` is not a typo) the library will be in the installation path `lib` dir and its public includes (only `A.h` in this case, not `B.h`) in the `include/Ex1` dir : + + > ls [install_topdir] + ├── include + │   ├── Ex1 + │   └── A.h + ├── lib + │   ├── libO2Ex1.dylib + +### [Ex2](../Examples/Ex2) Adding a basic library with a Root dictionary + +Using a slightly modified version of the previous example (the [A.h](../Examples/Ex2/include/Ex2/A.h) now uses ClassDef for instance), we'll now add a Root dictionary : + + Ex2 + ├── CMakeLists.txt + ├── include + │   └── Ex2 + │   └── A.h + └── src + ├── A.cxx + ├── B.cxx + ├── B.h + └── Ex2LinkDef.h + + o2_add_library(Ex2 SOURCES src/A.cxx src/B.cxx PUBLIC_LINK_LIBRARIES FairMQ::FairMQ) + o2_target_root_dictionary(Ex2 HEADERS include/Ex2/A.h src/B.h LINKDEF src/Ex2LinkDef.h) + +will define a library, that depends on the `FairMQ::FairMQ` target, with 3 source files (the provided `A.cxx` and `B.cxx` plus a dictionary added by the `o2_target_root_dictionary`). In addition to create a dictionary source file, the `o2_target_root_dictionary` function also appends a dependency on `ROOT::RIO` target to `Ex2` because it's needed at link time for the dictionary part. + +While the `HEADERS` parameter to `o2_target_root_dictionary` is mandatory, the `LINKDEF` one can be omitted if the LinkDef file is named \[targetBaseName]LinkDef.h and is located in the \[targetBaseName] source directory (so in the above example it could have been omitted). + +When doing a `cmake --build .` you'll now find, in addition to the library in the `stage/lib` dir, a `rootmap` file and a `pcm` file. Those two files must be collocated with the library if you want to be able to load that library easily from the Root prompt. + + > ls stage/lib/*Ex2* + stage/lib/G__O2ExDict_rdict.pcm + stage/lib/libO2Ex2.dylib + stage/lib/libO2Ex2.rootmap + +If you look at the dependencies for libO2Ex2, you'll find the same ones as libO2Ex1, plus some ROOT ones, due to the dictionary inclusion. + + > otool -L stage/lib/libO2Ex2.dylib + stage/lib/libO2Ex2.dylib: + @rpath/libO2Ex2.dylib (compatibility version 0.0.0, current version 0.0.0) + @rpath/libFairMQ.1.4.dylib (compatibility version 1.4.0, current version 1.4.2) + @rpath/libRIO.6.16.so (compatibility version 6.16.0, current version 6.16.0) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_container.dylib (compatibility version 0.0.0, current version 0.0.0) + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_program_options.dylib (compatibility version 0.0.0, current version 0.0.0) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_regex.dylib (compatibility version 0.0.0, current version 0.0.0) + @rpath/libFairLogger.1.2.dylib (compatibility version 1.2.0, current version 1.2.0) + @rpath/libThread.6.16.so (compatibility version 6.16.0, current version 6.16.0) + @rpath/libCore.6.16.so (compatibility version 6.16.0, current version 6.16.0) + /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4) + +The include installation will be similar to Ex1 : the `LinkDef.h` file is _not_ installed (unless you put it under include/Ex2 but that would not be wise). + + > ls [install_topdir] + ├── include + │   ├── Ex2 + │   └── A.h + ├── lib + │   ├── G__O2ExDict_rdict.pcm + │   ├── libO2Ex2.dylib + │   ├── libO2Ex2.rootmap + +### [Ex3](../Examples/Ex3) Adding an executable + +Adding an executable to previous example : + + Ex3 + ├── CMakeLists.txt + ├── include + │   └── Ex3 + │   └── A.h + └── src + ├── A.cxx + ├── B.cxx + ├── B.h + ├── Ex2LinkDef.h + └── run.cxx + + o2_add_library(Ex3 + SOURCES src/A.cxx src/B.cxx + PUBLIC_LINK_LIBRARIES FairMQ::FairMQ) + + o2_target_root_dictionary(Ex3 + HEADERS include/Ex3/A.h src/B.h) + + o2_add_executable(ex3 + SOURCES src/run.cxx + PUBLIC_LINK_LIBRARIES O2::Ex3 O2::Ex2 + COMPONENT_NAME example) + +There are three things to note in the `o2_add_executable`. + +First, we reference the `Ex3` library, built in the same module, using its fully qualified name `O2::Ex3`. Using just `Ex3` would not work, as there is no target named `Ex3` (Ex3 is just the basename of the target). Likewise, the "external" (to this module) Ex2 library is also referenced by its fully qualified name `O2::Ex2`. The target dependencies gather the link dependencies (to the relevant libraries used during linking) but also the include dependencies (so that the relevant include directories, e.g. `include/Ex2` are found when compiling). + +Second, we used the optional `COMPONENT_NAME` argument, that will be used as part of the executable name. The output executable name will be `o2-example-ex3`, following our [naming convention for executable](https://rawgit.com/AliceO2Group/CodingGuidelines/master/naming_formatting.html#Executable_Names). + +Runtime dependencies of the executable can be seen with the same `otool -L` (mac) or `ldd` (linux) command : + + > otool -L stage/bin/o2-example-ex3 + stage/bin/o2-example-ex3: + @rpath/libO2Ex3.dylib (compatibility version 0.0.0, current version 0.0.0) + @rpath/libO2Ex2.dylib (compatibility version 0.0.0, current version 0.0.0) + @rpath/libFairMQ.1.4.dylib (compatibility version 1.4.0, current version 1.4.2) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_container.dylib (compatibility version 0.0.0, current version 0.0.0) + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_program_options.dylib (compatibility version 0.0.0, current version 0.0.0) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0) + /Users/laurent/alice/cmake/sw/osx_x86-64/boost/v1.68.0-1/lib/libboost_regex.dylib (compatibility version 0.0.0, current version 0.0.0) + @rpath/libFairLogger.1.2.dylib (compatibility version 1.2.0, current version 1.2.0) + @rpath/libRIO.6.16.so (compatibility version 6.16.0, current version 6.16.0) + @rpath/libThread.6.16.so (compatibility version 6.16.0, current version 6.16.0) + @rpath/libCore.6.16.so (compatibility version 6.16.0, current version 6.16.0) + /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4) + +where you can see the dependencies on our two Ex2 and Ex3 libraries, as well as their dependencies (FairMQ, ROOT) and their dependencies (FairLogger). + +Third, the created executable can be launched "as is" from the build tree, without having to setup the `PATH` and/or `LD_LIBRARY_PATH` environment variables. + + > stage/bin/o2-example-ex3 + Hello from ex2::A ctor + Hello from ex3::A ctor + +That is because the [RPATH](https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling) was correctly set by CMake for the build tree. It should be set correctly also when installing. + +### [Ex4](../Examples/Ex4) Adding a couple of tests + +Let's add two basic test2 to our previous example. + + o2_add_test(test1 + SOURCES test/test1.cxx + PUBLIC_LINK_LIBRARIES O2::Ex4 + COMPONENT_NAME Ex4 + LABELS fast dummy obvious + INSTALL) + + o2_add_test(test2 + SOURCES test/test2.cxx + PUBLIC_LINK_LIBRARIES O2::Ex4 O2::Ex3 O2::Ex2 + COMPONENT_NAME Ex4 + LABELS fast dummy) + +Those two test executables will be under `stage/bin` with a name starting with `o2-test-ex4` (i.e. the COMPONENT_NAME is used but transformed into lowercase) : + + stage/ + ├── bin + │   ├── o2-example-ex3 + │   ├── o2-example-ex4 + │   ├── o2-test-ex4-test1 + │   └── o2-test-ex4-test2 + └── lib + ├── libO2Ex1.dylib + ├── libO2Ex2.dylib + ├── libO2Ex3.dylib + └── libO2Ex4.dylib + +By default tests are not be installed, unless the `INSTALL` option is given to `o2_add_test`. So in the installation zone only the first test will be available, under the `tests` subdirectory. So the full installation of our 4 examples would give : + + ../install-Debug/ + ├── bin + │   ├── o2-example-ex3 + │   └── o2-example-ex4 + ├── include + │   ├── Ex1 + │   │   └── A.h + │   ├── Ex2 + │   │   └── A.h + │   ├── Ex3 + │   │   └── A.h + │   └── Ex4 + │   └── A.h + ├── lib + │   ├── G__O2Ex2Dict_rdict.pcm + │   ├── G__O2Ex3Dict_rdict.pcm + │   ├── G__O2Ex4Dict_rdict.pcm + │   ├── libO2Ex1.dylib + │   ├── libO2Ex2.dylib + │   ├── libO2Ex2.rootmap + │   ├── libO2Ex3.dylib + │   ├── libO2Ex3.rootmap + │   ├── libO2Ex4.dylib + │   └── libO2Ex4.rootmap + ├── share + │   └── config + │   └── rootmanager.dat + └── tests + └── o2-test-ex4-test1 + +As normally our tests are based on the [Boost.Test](https://www.boost.org/doc/libs/1_70_0/libs/test/doc/html/index.html) the dependency to the `Boost::unit_test_framework` is added automatically by the `o2_add_test` function (unless the `NO_BOOST` option is specified). + +Finally, note the usage of the `LABELS` (plural) option, which can be used to categorize the tests and/or to select which tests to be ran. + + > ctest + Test project /Users/laurent/alice/cmake/standalone/O2/build-Debug + Start 1: O2test-ex4-test1 + 1/3 Test #1: O2test-ex4-test1 ...................... Passed 0.07 sec + Start 2: O2test-ex4-test2 + 2/3 Test #2: O2test-ex4-test2 ...................... Passed 0.07 sec + Start 3: ensure-executable-naming-convention + 3/3 Test #3: ensure-executable-naming-convention ... Passed 0.03 sec + + 100% tests passed, 0 tests failed out of 3 + + Label Time Summary: + dummy = 0.14 sec*proc (2 tests) + fast = 0.14 sec*proc (2 tests) + obvious = 0.07 sec*proc (1 test) + + > ctest -L obvious # run only tests with a label of "obvious" + Test project /Users/laurent/alice/cmake/standalone/O2/build-Debug + Start 1: O2test-ex4-test1 + 1/3 Test #1: O2test-ex4-test1 ...................... Passed 0.07 sec + + 100% tests passed, 0 tests failed out of 1 + + Label Time Summary: + dummy = 0.07 sec*proc (1 test) + fast = 0.07 sec*proc (1 test) + obvious = 0.07 sec*proc (1 test) + +Note that tests can also be selected by name using regexp (`-R`). +Tests can also be _excluded_ based on label (`-LE`) or name (`-RE`). + + Test project /Users/laurent/alice/cmake/standalone/O2/build-Debug + Start 2: O2test-ex4-test2 + 1/2 Test #2: O2test-ex4-test2 ...................... Passed 0.07 sec + Start 3: ensure-executable-naming-convention + 2/2 Test #3: ensure-executable-naming-convention ... Passed 0.03 sec + + 100% tests passed, 0 tests failed out of 2 + + Label Time Summary: + dummy = 0.07 sec*proc (1 test) + fast = 0.07 sec*proc (1 test) + +### [Ex5](../Examples/Ex5) Adding a man page + +If a module provides one or more executables, it might be of interest for the users of those executables to have access to a man page for them. Ex5 illustates that use case. + + . + ├── CMakeLists.txt + ├── README.md + ├── doc + │   └── ex5.7.in + └── src + └── run.cxx + +The [man page](ManPages.md) is created using : + + o2_target_man_page([targetName] NAME ex5 SECTION 7) + +where `NAME xx` refers to a file `doc/xx.[SECTION].in`, and the actual `targetName` can be found from the base target name (ex5 in that case) using the [o2_name_target](../cmake/O2NameTarget.cmake) function. diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 6df257ea3a465..7ce37c657235e 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,3 +1,13 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + # # Build the doxygen # @@ -5,29 +15,38 @@ 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) - option(DOC_INSTALL "Install the documentation when calling \"make install\"" OFF) - set(DOC_TARGET_ALL "") # ensure that we build the doc if doc must be installed - if(DOC_INSTALL) - set(DOC_TARGET_ALL "ALL") - endif(DOC_INSTALL) +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) + option(DOC_INSTALL "Install the documentation when calling \"make install\"" + OFF) + set(DOC_TARGET_ALL "") # ensure that we build the doc if doc must be installed + if(DOC_INSTALL) + set(DOC_TARGET_ALL "ALL") + endif(DOC_INSTALL) - # target doc - add_custom_target(doc ${DOC_TARGET_ALL} - ${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 ${DOC_TARGET_ALL} ${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 - if(DOC_INSTALL) - message(STATUS "Documentation will be installed") - install(DIRECTORY ${DOC_OUTPUT_DIR}/html DESTINATION share/doc/${PROJECT_NAME} COMPONENT doc) - endif(DOC_INSTALL) -endif (DOXYGEN_FOUND) + # installation + if(DOC_INSTALL) + message(STATUS "Documentation will be installed") + install(DIRECTORY ${DOC_OUTPUT_DIR}/html + DESTINATION share/doc/${PROJECT_NAME} + COMPONENT doc) + endif(DOC_INSTALL) +endif(DOXYGEN_FOUND) diff --git a/doc/CMakeMigration.md b/doc/CMakeMigration.md new file mode 100644 index 0000000000000..c0e5702d99161 --- /dev/null +++ b/doc/CMakeMigration.md @@ -0,0 +1,190 @@ +# Migration to "Modern" CMake + +## Big picture + +The driving force is to abandon the whole bucket system that proved itself a great way to hide genuine dependency issues we're having in our build system. + +To do so the main idea is to migrate our CMake usage to latest practices recommended by the CMake community. + +Details can be found in many online locations in [blog post](https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/), [video](https://www.youtube.com/watch?v=bsXLMQ6WgIk), or [book](https://crascit.com/professional-cmake/) form, but the core concept is to base everything on **targets** and forego as much as possible the usage of variables and/or directory specific functions. + +Also, since our CMakeLists.txt that were first written a few years back, more third-party libraries have embraced the new CMake ways of working and as such provide reasonably good `XXXConfig.cmake` files that are used when using `find_package(XXX)`. We should use them instead of cooking complicated `FindXXX.cmake` as much as we can. + +Targets are normally created with CMake-provided functions like `add_library`, `add_executable` and characterized with functions like `target_include_directories`, `target_link_libraries`, etc... + +We pondered for a long time whether we should simply stick to those native functions for our builds. But that would mean quite a bit of repetitive pieces of code in all our CMakeLists.txt. Plus it would make enforcing some conventions harder. So we decided (like in the previous incarnation of our build system) to use our own functions instead. + +Compared to the previous system though, we tried : + +- to use names (of the functions and their parameters) closely matching those of the original CMake ones, so people that already know CMake are less confused +- to use only functions instead of macros (unless required), so the parameters do not leak into parent scope +- to forego (almost) completely the usage of custom variables (variables are not bad practice per se, but most of our CMakeLists.txt can be written without any) + +## Custom CMake functions + +All our CMake functions are defined in the [cmake](../cmake) directory. Each file there defines one function. The filename is [UpperCamelCase](https://en.wikipedia.org/wiki/Camel_case) while the function name is [snake_case](https://en.wikipedia.org/wiki/Snake_case) (CMake function names are case insensitive but the modern convention is to have them all lower case). So for instance `o2_add_executable` is defined in `cmake/O2AddExecutable.cmake`. Each function is documented in its corresponding `.cmake` file. + +The main defined functions are currently : + +- [o2_add_executable](../cmake/O2AddExecutable.cmake) +- [o2_add_library](../cmake/O2AddLibrary.cmake) +- [o2_add_header_only_library](../cmake/O2AddHeaderOnleLibrary.cmake) +- [o2_add_test](../cmake/O2AddTest.cmake) +- [o2_add_test_wrapper](../cmake/O2AddTestWrapper.cmake) +- [o2_target_root_dictionary](../cmake/O2TargetRootDictionary.cmake) + +All the `o2_` functions above take as first (unnamed) parameter the _basename_ of a target. In order to prepare for the packaging step, the actual target name is _not_ the same as this _basename_. The target naming scheme is handled by the `o2_name_target` function. But in most cases the developpers do not need to know this final name, just that their target should be referenced as `basename` when they are used as first parameter of the `o2_xxx` functions or as `O2::basename` when used as dependencies. + +## Migration plan + +The idea is to go in steps. + +1. rewrite all our main CMakeLists.txt to get a working build, but without taking care of the more difficult or less critical parts, like a) GPU stuff (critical and difficult) b) testing of Root macros (difficult) c) getting a proper O2Config.cmake produced (aka packaging). This first step is like a proof-of-concept, but almost full scale. Discuss the implementation choices at this stage. + +2. add GPU/HIP/OpenCL stuff + +3. add creation of O2Config.cmake + +4. add Root macro testing + +5. polish and fix the remaining inconsistencies (e.g. test labelling, etc...) + +## Step 1 + +In this step the idea is to limit ourselves to change only `CMakeLists.txt` and `*.cmake` files and not the source code (unless absolutely necessary). The top [CMakeLists.txt](../CMakeLists.txt) was rewritten from scratch and is composed of different parts : + +- preamble: basic project definition, cmake version requirement, ctest inclusion +- project wide setup: cxx checks, build options, output paths, rpath settings +- external dependencices: all the find_package calls +- definition of the targets : i.e. inclusion of all the sub_directories, in the correct order +- end with testing and doc + +For the developper there is one major visible usage change : testing (still using ctest of course) can now be done from the build tree itself, i.e. without installation. + +The main changes with respect to the current/previous situation are highlighted below. + +### Preamble + +CMake 3.13 is still the minimum version required. 3.14 would be interesting but is not critical. Note that when out CMake 3.15 will bring some generator expressions features that we might want to take advantage of (e.g. [REMOVE_DUPLICATES](https://gitlab.kitware.com/cmake/cmake/issues/18210)) and so might justify bumping the CMake version we use at that moment. + +### Project wide setup + +Here we have some basic sanity checks (forbid in-source builds for instance), perform some feature checks on the CXX compiler, set the default for our [build options](../cmake/O2DefineOptions.cmake), set the output directories and RPATH settings. Note the `BUILD_SIMULATION` option : currently used "only" to fetch more dependencies, but might imagine to actually group all the simulation-dependent parts of O2 into an optional component ? Not for now, but maybe a thing to consider for the future ? + +Compared to previous usage, a `stage` area was added in the build tree, where (most of) the build artifacts are created. That's where you'll find the `bin`, `lib`, `share` directories instead of directly under the build topdir. + +### External dependencies + +Third-party dependencies are found in [dependencies/CMakeLists.txt](../dependencies/CMakeLists.txt). +`find_package` calls are of the `CONFIG` variety unless there's a compelling reason to use the `MODULE` version. +In particular : + +- [FindFairRoot](../dependencies/FindFairRoot.cmake) is creating imported targets so we can use `FairRoot::XXX` targets even if those are not (yet) created by FairRoot itself. That file will disappear when FairRoot completes its own CMake migration. +- [FindGeant3](../dependencies/FindGeant3.cmake), [FindGeant4](../dependencies/FindGeant4.cmake), [Geant4VMC](../dependencies/FindGeant4VMC.cmake) : while those MC projects have Config.cmake files and thus define targets, they do not include the proper include paths for those targets. So those Find modules are just light ones that add the missing include paths to the imported targets defined in those projects. +- [Findpythia](../dependencies/Findpythia.cmake) (for Pythia8) and [Findpythia6](../dependencies/Findpythia6.cmake) define imported targets for those libraries +- [Findms_gsl](../dependencies/Findms_gsl.cmake) defines a `ms_gsl` target corresponding to the header only library +- [FindRapidJSON](../dependencies/FindRapidJSON.cmake) defines a `RapidJSON::RapidJSON` target corresponding to the header only library + +As an aside, in order to ease the development of this new CMake system, a [o2_find_dependencies_from_alibuild](../dependencies/O2FindDependenciesFromAliBuild.cmake) function that "detects" the third-party dependencies from an AliBuild installation zone was developped. That might come in handy for other people too (e.g. those using IDEs like CLion ?) + +### Definition of all targets + +That part is the meat of the CMakeLists.txt and is just the inclusion of the relevant subdirectories, but with a catch : order matters ! Some dependency cycles that had been hidden with the bucket system now shows up ... + +### Testing + +Lastly some setup for testing is done in `tests` subdirectory. That part is still a bit WIP, but that's the location of the shell scripts that are used. + +## Status at end of step 1 + +The way it was developped : first make a regular install of O2@dev using aliBuild. +Then switch to `cmake-migration-step-1` branch. Create a build directory somewhere, and run cmake there : + +``` +> cd build-RelWithDebInfo +> rm -rf * +> cmake $HOME/alice/cmake/O2 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=../install-RelWithDebInfo -DCMAKE_GENERATOR=Ninja -DALIBUILD_BASEDIR=$HOME/alice/cmake/sw/osx_x86-64 +``` + +Use `ninja` to build, `cmake .` to force rerunning cmake. Rince and repeat. Do it on Mac(10.14) and on CentOS7. + +The tests for this step (the failing test is only failing on CentOS7 in Debug configuration) : + +``` +~/alice/cmake/standalone/O2/build-Debug$ ctest --progress -j32 +Test project /home/aphecetche/alice/cmake/standalone/O2/build-Debug +50/85 Test #34: O2test-dplutils-RootTreeWriterWorkflow..............***Failed 2.07 sec +85/85 Test #24: O2test-detectorsbase-MatBudLUT +99% tests passed, 1 tests failed out of 85 + +Label Time Summary: +dummy = 0.11 sec*proc (2 tests) +example = 0.05 sec*proc (1 test) +fast = 0.16 sec*proc (3 tests) +gpu = 2.13 sec*proc (2 tests) +its = 1.06 sec*proc (1 test) +mch = 0.42 sec*proc (8 tests) +mft = 1.06 sec*proc (1 test) +mid = 20.33 sec*proc (5 tests) +obvious = 0.06 sec*proc (1 test) +slow = 14.10 sec*proc (1 test) +steer = 3.10 sec*proc (2 tests) +tpc = 28.64 sec*proc (10 tests) + +Total Test time (real) = 23.29 sec + +The following tests FAILED: + 34 - O2test-dplutils-RootTreeWriterWorkflow (Failed) +Errors while running CTest +``` + +## Tips + +### Getting the list of targets + +In the build directory, if you do : + +``` +mkdir -p .cmake/api/v1/query/ +touch .cmake/api/v1/query/codemodel-v2 +``` + +Then after the cmake configure stage (if using CMake >= 3.14) you'll get a list of JSON files describing the targets in the reply subdir : + +``` +> tree .cmake/api/v1/reply +├── codemodel-v2-83681dd2d17b5fde868d.json +├── index-2019-06-11T10-25-54-0072.json +├── target-O2bench-mch-segmentation3-Debug-9c692e4e44d81a3a3a92.json +├── target-O2bench-mid-clusterizer-Debug-1340ba249c9a02e67ed5.json +├── target-O2bench-mid-tracker-Debug-3e2229d129fb77d3b863.json +├── target-O2exe-alicehlt-eventsampler-device-Debug-3bd0b54283972d791f58.json +├── target-O2exe-alicehlt-runcomponent-Debug-80eb80e9623ee42d3fb2.json +├── target-O2exe-alicehlt-wrapper-device-Debug-10621b10deb5caf32c18.json +├── target-O2exe-ccdb-conditions-client-Debug-07e6fca14004fe227979.json +├── target-O2exe-ccdb-conditions-server-Debug-ab5afdf6854abca507b7.json +├── target-O2exe-ccdb-standalone-client-Debug-aaff2add767f9b354708.json + +``` + +## Step 2 + +This step is trying to get the GPU targets back in business. There are three versionsto consider: [HIP](../GPU/GPUTracking/Base/hip), [OpenCL](../GPU/GPUTracking/Base/opencl) and CUDA (for [TPC](..GPU/GPUTracking/Base/cuda) and [ITS](../Detectors/ITSMFT/ITS/tracking/cuda)). + +In the `GPUTracking` all the AliRoot-specific references has been removed. They will need to be put back there if needed. + +This step was tested on a CentOS7 server with OpenCL, HIP and CUDA dev. kits installed. + +This step also brings a temporary [O2RecipeAdapter](../dependencies/O2RecipeAdapter.cmake) cmake include to be able to test this without having to modify (too much at least) the existing o2 recipe and CI. + +## Step 3 + +In order to have the O2Suite building fine, step 3 is now the addition of the creation of a proper O2Config.cmake file, so that consumer packages (like QualityControl) can use our targets. + +## Step 3 and 4 + +The proper generation of the O2Config.cmake (step 3) file has been done in anticipation for its usage by QualityControl. + +The macro testing (step 4) is working, but only within the correct environment (i.e. within an alibuild build). The running of ctest without a prior environment will have to be deferred for later on, as it's not a completely trivial task (and is a departure from the current practice anyway) + +[ ] Remaining to be done : generation of O2ConfigVersion.cmake file. diff --git a/doc/CodeOrganization.md b/doc/CodeOrganization.md index 1d3c958170aea..980565db35168 100644 --- a/doc/CodeOrganization.md +++ b/doc/CodeOrganization.md @@ -1,7 +1,6 @@ \page refdocCodeOrganization Code Organization -Code organisation -================= +# Code organisation ## Overview @@ -10,7 +9,8 @@ The _per detector_ sub-modules are grouped under the Detectors directory. The _per function_ are in the top directory or grouped, e.g. Utilites. A typical submodule looks like : -~~~~ + +``` . |-- Common | |-- CMakeLists.txt @@ -25,7 +25,7 @@ A typical submodule looks like : | `-- test | `-- TestFactory.cxx -~~~~ +``` Depending on the case, some subdirectories can be voluntarily left out or added. The headers go to the include directory if they are part of the interface, in the src otherwise. @@ -38,26 +38,22 @@ Other repositories in the AliceO2Group follow the same structure. A number of principles were agreed on that resulted in the above code organisation : -* A _module_ is a set of code closely related sharing an interface that can result in one or more libraries. -* Favour is given to extracting large common components(modules/projects) into their own repositories within +- A _module_ is a set of code closely related sharing an interface that can result in one or more libraries. +- Favour is given to extracting large common components(modules/projects) into their own repositories within AliceO2Group in github. -* AliceO2 therefore becomes a thinner repo containing : - * Detector specific code (e.g. related to reconstruction, simulation, calibration or qc). - * Commonalities (e.g. DataFormat, Steer-like), i.e. things other components depend on and that have not been extracted to their own repo. - * Global algorithms (e.g. global tracking), i.e. things that depend on several detectors. -* The directory structure can be either per detector or per function or a mixture. +- AliceO2 therefore becomes a thinner repo containing : + - Detector specific code (e.g. related to reconstruction, simulation, calibration or qc). + - Commonalities (e.g. DataFormat, Steer-like), i.e. things other components depend on and that have not been extracted to their own repo. + - Global algorithms (e.g. global tracking), i.e. things that depend on several detectors. +- The directory structure can be either per detector or per function or a mixture. The AliceO2 repository has a mixture of _per detector_ and _per function_ sub-modules with corresponding sub-structure. -* Dependencies are defined centrally as _buckets_. -* Each sub-module generates a single library linked against the dependencies defined in a single bucket. -* sub-modules' executable(s) link against the same bucket as the library and the library itself. -* Horizontal dependencies are in general forbidden (between sub-modules at the same level) (?) -* Naming : camel-case - * What is repeated / structural starts with a lower case letter (e.g. src, include, test). - * The rest (labels, unique names) start with an upper case letter (e.g. Common, Detectors). -* Why are headers in `MyModule/include/MyModule` and not directly in `MyModule/include ?` - * The difficulty here is that we have a number of constraints. First the headers must be installed in a directory - named after the module. Second the code which uses the headers must include `MyModule/xyz.h` and it must work - whether it is inside AliceO2 or in a different repo, i.e. whether the headers are installed or they are internal. - When evaluating the different options we ended up with this not-totally-perfect solution because all other solutions - broke one of the constraints or required a massive hurdle of CMake magic. If someone comes up with a different working - solution we would happily consider it. \ No newline at end of file +- Naming : camel-case + - What is repeated / structural starts with a lower case letter (e.g. src, include, test). + - The rest (labels, unique names) start with an upper case letter (e.g. Common, Detectors). +- Why are headers in `MyModule/include/MyModule` and not directly in `MyModule/include ?` + - The difficulty here is that we have a number of constraints. First the headers must be installed in a directory + named after the module. Second the code which uses the headers must include `MyModule/xyz.h` and it must work + whether it is inside AliceO2 or in a different repo, i.e. whether the headers are installed or they are internal. + When evaluating the different options we ended up with this not-totally-perfect solution because all other solutions + broke one of the constraints or required a massive hurdle of CMake magic. If someone comes up with a different working + solution we would happily consider it. diff --git a/doc/DoxygenInstruction.md b/doc/DoxygenInstructions.md similarity index 100% rename from doc/DoxygenInstruction.md rename to doc/DoxygenInstructions.md diff --git a/doc/ManPages.md b/doc/ManPages.md index f6b0aead31a10..a0b86fb46dfe5 100644 --- a/doc/ManPages.md +++ b/doc/ManPages.md @@ -6,13 +6,14 @@ You can create man pages in nroff format under: and it will create a man page for you in: - ${CMAKE_BINARY_DIR}/share/man/man
+ ${CMAKE_BINARY_DIR}/stage/share/man/man
if you add: - O2_GENERATE_MAN(NAME SECTION
) + o2_target_man_page(target NAME SECTION
) -to your `CMakeLists.txt`. If `SECTION` is omitted it will default to 1 +to your `CMakeLists.txt`. Note the man page is "attached" to a given target. +If `SECTION` is omitted it will default to 1 (executables). For more informantion about nroff format you can look at: http://www.linuxjournal.com/article/1158 diff --git a/macro/CMakeLists.txt b/macro/CMakeLists.txt index bbe3c5de52b0c..a4d4a3650a6e4 100644 --- a/macro/CMakeLists.txt +++ b/macro/CMakeLists.txt @@ -1,143 +1,490 @@ -# setup files to be installed (only ROOT macros for the moment) -FILE(GLOB INSTALL_FILES "*.C") -INSTALL(FILES ${INSTALL_FILES} DESTINATION share/macro/) - - -# NOTE: commented out until unit testing reenabled - +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# setup files to be installed (only ROOT macros for the moment) NOT using GLOB, +# as we should be mindful of what we install. if we have lot of files here, it's +# probably because most of them should be elsewhere in the first place ... + +install(FILES CheckClusters_mft.C + CheckDigits_mft.C + SetIncludePath.C + analyzeHits.C + build_geometry.C + checkTOFMatching.C + compareTopologyDistributions.C + eventDisplay.C + initSimGeomAndField.C + loadExtDepLib.C + load_all_libs.C + o2sim.C + putCondition.C + readEMCHits.C + readITSDigits.C + rootlogon.C + runCATrackingClusterNative.C + run_CRUDataSkimming_its.C + run_calib_tof.C + run_clus_itsSA.C + run_clus_mftSA.C + run_clus_tof.C + run_clus_tpc.C + run_collect_calib_tof.C + run_digi.C + run_digi2raw_its.C + run_digi_mft.C + run_digi_tof.C + run_match_TPCITS.C + run_match_tof.C + run_primary_vertexer_ITS.C + run_rawdecoding_its.C + run_sim.C + run_sim_emcal.C + run_sim_mft.C + run_sim_pythia8hi.C + run_sim_tof.C + run_sim_tpc.C + run_trac_ca_its.C + run_trac_its.C + run_trac_mft.C + DESTINATION share/macro/) + +# FIXME: a lot of macros that are here should really be elsewhere. Those which +# depends on a single subsystem should be located within that subsystem +# directory instead of in this global location. and this global location should +# be reserved for macros that use more than one subsystem ? + +# FIXME: move to subsystem dir +o2_add_test_root_macro(CheckClusters_mft.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsITSMFT + O2::ITSMFTSimulation O2::MFTBase + O2::MathUtils + O2::SimulationDataFormat + LABELS mft) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(CheckDigits_mft.C + PUBLIC_LINK_LIBRARIES O2::ITSMFTBase O2::ITSMFTSimulation + O2::MFTBase O2::MathUtils + O2::SimulationDataFormat + LABELS mft) + +o2_add_test_root_macro(analyzeHits.C + PUBLIC_LINK_LIBRARIES O2::ITSMFTSimulation + O2::TOFSimulation + O2::EMCALBase + O2::TRDSimulation + O2::T0Simulation + O2::DataFormatsFITV0 + O2::HMPIDBase + O2::TPCSimulation + O2::PHOSBase + O2::FDDSimulation) + +o2_add_test_root_macro(build_geometry.C + PUBLIC_LINK_LIBRARIES O2::DetectorsPassive + O2::Field + O2::TPCSimulation + O2::ITSSimulation + O2::MFTSimulation + O2::MCHSimulation + O2::MIDSimulation + O2::EMCALSimulation + O2::TOFSimulation + O2::TRDSimulation + O2::T0Simulation + O2::V0Simulation + O2::FDDSimulation + O2::HMPIDSimulation + O2::PHOSSimulation + O2::CPVSimulation + O2::ZDCSimulation) + +o2_add_test_root_macro(checkTOFMatching.C + PUBLIC_LINK_LIBRARIES O2::GlobalTracking + O2::ReconstructionDataFormats + O2::SimulationDataFormat) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(compareTopologyDistributions.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsITSMFT + LABELS its) + +# FIXME: what's the point of this one ? +o2_add_test_root_macro(eventDisplay.C PUBLIC_LINK_LIBRARIES FairRoot::Base) + +o2_add_test_root_macro( + initSimGeomAndField.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsParameters O2::Field) + +o2_add_test_root_macro(o2sim.C + PUBLIC_LINK_LIBRARIES O2::Generators + O2::DetectorsPassive + O2::Field + O2::TPCSimulation + O2::ITSSimulation + O2::MFTSimulation + O2::MCHSimulation + O2::MIDSimulation + O2::EMCALSimulation + O2::TOFSimulation + O2::TRDSimulation + O2::T0Simulation + O2::V0Simulation + O2::FDDSimulation + O2::HMPIDSimulation + O2::PHOSSimulation + O2::CPVSimulation + O2::ZDCSimulation + O2::CommonTypes + O2::SimSetup + O2::Steer) + +# FIXME: move to subsystem dir + add includes if one wants to compile it... +# o2_add_test_root_macro( putCondition.C) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(readEMCHits.C + PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat + O2::EMCALBase + LABELS emcal) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(readITSDigits.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsITSMFT + O2::ITSMFTBase + O2::SimulationDataFormat + LABELS its) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(runCATrackingClusterNative.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsTPC + O2::ReconstructionDataFormats + O2::SimulationDataFormat + O2::TPCReconstruction + LABELS tpc) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_CRUDataSkimming_its.C + PUBLIC_LINK_LIBRARIES O2::ITSMFTReconstruction + O2::DataFormatsITSMFT + O2::ITSMFTBase + O2::ITSMFTReconstruction + LABELS its) + +# FIXME: move to subsystem dir ? +o2_add_test_root_macro(run_calib_tof.C + PUBLIC_LINK_LIBRARIES O2::Field O2::DataFormatsParameters + O2::DetectorsBase + O2::GlobalTracking) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_clus_itsSA.C + PUBLIC_LINK_LIBRARIES O2::DetectorsBase + O2::ITSReconstruction + O2::ITSMFTReconstruction + O2::ITSMFTBase + LABELS its) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_clus_mftSA.C + PUBLIC_LINK_LIBRARIES O2::DetectorsBase + O2::MFTReconstruction + O2::ITSMFTReconstruction + LABELS mft) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_clus_tof.C + PUBLIC_LINK_LIBRARIES O2::TOFReconstruction + LABELS tof) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_clus_tpc.C + PUBLIC_LINK_LIBRARIES O2::TPCReconstruction + LABELS tpc) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_collect_calib_tof.C + PUBLIC_LINK_LIBRARIES O2::GlobalTracking) + +o2_add_test_root_macro(run_digi.C + PUBLIC_LINK_LIBRARIES FairRoot::Base + FairLogger::FairLogger) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_digi2raw_its.C + PUBLIC_LINK_LIBRARIES O2::ITSMFTReconstruction + O2::DataFormatsITSMFT + O2::ITSMFTBase + O2::ITSMFTReconstruction + LABELS its) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_digi_mft.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsParameters + O2::MFTSimulation + LABELS mft) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_digi_tof.C + PUBLIC_LINK_LIBRARIES O2::TOFSimulation + LABELS tof) + +o2_add_test_root_macro(run_match_TPCITS.C + PUBLIC_LINK_LIBRARIES O2::Field + O2::DataFormatsParameters + O2::DetectorsBase + O2::DataFormatsTPC + O2::TPCReconstruction + O2::GlobalTracking + O2::ITSMFTBase + LABELS "its;tpc") + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_match_tof.C + PUBLIC_LINK_LIBRARIES O2::Field O2::DataFormatsParameters + O2::DetectorsBase + O2::GlobalTracking + LABELS tof) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_primary_vertexer_ITS.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsITSMFT + O2::DataFormatsParameters + O2::SimulationDataFormat + O2::ITSBase O2::ITStracking + LABELS its) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_rawdecoding_its.C + PUBLIC_LINK_LIBRARIES O2::ITSMFTReconstruction + O2::DataFormatsITSMFT + O2::CommonDataFormat + LABELS its) + +# FIXME: move to subsystem dir + check compilation o2_add_test_root_macro( +# run_rec_ca.C PUBLIC_LINK_LIBRARIES O2::DetectorsCommonDataFormats +# O2::DataFormatsITSMFT O2::DataFormatsParameters O2::DetectorsBase O2::Field +# O2::ITSBase O2::ITStracking O2::MathUtils O2::SimulationDataFormat) + +o2_add_test_root_macro(run_sim.C + PUBLIC_LINK_LIBRARIES O2::DetectorsPassive + O2::Field + O2::ITSBase + O2::ITSMFTBase + O2::ITSSimulation + O2::TPCSimulation) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_sim_emcal.C + PUBLIC_LINK_LIBRARIES O2::DetectorsPassive O2::Field + O2::EMCALSimulation + LABELS emcal) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_sim_mft.C + PUBLIC_LINK_LIBRARIES O2::DetectorsPassive O2::Field + O2::MFTBase O2::MFTSimulation + LABELS mft) + +# FIXME: move to subsystem dir +if(pythia_FOUND) + o2_add_test_root_macro(run_sim_pythia8hi.C + PUBLIC_LINK_LIBRARIES O2::Field O2::DetectorsPassive + O2::TPCSimulation O2::Generators) +endif() + +o2_add_test_root_macro(run_sim_tof.C + PUBLIC_LINK_LIBRARIES O2::Field O2::DetectorsPassive + O2::Generators O2::TPCSimulation + O2::TOFSimulation + LABELS tof) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_sim_tpc.C + PUBLIC_LINK_LIBRARIES O2::Field O2::DetectorsPassive + O2::Generators O2::TPCSimulation + LABELS tpc) + +# FIXME: move to subsystem dir + check how to deal with GPU dependencies +o2_add_test_root_macro(run_trac_ca_its.C + PUBLIC_LINK_LIBRARIES O2::GPUTracking + LABELS its COMPILE_ONLY) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_trac_its.C + PUBLIC_LINK_LIBRARIES O2::DetectorsCommonDataFormats + O2::DataFormatsITSMFT + O2::DataFormatsParameters + O2::DetectorsBase + O2::Field + O2::ITSBase + O2::ITSReconstruction + O2::ITStracking + O2::MathUtils + O2::SimulationDataFormat + LABELS its) + +# FIXME: move to subsystem dir +o2_add_test_root_macro(run_trac_mft.C + PUBLIC_LINK_LIBRARIES O2::Field O2::MFTReconstruction + O2::GPUCommon + LABELS mft) + +# +# NOTE: commented out until unit testing reenabled FIXME : re-enable or delete ? +# # GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/run_sim_tpc.C) -# add_test_wrap(run_sim_tpc_TGeant3 -# ${CMAKE_BINARY_DIR}/macro/run_sim_tpc.sh 10 \"TGeant3\") -# Set_Tests_Properties(run_sim_tpc_TGeant3 PROPERTIES TIMEOUT "30") -# Set_Tests_Properties(run_sim_tpc_TGeant3 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") - -# add_test_wrap(run_sim_tpc_TGeant4 -# ${CMAKE_BINARY_DIR}/macro/run_sim_tpc.sh 10 \"TGeant4\") -# Set_Tests_Properties(run_sim_tpc_TGeant4 PROPERTIES DEPENDS run_sim_tpc_TGeant3) -# Set_Tests_Properties(run_sim_tpc_TGeant4 PROPERTIES TIMEOUT "30") -# Set_Tests_Properties(run_sim_tpc_TGeant4 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") - - -# GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/run_digi_tpc.C) - -# add_test_wrap(run_digi_tpc_TGeant3 -# ${CMAKE_BINARY_DIR}/macro/run_digi_tpc.sh 10 \"TGeant3\") -# Set_Tests_Properties(run_digi_tpc_TGeant3 PROPERTIES DEPENDS run_sim_TGeant3) -# Set_Tests_Properties(run_digi_tpc_TGeant3 PROPERTIES TIMEOUT "30") -# Set_Tests_Properties(run_digi_tpc_TGeant3 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") - - -# add_test_wrap(run_digi_tpc_TGeant4 -# ${CMAKE_BINARY_DIR}/macro/run_digi_tpc.sh 10 \"TGeant4\") -# Set_Tests_Properties(run_digi_tpc_TGeant4 PROPERTIES DEPENDS run_sim_tpc_TGeant4) -# Set_Tests_Properties(run_digi_tpc_TGeant4 PROPERTIES TIMEOUT "30") -# Set_Tests_Properties(run_digi_tpc_TGeant4 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") - -# GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/run_clusterer.C) - - -# add_test_wrap(run_clusterer_TGeant3 -# ${CMAKE_BINARY_DIR}/macro/run_clusterer.sh 10 \"TGeant3\") -# Set_Tests_Properties(run_clusterer_TGeant3 PROPERTIES DEPENDS run_digi_tpc_TGeant3) -# Set_Tests_Properties(run_clusterer_TGeant3 PROPERTIES TIMEOUT "30") -# Set_Tests_Properties(run_clusterer_TGeant3 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") - -# add_test_wrap(comp_clusterer_TGeant3 -# ${CMAKE_BINARY_DIR}/macro/compare_cluster.sh 10 \"TGeant3\") -# Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES DEPENDS run_clusterer_TGeant3) -# Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES TIMEOUT "30") -# Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") - -# add_test_wrap(run_clusterer_TGeant4 -# ${CMAKE_BINARY_DIR}/macro/run_clusterer.sh 10 \"TGeant4\") -# Set_Tests_Properties(run_clusterer_TGeant4 PROPERTIES DEPENDS run_digi_tpc_TGeant4) -# Set_Tests_Properties(run_clusterer_TGeant4 PROPERTIES TIMEOUT "30") -# Set_Tests_Properties(run_clusterer_TGeant4 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") - -# GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/test_GBTFrame.C) -# GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/test_fixedPoint.C) +# add_test_wrap(run_sim_tpc_TGeant3 ${CMAKE_BINARY_DIR}/macro/run_sim_tpc.sh 10 +# \TGeant3\) Set_Tests_Properties(run_sim_tpc_TGeant3 PROPERTIES TIMEOUT 30) +# Set_Tests_Properties(run_sim_tpc_TGeant3 PROPERTIES PASS_REGULAR_EXPRESSION +# Macro finished succesfully) + +# add_test_wrap(run_sim_tpc_TGeant4 ${CMAKE_BINARY_DIR}/macro/run_sim_tpc.sh 10 +# \TGeant4\) Set_Tests_Properties(run_sim_tpc_TGeant4 PROPERTIES DEPENDS +# run_sim_tpc_TGeant3) Set_Tests_Properties(run_sim_tpc_TGeant4 PROPERTIES +# TIMEOUT 30) Set_Tests_Properties(run_sim_tpc_TGeant4 PROPERTIES +# PASS_REGULAR_EXPRESSION Macro finished succesfully) + +# GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/run_digi_tpc.C) + +# add_test_wrap(run_digi_tpc_TGeant3 ${CMAKE_BINARY_DIR}/macro/run_digi_tpc.sh +# 10 \TGeant3\) Set_Tests_Properties(run_digi_tpc_TGeant3 PROPERTIES DEPENDS +# run_sim_TGeant3) Set_Tests_Properties(run_digi_tpc_TGeant3 PROPERTIES TIMEOUT +# 30) Set_Tests_Properties(run_digi_tpc_TGeant3 PROPERTIES +# PASS_REGULAR_EXPRESSION Macro finished succesfully) + +# add_test_wrap(run_digi_tpc_TGeant4 ${CMAKE_BINARY_DIR}/macro/run_digi_tpc.sh +# 10 \TGeant4\) Set_Tests_Properties(run_digi_tpc_TGeant4 PROPERTIES DEPENDS +# run_sim_tpc_TGeant4) Set_Tests_Properties(run_digi_tpc_TGeant4 PROPERTIES +# TIMEOUT 30) Set_Tests_Properties(run_digi_tpc_TGeant4 PROPERTIES +# PASS_REGULAR_EXPRESSION Macro finished succesfully) + +# GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/run_clusterer.C) + +# add_test_wrap(run_clusterer_TGeant3 ${CMAKE_BINARY_DIR}/macro/run_clusterer.sh +# 10 \TGeant3\) Set_Tests_Properties(run_clusterer_TGeant3 PROPERTIES DEPENDS +# run_digi_tpc_TGeant3) Set_Tests_Properties(run_clusterer_TGeant3 PROPERTIES +# TIMEOUT 30) Set_Tests_Properties(run_clusterer_TGeant3 PROPERTIES +# PASS_REGULAR_EXPRESSION Macro finished succesfully) + +# add_test_wrap(comp_clusterer_TGeant3 +# ${CMAKE_BINARY_DIR}/macro/compare_cluster.sh 10 \TGeant3\) +# Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES DEPENDS +# run_clusterer_TGeant3) Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES +# TIMEOUT 30) Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES +# PASS_REGULAR_EXPRESSION Macro finished succesfully) + +# add_test_wrap(run_clusterer_TGeant4 ${CMAKE_BINARY_DIR}/macro/run_clusterer.sh +# 10 \TGeant4\) Set_Tests_Properties(run_clusterer_TGeant4 PROPERTIES DEPENDS +# run_digi_tpc_TGeant4) Set_Tests_Properties(run_clusterer_TGeant4 PROPERTIES +# TIMEOUT 30) Set_Tests_Properties(run_clusterer_TGeant4 PROPERTIES +# PASS_REGULAR_EXPRESSION Macro finished succesfully) + +# GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/test_GBTFrame.C) +# GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/test_fixedPoint.C) # GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/compare_cluster.C) -# add_test_wrap(comp_clusterer_TGeant3 -# ${CMAKE_BINARY_DIR}/macro/compare_cluster.sh 10 \"TGeant3\") -# Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES DEPENDS run_clusterer_TGeant3) -# Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES TIMEOUT "30") -# Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") -# add_test_wrap(test_GBTFrame -# ${CMAKE_BINARY_DIR}/macro/test_GBTFrame.sh) -# Set_Tests_Properties(test_GBTFrame PROPERTIES TIMEOUT "30") -# Set_Tests_Properties(test_GBTFrame PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") +# add_test_wrap(comp_clusterer_TGeant3 +# ${CMAKE_BINARY_DIR}/macro/compare_cluster.sh 10 \TGeant3\) +# Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES DEPENDS +# run_clusterer_TGeant3) Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES +# TIMEOUT 30) Set_Tests_Properties(comp_clusterer_TGeant3 PROPERTIES +# PASS_REGULAR_EXPRESSION Macro finished succesfully) +# add_test_wrap(test_GBTFrame ${CMAKE_BINARY_DIR}/macro/test_GBTFrame.sh) +# Set_Tests_Properties(test_GBTFrame PROPERTIES TIMEOUT 30) +# Set_Tests_Properties(test_GBTFrame PROPERTIES PASS_REGULAR_EXPRESSION Macro +# finished succesfully) # GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/load_all_libs.C) -# #ITS tests with G3 -# configure_file(${CMAKE_SOURCE_DIR}/macro/run_sim_its.sh ${CMAKE_BINARY_DIR}/macro/run_sim_its.sh) -# configure_file(${CMAKE_SOURCE_DIR}/macro/run_sim_its.C ${CMAKE_BINARY_DIR}/macro/run_sim_its.C) -# configure_file(${CMAKE_SOURCE_DIR}/macro/SetIncludePath.C ${CMAKE_BINARY_DIR}/macro/SetIncludePath.C) - -# add_test_wrap(NAME run_sim_its_G3 COMMAND ${CMAKE_BINARY_DIR}/macro/run_sim_its.sh 10 TGeant3) -# set_tests_properties(run_sim_its_G3 PROPERTIES TIMEOUT "30") -# set_tests_properties(run_sim_its_G3 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") - - -# configure_file(${CMAKE_SOURCE_DIR}/macro/run_digi_its.sh ${CMAKE_BINARY_DIR}/macro/run_digi_its.sh) -# configure_file(${CMAKE_SOURCE_DIR}/macro/run_digi_its.C ${CMAKE_BINARY_DIR}/macro/run_digi_its.C) - -# add_test_wrap(NAME run_digi_its_G3 COMMAND ${CMAKE_BINARY_DIR}/macro/run_digi_its.sh 10 TGeant3) -# set_tests_properties(run_digi_its_G3 PROPERTIES TIMEOUT "30") -# set_tests_properties(run_digi_its_G3 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") -# set_tests_properties(run_digi_its_G3 PROPERTIES DEPENDS run_sim_its_G3) - -# configure_file(${CMAKE_SOURCE_DIR}/macro/run_clus_its.sh ${CMAKE_BINARY_DIR}/macro/run_clus_its.sh) -# configure_file(${CMAKE_SOURCE_DIR}/macro/run_clus_its.C ${CMAKE_BINARY_DIR}/macro/run_clus_its.C) - -# add_test_wrap(NAME run_clus_its_G3 COMMAND ${CMAKE_BINARY_DIR}/macro/run_clus_its.sh 10 TGeant3) -# set_tests_properties(run_clus_its_G3 PROPERTIES TIMEOUT "30") -# set_tests_properties(run_clus_its_G3 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") -# set_tests_properties(run_clus_its_G3 PROPERTIES DEPENDS run_digi_its_G3) - -# configure_file(${CMAKE_SOURCE_DIR}/macro/run_trac_its.sh ${CMAKE_BINARY_DIR}/macro/run_trac_its.sh) -# configure_file(${CMAKE_SOURCE_DIR}/macro/run_trac_its.C ${CMAKE_BINARY_DIR}/macro/run_trac_its.C) - -# add_test_wrap(NAME run_trac_its_G3 COMMAND ${CMAKE_BINARY_DIR}/macro/run_trac_its.sh 10 TGeant3) -# set_tests_properties(run_trac_its_G3 PROPERTIES TIMEOUT "30") -# set_tests_properties(run_trac_its_G3 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") -# set_tests_properties(run_trac_its_G3 PROPERTIES DEPENDS run_clus_its_G3) - - - -# #ITS tests with G4 - -# add_test_wrap(NAME run_sim_its_G4 COMMAND ${CMAKE_BINARY_DIR}/macro/run_sim_its.sh 10 TGeant4) -# set_tests_properties(run_sim_its_G4 PROPERTIES TIMEOUT "30") -# set_tests_properties(run_sim_its_G4 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") - - -# add_test_wrap(NAME run_digi_its_G4 COMMAND ${CMAKE_BINARY_DIR}/macro/run_digi_its.sh 10 TGeant4) -# set_tests_properties(run_digi_its_G4 PROPERTIES TIMEOUT "30") -# set_tests_properties(run_digi_its_G4 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") -# set_tests_properties(run_digi_its_G4 PROPERTIES DEPENDS run_sim_its_G4) - - -# add_test_wrap(NAME run_clus_its_G4 COMMAND ${CMAKE_BINARY_DIR}/macro/run_clus_its.sh 10 TGeant4) -# set_tests_properties(run_clus_its_G4 PROPERTIES TIMEOUT "30") -# set_tests_properties(run_clus_its_G4 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") -# set_tests_properties(run_clus_its_G4 PROPERTIES DEPENDS run_digi_its_G4) - - -# add_test_wrap(NAME run_trac_its_G4 COMMAND ${CMAKE_BINARY_DIR}/macro/run_trac_its.sh 10 TGeant4) -# set_tests_properties(run_trac_its_G4 PROPERTIES TIMEOUT "30") -# set_tests_properties(run_trac_its_G4 PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") -# set_tests_properties(run_trac_its_G4 PROPERTIES DEPENDS run_clus_its_G4) - - - - -# GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/load_all_libs.C) -# add_test_wrap(load_all_libs -# ${CMAKE_BINARY_DIR}/macro/load_all_libs.sh) -# Set_Tests_Properties(load_all_libs PROPERTIES TIMEOUT "30") -# Set_Tests_Properties(load_all_libs PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully.") - +# #ITS tests with G3 configure_file(${CMAKE_SOURCE_DIR}/macro/run_sim_its.sh +# ${CMAKE_BINARY_DIR}/macro/run_sim_its.sh) +# configure_file(${CMAKE_SOURCE_DIR}/macro/run_sim_its.C +# ${CMAKE_BINARY_DIR}/macro/run_sim_its.C) +# configure_file(${CMAKE_SOURCE_DIR}/macro/SetIncludePath.C +# ${CMAKE_BINARY_DIR}/macro/SetIncludePath.C) + +# add_test_wrap(NAME run_sim_its_G3 COMMAND +# ${CMAKE_BINARY_DIR}/macro/run_sim_its.sh 10 TGeant3) +# set_tests_properties(run_sim_its_G3 PROPERTIES TIMEOUT 30) +# set_tests_properties(run_sim_its_G3 PROPERTIES PASS_REGULAR_EXPRESSION Macro +# finished succesfully) + +# configure_file(${CMAKE_SOURCE_DIR}/macro/run_digi_its.sh +# ${CMAKE_BINARY_DIR}/macro/run_digi_its.sh) +# configure_file(${CMAKE_SOURCE_DIR}/macro/run_digi_its.C +# ${CMAKE_BINARY_DIR}/macro/run_digi_its.C) + +# add_test_wrap(NAME run_digi_its_G3 COMMAND +# ${CMAKE_BINARY_DIR}/macro/run_digi_its.sh 10 TGeant3) +# set_tests_properties(run_digi_its_G3 PROPERTIES TIMEOUT 30) +# set_tests_properties(run_digi_its_G3 PROPERTIES PASS_REGULAR_EXPRESSION Macro +# finished succesfully) set_tests_properties(run_digi_its_G3 PROPERTIES DEPENDS +# run_sim_its_G3) + +# configure_file(${CMAKE_SOURCE_DIR}/macro/run_clus_its.sh +# ${CMAKE_BINARY_DIR}/macro/run_clus_its.sh) +# configure_file(${CMAKE_SOURCE_DIR}/macro/run_clus_its.C +# ${CMAKE_BINARY_DIR}/macro/run_clus_its.C) + +# add_test_wrap(NAME run_clus_its_G3 COMMAND +# ${CMAKE_BINARY_DIR}/macro/run_clus_its.sh 10 TGeant3) +# set_tests_properties(run_clus_its_G3 PROPERTIES TIMEOUT 30) +# set_tests_properties(run_clus_its_G3 PROPERTIES PASS_REGULAR_EXPRESSION Macro +# finished succesfully) set_tests_properties(run_clus_its_G3 PROPERTIES DEPENDS +# run_digi_its_G3) + +# configure_file(${CMAKE_SOURCE_DIR}/macro/run_trac_its.sh +# ${CMAKE_BINARY_DIR}/macro/run_trac_its.sh) +# configure_file(${CMAKE_SOURCE_DIR}/macro/run_trac_its.C +# ${CMAKE_BINARY_DIR}/macro/run_trac_its.C) + +# add_test_wrap(NAME run_trac_its_G3 COMMAND +# ${CMAKE_BINARY_DIR}/macro/run_trac_its.sh 10 TGeant3) +# set_tests_properties(run_trac_its_G3 PROPERTIES TIMEOUT 30) +# set_tests_properties(run_trac_its_G3 PROPERTIES PASS_REGULAR_EXPRESSION Macro +# finished succesfully) set_tests_properties(run_trac_its_G3 PROPERTIES DEPENDS +# run_clus_its_G3) + +# #ITS tests with G4 + +# add_test_wrap(NAME run_sim_its_G4 COMMAND +# ${CMAKE_BINARY_DIR}/macro/run_sim_its.sh 10 TGeant4) +# set_tests_properties(run_sim_its_G4 PROPERTIES TIMEOUT 30) +# set_tests_properties(run_sim_its_G4 PROPERTIES PASS_REGULAR_EXPRESSION Macro +# finished succesfully) + +# add_test_wrap(NAME run_digi_its_G4 COMMAND +# ${CMAKE_BINARY_DIR}/macro/run_digi_its.sh 10 TGeant4) +# set_tests_properties(run_digi_its_G4 PROPERTIES TIMEOUT 30) +# set_tests_properties(run_digi_its_G4 PROPERTIES PASS_REGULAR_EXPRESSION Macro +# finished succesfully) set_tests_properties(run_digi_its_G4 PROPERTIES DEPENDS +# run_sim_its_G4) + +# add_test_wrap(NAME run_clus_its_G4 COMMAND +# ${CMAKE_BINARY_DIR}/macro/run_clus_its.sh 10 TGeant4) +# set_tests_properties(run_clus_its_G4 PROPERTIES TIMEOUT 30) +# set_tests_properties(run_clus_its_G4 PROPERTIES PASS_REGULAR_EXPRESSION Macro +# finished succesfully) set_tests_properties(run_clus_its_G4 PROPERTIES DEPENDS +# run_digi_its_G4) + +# add_test_wrap(NAME run_trac_its_G4 COMMAND +# ${CMAKE_BINARY_DIR}/macro/run_trac_its.sh 10 TGeant4) +# set_tests_properties(run_trac_its_G4 PROPERTIES TIMEOUT 30) +# set_tests_properties(run_trac_its_G4 PROPERTIES PASS_REGULAR_EXPRESSION Macro +# finished succesfully) set_tests_properties(run_trac_its_G4 PROPERTIES DEPENDS +# run_clus_its_G4) +# GENERATE_ROOT_TEST_SCRIPT(${CMAKE_SOURCE_DIR}/macro/load_all_libs.C) +# add_test_wrap(load_all_libs ${CMAKE_BINARY_DIR}/macro/load_all_libs.sh) +# Set_Tests_Properties(load_all_libs PROPERTIES TIMEOUT 30) +# Set_Tests_Properties(load_all_libs PROPERTIES PASS_REGULAR_EXPRESSION Macro +# finished succesfully.) diff --git a/macro/readEMCHits.C b/macro/readEMCHits.C index 436b6861a048f..75c186cdf2a4c 100644 --- a/macro/readEMCHits.C +++ b/macro/readEMCHits.C @@ -10,8 +10,6 @@ #include #include #include "FairLogger.h" -#include "DataFormatsITSMFT/ROFRecord.h" -#include "ITSMFTBase/Digit.h" #include "SimulationDataFormat/RunContext.h" #include "SimulationDataFormat/MCTruthContainer.h" #include "SimulationDataFormat/MCCompLabel.h" diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt new file mode 100644 index 0000000000000..1bbd2ee8975f7 --- /dev/null +++ b/packaging/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include(CPack) + +install(EXPORT O2Targets + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2 + NAMESPACE O2:: + FILE O2Targets.cmake) + +install(FILES O2Config.cmake ../cmake/AddRootDictionary.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2) + +install(DIRECTORY ../dependencies/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2) diff --git a/packaging/O2Config.cmake b/packaging/O2Config.cmake new file mode 100644 index 0000000000000..deeb63d7dc2c4 --- /dev/null +++ b/packaging/O2Config.cmake @@ -0,0 +1,17 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include("${CMAKE_CURRENT_LIST_DIR}/O2Dependencies.cmake") + +include("${CMAKE_CURRENT_LIST_DIR}/O2Targets.cmake") + +include("${CMAKE_CURRENT_LIST_DIR}/AddRootDictionary.cmake") + +message(STATUS "!!! Using new O2 targets. That's a good thing.") diff --git a/run/CMakeLists.txt b/run/CMakeLists.txt index 9bd7ed8730ee5..90501fb9cfa5c 100644 --- a/run/CMakeLists.txt +++ b/run/CMakeLists.txt @@ -1,83 +1,171 @@ -Set(Exe_Names - o2-sim-serial - o2-sim-tpc - o2-sim-device-runner - o2-sim-primary-server-device-runner - o2-sim-hit-merger-runner - o2-sim -) - -Set(Exe_Source - o2sim.cxx - runTPC.cxx - O2SimDeviceRunner.cxx - O2PrimaryServerDeviceRunner.cxx - O2HitMergerRunner.cxx - o2sim_parallel.cxx -) - -set(BUCKET_NAME "run_bucket") -set(LIBRARY_NAME "") - -list(LENGTH Exe_Names _length) -math(EXPR _length ${_length}-1) - -foreach (_file RANGE 0 ${_length}) # loop over a range because we traverse 2 lists and not 1 - list(GET Exe_Names ${_file} _name) - list(GET Exe_Source ${_file} _src) - O2_GENERATE_EXECUTABLE( - EXE_NAME ${_name} - SOURCES ${_src} - MODULE_LIBRARY_NAME ${LIBRARY_NAME} - BUCKET_NAME ${BUCKET_NAME} - ) -endforeach (_file RANGE 0 ${_length}) - -Install(FILES o2simtopology.json DESTINATION share/config) - -# add a complex simulation as a unit test (if simulation was enabled) -# perform some checks on kinematics and track references -if (HAVESIMULATION) - - add_test_wrap(NAME o2sim_G4 - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - DONT_FAIL_ON_TIMEOUT - MAX_ATTEMPTS 2 - TIMEOUT 400 - COMMAND ${CMAKE_BINARY_DIR}/bin/o2-sim -n 2 -j 2 -e TGeant4 -o o2simG4) - set_tests_properties(o2sim_G4 PROPERTIES PASS_REGULAR_EXPRESSION "SIMULATION RETURNED SUCCESFULLY" - FIXTURES_SETUP G4) - set_property(TEST o2sim_G4 APPEND PROPERTY ENVIRONMENT "ALICE_O2SIM_DUMPLOG=ON") - - # note that the MT is currently only supported in the non FairMQ version - add_test_wrap(NAME o2sim_G4_mt - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - DONT_FAIL_ON_TIMEOUT - MAX_ATTEMPTS 2 - TIMEOUT 400 - COMMAND ${CMAKE_BINARY_DIR}/bin/o2-sim-serial -n 1 -e TGeant4 --isMT on -o o2simG4MT) - set_tests_properties(o2sim_G4_mt PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished succesfully") - - add_test_wrap(NAME o2sim_checksimkinematics_G4 - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND root -n -b -l -q ${CMAKE_SOURCE_DIR}/DataFormats/simulation/test/checkStack.C\(\"o2simG4.root\"\)) - set_tests_properties(o2sim_checksimkinematics_G4 PROPERTIES FIXTURES_REQUIRED G4) - add_test_wrap(NAME o2sim_G3 - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - DONT_FAIL_ON_TIMEOUT - MAX_ATTEMPTS 3 - COMMAND ${CMAKE_BINARY_DIR}/bin/o2-sim -n 2 -j 2 -e TGeant3 -o o2simG3) - - # set properties for G3 ... we use fixtures to force execution after G4 (since they require multiple CPUs) - set_tests_properties(o2sim_G3 PROPERTIES PASS_REGULAR_EXPRESSION "SIMULATION RETURNED SUCCESFULLY" - FIXTURES_REQUIRED G4 - FIXTURES_SETUP G3) - set_property(TEST o2sim_G3 APPEND PROPERTY ENVIRONMENT "ALICE_O2SIM_DUMPLOG=ON") - - add_test_wrap(NAME o2sim_checksimkinematics_G3 - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - DONT_FAIL_ON_TIMEOUT - MAX_ATTEMPTS 3 - COMMAND root -n -b -l -q ${CMAKE_SOURCE_DIR}/DataFormats/simulation/test/checkStack.C\(\"o2simG3.root\"\)) - set_tests_properties(o2sim_checksimkinematics_G3 PROPERTIES FIXTURES_REQUIRED G3) -endif() +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +# allsim is not a real library (i.e. not something that is built) but a +# convenient bag for all the deps needed in the executables below +add_library(allsim INTERFACE) + +target_link_libraries(allsim + INTERFACE O2::SimConfig + O2::Steer + O2::SimSetup + FairMQ::FairMQ + O2::CPVSimulation + O2::DetectorsPassive + O2::EMCALSimulation + O2::FDDSimulation + O2::Field + O2::HMPIDSimulation + O2::ITSSimulation + O2::MCHSimulation + O2::MFTSimulation + O2::MIDSimulation + O2::PHOSSimulation + O2::T0Simulation + O2::TOFSimulation + O2::TPCSimulation + O2::TRDSimulation + O2::V0Simulation + O2::ZDCSimulation + O2::Generators) + +o2_add_executable(device-runner + COMPONENT_NAME sim + SOURCES O2SimDeviceRunner.cxx + PUBLIC_LINK_LIBRARIES allsim) + +o2_add_executable(serial + COMPONENT_NAME sim + SOURCES o2sim.cxx + PUBLIC_LINK_LIBRARIES allsim) + +o2_add_executable(sim + SOURCES o2sim_parallel.cxx + PUBLIC_LINK_LIBRARIES allsim O2::Framework) + +o2_add_executable(primary-server-device-runner + COMPONENT_NAME sim + SOURCES O2PrimaryServerDeviceRunner.cxx + PUBLIC_LINK_LIBRARIES allsim) + +o2_add_executable(hit-merger-runner + COMPONENT_NAME sim + SOURCES O2HitMergerRunner.cxx + PUBLIC_LINK_LIBRARIES allsim) + +o2_add_executable(tpc + COMPONENT_NAME sim + SOURCES runTPC.cxx + PUBLIC_LINK_LIBRARIES allsim O2::TPCReconstruction) + +o2_data_file(COPY o2simtopology.json DESTINATION config) + +# * # add a complex simulation as a unit test (if simulation was enabled) +# perform +# * # some checks on kinematics and track references + +o2_name_target(sim NAME o2simExecutable IS_EXE) +o2_name_target(sim-serial NAME o2simSerialExecutable IS_EXE) + +o2_add_test_wrapper(NAME o2sim_G4 + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DONT_FAIL_ON_TIMEOUT + MAX_ATTEMPTS 2 + TIMEOUT 400 + COMMAND $ + COMMAND_LINE_ARGS -n + 2 + -j + 2 + -e + TGeant4 + -o + o2simG4 + LABELS long sim g4 + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage) + +set_tests_properties(o2sim_G4 + PROPERTIES PASS_REGULAR_EXPRESSION + "SIMULATION RETURNED SUCCESFULLY" FIXTURES_SETUP + G4) +set_property(TEST o2sim_G4 APPEND PROPERTY ENVIRONMENT "ALICE_O2SIM_DUMPLOG=ON") + +# # note that the MT is currently only supported in the non FairMQ version +o2_add_test_wrapper(NAME o2sim_G4_mt + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DONT_FAIL_ON_TIMEOUT + MAX_ATTEMPTS 2 + TIMEOUT 400 + COMMAND $ + COMMAND_LINE_ARGS -n + 1 + -e + TGeant4 + --isMT + on + -o + o2simG4MT + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage) +set_tests_properties(o2sim_G4_mt + PROPERTIES PASS_REGULAR_EXPRESSION + "Macro finished succesfully") + +o2_add_test_wrapper( + NAME o2sim_checksimkinematics_G4 + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND ${ROOT_root_CMD} + COMMAND_LINE_ARGS + -n -b -l -q + ${CMAKE_SOURCE_DIR}/DataFormats/simulation/test/checkStack.C\(\"o2simG4.root\"\) + LABELS g4 sim) + +set_tests_properties(o2sim_checksimkinematics_G4 + PROPERTIES FIXTURES_REQUIRED G4) + +o2_add_test_wrapper(NAME o2sim_G3 + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DONT_FAIL_ON_TIMEOUT + MAX_ATTEMPTS 3 + COMMAND $ + COMMAND_LINE_ARGS -n + 2 + -j + 2 + -e + TGeant3 + -o + o2simG3 + LABELS g3 sim long + ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage) + +# set properties for G3 ... we use fixtures to force execution after G4 (since +# they require multiple CPUs) +set_tests_properties(o2sim_G3 + PROPERTIES PASS_REGULAR_EXPRESSION + "SIMULATION RETURNED SUCCESFULLY" + FIXTURES_REQUIRED + G4 + FIXTURES_SETUP + G3) +set_property(TEST o2sim_G3 APPEND PROPERTY ENVIRONMENT "ALICE_O2SIM_DUMPLOG=ON") + +o2_add_test_wrapper( + NAME o2sim_checksimkinematics_G3 + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DONT_FAIL_ON_TIMEOUT + MAX_ATTEMPTS 3 + COMMAND ${ROOT_root_CMD} + COMMAND_LINE_ARGS + -n -b -l -q + ${CMAKE_SOURCE_DIR}/DataFormats/simulation/test/checkStack.C\(\"o2simG3.root\"\) + LABELS g3 sim) + +set_tests_properties(o2sim_checksimkinematics_G3 + PROPERTIES FIXTURES_REQUIRED G3) diff --git a/run/o2sim_parallel.cxx b/run/o2sim_parallel.cxx index 3ca4acd9cb6a4..94d247662baef 100644 --- a/run/o2sim_parallel.cxx +++ b/run/o2sim_parallel.cxx @@ -267,9 +267,12 @@ int main(int argc, char* argv[]) std::cerr << arguments[i] << "\n"; } } - std::cerr << "$$$$"; - execv(path.c_str(), (char* const*)arguments); - return 0; + std::cerr << "$$$$\n"; + auto r = execv(path.c_str(), (char* const*)arguments); + if (r != 0) { + perror(nullptr); + } + return r; } else { childpids.push_back(pid); close(pipe_serverdriver_fd[1]); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000000000..0d42d8f846058 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,16 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}) + +include(O2SetupTesting) +o2_setup_testing() diff --git a/tests/O2SetupTesting.cmake b/tests/O2SetupTesting.cmake new file mode 100644 index 0000000000000..ff9e433a20163 --- /dev/null +++ b/tests/O2SetupTesting.cmake @@ -0,0 +1,38 @@ +# Copyright CERN and copyright holders of ALICE O2. This software is distributed +# under the terms of the GNU General Public License v3 (GPL Version 3), copied +# verbatim in the file "COPYING". +# +# See http://alice-o2.web.cern.ch/license for full licensing information. +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization or +# submit itself to any jurisdiction. + +include_guard() + +function(o2_setup_testing) + + # Create special .rootrc for testing compiled macros + configure_file(tests.rootrc.in ${CMAKE_BINARY_DIR}/.rootrc @ONLY) + + # Create special script for testing root macros. This script needs + # LD_LIBRARY_PATH + if(NOT LD_LIBRARY_PATH) + set(LD_LIBRARY_PATH $ENV{LD_LIBRARY_PATH}) + endif() + configure_file(test-root-macro.sh.in ${CMAKE_BINARY_DIR}/test-root-macro.sh + @ONLY) + + # Create tests wrapper (and make it executable) + configure_file(tests-wrapper.sh.in ${CMAKE_BINARY_DIR}/tests-wrapper.sh @ONLY) + + # Create test for executable naming convention + configure_file(ensure-executable-naming-convention.sh.in + ${CMAKE_BINARY_DIR}/ensure-executable-naming-convention.sh + @ONLY) + + add_test(NAME ensure-executable-naming-convention + COMMAND ${CMAKE_BINARY_DIR}/ensure-executable-naming-convention.sh + @ONLY) + +endfunction() diff --git a/tests/ctest-sort-tests-by-cost.py b/tests/ctest-sort-tests-by-cost.py new file mode 100755 index 0000000000000..05d4723f19cdd --- /dev/null +++ b/tests/ctest-sort-tests-by-cost.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +tests=[] + +with open('Testing/Temporary/CTestCostData.txt','r') as reader: + for line in reader: + r = line.split(' ') + if len(r) != 3: + break + tests += [ ('{:7.3f}'.format(float(r[2])),r[0]) ] + +tests.sort(key=lambda x: x[0], reverse=True) + +print(*tests,sep='\n') diff --git a/cmake/ensure-executable-naming-convention.sh.in b/tests/ensure-executable-naming-convention.sh.in similarity index 70% rename from cmake/ensure-executable-naming-convention.sh.in rename to tests/ensure-executable-naming-convention.sh.in index 46c297b6213d2..9e6d6a1b73c02 100755 --- a/cmake/ensure-executable-naming-convention.sh.in +++ b/tests/ensure-executable-naming-convention.sh.in @@ -23,9 +23,10 @@ warning_unknown_subsystem() { echo "WARNING: in $1 the subsystem $2 is not in the list of know subsystem" } -RE_IS_TEST="^test" +RE_IS_TEST="^o2-test" +RE_IS_BENCH="^o2-bench" RE_START_WITH_O2_OR_TEST="^o2-" -RE_ONLY_LOWER_CASE_OR_DASH="^[a-z0-9]([a-z0-9]+|-)+[a-z0-9]$" +RE_ONLY_LOWER_CASE_OR_DASH_OR_COMMA="^[a-z0-9]([a-z0-9\.]+|-)+[a-z0-9]$" RE_SUBSYSTEM="(o2)-([a-z,0-9]+)+" # o2-subsystem KNOWN_GROUPS="alicehlt \ @@ -33,19 +34,24 @@ analysis aod d0 simple \ data datapublisher datasampling \ ccdb \ sim \ -eve \ +eve example start \ fake dummy diamond parallel \ fit its mch mid tpc \ tpcits \ flp heartbeat message epn \ mergers \ -subframebuilder sync timeframe" +subframebuilder sync timeframe framework" -for F in @CMAKE_INSTALL_PREFIX@/bin/*; do - [[ -x $F ]] && continue +[[ -d @CMAKE_RUNTIME_OUTPUT_DIRECTORY@ ]] || exit 0 + +cd @CMAKE_RUNTIME_OUTPUT_DIRECTORY@ + +for F in *; do + [[ -x $F && -f $F ]] || continue [[ $F =~ $RE_IS_TEST ]] && continue # convention for tests is yet to come + [[ $F =~ $RE_IS_BENCH ]] && continue # convention for tests is yet to come [[ ! $F =~ $RE_START_WITH_O2_OR_TEST ]] && error_msg $F "does not start with o2-" - [[ ! $F =~ $RE_ONLY_LOWER_CASE_OR_DASH ]] && error_msg $F "should only contains lowercase letters, numbers, or dashes" + [[ ! $F =~ $RE_ONLY_LOWER_CASE_OR_DASH_OR_COMMA ]] && error_msg $F "should only contains lowercase letters, numbers, or dashes" [[ $F =~ $RE_SUBSYSTEM ]] && SUBSYSTEM=${BASH_REMATCH[2]} [[ ! " $KNOWN_GROUPS " =~ .*\ $SUBSYSTEM\ .* ]] && warning_unknown_subsystem $F $SUBSYSTEM done diff --git a/tests/test-root-macro.sh.in b/tests/test-root-macro.sh.in new file mode 100755 index 0000000000000..2ad3207da24ee --- /dev/null +++ b/tests/test-root-macro.sh.in @@ -0,0 +1,39 @@ +#!/bin/bash -e + +# script to test the loading and possibly compilation of a Root macro +# within a controlled environment +# + +MACRO=$1 +COMPILE=$2 +INCPATH=$3 + +LIBPATH=@CMAKE_LIBRARY_OUTPUT_DIRECTORY@:@LD_LIBRARY_PATH@ + +[[ -z "$INCPATH" ]] && INCPATH=$ROOT_INCLUDE_PATH + +if [[ ! -f ${MACRO} ]]; then + echo "Could not find macro ${MACRO}" + exit 64 +fi + +ROOTCMD=".L ${MACRO}" + +[[ ${COMPILE} -eq 1 ]] && ROOTCMD="${ROOTCMD}++" + +ERRVARNAME="test_root_macro_sh_in_err" + +CMD="Int_t ${ERRVARNAME}; gROOT->ProcessLine(\"${ROOTCMD}\",&${ERRVARNAME}); +std::cout << \"Exit code=\" << ${ERRVARNAME} << \"\n\"; gSystem->Exit(${ERRVARNAME});" + +echo "ROOT_INCLUDE_PATH to be used:" +echo ${INCPATH} | tr ":" "\n" +echo "LD_LIBRARY_PATH to be used:" +echo ${LIBPATH} | tr ":" "\n" + +env ROOT_INCLUDE_PATH=${INCPATH} LD_LIBRARY_PATH=${LIBPATH} @ROOT_root_CMD@ -n -b -l -q -e "${CMD}" + +RV=$? + +exit $RV + diff --git a/cmake/tests-wrapper.sh.in b/tests/tests-wrapper.sh.in old mode 100644 new mode 100755 similarity index 56% rename from cmake/tests-wrapper.sh.in rename to tests/tests-wrapper.sh.in index 47b1077fb64df..abc1e5927e057 --- a/cmake/tests-wrapper.sh.in +++ b/tests/tests-wrapper.sh.in @@ -8,40 +8,40 @@ # --dont-fail-on-timeout] -- prog [arg1 [arg2...]] MAX_ATTEMPTS=1 -TIMEOUT= # default: no timeout -DONT_FAIL_ON_TIMEOUT= # default: if it times out, it fails -NON_FATAL= # default: fail on error +TIMEOUT= # default: no timeout +DONT_FAIL_ON_TIMEOUT= # default: if it times out, it fails +NON_FATAL= # default: fail on error ARGS=("$@") while [[ $# -gt 0 ]]; do case "$1" in - --) - shift - break + --) + shift + break ;; - --name) - TEST_NAME="$2" - shift 2 + --name) + TEST_NAME="$2" + shift 2 ;; - --max-attempts) - MAX_ATTEMPTS="$2" - shift 2 + --max-attempts) + MAX_ATTEMPTS="$2" + shift 2 ;; - --timeout) - TIMEOUT="$2" - shift 2 + --timeout) + TIMEOUT="$2" + shift 2 ;; - --dont-fail-on-timeout) - DONT_FAIL_ON_TIMEOUT=1 - shift + --dont-fail-on-timeout) + DONT_FAIL_ON_TIMEOUT=1 + shift ;; - --non-fatal) - NON_FATAL=1 - shift + --non-fatal) + NON_FATAL=1 + shift ;; - *) - echo "Parameter unknown: $1" >&2 - exit 1 + *) + echo "Parameter unknown: $1" >&2 + exit 1 ;; esac done @@ -54,52 +54,37 @@ fi LOG="@CMAKE_BINARY_DIR@/test_logs/${TEST_NAME//\//_}.log" mkdir -p "$(dirname "$LOG")" -rm -f "$LOG"* &> /dev/null - -# Mitigate zombie processes -# -# This will create a zombie process when executed in something which does fork -# + exec + wait on children process. This is because >(tee "$LOG") will -# actually create a new process which is unknown to the parent. -# -# Under normal conditions this should not be a problem, given the bash -# executing the continuous-builder.sh should reap the zombie process. However -# continuous-builder.sh itself does the same and the zombie ends up escaping -# the bash and gets attached to the python agent, which only reaps the -# processes it knows about. -# -# Bottomline is that this trick is looking for troubles and should never be -# used. -# -# exec &> >(tee "$LOG") -echo "No separate logs for now" > "$LOG" +rm -f "$LOG"* &>/dev/null +exec &> >(tee "$LOG") function banner() { echo "=== $TEST_NAME - $1 ===" >&2 } banner "Starting test. Max attempts: $MAX_ATTEMPTS.${TIMEOUT:+" Timeout per attempt: $TIMEOUT."}${DONT_FAIL_ON_TIMEOUT:+" Timeouts are not fatal."}${NON_FATAL:+" Errors are not fatal."}" + for A in "${ARGS[@]}"; do banner "Argument: $A" done banner "Current working directory: $PWD" -banner "Environment" -env +echo "PATH=$PATH" +echo "ROOT_INCLUDE_PATH=$ROOT_INCLUDE_PATH" +echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" banner "/Environment" # Do we have timeout? TIMEOUT_EXEC=timeout TIMEOUT_CMD= TIMEOUT_PSTACK= -type $TIMEOUT_EXEC &> /dev/null || TIMEOUT_EXEC=gtimeout -type $TIMEOUT_EXEC &> /dev/null || TIMEOUT_EXEC= +type $TIMEOUT_EXEC &>/dev/null || TIMEOUT_EXEC=gtimeout +type $TIMEOUT_EXEC &>/dev/null || TIMEOUT_EXEC= if [[ $TIMEOUT_EXEC && $TIMEOUT ]]; then # Kill with 15; if after 10 seconds it's still alive, send 9 TIMEOUT_CMD="$TIMEOUT_EXEC --signal=SIGTERM --kill-after=10s ${TIMEOUT}s" # Get a stack trace, if possible, shortly before sending the first SIGTERM - if type pstack &> /dev/null; then - export GDB=$(which gdb 2> /dev/null) - TIMEOUT_PSTACK=$(( TIMEOUT - 10 )) + if type pstack &>/dev/null; then + export GDB=$(which gdb 2>/dev/null) + TIMEOUT_PSTACK=$((TIMEOUT - 10)) if [[ $TIMEOUT_PSTACK -lt 10 ]]; then TIMEOUT_PSTACK=10 fi @@ -112,29 +97,41 @@ banner "Timeout prefix: $TIMEOUT_CMD" CMD="$1" shift -type "$CMD" &> /dev/null || CMD="@CMAKE_BINARY_DIR@/bin/$CMD" +type "$CMD" &>/dev/null || CMD="@CMAKE_BINARY_DIR@/bin/$CMD" + +for ((ATTEMPT = 1; ATTEMPT <= MAX_ATTEMPTS; ATTEMPT++)); do + DARGS=("$@") + # Deduping args that contain a ":" + N=${#DARGS[@]} + i=1 + while [[ $i -lt $N ]]; do + A=${DARGS[$i]} + if [[ $A =~ : ]]; then + DARGS[$i]=$(echo $A | tr ":" "\n" | sort | uniq | tr "\n" ":") + fi + i=$(($i + 1)) + done -for ((ATTEMPT=1; ATTEMPT<=MAX_ATTEMPTS; ATTEMPT++)); do - banner "Running $CMD with args $* (attempt $ATTEMPT/$MAX_ATTEMPTS)" + banner "Running $CMD with args ${DARGS[*]} (attempt $ATTEMPT/$MAX_ATTEMPTS)" ERR=0 rm -f "${LOG}.bt" - $TIMEOUT_CMD "$CMD" "$@" & - REAL_PID=$(pgrep -P$! 2> /dev/null || true) + $TIMEOUT_CMD "$CMD" "${DARGS[@]}" & + REAL_PID=$(pgrep -P$! 2>/dev/null || true) if [[ $REAL_PID && $TIMEOUT_PSTACK ]]; then banner "Process running as $REAL_PID for attempt $ATTEMPT" FINISHED= - for ((I=0; I /dev/null; then + for ((I = 0; I < TIMEOUT_PSTACK; I++)); do + if ! kill -0 $REAL_PID &>/dev/null; then FINISHED=1 break fi sleep 1 done if [[ ! $FINISHED ]]; then - pstack $REAL_PID &> "${LOG}.bt" || true + pstack $REAL_PID &>"${LOG}.bt" || true fi fi - wait $! || ERR=$? # wait timeout process, not real PID + wait $! || ERR=$? # wait timeout process, not real PID if [[ $ERR == 0 ]]; then banner "Test finished with success after $ATTEMPT attempts, exiting" mv "$LOG" "${LOG}.0" @@ -150,7 +147,7 @@ for ((ATTEMPT=1; ATTEMPT<=MAX_ATTEMPTS; ATTEMPT++)); do fi done -mv "$LOG" "${LOG}.${ERR}" # log file will contain exitcode in name +mv "$LOG" "${LOG}.${ERR}" # log file will contain exitcode in name banner "Test failed after $MAX_ATTEMPTS attempts with $ERR" if [[ $DONT_FAIL_ON_TIMEOUT && $ERR == 124 ]]; then # man timeout --> 124 is for "timed out" diff --git a/cmake/tests.rootrc.in b/tests/tests.rootrc.in similarity index 100% rename from cmake/tests.rootrc.in rename to tests/tests.rootrc.in diff --git a/tests/tmp-patch-tests-environment.sh.in b/tests/tmp-patch-tests-environment.sh.in new file mode 100755 index 0000000000000..6e8e4ad4f098d --- /dev/null +++ b/tests/tmp-patch-tests-environment.sh.in @@ -0,0 +1,10 @@ +#!/bin/bash + +for i in $(find @CMAKE_BINARY_DIR@ -name CTestTestfile.cmake); do + if grep ENVIRONMENT $i >/dev/null 2>&1; then + echo "Patching test file with an ENVIRONMENT: $i" + sed -i.bak /O2_ROOT/s=@CMAKE_BINARY_DIR@/stage=@CMAKE_INSTALL_PREFIX@=g $i && rm $i.bak + sed -i.bak /VMCWORKDIR/s=@CMAKE_BINARY_DIR@/stage=@CMAKE_INSTALL_PREFIX@=g $i && rm $i.bak + sed -i.bak /PATH/s=@CMAKE_BINARY_DIR@/stage=@CMAKE_INSTALL_PREFIX@=g $i && rm $i.bak + fi +done