bashbaug / opencl-runtime-loader

OpenCL Runtime Loader Library
MIT License
2 stars 0 forks source link

Enable shared library builds and improve CMake script #3

Closed sztomi closed 4 years ago

sztomi commented 4 years ago

This PR contains various changes to the CMake build that make it a bit more flexible.

There was an incomplete link flag passed which caused the shared build to fail. The relevant section in the flags: -Wl,--version-script -shared -Wl,-soname,libOpenCLRuntimeLoader.so

--version-script requires an argument, so the next linker option, -soname was treated as one, leading to this error:

cannot open linker script file -soname: No such file or directory

I'm not sure what the intention was with this flag, maybe it was a copy-paste error? In any case, this allows building the library in both a shared and static configuration.

bashbaug commented 4 years ago

This is great - thank you very much for your contribution!

At some point I may add an override so this specific project can be built as a static lib even if other projects are built with shared libs, similar to the solution here:

https://stackoverflow.com/questions/53499678/cmake-build-shared-libs-for-single-libraries

This is definitely an improvement though in the meantime. Thanks again!

sztomi commented 4 years ago

Thanks!