Skip to content

Commit

Permalink
[cmake] Improve recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
kostorr committed Jul 14, 2020
1 parent 7bbcaf0 commit 16cf3e7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,17 @@ target_include_directories(LLA
${CMAKE_CURRENT_SOURCE_DIR}/src
)

set(LINK_LIBS
AliceO2::ReadoutCard
AliceO2::InfoLogger
AliceO2::Common
Boost::boost
)

# Link targets
target_link_libraries(LLA
PUBLIC
AliceO2::Common
AliceO2::InfoLogger
AliceO2::ReadoutCard
${LINK_LIBS}
PRIVATE
$<$<BOOL:${Python2_FOUND}>:Boost::python27>
$<$<BOOL:${Python2_FOUND}>:Python2::Python>
Expand Down
34 changes: 16 additions & 18 deletions cmake/LLAConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,29 @@ set(Common_CMAKE_DIR @Common_DIR@)
set(InfoLogger_CMAKE_DIR @InfoLogger_ROOT@)
set(ReadoutCard_CMAKE_DIR @ReadoutCard_ROOT@)

#if(NOT APPLE)
# find_package(Python3 3.6 COMPONENTS Development)
# if(Python3_FOUND)
# set(boost_python_component "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
# else()
# # Backwards compatible. Can be removed once the Python3 recipe is stable
# message(WARNING "Python 3 was not found: falling back to Python 3")
# find_package(Python2 2.7 COMPONENTS Development REQUIRED)
# set(boost_python_component "python27")
# endif()
#endif()
if(NOT APPLE)
find_package(Python3 3.6 COMPONENTS Development)
if(Python3_FOUND)
set(boost_python_component "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
else()
# Backwards compatible. Can be removed once the Python3 recipe is stable
message(WARNING "Python 3 was not found: falling back to Python 3")
find_package(Python2 2.7 COMPONENTS Development REQUIRED)
set(boost_python_component "python27")
endif()
endif()

find_dependency(Common CONFIG HINTS ${Common_CMAKE_DIR})
find_dependency(InfoLogger CONFIG HINTS ${InfoLogger_CMAKE_DIR})
find_dependency(ReadoutCard CONFIG HINTS ${ReadoutCard_CMAKE_DIR})
find_dependency(Boost)

# find package must be used as Common already looks for boost and set Boost_FOUND
#find_package(Boost QUIET
# COMPONENTS
# system
# filesystem
# ${boost_python_component}
# REQUIRED
#)
find_package(Boost QUIET
COMPONENTS
${boost_python_component}
REQUIRED
)

if(NOT TARGET o2::LLA)
include("${LLA_CMAKE_DIR}/LLATargets.cmake")
Expand Down
1 change: 0 additions & 1 deletion src/PythonInterface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ namespace lla = o2::lla;
class Session
{
public:
// TODO: Update the interface wrt the card id here
Session(std::string sessionName, std::string cardId)
{
lla::SessionParameters params = lla::SessionParameters::makeParameters()
Expand Down

0 comments on commit 16cf3e7

Please sign in to comment.