You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe the distinction between static and shared libraries should not be made where the library target is defined. Instead, the consumer should specify how the library should be consumed.
The library types to consider are:
header only
object (only object files are built, nothing is linked)
static
shared
Adapted inheritance rules would allow a concise, clear definition of a library target, which could then be consumed consistently by other targets, without as much need to separately treat static and shared library targets.
Implementation requirements:
a way of defining whether a dependency should be built & linked as object, static or shared. Maybe:
use a dict: dependencies: [shared=[...], static=[...], object=[...], header-only=[...]]
use different keywords: dependencies_static: [...]...
default to static for buildable libraries and allow specifying dependencies: [..., shared=[...], object=[...]
specify a "preferred" linkage, which can be overridden, e.g. if a consumer wants to link statically
a CLI parameter, which defines what should be built
a way of building a library as a specific kind (e.g. if we want to redistribute a library, not an executable, we need to build it irrespective of how it is linked into other build targets). Maybe:
?
flags.link would have to be turned into interface-flags.link when building a static library (flags.compile can remain). Instead of inheritance rules per target type, we would have rules per dependency type.
The first point is particularly important to decide, as it defines the problems and special cases...
Problems:
some libraries require flags to be specified, e.g. glfw requires _GLFW_BUILD_DLL to be defined for shared library builds (I believe this to be bad practice)
target definitions become more implicit and proper usage of clang-build would require a little deeper knowledge of the rules around library targets
Questions:
how will the case executable ---static---> library ---> shared library be treated (especially when the shared library is system-installed or downloaded binary)? This would need to be properly documented, as the user might expect no dynamic dependencies because static linkage of the executable was defined
how should the "consumer" use header-only versus other libraries that need to be built & linked
how to build a library specifically as a shared, static or object library, when it is not depended on? Better CLI options may be needed. Improved CLI options for this could also help with specifically building the tests or examples of one specific target.
what would be the inheritance rules of object libraries?
discussionSomething that might end up being labled enhancement or wontfix
1 participant
Converted from issue
This discussion was converted from issue #83 on July 29, 2021 21:50.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I believe the distinction between static and shared libraries should not be made where the library target is defined. Instead, the consumer should specify how the library should be consumed.
The library types to consider are:
Adapted inheritance rules would allow a concise, clear definition of a library target, which could then be consumed consistently by other targets, without as much need to separately treat
static
andshared
library targets.Implementation requirements:
object
,static
orshared
. Maybe:dependencies: [shared=[...], static=[...], object=[...], header-only=[...]]
dependencies_static: [...]
...static
for buildable libraries and allow specifyingdependencies: [..., shared=[...], object=[...]
flags.link
would have to be turned intointerface-flags.link
when building a static library (flags.compile
can remain). Instead of inheritance rules per target type, we would have rules per dependency type.The first point is particularly important to decide, as it defines the problems and special cases...
Problems:
_GLFW_BUILD_DLL
to be defined for shared library builds (I believe this to be bad practice)clang-build
would require a little deeper knowledge of the rules around library targetsQuestions:
executable ---static---> library ---> shared library
be treated (especially when the shared library is system-installed or downloaded binary)? This would need to be properly documented, as the user might expect no dynamic dependencies because static linkage of the executable was definedheader-only
versus other libraries that need to be built & linkedobject
libraries?Beta Was this translation helpful? Give feedback.
All reactions