-
-
Notifications
You must be signed in to change notification settings - Fork 396
cmake: add export target config files #6877
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
Conversation
|
@m-kuhn Is there any possibility that you can test this PR soon, or will it be good for you to test later on from main when you find the time? |
|
It builds well here, thanks There is one problem remaining, that (absolute) include paths of dependencies are propagated as include paths for grass and end up in the exported config. As far as I can see, this line can just be removed. vcpkg build output (with the line removed): Is it correct, that we need all targets exported (I just did |
Thanks for testing, really appreciate it!
The problem is, unfortunately, that the GRASS lib's API exposes API from a couple of third party libraries. See #5263 for the rationale behind that line. So a third party software linking to the GRASS vector library also need, for example, GDAL include path, but not necessarily need to link to GDAL. I'm not sure how to solve that differently.
How about |
I am do not completely understand the problem yet. These types are accessed through e.g.
That's what I expect to use. Is there also a need for |
The GDAL (and PostgreSQL) types are part of grass/include/grass/vect/dig_structs.h Line 1388 in bc06217
I'll see if I can find out a workaround to target_include_directories. I'm curious, is the absolute path in the target a problem/blocker from your point of view?
The Addons typically use bitmap btree2 dbmibase gis gmath gproj imagery linkm raster segment vector. The rest of the libraries are not very likely to be used, but as the targets are generated automatically, why not keep them. |
exposed in GRASS API, enabling linking core modules to GRASS libraries without adding unnecessary dependency targets.
|
With latest commit I have removed all |
|
@nilason this change will avoid the problem of having absolute include paths, but downstream projects should specify the dependency on gdal and proj manually (it will probably work without in most cases if gdal and proj are installed to system and share the include folder with grass or other already included libraries, but not if they have been installed into separate directories) I haven't worked with this myself, but I could imagine that the following pattern will extract the include directory at configure time of the downstream library (and not at build time of grass): |
Thanks for the tip, I'll explore if/how this can be used... |
Indeed, this works for core modules, should therefore work for downstream projects too (including Addons, with some modifications to #6878). Updated with d34c526. |
|
@HuidaeCho Could you please take a look at this and/or approve? Need this merged to continue with #6878. |
echoix
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unblocking you in case you have to wait too long. It looks generally fine when reading through, though I haven't tried to run it
Alternative to #6869.
This is the first part of an update to add CMake support for
g.extension, extracted here the CMake export target configuration files part, to simplify review .In addition to the "pure" export, the following updates are added:
The targets exported are in the pattern
GRASS::<grass-lib-name-in-lowercase>, e.g.GRASS::gis,GRASS::raster.cc @m-kuhn