Add option to build shared library#8
Conversation
|
What is your intention of building |
|
Helpful to test Glaze when packaging: At present ctest does not run any tests: |
|
@bkmgit, would it be helpful for Glaze to have its own copy of this Was your idea to link Glaze unit tests to the ut shared library? Because right now Glaze unit tests would require the header file anyway. I'm trying to understand what the shared library would give you, it just seems to add complications and worse security. |
|
It is possible to package ut as a header only library, but assumed it is good to have all options available. |
|
Bundling ut with Glaze is not desirable. |
The library just doesn't work as a shared library, it relies on templates and source location. So, no one would want to use a shared library version of this code. |
|
Modules support gets compiled as a static library. Can it be used as a shared library? |
|
C++20 modules don't get compiled to a static libraries (although they do produce object files). Static libraries don't work for templates and inline constexpr evaluated code, but C++20 modules do work in these cases. |
|
+1 for @stephenberry position here. I don't quite understand the need for shared library in UT's case. |
|
It seems some kind of versioning is suggested: but still reading up on how to package the module. |
|
It seems the extension should be cppm: https://crascit.com/2024/04/04/cxx-modules-cmake-shared-libraries/ but what CMake should do is still be worked out: |
|
File extension doesn't impact this, so I don't think that's the case. |
|
@bkmgit, this is obviously AI generated, but I think helpful to explain the Packaging
|
|
I have a spec file: main unresolved issue is how to package the module. |
|
@bkmgit, currently the module isn't used by Glaze and I don't think there are standard practices for packaging modules right now. Typically modules would be built in place and not packaged like libraries. |
|
Both Poco and nlohmann-json create modules. These can either be shared or static libraries. When created as shared libraries, sonames are included. Poco in addition installs cppm files. A list of other C++ libraries with module is available at https://arewemodulesyet.org/projects/ |
|
nlohmann-json's module target produces a static library as a CMake artifact for the BMI. if(UT_ENABLE_MODULES)
add_library(${PROJECT_NAME}_${PROJECT_NAME} STATIC)This is not a traditional static library, but it is CMake's approach to the BMI and you can use it in the same way that nlohmann-json's module handling works. As for shared libraries, it doesn't work with |
No description provided.