From 2a8f23ff8aa29514d8e003ecce1808aa242af292 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 18 Mar 2018 10:28:36 +0100 Subject: Fix crash when building project with no source files --- .vscode/launch.json | 16 ++++++++++++++++ backend/ninja/Ninja.cpp | 2 +- src/main.cpp | 12 +++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..dc20432 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Debug", + "type": "gdb", + "request": "launch", + "target": "./sibs-build/debug/sibs", + "cwd": "${workspaceRoot}", + "arguments": "build /home/dec05eba/git/gen-sfml-ui" + } + ] +} \ No newline at end of file diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index ead91a7..044fb64 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -318,7 +318,7 @@ namespace backend else { const PkgConfigFlags &pkgConfigFlag = pkgConfigFlagsResult.unwrap(); - if (!pkgConfigFlag.linkerFlags.empty()) + if (dynamicLinkerFlagCallback && !pkgConfigFlag.linkerFlags.empty()) dynamicLinkerFlagCallback(pkgConfigFlag.linkerFlags); if(!pkgConfigFlag.cflags.empty()) cflagsCallbackFunc(pkgConfigFlag.cflags); diff --git a/src/main.cpp b/src/main.cpp index c0d02d5..b9d6c1b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -79,6 +79,14 @@ using namespace std::chrono; // TODO (bug): Fix issue where running sibs-build in a project that uses cmake wont build and run tests +// TODO: Add 'license' in project.conf. License must be commonly known license or 'custom'. +// This is to include lgpl dependencies as dynamic libraries and give error if you are using gpl dependencies in a non gpl project. +// If the license type is custom, then the ways the library can be used should be defined in such a way that dependent projects can determinate +// if the dependency can be used without breaking compatibility between licenses. +// TODO: Dynamically link libgit2 (sibs dependency) since it's under lgpl license. Optionally implement git clone/pull with MIT license. + +// TODO: Auto export all symbols under windows (https://stackoverflow.com/questions/225432/export-all-symbols-when-creating-a-dll) + #if OS_FAMILY == OS_FAMILY_POSIX #define ferr std::cerr #else @@ -449,6 +457,7 @@ void newProjectCreateConf(const string &projectName, const string &projectType, projectConfStr += "platforms = [\""; projectConfStr += asString(SYSTEM_PLATFORM); projectConfStr += "\"]\n"; + projectConfStr += "tests = \"tests\""; projectConfStr += "\n"; projectConfStr += "[dependencies]\n"; @@ -524,7 +533,8 @@ int newProject(int argc, const _tinydir_char_t **argv) createProjectSubDir(projectPath + TINYDIR_STRING("/src")); createProjectSubDir(projectPath + TINYDIR_STRING("/include")); createProjectSubDir(projectPath + TINYDIR_STRING("/tests")); - createProjectFile(projectPath + TINYDIR_STRING("/src/main.cpp"), "#include \n\nint main(int argc, char **argv)\n{\n printf(\"hello, world!\\n\");\n return 0;\n}\n"); + if(projectTypeConf == "executable") + createProjectFile(projectPath + TINYDIR_STRING("/src/main.cpp"), "#include \n\nint main(int argc, char **argv)\n{\n printf(\"hello, world!\\n\");\n return 0;\n}\n"); // We are ignoring git init result on purpose. If it fails, just ignore it; not important gitInitProject(projectPath); return 0; -- cgit v1.2.3