dougbinks / enkiTS

A permissively licensed C and C++ Task Scheduler for creating parallel programs. Requires C++11 support.
zlib License
1.66k stars 138 forks source link

Install headers in a subdirectory #110

Closed bkmgit closed 7 months ago

bkmgit commented 7 months ago

Solves https://github.com/dougbinks/enkiTS/issues/108

dougbinks commented 7 months ago

Many thanks for the issue #108 and this PR.

Since I do not install libraries (I believe all dependencies should be in your code repo or subrepos) and did not write the install, I'll ask @pr0g who made the last major change to the cmake install #96 to review this, especially as their change was the one to remove the enkiTS include subfolder.

If this PR doesn't break the use of cmake install then I'm happy to merge it.

bkmgit commented 7 months ago

Trying to package this for Fedora Linux. Likelihood of name collisions with headers of other software ar reduced if headers are in a subdirectory.

pr0g commented 7 months ago

Hey there,

I took a look at this and it totally makes sense, but I think it would technically constitute a breaking change (if anyone was depending on how the library is installed right now). So maybe a version bump if that's possible would be a good idea?

I intentionally didn't add the library name folder to keep things the same as when including files via FetchContent, as the folder name isn't there in that case. With this change I believe the include paths would be different if using FetchContent of find_package via installing. It's not a huge deal but probably worth mentioning somewhere in the docs too for usage (when I install I usually use a local folder via CMAKE_INSTALL_PREFIX so hadn't run into this issue before).

So this can be merged but I'd recommend maybe a small doc update if possible and a version bump to indicate the change. Maybe that's overkill, but just a suggestion. This is up to @dougbinks.

Thanks!

pr0g commented 7 months ago

Actually one other option might also be to modify:

https://github.com/dougbinks/enkiTS/blob/8c13c08744f7515da13684d46bf8f279a5b94ab2/CMakeLists.txt#L48-L50

So it looks like this...

target_include_directories( enkiTS PUBLIC 
     PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src> 
            $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/enkiTS>) 

That way the include paths would remain the same, and you'd avoid any potential collisions if installing to the system.

bkmgit commented 7 months ago

Version bump is a good idea. For documentation, do you have suggestions? Can make a separate pull request as it may also be helpful to add information on using the shared library.

pr0g commented 7 months ago

Updates look great thanks @bkmgit 👍 For the docs I reckon the Building section of the README is as good a place as any. If it isn't too much trouble it would also be great to check this repo works with your changes (I believe it should) - https://github.com/pr0g/enkiTS-example. You just need to update the CMakeLists.txt file in the third-party folder to your repo (see here). Cheers!

dougbinks commented 7 months ago

Thanks for this work both of you!

I'm happy to merge this without the documentation, and have the documentation added in another PR. I'll perform a few more checks and merge shortly.

I intend to tag a new version soon once this is done.

pr0g commented 7 months ago

Sounds great @dougbinks 🙌 Thanks!

bkmgit commented 7 months ago

Thanks. Will do a few more checks and add a pull request with documentation tomorrow. Can you postpone making a new release until Monday?

dougbinks commented 7 months ago

Please take your time, there's no rush and I'll wait for your PR before making a new release.

I may merge this PR to the dev branch in the meantime.