forked from AliceO2Group/O2Physics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
export the cmake info for usage of O2Physics as dependency (AliceO2Gr…
- Loading branch information
Showing
8 changed files
with
284 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
# All rights not expressly granted are reserved. | ||
# | ||
# This software is distributed under the terms of the GNU General Public | ||
# License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
# | ||
# 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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
# All rights not expressly granted are reserved. | ||
# | ||
# This software is distributed under the terms of the GNU General Public | ||
# License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
# | ||
# 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(O2PHYSICS_TARGETPCMMAP_TARGET "" CACHE INTERNAL "target/PCM map (target)") | ||
set(O2PHYSICS_TARGETPCMMAP_PCM "" CACHE INTERNAL "target/PCM map (pcm)") | ||
|
||
function(set_root_pcm_dependencies) | ||
foreach(target pcm IN ZIP_LISTS O2PHYSICS_TARGETPCMMAP_TARGET O2PHYSICS_TARGETPCMMAP_PCM) | ||
if (NOT pcm STREQUAL "") | ||
#message(STATUS "target ${target} has pcm ${pcm}") | ||
list(APPEND target_pcms_${target} ${pcm}) | ||
endif() | ||
endforeach() | ||
|
||
foreach(target pcm IN ZIP_LISTS O2PHYSICS_TARGETPCMMAP_TARGET O2PHYSICS_TARGETPCMMAP_PCM) | ||
if (NOT pcm STREQUAL "") | ||
unset(pcm_dep_list) | ||
get_target_property(dep_targets ${target} LINK_LIBRARIES) | ||
foreach(dep_target IN LISTS dep_targets) | ||
if (dep_target MATCHES "^O2PHYSICS::") | ||
string(REPLACE "O2PHYSICS::" "" dep_target ${dep_target}) | ||
o2physics_name_target(${dep_target} NAME dep_target) | ||
#message(STATUS "target ${target} depends on ${dep_target}") | ||
foreach(dep_pcm IN LISTS target_pcms_${dep_target}) | ||
#message(STATUS "${pcm} depends on ${dep_pcm}") | ||
list(APPEND pcm_dep_list ${dep_pcm}) | ||
endforeach() | ||
endif() | ||
endforeach() | ||
set(list_pcm_deps_${target} "${pcm_dep_list}" CACHE INTERNAL "List of pcm dependencies for ${target}") | ||
endif() | ||
endforeach() | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#!/bin/bash -e | ||
|
||
# rootcling_wrapper.sh -- wrap call to rootcling to trap some warnings | ||
# we want to treat as errors : | ||
# | ||
# Warning: Unused class rule | ||
# | ||
# | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case "$1" in | ||
--rootmap_library_name) | ||
ROOTMAP_LIBRARY_NAME="$2" | ||
shift 2 | ||
;; | ||
--include_dirs) | ||
INCLUDE_DIRS="$2" | ||
shift 2 | ||
;; | ||
--compile_defs) | ||
COMPILE_DEFINITIONS="$2" | ||
shift 2 | ||
;; | ||
--headers) | ||
HEADERS="$2" | ||
shift 2 | ||
;; | ||
--ld_library_path) | ||
LD_LIBRARY_PATH="$2" | ||
shift 2 | ||
;; | ||
--dictionary_file) | ||
DICTIONARY_FILE="$2" | ||
shift 2 | ||
;; | ||
--rootmap_file) | ||
ROOTMAP_FILE="$2" | ||
shift 2 | ||
;; | ||
--pcmdeps) | ||
PCMDEPS="$2" | ||
shift 2 | ||
;; | ||
*) | ||
if [[ -z "$1" ]]; then | ||
shift | ||
else | ||
echo "Parameter unknown: $1" >&2 | ||
exit 1 | ||
fi | ||
;; | ||
esac | ||
done | ||
|
||
if [[ ! $ROOTMAP_LIBRARY_NAME ]]; then | ||
echo "--rootmap_library_name option is mandatory but was not given" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [[ ! $INCLUDE_DIRS ]]; then | ||
echo "--include_dirs option is mandatory but was not given" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [[ ! $DICTIONARY_FILE ]]; then | ||
echo "--dictionary_file option is mandatory but was not given" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [[ ! $ROOTMAP_FILE ]]; then | ||
echo "--rootmap_file option is mandatory but was not given" >&2 | ||
exit 1 | ||
fi | ||
|
||
case $OSTYPE in | ||
darwin*) | ||
unset PCMDEPS | ||
;; | ||
*) | ||
;; | ||
esac | ||
|
||
LOGFILE=${DICTIONARY_FILE}.log | ||
|
||
@CMAKE_COMMAND@ -E env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} @ROOT_rootcling_CMD@ \ | ||
-f $DICTIONARY_FILE \ | ||
-inlineInputHeader \ | ||
-noGlobalUsingStd \ | ||
-rmf ${ROOTMAP_FILE} \ | ||
-rml ${ROOTMAP_LIBRARY_NAME} \ | ||
${INCLUDE_DIRS//;/ } \ | ||
${COMPILE_DEFINITIONS//;/ } \ | ||
${PCMDEPS:+-m }${PCMDEPS//;/ -m } \ | ||
${HEADERS//;/ } \ | ||
> ${LOGFILE} 2>&1 || cat ${LOGFILE} >&2 | ||
|
||
if [[ $? != "0" ]]; then | ||
rm $DICTIONARY_FILE | ||
exit 1 | ||
fi | ||
|
||
MSG="Warning: Unused class rule" | ||
if [[ -s ${LOGFILE} ]]; then | ||
WARNINGS=$(grep -c "${MSG}" ${LOGFILE} || :) | ||
if [[ ! $WARNINGS == 0 ]]; then | ||
echo "ERROR: please fix the warnings below about unused class rule" >&2 | ||
grep "$MSG" ${LOGFILE} >&2 | ||
rm $DICTIONARY_FILE | ||
exit 1 | ||
fi | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
# All rights not expressly granted are reserved. | ||
# | ||
# This software is distributed under the terms of the GNU General Public | ||
# License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
# | ||
# 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 O2PhysicsTargets | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2Physics | ||
NAMESPACE O2Physics:: | ||
FILE O2PhysicsTargets.cmake) | ||
|
||
install(FILES O2PhysicsConfig.cmake ../cmake/AddRootDictionary.cmake | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2Physics) | ||
|
||
install(FILES ../cmake/rootcling_wrapper.sh.in | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2Physics | ||
PERMISSIONS OWNER_READ | ||
OWNER_WRITE | ||
OWNER_EXECUTE | ||
GROUP_READ | ||
GROUP_EXECUTE | ||
WORLD_READ | ||
WORLD_EXECUTE) | ||
|
||
install(DIRECTORY ../dependencies/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/O2Physics) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
# All rights not expressly granted are reserved. | ||
# | ||
# This software is distributed under the terms of the GNU General Public | ||
# License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
# | ||
# 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}/O2PhysicsDependencies.cmake") | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/O2PhysicsTargets.cmake") | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/AddRootDictionary.cmake") | ||
|
||
message(STATUS "!!! Using new O2Physics targets. That's a good thing.") |