From 92f24893a5e2d12d0c32662483117c7032623bf1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 13 Dec 2017 18:35:52 +0100 Subject: 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. --- src/GlobalLib.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/GlobalLib.cpp') 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::Ok(""); + return Result::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 createBuildDirResult = createDirectoryRecursive(debugBuildPath.c_str()); if(createBuildDirResult.isErr()) return Result::Err(createBuildDirResult); @@ -153,11 +161,6 @@ namespace sibs if (buildResult.isErr()) return Result::Err(buildResult.getErrMsg()); - string staticLibPath = debugBuildPath; - staticLibPath += "/lib"; - staticLibPath += name; - staticLibPath += ".a"; - linkerFlagCallbackFunc(staticLibPath); return Result::Ok(staticLibPath); } } -- cgit v1.2.3