diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c0acfa9b5..954c179a0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,7 +45,7 @@ jobs: - name: Build testproject run: | - set PATH=%PATH%;"C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64" + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 cd resources/testproject ..\..\build\${{ matrix.build_type }}\c3c.exe --debug-log --emit-llvm run hello_world_win32 dir build\llvm_ir @@ -56,6 +56,7 @@ jobs: - name: Build testproject lib run: | cd resources/testproject + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 ..\..\build\${{ matrix.build_type }}\c3c.exe --debug-log build hello_world_win32_lib - name: Vendor-fetch @@ -142,7 +143,7 @@ jobs: - name: Build testproject lib run: | cd resources/testproject - ../../build/c3c build hello_world_lib --debug-log + ../../build/c3c build hello_world_lib --cc cc --debug-log - name: run compiler tests run: | diff --git a/resources/testproject/project.json b/resources/testproject/project.json index 9698f7010..8cf0853fe 100644 --- a/resources/testproject/project.json +++ b/resources/testproject/project.json @@ -20,6 +20,7 @@ "targets": { "hello_world": { "type": "executable", + "cc" : "cc", "c-sources-override": [ "./csource/**" ], @@ -27,12 +28,12 @@ }, "hello_world_win32": { "type": "executable", - "cc" : "cl.exe", "c-sources-override": [ ] }, "hello_world_lib": { "type": "static-lib", + "cc" : "cc", "c-sources-override": [ "./csource/**" ] diff --git a/src/compiler/linker.c b/src/compiler/linker.c index 38d71d1e9..155f8337a 100644 --- a/src/compiler/linker.c +++ b/src/compiler/linker.c @@ -782,19 +782,9 @@ const char *cc_compiler(const char *cc, const char *file, const char *flags) len -= 2; filename[len] = 0; } - const char *out_name; - if (is_cl_exe) - { - out_name = dir - ? str_printf("/Fo:\"%s\\%s%s\"", dir, filename, get_object_extension()) - : str_printf("/Fo:\"%s%s\"", filename, get_object_extension()); - } - else - { - out_name = dir - ? str_printf("%s/%s%s", dir, filename, get_object_extension()) - : str_printf("%s%s", filename, get_object_extension()); - } + const char *out_name = dir + ? str_printf("%s/%s%s", dir, filename, get_object_extension()) + : str_printf("%s%s", filename, get_object_extension());; const char **parts = NULL; vec_add(parts, cc); @@ -812,8 +802,15 @@ const char *cc_compiler(const char *cc, const char *file, const char *flags) vec_add(parts, is_cl_exe ? "/c" : "-c"); if (flags) vec_add(parts, flags); vec_add(parts, file); - if (!is_cl_exe) vec_add(parts, "-o"); - vec_add(parts, out_name); + if (is_cl_exe) + { + vec_add(parts, str_printf("/Fo:\"%s\"", out_name)); + } + else + { + vec_add(parts, "-o"); + vec_add(parts, out_name); + } const char *output = concat_string_parts(parts); DEBUG_LOG("Compiling c sources using '%s'", output);