From 8b052110d8802eda3d4d76700bde8ecc80dbf79a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 3 Jan 2018 21:17:49 +0100 Subject: Add "sibs test" command. Tests are only run when that command is invoked --- include/Conf.hpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'include/Conf.hpp') diff --git a/include/Conf.hpp b/include/Conf.hpp index 476e38b..de63eae 100644 --- a/include/Conf.hpp +++ b/include/Conf.hpp @@ -169,13 +169,14 @@ namespace sibs class SibsConfig : public ConfigCallback { public: - SibsConfig(Compiler _compiler, const FileString &_projectPath, OptimizationLevel _optimizationLevel = OPT_LEV_DEBUG) : + SibsConfig(Compiler _compiler, const FileString &_projectPath, OptimizationLevel _optimizationLevel, bool _buildTests) : compiler(_compiler), projectPath(_projectPath), packageType((PackageType)-1), optimizationLevel(_optimizationLevel), finishedProcessing(false), - useCmake(false) + useCmake(false), + buildTests(_buildTests) { cmakeDirGlobal = projectPath; cmakeDirStatic = cmakeDirGlobal; @@ -214,6 +215,11 @@ namespace sibs { return testPath; } + + void setTestPath(const FileString &testPath) + { + this->testPath = testPath; + } virtual const std::vector& getDependencies() const { @@ -267,12 +273,12 @@ namespace sibs const FileString& getCmakeDirStatic() const { - return cmakeDirStatic; + return !cmakeDirStatic.empty() ? cmakeDirStatic : cmakeDirGlobal; } const FileString& getCmakeDirDynamic() const { - return cmakeDirDynamic; + return !cmakeDirDynamic.empty() ? cmakeDirDynamic : cmakeDirGlobal; } // Get cmake args for all builds. This is args under [cmake] only @@ -308,6 +314,11 @@ namespace sibs return useCmake; } + bool shouldBuildTests() const + { + return buildTests; + } + void setPackageType(PackageType packageType) { this->packageType = packageType; @@ -351,13 +362,14 @@ namespace sibs std::string cmakeArgsStatic; std::string cmakeArgsDynamic; bool useCmake; + bool buildTests; bool finishedProcessing; }; class SibsTestConfig : public SibsConfig { public: - SibsTestConfig(Compiler _compiler, const FileString &_projectPath, OptimizationLevel _optimizationLevel) : SibsConfig(_compiler, _projectPath, _optimizationLevel) + SibsTestConfig(Compiler _compiler, const FileString &_projectPath, OptimizationLevel _optimizationLevel) : SibsConfig(_compiler, _projectPath, _optimizationLevel, true) { packageName = "test"; } -- cgit v1.2.3