From d22001283a49ad723da0023039c904dc6db7c5a0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 2 Oct 2018 21:14:45 +0200 Subject: Fix bundle for non system libraries --- src/Conf.cpp | 5 ++++- src/FileUtil.cpp | 2 +- src/main.cpp | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Conf.cpp b/src/Conf.cpp index 365cf38..fa92bf5 100644 --- a/src/Conf.cpp +++ b/src/Conf.cpp @@ -487,6 +487,9 @@ namespace sibs else fprintf(stderr, "Warning: Project contains tests directory but we got an error while retrieving the full path to it\n"); } + + if(config.isMainProject() && (config.packaging || config.bundling) && config.getPackageType() != PackageType::EXECUTABLE) + return Result::Err("Packaging is only supported for projects that are of type executable"); } return parseResult; @@ -1235,7 +1238,7 @@ namespace sibs if(prependSpace) cmakeArgs += TINYDIR_STRING(" "); cmakeArgs += TINYDIR_STRING("\"-D"); - cmakeArgs += toFileString(string(arg.data, arg.size)); + cmakeArgs += toFileString(arg); cmakeArgs += TINYDIR_STRING("\""); } } diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp index f52dd1f..498f638 100644 --- a/src/FileUtil.cpp +++ b/src/FileUtil.cpp @@ -52,7 +52,7 @@ namespace sibs FileString toFileString(const StringView &utf8Str) { - return FileString(utf8Str.data, utf8Str.size); + return FileString(utf8Str.data, utf8Str.data + utf8Str.size); } #else std::string toUtf8(const sibs::FileString &input) diff --git a/src/main.cpp b/src/main.cpp index f33b1f6..119aafb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1071,6 +1071,7 @@ static int packageProject(int argc, const _tinydir_char_t **argv) SibsConfig sibsConfig(compiler, projectPath, OPT_LEV_RELEASE, false); sibsConfig.showWarnings = true; sibsConfig.packaging = packagingType == PackagingType::STATIC; + sibsConfig.bundling = packagingType == PackagingType::BUNDLE; int result = buildProject(projectPath, projectConfFilePath, sibsConfig); if(result != 0) return result; @@ -1087,6 +1088,7 @@ static int packageProject(int argc, const _tinydir_char_t **argv) { string packagePath = toUtf8(projectPath + TINYDIR_STRING("/sibs-build/package")); string executablePath = toUtf8(projectPath + TINYDIR_STRING("/sibs-build/release/") + sibsConfig.getPackageName()); + printf("Creating a package from project and dependencies...\n"); FileString cmd = "python3 \"" + packageScriptPath + "\" \"" + executablePath + "\" \"" + packagePath + "\""; Result bundleResult = exec(cmd.c_str(), true); if(!bundleResult) -- cgit v1.2.3