-
Notifications
You must be signed in to change notification settings - Fork 108
feat: shared
library targets
#1138
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
base: main
Are you sure you want to change the base?
Conversation
…re the building order, not only link flags
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.
@perazz, it looks great to me! This must be a huge amount of work. I'm also testing the code locally, and it works well.
Adding a shared
logical key to the [library]
field may pose the following confusion:
When shared = true
or shared = false
, users are confused if they want to create both static and dynamic link libraries.
This got me thinking about how cargo and meson do:
Cargo sets a crate-type
string key in the [lib]
field to distinguish or use both dylib
and staticlib
.
[lib]
# Generate both dynamic and static libraries
crate-type = ["dylib", "staticlib"]
Meson distinguishes between static
, shared
or both
by the default_library
macro.
Fpm does not currently have a crate
definition and the crate-type
key, maybe we need to define a key name for this, default-library
, library-type
or something else? to support flexible selection and construction of dynamic and static link libraries.
With this PR, we have:
I think we can implement a static build, similar to the shared build (one complete library per package/dependency)
or similarly
I would leave building two library types simultaneously as a new feature PR, as it will require far more complex changes to the build system. @zoziha what do you think? |
Thank you for your detailed explanation, @perazz . And yes, that would be another PR and it might also be quite complex. Since this PR has implemented the construction of shared libraries and defined a Additionally, when generating a shared library (.dll) in the MINGW or CYGWIN environment on Windows OS, an import library (.dll.a) should also be generated: gfortran -shared -o libmydll.dll mydll.o -Wl,--out-implib,libmydll.dll.a |
Introduce a new manifest option to enable building shared libraries:
When enabled, the project, and all dependencies, are compiled as a shared library (
.so
,.dylib
, or.dll
depending on the platform) instead of the default static archive. Features:lib/
ifinstall.library = true
.lib<package_name>.{so, dll, dylib}
future-proof for later extension to versioning supportfpm run
now dynamically updatesLD_LIBRARY_PATH
to include the library install folders.shared
library targets fpm-docs#164Address #681 #655, Supersede #1050.
cc: @certik @urbanjost @arteevraina @henilp105