diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-03-18 10:28:36 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-03-18 10:28:45 +0100 |
commit | 2a8f23ff8aa29514d8e003ecce1808aa242af292 (patch) | |
tree | 525a18f195e421bd794d25db08004c0db93f4835 | |
parent | 16ae8338d9227ba9b06694c199e7aedec11d4ef5 (diff) |
Fix crash when building project with no source files
-rw-r--r-- | .vscode/launch.json | 16 | ||||
-rw-r--r-- | backend/ninja/Ninja.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 12 |
3 files changed, 28 insertions, 2 deletions
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 <cstdio>\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 <cstdio>\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; |