aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-28 22:55:50 +0100
committerdec05eba <dec05eba@protonmail.com>2017-12-28 22:56:34 +0100
commit179c5baaa2b24be61f65daad0e4d415914af4c71 (patch)
treeaff81e8c9b158bfe44789305012aa06ec951b482 /src
parent9ffe3db21297192b0f26929e74327487905ad444 (diff)
Add support for tests in a package where type is executable
Diffstat (limited to 'src')
-rw-r--r--src/Conf.cpp23
-rw-r--r--src/GlobalLib.cpp21
-rw-r--r--src/main.cpp18
3 files changed, 26 insertions, 36 deletions
diff --git a/src/Conf.cpp b/src/Conf.cpp
index d6aee2c..6d5834e 100644
--- a/src/Conf.cpp
+++ b/src/Conf.cpp
@@ -341,6 +341,27 @@ namespace sibs
case OPT_LEV_RELEASE: return "release";
}
}
+
+ bool SibsConfig::isDefined(const std::string &name) const
+ {
+ return defines.find(name) != defines.end();
+ }
+
+ bool SibsConfig::define(const std::string &name, const std::string &value)
+ {
+ if(isDefined(name))
+ return false;
+ else
+ {
+ defines[name] = value;
+ return true;
+ }
+ }
+
+ const std::unordered_map<std::string, std::string>& SibsConfig::getDefines() const
+ {
+ return defines;
+ }
void SibsConfig::processObject(StringView name)
{
@@ -495,4 +516,4 @@ namespace sibs
{
finishedProcessing = true;
}
-} \ No newline at end of file
+}
diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp
index d994a27..cbc27bc 100644
--- a/src/GlobalLib.cpp
+++ b/src/GlobalLib.cpp
@@ -126,22 +126,7 @@ namespace sibs
return Result<string>::Err(errMsg);
}
- backend::Ninja::LibraryType libraryType;
- switch(sibsConfig.getPackageType())
- {
- case PackageType::STATIC:
- libraryType = backend::Ninja::LibraryType::STATIC;
- break;
- case PackageType::DYNAMIC:
- case PackageType::LIBRARY:
- libraryType = backend::Ninja::LibraryType::DYNAMIC;
- break;
- default:
- assert(false);
- return Result<string>::Err("Unexpected error");
- }
-
- backend::Ninja ninja(libraryType);
+ backend::Ninja ninja;
FileWalkCallbackFunc collectSourceFiles = [&ninja, &sibsConfig, &collectSourceFiles](tinydir_file *file)
{
if(file->is_reg)
@@ -189,7 +174,7 @@ namespace sibs
string libPath = buildPath;
libPath += "/lib";
libPath += name;
- if(libraryType == backend::Ninja::LibraryType::STATIC)
+ if(sibsConfig.getPackageType() == PackageType::STATIC)
{
libPath += ".a";
string libPathCmd = "'";
@@ -255,4 +240,4 @@ namespace sibs
return Archive::extract(libArchivedFilePath.c_str(), libPath.c_str());
}
-} \ No newline at end of file
+}
diff --git a/src/main.cpp b/src/main.cpp
index 9e84521..26cab5c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -197,23 +197,7 @@ int buildProject(int argc, const char **argv)
//string projectSrcPath = projectPath + "/src";
//validateDirectoryPath(projectSrcPath.c_str());
- PackageType packageType = sibsConfig.getPackageType();
- backend::Ninja::LibraryType libraryType;
- switch(packageType)
- {
- case PackageType::EXECUTABLE:
- libraryType = backend::Ninja::LibraryType::EXECUTABLE;
- break;
- case PackageType::STATIC:
- libraryType = backend::Ninja::LibraryType::STATIC;
- break;
- case PackageType::DYNAMIC:
- case PackageType::LIBRARY:
- libraryType = backend::Ninja::LibraryType::DYNAMIC;
- break;
- }
-
- backend::Ninja ninja(libraryType);
+ backend::Ninja ninja;
FileWalkCallbackFunc collectSourceFiles = [&ninja, &sibsConfig, &collectSourceFiles](tinydir_file *file)
{
if(file->is_reg)