aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-03-08 16:09:37 +0100
committerdec05eba <dec05eba@protonmail.com>2022-03-08 16:09:37 +0100
commitd20ab1b390c14ac794ca3438df7e1d9cf057ceed (patch)
tree4ad56c1f39a25708e7deb73797318b1d6f695d57 /backend
parent44bbf443901519f59de79393ab01f7a7058230fb (diff)
Add --linker, --build and --skip-compile options
Diffstat (limited to 'backend')
-rw-r--r--backend/BackendUtils.cpp2
-rw-r--r--backend/ninja/Ninja.cpp20
2 files changed, 17 insertions, 5 deletions
diff --git a/backend/BackendUtils.cpp b/backend/BackendUtils.cpp
index befd7ed..caeea3c 100644
--- a/backend/BackendUtils.cpp
+++ b/backend/BackendUtils.cpp
@@ -116,6 +116,8 @@ namespace backend
subProjectConfig->packaging = sibsConfig.packaging;
subProjectConfig->platform = sibsConfig.platform;
subProjectConfig->bundling = sibsConfig.bundling;
+ subProjectConfig->linker = sibsConfig.linker;
+ subProjectConfig->skipCompile = sibsConfig.skipCompile;
FileString subProjectBuildPath;
readSibsConfig(file->path, projectConfPath, *subProjectConfig, subProjectBuildPath);
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index be8e303..7c0e9c0 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -809,6 +809,10 @@ namespace backend
// TODO: Allow configuring default linking flags. Maybe have `package.useThreads = false` to disable this flag
string allLinkerFlags;
+
+ if(!config.linker.empty())
+ allLinkerFlags += " -fuse-ld=" + config.linker;
+
if(isSamePlatformFamily(config.platform, PLATFORM_LINUX))
allLinkerFlags = "-pthread";
@@ -1703,13 +1707,15 @@ namespace backend
if (fileOverwriteResult.isErr())
return fileOverwriteResult;
- Result<bool> buildResult = compile(savePath);
- if (!buildResult)
- return buildResult;
+ if(config.skipCompile) {
+ Result<bool> buildResult = compile(savePath);
+ if (!buildResult)
+ return buildResult;
+ }
if((config.isMainProject() && !config.shouldBuildTests()) || config.isTest())
{
- buildResult = buildCompilationDatabase(savePath, config.getProjectPath());
+ Result<bool> buildResult = buildCompilationDatabase(savePath, config.getProjectPath());
if(!buildResult)
return buildResult;
}
@@ -1750,6 +1756,10 @@ namespace backend
sibsTestConfig.setSanitize(config.getSanitize());
sibsTestConfig.zigTestFiles = move(config.zigTestFiles);
sibsTestConfig.zigTestAllFiles = config.zigTestAllFiles;
+ sibsTestConfig.cVersion = config.cVersion;
+ sibsTestConfig.cppVersion = config.cppVersion;
+ sibsTestConfig.linker = config.linker;
+ sibsTestConfig.skipCompile = config.skipCompile;
if(projectConfFileType == FileType::REGULAR)
{
Result<bool> result = Config::readFromFile(projectConfFilePath.data.c_str(), sibsTestConfig);
@@ -1831,7 +1841,7 @@ namespace backend
if (!buildFileResult)
return buildFileResult;
- if(!zigTest)
+ if(!zigTest && !config.testsBuildOnly)
{
Result<ExecResult> runTestResult = exec({ Path(buildPath).join(toFileString(sibsTestConfig.getPackageName())).data }, true);
if(!runTestResult)