From cfe578ec12198d09a9a89a2e0b40bccaa06aa8ae Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 11 Dec 2017 20:19:28 +0100 Subject: Add package type to project.conf Type can be either executable or library. Executable: project compiles to an executable binary. Library: project compiles to either a static or dynamic library, depending on what how the dependent project wants the dependency to compile. With having type in project.conf, you cant include wrong type of project (an executable including another executable, conflicting main functions). --- include/Conf.hpp | 16 ++++++++++------ include/Package.hpp | 13 +++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 include/Package.hpp (limited to 'include') diff --git a/include/Conf.hpp b/include/Conf.hpp index 3634f4c..c792075 100644 --- a/include/Conf.hpp +++ b/include/Conf.hpp @@ -5,6 +5,7 @@ #include "StringView.hpp" #include "utils.hpp" #include "Dependency.hpp" +#include "Package.hpp" #include #include #include @@ -84,7 +85,7 @@ namespace sibs class SibsConfig : public ConfigCallback { public: - SibsConfig() : finishedProcessing(false) {} + SibsConfig() : finishedProcessing(false), packageType((PackageType)-1) {} const std::string& getPackageName() const { @@ -92,6 +93,12 @@ namespace sibs return packageName; } + PackageType getPackageType() const + { + assert(finishedProcessing); + return packageType; + } + const std::vector& getDependencies() const { return dependencies; @@ -99,14 +106,11 @@ namespace sibs protected: void processObject(StringView name) override; void processField(StringView name, const ConfigValue &value) override; - - void finished() override - { - finishedProcessing = true; - } + void finished() override; private: StringView currentObject; std::string packageName; + PackageType packageType; std::vector dependencies; bool finishedProcessing; }; diff --git a/include/Package.hpp b/include/Package.hpp new file mode 100644 index 0000000..130e987 --- /dev/null +++ b/include/Package.hpp @@ -0,0 +1,13 @@ +#ifndef SIBS_PACKAGE_HPP +#define SIBS_PACKAGE_HPP + +namespace sibs +{ + enum class PackageType : int + { + EXECUTABLE, + LIBRARY + }; +} + +#endif //SIBS_PACKAGE_HPP -- cgit v1.2.3