forked from mesonbuild/meson
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extend override_find_program with native keyword
For the most part, what we had before would work correctly for cross building. There is, however a case where this might not work correctly, which is a project for the host machine that builds a build machine target and uses that as an override (think some kind of transpiler), to make this work correctly we need to add a native keyword argument to the `override_find_program` method.
- Loading branch information
Showing
9 changed files
with
59 additions
and
9 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
docs/markdown/snippets/subproject_and_override_program_native.md
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,13 @@ | ||
## subproject() and meson.override_find_program() now support the native keyword argument | ||
|
||
Subprojects may now be built for the host or build machine (or both). This means | ||
that build time dependencies can be built for the matching running the build in a | ||
cross compile setup. When a subproject is run for the build machine it will act | ||
just like a normal build == host setup, except that no targets will be installed. | ||
|
||
This necessarily means that `meson.override_find_program()` must differentiate | ||
between programs for the host and those for the build machine, as you may need | ||
two versions of the same program, which have different outputs based on the | ||
machine they are for. For backwards compatibility reasons the default is for the | ||
host machine. Inside a native subproject the host and build machine will both be | ||
the build machine. |
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
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
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,8 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) { | ||
printf("const char * gen_main(void) {\n"); | ||
printf(" return \"int main() \";\n"); | ||
printf("}\n"); | ||
return 0; | ||
} |
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
5 changes: 4 additions & 1 deletion
5
test cases/native/10 native subproject/subprojects/buildtool/buildtool.c
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
#include <stdio.h> | ||
|
||
const char * gen_main(void); | ||
|
||
int main() { | ||
printf("int main() { return 0; }\n"); | ||
printf("%s", gen_main()); | ||
printf("{ return 0; }\n"); | ||
return 0; | ||
} |
11 changes: 10 additions & 1 deletion
11
test cases/native/10 native subproject/subprojects/buildtool/meson.build
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