aboutsummaryrefslogtreecommitdiff
path: root/src/GlobalLib.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-13 18:35:52 +0100
committerdec05eba <dec05eba@protonmail.com>2017-12-13 18:37:07 +0100
commit92f24893a5e2d12d0c32662483117c7032623bf1 (patch)
tree2fac67d414383465f1257a875d7a23ab3cfd9814 /src/GlobalLib.cpp
parentf2c70dfaba8d6481e86646080c51b6874d95f14e (diff)
Fix linking issue (linking in wrong order)
Change program argument handling. Add new program argument "new" to create a new sibs project which creates a project with all necessary files and also uses git init (ignores failure, for example if git is not installed). Change build path from "build" to "sibs-build" to prevent name clashing since "build" is a common name for directories.
Diffstat (limited to 'src/GlobalLib.cpp')
-rw-r--r--src/GlobalLib.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp
index 177f1b9..203cd0f 100644
--- a/src/GlobalLib.cpp
+++ b/src/GlobalLib.cpp
@@ -136,11 +136,19 @@ namespace sibs
if(ninja.getSourceFiles().empty())
{
- return Result<string>::Ok("");
+ return Result<string>::Ok("No source files in dependency (header only library?)");
}
else
{
- string debugBuildPath = packageDir + "/build/debug";
+ string debugBuildPath = packageDir + "/sibs-build/debug";
+ string staticLibPath = debugBuildPath;
+ staticLibPath += "/lib";
+ staticLibPath += name;
+ staticLibPath += ".a";
+ linkerFlagCallbackFunc(staticLibPath);
+
+ // TODO: Use different directories depending on the project type, but .o build files should be in the same directory
+ // no matter what project type, since they are used for executables, static/dynamic libraries
Result<bool> createBuildDirResult = createDirectoryRecursive(debugBuildPath.c_str());
if(createBuildDirResult.isErr())
return Result<string>::Err(createBuildDirResult);
@@ -153,11 +161,6 @@ namespace sibs
if (buildResult.isErr())
return Result<string>::Err(buildResult.getErrMsg());
- string staticLibPath = debugBuildPath;
- staticLibPath += "/lib";
- staticLibPath += name;
- staticLibPath += ".a";
- linkerFlagCallbackFunc(staticLibPath);
return Result<string>::Ok(staticLibPath);
}
}