diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bootstrap.cc | 8 | ||||
-rw-r--r-- | src/ctor.h | 22 | ||||
-rw-r--r-- | src/libctor.cc | 12 | ||||
-rw-r--r-- | src/task.cc | 2 | ||||
-rw-r--r-- | src/task.h | 4 | ||||
-rw-r--r-- | src/task_ar.cc | 2 | ||||
-rw-r--r-- | src/task_cc.cc | 2 | ||||
-rw-r--r-- | src/task_ld.cc | 4 | ||||
-rw-r--r-- | src/task_so.cc | 2 | ||||
-rw-r--r-- | src/tasks.cc | 30 | ||||
-rw-r--r-- | src/unittest.cc | 2 |
11 files changed, 45 insertions, 45 deletions
diff --git a/src/bootstrap.cc b/src/bootstrap.cc index 3a73cc6..3e0adf8 100644 --- a/src/bootstrap.cc +++ b/src/bootstrap.cc @@ -23,8 +23,8 @@ std::filesystem::path configurationFile("configuration.cc"); std::filesystem::path configHeaderFile("config.h"); namespace ctor { -const ctor::Configuration default_configuration{}; -const ctor::Configuration& configuration() +const Configuration default_configuration{}; +const Configuration& configuration() { return default_configuration; } @@ -81,8 +81,8 @@ int main(int argc, char* argv[]) auto& targets = getTargets(settings); for(const auto& target : targets) { - if(target.config.type != TargetType::UnitTest && - target.config.type != TargetType::UnitTestLib) + if(target.config.type != ctor::target_type::unit_test && + target.config.type != ctor::target_type::unit_test_library) { non_unittest_targets.push_back(target); } @@ -13,17 +13,17 @@ namespace ctor { -enum class TargetType +enum class target_type { - Auto, // Default - deduce from target name and sources extensions - - Executable, - StaticLibrary, - DynamicLibrary, - Object, - UnitTest, - UnitTestLib, - Function, + automatic, // Default - deduce from target name and sources extensions + + executable, + static_library, + dynamic_library, + object, + unit_test, + unit_test_library, + function, }; enum class Language @@ -82,7 +82,7 @@ using GeneratorCb = std::function<int(const std::string& input, struct BuildConfiguration { std::string name; // Name - used for referring in other configurations. - TargetType type{TargetType::Auto}; + ctor::target_type type{ctor::target_type::automatic}; OutputSystem system{OutputSystem::Host}; std::string target; // Output target file for this configuration std::vector<Source> sources; // source list diff --git a/src/libctor.cc b/src/libctor.cc index 83002db..7e39549 100644 --- a/src/libctor.cc +++ b/src/libctor.cc @@ -317,8 +317,8 @@ Options: auto& targets = getTargets(settings); for(const auto& target : targets) { - if(target.config.type == TargetType::UnitTest || - target.config.type == TargetType::UnitTestLib) + if(target.config.type == ctor::target_type::unit_test || + target.config.type == ctor::target_type::unit_test_library) { unittest_targets.push_back(target); } @@ -340,8 +340,8 @@ Options: auto& targets = getTargets(settings); for(const auto& target : targets) { - if(target.config.type != TargetType::UnitTest && - target.config.type != TargetType::UnitTestLib) + if(target.config.type != ctor::target_type::unit_test && + target.config.type != ctor::target_type::unit_test_library) { non_unittest_targets.push_back(target); } @@ -370,8 +370,8 @@ Options: auto& targets = getTargets(settings); for(const auto& target : targets) { - if(target.config.type != TargetType::UnitTest && - target.config.type != TargetType::UnitTestLib) + if(target.config.type != ctor::target_type::unit_test && + target.config.type != ctor::target_type::unit_test_library) { non_unittest_targets.push_back(target); } diff --git a/src/task.cc b/src/task.cc index 5e3bbb8..fa843c7 100644 --- a/src/task.cc +++ b/src/task.cc @@ -114,7 +114,7 @@ const BuildConfiguration& Task::buildConfig() const return config; } -TargetType Task::targetType() const +ctor::target_type Task::targetType() const { return target_type; } @@ -59,7 +59,7 @@ public: //! (target) task. const ctor::BuildConfiguration& buildConfig() const; - ctor::TargetType targetType() const; + ctor::target_type targetType() const; ctor::Language sourceLanguage() const; ctor::OutputSystem outputSystem() const; std::string compiler() const; @@ -76,7 +76,7 @@ protected: std::vector<std::string> dependsStr; std::set<std::shared_ptr<Task>> dependsTasks; const ctor::BuildConfiguration& config; - ctor::TargetType target_type{ctor::TargetType::Auto}; + ctor::target_type target_type{ctor::target_type::automatic}; ctor::Language source_language{ctor::Language::Auto}; ctor::OutputSystem output_system{ctor::OutputSystem::Host}; const ctor::Settings& settings; diff --git a/src/task_ar.cc b/src/task_ar.cc index 024755f..eaf23e6 100644 --- a/src/task_ar.cc +++ b/src/task_ar.cc @@ -40,7 +40,7 @@ TaskAR::TaskAR(const BuildConfiguration& config, flagsFile = std::filesystem::path(settings.builddir) / cleanUp(sourceDir) / targetFile().stem(); flagsFile += ".flags"; - target_type = TargetType::StaticLibrary; + target_type = ctor::target_type::static_library; source_language = Language::C; for(const auto& source : config.sources) { diff --git a/src/task_cc.cc b/src/task_cc.cc index 9ec3e01..2b1e648 100644 --- a/src/task_cc.cc +++ b/src/task_cc.cc @@ -32,7 +32,7 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings, base += "-"; base += sourceFile.stem(); - target_type = TargetType::Object; + target_type = ctor::target_type::object; source_language = source.language; if(source_language == Language::Auto) { diff --git a/src/task_ld.cc b/src/task_ld.cc index acd733b..9a36bd9 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -24,9 +24,9 @@ TaskLD::TaskLD(const BuildConfiguration& config, , sourceDir(sourceDir) { target_type = config.type; - if(target_type == TargetType::Auto) + if(target_type == ctor::target_type::automatic) { - target_type = TargetType::Executable; + target_type = ctor::target_type::executable; } std::filesystem::create_directories(std::filesystem::path(settings.builddir) / sourceDir); diff --git a/src/task_so.cc b/src/task_so.cc index fc5ef4a..4d154d7 100644 --- a/src/task_so.cc +++ b/src/task_so.cc @@ -42,7 +42,7 @@ TaskSO::TaskSO(const BuildConfiguration& config, flagsFile = std::filesystem::path(settings.builddir) / cleanUp(sourceDir) / targetFile().stem(); flagsFile += ".flags"; - target_type = TargetType::DynamicLibrary; + target_type = ctor::target_type::dynamic_library; source_language = Language::C; for(const auto& source : config.sources) { diff --git a/src/tasks.cc b/src/tasks.cc index 2d83349..a1d4c70 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -87,24 +87,24 @@ std::set<std::shared_ptr<Task>> taskFactory(const BuildConfiguration& config, std::filesystem::path targetFile(config.target); - TargetType target_type{config.type}; - if(target_type == TargetType::Auto) + ctor::target_type target_type{config.type}; + if(target_type == ctor::target_type::automatic) { if(config.function != nullptr) { - target_type = TargetType::Function; + target_type = ctor::target_type::function; } else if(targetFile.extension() == ".a") { - target_type = TargetType::StaticLibrary; + target_type = ctor::target_type::static_library; } else if(targetFile.extension() == ".so") { - target_type = TargetType::DynamicLibrary; + target_type = ctor::target_type::dynamic_library; } else if(targetFile.extension() == "") { - target_type = TargetType::Executable; + target_type = ctor::target_type::executable; } else { @@ -115,7 +115,7 @@ std::set<std::shared_ptr<Task>> taskFactory(const BuildConfiguration& config, } std::vector<std::string> objects; - if(target_type != TargetType::Function) + if(target_type != ctor::target_type::function) { for(const auto& file : config.sources) { @@ -138,17 +138,17 @@ std::set<std::shared_ptr<Task>> taskFactory(const BuildConfiguration& config, switch(target_type) { - case TargetType::Auto: + case ctor::target_type::automatic: // The target_type cannot be Auto break; - case TargetType::StaticLibrary: - case TargetType::UnitTestLib: + case ctor::target_type::static_library: + case ctor::target_type::unit_test_library: tasks.insert(std::make_shared<TaskAR>(config, settings, config.target, objects, sourceDir)); break; #ifndef BOOTSTRAP - case TargetType::DynamicLibrary: + case ctor::target_type::dynamic_library: // TODO: Use C++20 starts_with if(targetFile.stem().string().substr(0, 3) != "lib") { @@ -159,14 +159,14 @@ std::set<std::shared_ptr<Task>> taskFactory(const BuildConfiguration& config, objects, sourceDir)); break; - case TargetType::Executable: - case TargetType::UnitTest: + case ctor::target_type::executable: + case ctor::target_type::unit_test: tasks.insert(std::make_shared<TaskLD>(config, settings, config.target, objects, sourceDir)); break; - case TargetType::Object: - case TargetType::Function: + case ctor::target_type::object: + case ctor::target_type::function: break; #else default: diff --git a/src/unittest.cc b/src/unittest.cc index cceaec7..855a2ae 100644 --- a/src/unittest.cc +++ b/src/unittest.cc @@ -18,7 +18,7 @@ int runUnitTests(std::set<std::shared_ptr<Task>>& tasks, // Run unit-tests for(const auto& task : tasks) { - if(task->targetType() == TargetType::UnitTest) + if(task->targetType() == ctor::target_type::unit_test) { auto name = task->name(); if(name.empty()) |