-
Notifications
You must be signed in to change notification settings - Fork 18
Fix CMake export and include interfaces #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 15 commits
d5a94db
74fecb7
640644a
62455c3
7a68f0e
f1e880a
e5db953
9cffc2b
960796b
8751dae
2d6daa1
f898abd
66a54c1
9d8ef4d
b813de2
0c8fb71
e0d9ca0
e028d87
94e39b0
4a98590
4a02af5
cfff721
fbb48a1
1b4e34f
d6c3ed1
aba291b
ec7928a
98ed8b0
e52e634
55c8ee9
5bd1110
f475202
659bf07
bb4400a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| @PACKAGE_INIT@ | ||
| include(CMakeFindDependencyMacro) | ||
| find_dependency(date) | ||
| find_dependency(BLAS) | ||
NikEfth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if(@PETSIRD_GENERATED_USE_NDJSON@) | ||
| find_dependency(nlohmann_json) | ||
| endif() | ||
| if(@PETSIRD_GENERATED_USE_HDF5@) | ||
| find_dependency(HDF5 COMPONENTS CXX) | ||
| endif() | ||
| include("${CMAKE_CURRENT_LIST_DIR}/petsirdTargets.cmake") | ||
| check_required_components(PETSIRD) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,33 @@ | ||
| find_package(xtensor-blas REQUIRED) | ||
| find_package(xtensor REQUIRED) | ||
| # find_package(xtensor-blas REQUIRED) | ||
| find_package(BLAS REQUIRED) | ||
NikEfth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # create a petsird_helpers library target | ||
| # Currently it is just empty, but allows creating target properties which are transitive | ||
| add_library(petsird_helpers INTERFACE) | ||
| target_link_libraries(petsird_helpers INTERFACE petsird xtensor-blas) | ||
| target_include_directories(petsird_helpers INTERFACE "${PROJECT_SOURCE_DIR}/helpers/include") | ||
|
|
||
| target_include_directories(petsird_helpers | ||
| INTERFACE | ||
| ${xtensor_INCLUDE_DIRS} | ||
NikEfth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
| $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> | ||
| ) | ||
|
|
||
| target_link_libraries(petsird_helpers INTERFACE petsird BLAS::BLAS) | ||
NikEfth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| add_executable(petsird_generator petsird_generator.cpp) | ||
| target_link_libraries(petsird_generator petsird_helpers) | ||
| target_link_libraries(petsird_generator PRIVATE petsird_helpers) | ||
|
|
||
| add_executable(petsird_analysis petsird_analysis.cpp) | ||
| target_link_libraries(petsird_analysis petsird_helpers) | ||
| target_link_libraries(petsird_analysis PRIVATE petsird_helpers) | ||
|
|
||
| foreach(t petsird petsird_generated petsird_helpers) | ||
| if(TARGET ${t}) | ||
| get_target_property(_libs ${t} INTERFACE_LINK_LIBRARIES) | ||
| if(_libs) | ||
| list(FILTER _libs EXCLUDE REGEX "xtensor") | ||
| set_target_properties(${t} | ||
| PROPERTIES INTERFACE_LINK_LIBRARIES "${_libs}") | ||
| endif() | ||
| endif() | ||
| endforeach() | ||
|
Comment on lines
+27
to
+36
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why did you need this? (probably because you removed
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To undo an overly-aggressive dependency propagation introduced by generated / helper targets.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As long as xtensor is header-only, we could use the same trick as https://github.com/UCL/STIR/blob/ec3a5670f9b63cb10f4bebce6edf22d6f028a6fb/src/buildblock/CMakeLists.txt#L125-L137, i.e. only add the include path. However, this is all quite ugly. I'd rather avoid it as much as possible. As long as we have
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please try without it and document any problems? |
||
Uh oh!
There was an error while loading. Please reload this page.