From 75d1fa7244b9c5cddae056a281f457dd1e81cfb2 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 11 Jan 2023 17:47:30 +0100 Subject: Rename TargetType::Xyz to target_type::xyz --- ctor.cc | 2 +- src/bootstrap.cc | 8 ++++---- src/ctor.h | 22 +++++++++++----------- src/libctor.cc | 12 ++++++------ src/task.cc | 2 +- src/task.h | 4 ++-- src/task_ar.cc | 2 +- src/task_cc.cc | 2 +- src/task_ld.cc | 4 ++-- src/task_so.cc | 2 +- src/tasks.cc | 30 +++++++++++++++--------------- src/unittest.cc | 2 +- test/ctor.cc | 10 +++++----- 13 files changed, 51 insertions(+), 51 deletions(-) diff --git a/ctor.cc b/ctor.cc index 6fe4084..04e4cad 100644 --- a/ctor.cc +++ b/ctor.cc @@ -10,7 +10,7 @@ ctor::BuildConfigurations ctorConfigs(const ctor::Settings& settings) return { { - .type = ctor::TargetType::StaticLibrary, + .type = ctor::target_type::static_library, .target = "libctor.a", .sources = { "src/build.cc", 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); } diff --git a/src/ctor.h b/src/ctor.h index 9770c09..2fefac3 100644 --- a/src/ctor.h +++ b/src/ctor.h @@ -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 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; } diff --git a/src/task.h b/src/task.h index b4f37a5..1d61665 100644 --- a/src/task.h +++ b/src/task.h @@ -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 dependsStr; std::set> 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> 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> taskFactory(const BuildConfiguration& config, } std::vector 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> 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(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> 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(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>& 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()) diff --git a/test/ctor.cc b/test/ctor.cc index 1a63486..fcb275d 100644 --- a/test/ctor.cc +++ b/test/ctor.cc @@ -10,7 +10,7 @@ ctor::BuildConfigurations ctorTestConfigs(const ctor::Settings& settings) return { { - .type = ctor::TargetType::UnitTest, + .type = ctor::target_type::unit_test, .target = "execute_test", .sources = { "execute_test.cc", @@ -27,7 +27,7 @@ ctor::BuildConfigurations ctorTestConfigs(const ctor::Settings& settings) }, }, { - .type = ctor::TargetType::UnitTest, + .type = ctor::target_type::unit_test, .target = "tasks_test", .sources = { "tasks_test.cc", @@ -44,7 +44,7 @@ ctor::BuildConfigurations ctorTestConfigs(const ctor::Settings& settings) }, }, { - .type = ctor::TargetType::UnitTest, + .type = ctor::target_type::unit_test, .target = "source_type_test", .sources = { "source_type_test.cc", @@ -61,7 +61,7 @@ ctor::BuildConfigurations ctorTestConfigs(const ctor::Settings& settings) }, }, { - .type = ctor::TargetType::UnitTest, + .type = ctor::target_type::unit_test, .target = "tools_test", .sources = { "tools_test.cc", @@ -78,7 +78,7 @@ ctor::BuildConfigurations ctorTestConfigs(const ctor::Settings& settings) }, }, { - .type = ctor::TargetType::UnitTestLib, + .type = ctor::target_type::unit_test_library, .target = "libctor_nomain.a", .sources = { "../src/build.cc", -- cgit v1.2.3