aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/ninja/Ninja.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index fc1142b..e71b22a 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -863,6 +863,8 @@ namespace backend
}
}
+ bool zigTest = (config.zigTestAllFiles || !config.zigTestFiles.empty());
+
vector<ninja::NinjaArg> cLanguageVersionFlags = getLanguageVersionFlag(config.getCompiler(), config.getCversion());
compileCCommand.insert(compileCCommand.end(), cLanguageVersionFlags.begin(), cLanguageVersionFlags.end());
@@ -885,8 +887,6 @@ namespace backend
// TODO: Find a way to do this more efficiently
vector<ninja::NinjaArg> cflagsIncludes = convertCFlagsIncludesToZigIncludes(config.getCompiler(), cflags);
- vector<ninja::NinjaArg> zigLibraryFlags = convertCLibrariesToZigLibraries(config.getCompiler(), allLinkerFlags);
-
vector<ninja::NinjaArg> compileZigArgs = {
ninja::NinjaArg::createRaw("zig build-obj"),
ninja::NinjaArg::createRaw("$in"),
@@ -896,11 +896,16 @@ namespace backend
ninja::NinjaArg::createRaw("--library c"), // TODO: Remove this if project does not depend on c libraries or project only has .zig files
ninja::NinjaArg::createRaw("$globalIncDirZig")
};
- // TODO: Verify if we really need to add all libraries for every object file
+
compileZigArgs.insert(compileZigArgs.end(), cflagsIncludes.begin(), cflagsIncludes.end());
- compileZigArgs.insert(compileZigArgs.end(), zigLibraryFlags.begin(), zigLibraryFlags.end());
zigTestArgs.insert(zigTestArgs.end(), cflagsIncludes.begin(), cflagsIncludes.end());
- zigTestArgs.insert(zigTestArgs.end(), zigLibraryFlags.begin(), zigLibraryFlags.end());
+
+ if(zigTest)
+ {
+ // TODO: Verify if we really need to add all libraries for every object file
+ vector<ninja::NinjaArg> zigLibraryFlags = convertCLibrariesToZigLibraries(config.getCompiler(), allLinkerFlags);
+ zigTestArgs.insert(zigTestArgs.end(), zigLibraryFlags.begin(), zigLibraryFlags.end());
+ }
if(config.getOptimizationLevel() == sibs::OPT_LEV_RELEASE)
{
@@ -926,7 +931,6 @@ namespace backend
bool usesCFiles = false;
bool usesCppFiles = false;
- bool zigTest = (config.zigTestAllFiles || !config.zigTestFiles.empty());
vector<string> objectNames;
objectNames.reserve(sourceFiles.size());