-
-
Notifications
You must be signed in to change notification settings - Fork 324
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
🐛 Allow passing extra_libs
to CheckLibWithHeader
#4676
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7575421
:bug: Allow passing `extra_libs` to `CheckLibWithHeader`
rdbisme dae3e49
:white_check_mark: Add test
rdbisme 5c1ee17
:memo: Add change summary
rdbisme 2bb3cd3
Also enable extra_libs for CheckLib
mwichmann 07e63ae
Minor fixes to CheckLibWithHeader test
mwichmann b1d71e6
Fix CheckLibWithHeader test - undo mistake
mwichmann 5f8a725
Windows-ify the new CheckLibWithHeader test
mwichmann 9bcbf7b
Per request, "fixture-ize" CheckLibWithHeader_extra_libs test
mwichmann 663165b
Simplify use of dir_fixture and some test logic. Added DefaultEnviron…
bdbaddog 2a9d19a
Simplify use of dir_fixture
bdbaddog a5fcde6
Simplify use of dir_fixture
bdbaddog e3c23de
Simplify
bdbaddog 769eff9
Add note to docstring that this is a live test per mwichmann
bdbaddog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# Copyright The SCons Foundation | ||
|
||
env = Environment( | ||
CPPPATH=['#'], | ||
LIBPATH=['libB', 'libA'], | ||
LIBS=['A', 'B'], | ||
RPATH=['libA', 'libB'], | ||
) | ||
|
||
conf = Configure(env) | ||
if not conf.CheckLibWithHeader( | ||
['B'], | ||
header="libB/libB.h", | ||
language='C', | ||
extra_libs=['A'], | ||
call='libB();', | ||
autoadd=False, | ||
): | ||
print("Cannot build against 'B' library, exiting.") | ||
Exit(1) | ||
env = conf.Finish() | ||
|
||
# TODO: we should be able to build and run a test program now, | ||
# to make sure Configure() didn't lie to us about usability. | ||
# Disabled for now, because that's trickier in Windows (the rpath | ||
# only works for Linux) | ||
# env.Program(target="testlibs", source="src/test.c") | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# Copyright The SCons Foundation | ||
|
||
SharedLibrary(target='A', source=['libA.c'], CPPDEFINES='BUILDINGSHAREDLIB') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// Copyright The SCons Foundation | ||
|
||
#include <stdio.h> | ||
#include "libA.h" | ||
|
||
LIBA_DECL void libA(void) { | ||
printf("libA\\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// Copyright The SCons Foundation | ||
|
||
#ifndef _LIBA_H | ||
#define _LIBA_H | ||
|
||
// define BUILDINGSHAREDLIB when building libA as shared lib | ||
#ifdef _MSC_VER | ||
# ifdef BUILDINGSHAREDLIB | ||
# define LIBA_DECL __declspec(dllexport) | ||
# else | ||
# define LIBA_DECL __declspec(dllimport) | ||
# endif | ||
#endif // WIN32 | ||
|
||
#ifndef LIBA_DECL | ||
# define LIBA_DECL | ||
#endif | ||
|
||
LIBA_DECL void libA(void); | ||
#endif // _LIBA_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# Copyright The SCons Foundation | ||
|
||
SharedLibrary( | ||
target='B', | ||
source=['libB.c'], | ||
LIBS=['A'], | ||
LIBPATH='../libA', | ||
CPPPATH='../libA', | ||
CPPDEFINES='BUILDINGSHAREDLIB', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// Copyright The SCons Foundation | ||
|
||
#include <stdio.h> | ||
#include "libA.h" | ||
#include "libB.h" | ||
|
||
LIBB_DECL void libB (void) { | ||
printf("libB\\n"); | ||
libA(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// Copyright The SCons Foundation | ||
|
||
#ifndef _LIBB_H | ||
#define _LIBB_H | ||
|
||
// define BUILDINGSHAREDLIB when building libB as shared lib | ||
#ifdef _MSC_VER | ||
# ifdef BUILDINGSHAREDLIB | ||
# define LIBB_DECL __declspec(dllexport) | ||
# else | ||
# define LIBB_DECL __declspec(dllimport) | ||
# endif | ||
#endif // WIN32 | ||
|
||
#ifndef LIBB_DECL | ||
# define LIBB_DECL | ||
#endif | ||
|
||
LIBB_DECL void libB(void); | ||
#endif // _LIBB_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "libB/libB.h" | ||
|
||
int main() | ||
{ | ||
libB(); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think you should just be able to do this once as
test.dir_fixture(['fixture', 'checklib_extra'])
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.
I suppose. If you think it's worth doing yet another iteration...