Skip to content

Commit ddf1ef5

Browse files
Barthelemyknopers8
authored andcommitted
Update O2 dependency mechanism (#134)
* Better handling of O2 dependencies * Additions to the FAQ concerning the dependencies * update TOC
1 parent d1f3db4 commit ddf1ef5

2 files changed

Lines changed: 38 additions & 11 deletions

File tree

cmake/FindAliceO2.cmake

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,30 @@ set(AliceO2_INCLUDE_DIRS ${AliceO2_INCLUDE_DIR})
2121
list(APPEND AliceO2_INCLUDE_DIRS ${MS_GSL_INCLUDE_DIR})
2222

2323
# find libraries
24-
find_library(AliceO2_LIBRARY_FRAMEWORK NAMES Framework HINTS ${O2_ROOT}/lib ENV LD_LIBRARY_PATH)
25-
find_library(AliceO2_LIBRARY_HEADERS NAMES Headers HINTS ${O2_ROOT}/lib ENV LD_LIBRARY_PATH)
26-
find_library(AliceO2_LIBRARY_CCDB NAMES CCDB HINTS ${O2_ROOT}/lib ENV LD_LIBRARY_PATH)
27-
find_library(AliceO2_LIBRARY_DebugGUI NAMES DebugGUI HINTS ${O2_ROOT}/lib ENV LD_LIBRARY_PATH)
28-
29-
set(AliceO2_LIBRARIES ${AliceO2_LIBRARY_FRAMEWORK} ${AliceO2_LIBRARY_HEADERS} ${AliceO2_LIBRARY_CCDB} ${AliceO2_LIBRARY_DebugGUI})
3024
# TODO SEARCH *ALL* LIBRARIES --> AliceO2 should ideally provide the list !!!
25+
set(O2_LIBRARIES_NAMES
26+
Framework
27+
Headers
28+
CCDB
29+
DebugGUI
30+
DetectorsBase
31+
ITSBase
32+
ITSSimulation
33+
ITSReconstruction
34+
ITSWorkflow
35+
ITSMFTReconstruction
36+
ITSMFTBase
37+
DetectorsCommonDataFormats
38+
)
39+
foreach(lib_name ${O2_LIBRARIES_NAMES})
40+
find_library(AliceO2_LIBRARY_${lib_name} NAMES ${lib_name} HINTS ${O2_ROOT}/lib ENV LD_LIBRARY_PATH)
41+
list(APPEND AliceO2_LIBRARIES_VAR_NAMES AliceO2_LIBRARY_${lib_name})
42+
list(APPEND AliceO2_LIBRARIES ${AliceO2_LIBRARY_${lib_name}})
43+
endforeach()
3144

3245
# handle the QUIETLY and REQUIRED arguments and set AliceO2_FOUND to TRUE
3346
# if all listed variables are TRUE
34-
find_package_handle_standard_args(AliceO2 "AliceO2 could not be found. Install package AliceO2." AliceO2_LIBRARY_FRAMEWORK AliceO2_LIBRARY_HEADERS AliceO2_INCLUDE_DIR)
47+
find_package_handle_standard_args(AliceO2 "AliceO2 could not be found. Install package AliceO2." ${AliceO2_LIBRARIES_VAR_NAMES} AliceO2_INCLUDE_DIR)
3548

3649
if(${AliceO2_FOUND})
3750
message(STATUS "AliceO2 found, libraries: ${AliceO2_LIBRARIES}")
@@ -42,9 +55,9 @@ if(${AliceO2_FOUND})
4255
if(NOT TARGET AliceO2::AliceO2)
4356
add_library(AliceO2::AliceO2 INTERFACE IMPORTED)
4457
set_target_properties(AliceO2::AliceO2 PROPERTIES
45-
INTERFACE_INCLUDE_DIRECTORIES "${AliceO2_INCLUDE_DIRS}"
46-
INTERFACE_LINK_LIBRARIES "${AliceO2_LIBRARIES}"
47-
)
58+
INTERFACE_INCLUDE_DIRECTORIES "${AliceO2_INCLUDE_DIRS}"
59+
INTERFACE_LINK_LIBRARIES "${AliceO2_LIBRARIES}"
60+
)
4861
endif()
4962
endif()
5063

doc/FAQ.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,30 @@
44
<!--./gh-md-toc --insert /path/to/README.md-->
55
<!--ts-->
66
* [Frequently asked questions](#frequently-asked-questions)
7+
* [Build](#build)
8+
* [How do I add a dependency to my module ?](#how-do-i-add-a-dependency-to-my-module-)
9+
* [How do I make my module depend on library XXX from AliceO2 ?](#how-do-i-make-my-module-depend-on-library-xxx-from-aliceo2-)
710
* [CCDB repository](#ccdb-repository)
811
* [How to see which objects are stored in the CCDB ?](#how-to-see-which-objects-are-stored-in-the-ccdb-)
912
* [How to delete objects from the CCDB ?](#how-to-delete-objects-from-the-ccdb-)
1013

11-
<!-- Added by: bvonhall, at: 2019-04-10T12:19+0200 -->
14+
<!-- Added by: bvonhall, at: -->
1215

1316
<!--te-->
1417

1518
[← Go back to Advanced Topics](Advanced.md) | [↑ Go to the Table of Content ↑](../README.md)
1619

20+
## Build
21+
22+
### How do I add a dependency to my module ?
23+
24+
We use standard CMake and you should get acquainted with this tool. In the CMakeLists.txt of your module, add the missing dependency to the command `target_link_libraries` (i.e. the name of the library without "lib" and ".so".
25+
For AliceO2 libraries see the next question.
26+
27+
### How do I make my module depend on library XXX from AliceO2 ?
28+
29+
Add the library name to the list `O2_LIBRARIES_NAMES` in [FindAliceO2.cmake](../cmake/FindAliceO2.cmake)
30+
1731
## CCDB repository
1832

1933
### How to see which objects are stored in the CCDB ?

0 commit comments

Comments
 (0)