aboutsummaryrefslogtreecommitdiff
path: root/backend/ninja
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-09-21 11:00:01 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:33 +0200
commit12de0a5d9e4ffe14950d90a1aaf05f006dc3af5f (patch)
tree2c17c2e51bfa48a9e734222640b68ab90112a309 /backend/ninja
parent2a076c85676612d32e5076ae8708618b13bc6ff7 (diff)
Only define libraries for zig build if running tests
Diffstat (limited to 'backend/ninja')
-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());