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

PkgConfigDependency: Add option to choose between shared or static #2816

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@xclaesse
Contributor

xclaesse commented Dec 21, 2017

This adds 2 global project options:

  • default_link: Tells that we prefer static link when possible. This
    option could be used in more places where both static and shared
    libraries are available (e.g. future both_library()).
  • static_paths: List of path prefixes where it is allowed to use static
    libraries. By default it has "/" which means all paths are allowed.
    Sometimes it is useful to have there the path to an SDK that we want to
    static link and keep dynamic link for everything else (e.g. plateform
    libraries).

Closes #2765.

@xclaesse

This comment has been minimized.

Show comment
Hide comment
@xclaesse

xclaesse Jan 2, 2018

Contributor

Unit test fails with clang, it doesn't find libsdk.a, I don't understand why LIBRARY_PATH doesn't work, should be supported by clang since 2012...

Contributor

xclaesse commented Jan 2, 2018

Unit test fails with clang, it doesn't find libsdk.a, I don't understand why LIBRARY_PATH doesn't work, should be supported by clang since 2012...

# keep -lfoo to use shared library.
static_lib = args[0]
for p in static_paths:
if static_lib.startswith(p):

This comment has been minimized.

@xclaesse

xclaesse Mar 28, 2018

Contributor

Actually, revisiting a bit this patch, I think it can be greatly simplified. When static_paths is defined we could just not look at -L at all and replace libpaths by static_paths. That way self.compiler.find_library() will just find the .a files we want to keep.

@xclaesse

xclaesse Mar 28, 2018

Contributor

Actually, revisiting a bit this patch, I think it can be greatly simplified. When static_paths is defined we could just not look at -L at all and replace libpaths by static_paths. That way self.compiler.find_library() will just find the .a files we want to keep.

Xavier Claessens added some commits Jan 1, 2018

Xavier Claessens
Add 'default_link' global option
This option will be used when a dependency can be satisfied by both a
shared and a static library (e.g. pkg-config).
Xavier Claessens
Add 'static_paths' global option
It is a list of path prefixes where it is allowed to use static
libraries. By default it has "/" which means all paths are allowed.
Sometimes it is useful to have there the path to an SDK that we want to
static link and keep dynamic link for everything else (e.g. plateform
libraries).

Closes #2765.
@xclaesse

This comment has been minimized.

Show comment
Hide comment
@xclaesse

xclaesse Sep 27, 2018

Contributor

Let's abandon this PR, I changed my mind and I think PR #4276 is better.

Contributor

xclaesse commented Sep 27, 2018

Let's abandon this PR, I changed my mind and I think PR #4276 is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment