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.
The referenced issue involved the VS backend breaking when custom_targets where linked, extracted using extract_all_objects, and then linked into other targets, while in a subproject.
- Loading branch information
1 parent
3abb42d
commit 3feb322
Showing
15 changed files
with
150 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
import shutil | ||
|
||
shutil.copyfile(sys.argv[1], sys.argv[2]) |
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,4 @@ | ||
int func_custom1(void) | ||
{ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
int func_gen1(void) | ||
{ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
int func_custom1(void); | ||
int func_custom2(void); | ||
int func_custom3(void); | ||
int func_custom4(void); | ||
int func_gen1(void); | ||
int func_gen2(void); | ||
int func_gen3(void); | ||
int func_gen4(void); | ||
int func_gen5(void); | ||
int func_gen6(void); | ||
|
||
int main(void) | ||
{ | ||
func_custom1(); | ||
func_custom2(); | ||
func_custom3(); | ||
func_custom4(); | ||
func_gen1(); | ||
func_gen2(); | ||
func_gen3(); | ||
func_gen4(); | ||
func_gen5(); | ||
func_gen6(); | ||
return 0; | ||
} |
42 changes: 42 additions & 0 deletions
42
test cases/common/278 extract_all custom_target/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
project('extract all custom', 'c') | ||
fs = import('fs') | ||
|
||
copy = find_program('copy.py') | ||
gen = generator(copy, | ||
output : 'gen_@PLAINNAME@', | ||
arguments: ['@INPUT@', '@OUTPUT@']) | ||
src_gen = gen.process('gen1.c', 'sub/gen2.c') | ||
|
||
i = 0 | ||
src_custom = [] | ||
foreach f : ['custom1.c', 'sub/custom2.c'] | ||
i += 1 | ||
src_custom += [custom_target('custom' + i.to_string(), | ||
input : f, | ||
output : 'gen_' + fs.name(f), | ||
command : [copy, '@INPUT@', '@OUTPUT@']) | ||
] | ||
endforeach | ||
|
||
s1 = subproject('s1') | ||
sub_a = s1.get_variable('sub_a') | ||
sub_b = s1.get_variable('sub_b') | ||
subsub_a = s1.get_variable('s2').get_variable('subsub_a') | ||
|
||
# Use objects from subproject and subsubproject | ||
a = static_library('a', | ||
sources : [src_gen, src_custom], | ||
objects : [sub_a.extract_all_objects(), subsub_a.extract_all_objects()] | ||
) | ||
e1= executable('e1', | ||
sources: ['main.c'], | ||
link_with : a | ||
) | ||
|
||
# link with lib that uses objects from subproject of subproject | ||
e2 = executable('e2', | ||
sources : ['main.c', src_gen, src_custom], | ||
link_with : [sub_b] | ||
) | ||
test('test_e1', e1) | ||
test('test_e2', e2) |
4 changes: 4 additions & 0 deletions
4
test cases/common/278 extract_all custom_target/sub/custom2.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,4 @@ | ||
int func_custom2(void) | ||
{ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
int func_gen2(void) | ||
{ | ||
return 0; | ||
} |
4 changes: 4 additions & 0 deletions
4
test cases/common/278 extract_all custom_target/subprojects/s1/custom3.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,4 @@ | ||
int func_custom3(void) | ||
{ | ||
return 0; | ||
} |
4 changes: 4 additions & 0 deletions
4
test cases/common/278 extract_all custom_target/subprojects/s1/gen3.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,4 @@ | ||
int func_gen3(void) | ||
{ | ||
return 0; | ||
} |
26 changes: 26 additions & 0 deletions
26
test cases/common/278 extract_all custom_target/subprojects/s1/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
project('subproj', 'c') | ||
|
||
fs = import('fs') | ||
copy = find_program('../../copy.py') | ||
|
||
i = 2 | ||
src_custom = [] | ||
foreach f : ['custom3.c', 'sub/custom4.c'] | ||
i += 1 | ||
src_custom += [custom_target('custom' + i.to_string(), | ||
input : f, | ||
output : 'gen_' + fs.name(f), | ||
command : [copy, '@INPUT@', '@OUTPUT@']) | ||
] | ||
endforeach | ||
|
||
gen = generator(copy, | ||
output : 'gen_@PLAINNAME@', | ||
arguments: ['@INPUT@', '@OUTPUT@']) | ||
src_gen = gen.process('gen3.c', 'sub/gen4.c') | ||
|
||
s2 = subproject('s2') | ||
subsub_a = s2.get_variable('subsub_a') | ||
|
||
sub_a = static_library('sub_a', sources : [src_custom, src_gen]) | ||
sub_b = static_library('sub_b', objects : [sub_a.extract_all_objects(), subsub_a.extract_all_objects()]) |
4 changes: 4 additions & 0 deletions
4
test cases/common/278 extract_all custom_target/subprojects/s1/sub/custom4.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,4 @@ | ||
int func_custom4(void) | ||
{ | ||
return 0; | ||
} |
4 changes: 4 additions & 0 deletions
4
test cases/common/278 extract_all custom_target/subprojects/s1/sub/gen4.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,4 @@ | ||
int func_gen4(void) | ||
{ | ||
return 0; | ||
} |
4 changes: 4 additions & 0 deletions
4
test cases/common/278 extract_all custom_target/subprojects/s1/subprojects/s2/gen5.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,4 @@ | ||
int func_gen5(void) | ||
{ | ||
return 0; | ||
} |
11 changes: 11 additions & 0 deletions
11
test cases/common/278 extract_all custom_target/subprojects/s1/subprojects/s2/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
project('subproj', 'c') | ||
|
||
fs = import('fs') | ||
copy = find_program('../../../../copy.py') | ||
|
||
gen = generator(copy, | ||
output : 'gen_@PLAINNAME@', | ||
arguments: ['@INPUT@', '@OUTPUT@']) | ||
src_gen = gen.process('gen5.c', 'sub/gen6.c') | ||
|
||
subsub_a = static_library('subsub_a', sources : [src_gen]) |
4 changes: 4 additions & 0 deletions
4
test cases/common/278 extract_all custom_target/subprojects/s1/subprojects/s2/sub/gen6.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,4 @@ | ||
int func_gen6(void) | ||
{ | ||
return 0; | ||
} |