forked from mesonbuild/meson
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use same compiler args for pch as for regular target
Fixes mesonbuild#999, mesonbuild#1415, mesonbuild#2361.
- Loading branch information
Showing
14 changed files
with
88 additions
and
12 deletions.
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,5 @@ | ||
#!/usr/bin/env python3 | ||
import sys | ||
|
||
with open(sys.argv[1], 'w') as f: | ||
f.write("#define FOO 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env python3 | ||
import sys | ||
|
||
with open(sys.argv[1]) as f: | ||
content = f.read() | ||
with open(sys.argv[2], 'w') as f: | ||
f.write(content) |
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 @@ | ||
#define BAR 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cc = meson.get_compiler('c') | ||
cc_id = cc.get_id() | ||
if cc_id == 'lcc' | ||
error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.') | ||
endif | ||
|
||
generated_customTarget = custom_target('makeheader', | ||
output: 'generated_customTarget.h', | ||
command : [find_program('gen_custom.py'), '@OUTPUT0@']) | ||
|
||
generated_generator = generator(find_program('gen_generator.py'), | ||
output: '@BASENAME@.h', | ||
arguments: ['@INPUT@', '@OUTPUT@']) | ||
|
||
exe = executable('prog', 'prog.c', generated_customTarget, generated_generator.process('generated_generator.in'), | ||
c_pch: ['pch/prog_pch.c', 'pch/prog.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,2 @@ | ||
#include "generated_customTarget.h" | ||
#include "generated_generator.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,5 @@ | ||
#if !defined(_MSC_VER) | ||
#error "This file is only for use with MSVC." | ||
#endif | ||
|
||
#include "prog.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 @@ | ||
// No includes here, they need to come from the PCH | ||
|
||
int main(int argc, char **argv) { | ||
return FOO + BAR; | ||
} | ||
|
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
1 change: 1 addition & 0 deletions
1
test cases/common/13 pch/withIncludeDirectories/include/lib/lib.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 @@ | ||
#include <stdio.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,9 @@ | ||
cc = meson.get_compiler('c') | ||
cc_id = cc.get_id() | ||
if cc_id == 'lcc' | ||
error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.') | ||
endif | ||
|
||
exe = executable('prog', 'prog.c', | ||
include_directories: 'include', | ||
c_pch : ['pch/prog_pch.c', 'pch/prog.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 @@ | ||
#include<lib/lib.h> |
5 changes: 5 additions & 0 deletions
5
test cases/common/13 pch/withIncludeDirectories/pch/prog_pch.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#if !defined(_MSC_VER) | ||
#error "This file is only for use with MSVC." | ||
#endif | ||
|
||
#include "prog.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,10 @@ | ||
// No includes here, they need to come from the PCH | ||
|
||
void func() { | ||
fprintf(stdout, "This is a function that fails if stdio is not #included.\n"); | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
return 0; | ||
} | ||
|