Skip to content

Commit 06822e4

Browse files
committed
fix vcc include paths when testing on multi-config targets like MSVC
1 parent 7f300cf commit 06822e4

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

src/driver/vcc.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
typedef struct {
1414
char* tmp_filename;
1515
bool delete_tmp_file;
16+
char* include_path;
1617
} VccOptions;
1718

1819
static void cli_parse_vcc_args(VccOptions* options, int* pargc, char** argv) {
@@ -26,6 +27,13 @@ static void cli_parse_vcc_args(VccOptions* options, int* pargc, char** argv) {
2627
options->delete_tmp_file = false;
2728
options->tmp_filename = "vcc_tmp.ll";
2829
continue;
30+
} else if (strcmp(argv[i], "--vcc-include-path") == 0) {
31+
argv[i] = NULL;
32+
i++;
33+
if (i == argc)
34+
error("Missing subgroup size name");
35+
options->include_path = argv[i];
36+
continue;
2937
}
3038
}
3139

@@ -81,7 +89,10 @@ int main(int argc, char** argv) {
8189
growy_append_string(g, "clang");
8290
char* self_path = get_executable_location();
8391
char* working_dir = strip_path(self_path);
84-
growy_append_formatted(g, " -c -emit-llvm -S -g -O0 -ffreestanding -Wno-main-return-type -Xclang -fpreserve-vec3-type --target=spir64-unknown-unknown -isystem\"%s/../share/vcc/include/\" -D__SHADY__=1", working_dir);
92+
if (!vcc_options.include_path) {
93+
vcc_options.include_path = format_string_interned(arena, "%s/../share/vcc/include/", working_dir);
94+
}
95+
growy_append_formatted(g, " -c -emit-llvm -S -g -O0 -ffreestanding -Wno-main-return-type -Xclang -fpreserve-vec3-type --target=spir64-unknown-unknown -isystem\"%s\" -D__SHADY__=1", vcc_options.include_path);
8596
free(working_dir);
8697
free(self_path);
8798
growy_append_formatted(g, " -o %s", vcc_options.tmp_filename);

test/vcc/CMakeLists.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
list(APPEND VCC_SIMPLE_TESTS empty.c)
22
list(APPEND VCC_SIMPLE_TESTS address_spaces.c)
33

4+
set(VCC_TEST_ARGS --vcc-include-path "${PROJECT_BINARY_DIR}/share/vcc/include/")
5+
46
foreach(T IN LISTS VCC_SIMPLE_TESTS)
5-
add_test(NAME "test/vcc/${T}" COMMAND vcc ${PROJECT_SOURCE_DIR}/test/vcc/${T})
7+
add_test(NAME "test/vcc/${T}" COMMAND vcc ${PROJECT_SOURCE_DIR}/test/vcc/${T} ${VCC_TEST_ARGS})
68
endforeach()
79

8-
spv_outputting_test(NAME test/vcc/branch.c COMPILER vcc EXTRA_ARGS)
9-
spv_outputting_test(NAME test/vcc/loop.c COMPILER vcc EXTRA_ARGS)
10-
spv_outputting_test(NAME test/vcc/goto.c COMPILER vcc EXTRA_ARGS)
10+
spv_outputting_test(NAME test/vcc/branch.c COMPILER vcc EXTRA_ARGS ${VCC_TEST_ARGS})
11+
spv_outputting_test(NAME test/vcc/loop.c COMPILER vcc EXTRA_ARGS ${VCC_TEST_ARGS})
12+
spv_outputting_test(NAME test/vcc/goto.c COMPILER vcc EXTRA_ARGS ${VCC_TEST_ARGS})
1113

12-
spv_outputting_test(NAME test/vcc/vec_swizzle.c COMPILER vcc EXTRA_ARGS --entry-point test --no-dynamic-scheduling --execution-model Fragment)
14+
spv_outputting_test(NAME test/vcc/vec_swizzle.c COMPILER vcc EXTRA_ARGS ${VCC_TEST_ARGS} --entry-point test --no-dynamic-scheduling --execution-model Fragment)
1315

14-
spv_outputting_test(NAME test/vcc/empty.comp.c COMPILER vcc EXTRA_ARGS --entry-point main)
16+
spv_outputting_test(NAME test/vcc/empty.comp.c COMPILER vcc EXTRA_ARGS ${VCC_TEST_ARGS} --entry-point main)
1517

16-
spv_outputting_test(NAME test/vcc/simple.frag.c COMPILER vcc EXTRA_ARGS --entry-point main --no-dynamic-scheduling --execution-model Fragment)
17-
spv_outputting_test(NAME test/vcc/checkerboard.frag.c COMPILER vcc EXTRA_ARGS --entry-point main --no-dynamic-scheduling --execution-model Fragment)
18-
spv_outputting_test(NAME test/vcc/textured.frag.c COMPILER vcc EXTRA_ARGS --entry-point main --no-dynamic-scheduling --execution-model Fragment)
18+
spv_outputting_test(NAME test/vcc/simple.frag.c COMPILER vcc EXTRA_ARGS ${VCC_TEST_ARGS} --entry-point main --no-dynamic-scheduling --execution-model Fragment)
19+
spv_outputting_test(NAME test/vcc/checkerboard.frag.c COMPILER vcc EXTRA_ARGS ${VCC_TEST_ARGS} --entry-point main --no-dynamic-scheduling --execution-model Fragment)
20+
spv_outputting_test(NAME test/vcc/textured.frag.c COMPILER vcc EXTRA_ARGS ${VCC_TEST_ARGS} --entry-point main --no-dynamic-scheduling --execution-model Fragment)

0 commit comments

Comments
 (0)