oneapi-src / level-zero

oneAPI Level Zero Specification Headers and Loader
https://spec.oneapi.com/versions/latest/elements/l0/source/index.html
MIT License
211 stars 90 forks source link

logging: Allow to use spdlog from system if present #149

Closed frantisekz closed 3 months ago

frantisekz commented 4 months ago

Some distributions (like Fedora) disallow fetching content from the internet build-time. Let's allow to link with spdlog from the host and use that if present during the build-time instead of content fetch.

loqs commented 4 months ago

This fails for me when using the system spdlog as if spdlog_FOUND is set then the system library is not added to the targets link libraries.

ConiKost commented 4 months ago

I can confirm @loqs, it does not fix the issue for me, which I have reported in https://github.com/oneapi-src/level-zero/issues/146

lisanna-dettwyler commented 4 months ago

Some distributions (like Fedora) disallow fetching content from the internet build-time. Let's allow to link with spdlog from the host and use that if present during the build-time instead of content fetch.

Would moving from fetchcontent to a submodule make this any better? I presume it would since the submodule would get fetched before build-time.

loqs commented 4 months ago

Would moving from fetchcontent to a submodule make this any better? I presume it would since the submodule would get fetched before build-time.

Would you consider moving the fetch and build of spdlog / fmt to a submodule and allowing the use of the system libraries instead?

lisanna-dettwyler commented 4 months ago

Would system libraries be used by default or optionally? What is the use case for using a system spdlog if we're submoduling our own?

ConiKost commented 4 months ago

As maintainer of level-zero in Gentoo Linux, I can say, that using system libs is a must. We don't allow using 3rd party libs to be included by a package except for some binary only packages. Packages are supposed to be compiled against system libs.

So please allow the usage of such libs. As you can see in #146, the changes are currently reverted as consequence.

Since Gentoo is source based, an optional compile option is fine @lisanna-dettwyler

LecrisUT commented 3 months ago

You should bump the cmake_minimum_required. Bumping it to 3.21 will allow you to skip the find_package. The minimum of 3.2 is already broken with the usage of FetchContent.

One thing that's missing for this PR to work is the target_link_libraries (also remove target_include_directories since it doesn't match)

frantisekz commented 3 months ago

Replaced by https://github.com/oneapi-src/level-zero/pull/154 .