Repository navigation
cmake: export ittapi::headers target for collector implementations - #259
Skyb0rg007 wants to merge 1 commit into
Conversation
3b22029 to
c988c3b
Compare
eparshut
left a comment
There was a problem hiding this comment.
Hi @Skyb0rg007, thanks for contributing! Exporting the headers as a proper target makes sense, and moving GNUInstallDirs earlier is a good catch.
There are a few things I would like to change:
- Keep
ittapi::headerspublic-only.ittnotify_config.his an internal header, and it changes the build of any code that includes it (<windows.h>, UNICODE, _GNU_SOURCE, weak pthread symbols). Please move it andittnotify_types.hinto a separate target, e.g. for exampleittapi::collector_headers. - Don't expose
src/ittnotify. It also leaksittnotify_static.hand other internal headers. Copy just the two headers into the build directory, laid out the same way as in the install tree. - Make installing them opt-in. Add an option that is
OFFby default, since these are internal headers meant only for collectors. - Use the new target in
ittnotify_refcol. Then our own CI tests it. The target needs to be defined before theadd_subdirectorycall for the reference collector.
Add an ittapi::headers interface target that provides the collector headers.
c988c3b to
77d92b8
Compare
| target_include_directories(ittnotify_refcol PRIVATE | ||
| ${ITT_REFCOL_INCLUDE_DIR} | ||
| ${ITT_REFCOL_ITTNOTIFY_DIR}) | ||
| if(ITT_REFCOL_STANDALONE) |
There was a problem hiding this comment.
If the user installs itt and tries to use their ITT headers with the reference collector, this will use ITT's current headers. Maybe check whether ittapi::collector_header exists first and redefine it with the two directories below if it doesn't?
Optional: up to @eparshut and @Skyb0rg007
| ) | ||
| add_library(ittapi::headers ALIAS ittapi_headers) | ||
|
|
||
| # Internal headers for collector implementations. Including them changes the |
There was a problem hiding this comment.
I like @eparshut suggestion. This is sort of exposing a public interface, regardless of intentions, so we need to be careful saying these are public or not. Use at your own risk. Otherwise, you want to change internal implementation of these files and boom - users complains when it changes and says you need to bump version.
Maybe a documented disclaimer, say collectors use at your own risk - API between collector and source is stable but not promising anything for internal stuff. Anything not in ittapi::headers is "use at your own risk"
Add an ittapi::headers interface target that provides the public and collector headers.
The pti-gpu project expects this interface to exist (code), and exporting the headers as a target lets downstream clients properly depend on the header files.