diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-12 15:49:16 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-12 15:59:22 +0100 |
commit | c093758b4688fb5bae2cc7727b6c9b52b824043e (patch) | |
tree | f92c206b0fa6366319e17f1c7f375dfeb0ab5f27 | |
parent | cc4e14d243f4e7e1ad487d8865c5ffc8423e473d (diff) |
Move tools opt to ctor.h and rename tool_chain to toolchain for consistency.
-rw-r--r-- | src/ctor.h | 22 | ||||
-rw-r--r-- | src/externals_manual.cc | 8 | ||||
-rw-r--r-- | src/rebuild.cc | 14 | ||||
-rw-r--r-- | src/task_cc.cc | 15 | ||||
-rw-r--r-- | src/task_ld.cc | 8 | ||||
-rw-r--r-- | src/task_so.cc | 8 | ||||
-rw-r--r-- | src/tools.cc | 52 | ||||
-rw-r--r-- | src/tools.h | 28 | ||||
-rw-r--r-- | test/tools_test.cc | 128 |
9 files changed, 142 insertions, 141 deletions
@@ -66,6 +66,28 @@ enum class toolchain clang, }; +enum class opt +{ + // gcc/clang + output, // -o + debug, // -g + strip, // -s + warn_all, // -Wall + warnings_as_errors, // -Werror + generate_dep_tree, // -MMD + no_link, // -c + include_path, // -I<arg> + library_path, // -L<arg> + link, // -l<arg> + cpp_std, // -std=<arg> + build_shared, // -shared + threads, // -pthread + optimization, // -O<arg> + position_independent_code, // -fPIC + position_independent_executable, // -fPIE + custom, // entire option taken verbatim from <arg> +}; + struct flags { std::vector<std::string> cxxflags; // flags for c++ compiler diff --git a/src/externals_manual.cc b/src/externals_manual.cc index d6b519b..bc8e9d0 100644 --- a/src/externals_manual.cc +++ b/src/externals_manual.cc @@ -16,21 +16,21 @@ extern std::map<std::string, std::string> external_libdir; int resolv(const ctor::settings& settings, const ctor::external_configuration& config, const ctor::external_manual& ext, ctor::flags& flags) { - auto tool_chain = getToolChain(config.system); + auto toolchain = getToolChain(config.system); flags = ext.flags; auto inc = external_includedir.find(config.name); if(inc != external_includedir.end()) { - append(flags.cflags, getOption(tool_chain, opt::include_path, inc->second)); - append(flags.cxxflags, getOption(tool_chain, opt::include_path, inc->second)); + append(flags.cflags, getOption(toolchain, ctor::opt::include_path, inc->second)); + append(flags.cxxflags, getOption(toolchain, ctor::opt::include_path, inc->second)); } auto lib = external_libdir.find(config.name); if(lib != external_libdir.end()) { - append(flags.ldflags, getOption(tool_chain, opt::library_path, lib->second)); + append(flags.ldflags, getOption(toolchain, ctor::opt::library_path, lib->second)); } return 0; diff --git a/src/rebuild.cc b/src/rebuild.cc index 0d610b5..dec7119 100644 --- a/src/rebuild.cc +++ b/src/rebuild.cc @@ -162,27 +162,27 @@ bool recompileCheck(const ctor::settings& global_settings, int argc, char* argv[ config.name = "ctor"; config.system = ctor::output_system::build; - auto tool_chain = getToolChain(config.system); + auto toolchain = getToolChain(config.system); append(config.flags.cxxflags, - getOption(tool_chain, opt::optimization, "3")); + getOption(toolchain, ctor::opt::optimization, "3")); append(config.flags.cxxflags, - getOption(tool_chain, opt::cpp_std, "c++20")); + getOption(toolchain, ctor::opt::cpp_std, "c++20")); const auto& c = ctor::get_configuration(); if(c.has(ctor::cfg::ctor_includedir)) { append(config.flags.cxxflags, - getOption(tool_chain, opt::include_path, + getOption(toolchain, ctor::opt::include_path, c.get(ctor::cfg::ctor_includedir))); } if(c.has(ctor::cfg::ctor_libdir)) { append(config.flags.ldflags, - getOption(tool_chain, opt::library_path, + getOption(toolchain, ctor::opt::library_path, c.get(ctor::cfg::ctor_libdir))); } - append(config.flags.ldflags, getOption(tool_chain, opt::link, "ctor")); - append(config.flags.ldflags, getOption(tool_chain, opt::threads)); + append(config.flags.ldflags, getOption(toolchain, ctor::opt::link, "ctor")); + append(config.flags.ldflags, getOption(toolchain, ctor::opt::threads)); ctor::settings settings{global_settings}; settings.verbose = -1; // Make check completely silent. diff --git a/src/task_cc.cc b/src/task_cc.cc index 7f69998..c15bd6a 100644 --- a/src/task_cc.cc +++ b/src/task_cc.cc @@ -281,22 +281,21 @@ std::string TaskCC::flagsString() const std::vector<std::string> TaskCC::getCompilerArgs() const { - auto tool_chain = getToolChain(config.system); - + auto toolchain = getToolChain(config.system); auto compiler_flags = flags(); std::vector<std::string> args; - append(args, getOption(tool_chain, opt::generate_dep_tree)); + append(args, getOption(toolchain, ctor::opt::generate_dep_tree)); if(std::filesystem::path(config.target).extension() == ".so") { // Add -fPIC arg to all contained object files - append(args, getOption(tool_chain, opt::position_independent_code)); + append(args, getOption(toolchain, ctor::opt::position_independent_code)); } - append(args, getOption(tool_chain, opt::no_link)); + append(args, getOption(toolchain, ctor::opt::no_link)); args.push_back(sourceFile.string()); - append(args, getOption(tool_chain, opt::output, targetFile().string())); + append(args, getOption(toolchain, ctor::opt::output, targetFile().string())); for(const auto& flag : compiler_flags) { @@ -304,13 +303,13 @@ std::vector<std::string> TaskCC::getCompilerArgs() const switch(option.first) { // Relative include paths has to be altered to be relative to sourceDir - case opt::include_path: + case ctor::opt::include_path: { std::filesystem::path path(option.second); if(path.is_relative()) { path = (sourceDir / path).lexically_normal(); - append(args, getOption(tool_chain, opt::include_path, path.string())); + append(args, getOption(toolchain, ctor::opt::include_path, path.string())); } } continue; diff --git a/src/task_ld.cc b/src/task_ld.cc index 916f3ff..4915de9 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -82,7 +82,7 @@ bool TaskLD::dirtyInner() int TaskLD::runInner() { - auto tool_chain = getToolChain(config.system); + auto toolchain = getToolChain(config.system); std::vector<std::string> args; for(const auto& dep : getDependsTasks()) @@ -90,10 +90,10 @@ int TaskLD::runInner() auto depFile = dep->targetFile(); if(depFile.extension() == ".so") { - append(args, getOption(tool_chain, opt::library_path, + append(args, getOption(toolchain, ctor::opt::library_path, targetFile().parent_path().string())); auto lib = depFile.stem().string().substr(3); // strip 'lib' prefix - append(args, getOption(tool_chain, opt::link, lib)); + append(args, getOption(toolchain, ctor::opt::link, lib)); } else if(depFile.extension() == ".a" || depFile.extension() == ".o") { @@ -102,7 +102,7 @@ int TaskLD::runInner() } append(args, config.flags.ldflags); - append(args, getOption(tool_chain, opt::output, targetFile().string())); + append(args, getOption(toolchain, ctor::opt::output, targetFile().string())); { // Write flags to file. std::ofstream flagsStream(flagsFile); diff --git a/src/task_so.cc b/src/task_so.cc index 0340ff1..93a5ddb 100644 --- a/src/task_so.cc +++ b/src/task_so.cc @@ -79,14 +79,14 @@ bool TaskSO::dirtyInner() int TaskSO::runInner() { - auto tool_chain = getToolChain(config.system); + auto toolchain = getToolChain(config.system); std::vector<std::string> args; - append(args, getOption(tool_chain, opt::position_independent_code)); - append(args, getOption(tool_chain, opt::build_shared)); + append(args, getOption(toolchain, ctor::opt::position_independent_code)); + append(args, getOption(toolchain, ctor::opt::build_shared)); - append(args, getOption(tool_chain, opt::output, targetFile().string())); + append(args, getOption(toolchain, ctor::opt::output, targetFile().string())); for(const auto& task : getDependsTasks()) { diff --git a/src/tools.cc b/src/tools.cc index ddb1463..610a550 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -50,43 +50,43 @@ ctor::toolchain getToolChain(ctor::output_system system) namespace { -std::vector<std::string> getOptionGcc(opt option, const std::string& arg) +std::vector<std::string> getOptionGcc(ctor::opt option, const std::string& arg) { switch(option) { - case opt::output: + case ctor::opt::output: return {"-o", arg}; - case opt::debug: + case ctor::opt::debug: return {"-g"}; - case opt::strip: + case ctor::opt::strip: return {"-s"}; - case opt::warn_all: + case ctor::opt::warn_all: return {"-Wall"}; - case opt::warnings_as_errors: + case ctor::opt::warnings_as_errors: return {"-Werror"}; - case opt::generate_dep_tree: + case ctor::opt::generate_dep_tree: return {"-MMD"}; - case opt::no_link: + case ctor::opt::no_link: return {"-c"}; - case opt::include_path: + case ctor::opt::include_path: return {"-I" + arg}; - case opt::library_path: + case ctor::opt::library_path: return {"-L" + arg}; - case opt::link: + case ctor::opt::link: return {"-l" + arg}; - case opt::cpp_std: + case ctor::opt::cpp_std: return {"-std=" + arg}; - case opt::build_shared: + case ctor::opt::build_shared: return {"-shared"}; - case opt::threads: + case ctor::opt::threads: return {"-pthread"}; - case opt::optimization: + case ctor::opt::optimization: return {"-O" + arg}; - case opt::position_independent_code: + case ctor::opt::position_independent_code: return {"-fPIC"}; - case opt::position_independent_executable: + case ctor::opt::position_independent_executable: return {"-fPIE"}; - case opt::custom: + case ctor::opt::custom: return {arg}; } @@ -96,7 +96,7 @@ std::vector<std::string> getOptionGcc(opt option, const std::string& arg) } std::vector<std::string> getOption(ctor::toolchain toolchain, - opt option, + ctor::opt option, const std::string& arg) { switch(toolchain) @@ -114,28 +114,28 @@ std::vector<std::string> getOption(ctor::toolchain toolchain, } namespace { -std::pair<opt, std::string> getOptionGcc(const std::string& flag) +std::pair<ctor::opt, std::string> getOptionGcc(const std::string& flag) { if(flag.substr(0, 2) == "-I") { std::string path = flag.substr(2); path.erase(0, path.find_first_not_of(' ')); - return { opt::include_path, path }; + return { ctor::opt::include_path, path }; } if(flag.substr(0, 2) == "-L") { std::string path = flag.substr(2); path.erase(0, path.find_first_not_of(' ')); - return { opt::library_path, path }; + return { ctor::opt::library_path, path }; } - return { opt::custom, flag }; + return { ctor::opt::custom, flag }; } } -std::pair<opt, std::string> getOption(const std::string& flag, - ctor::toolchain toolchain) +std::pair<ctor::opt, std::string> getOption(const std::string& flag, + ctor::toolchain toolchain) { switch(toolchain) { @@ -148,5 +148,5 @@ std::pair<opt, std::string> getOption(const std::string& flag, } std::cerr << "Unsupported tool-chain.\n"; - return { opt::custom, flag }; + return { ctor::opt::custom, flag }; } diff --git a/src/tools.h b/src/tools.h index bedb708..e6c2264 100644 --- a/src/tools.h +++ b/src/tools.h @@ -8,28 +8,6 @@ #include "ctor.h" -enum class opt -{ - // gcc/clang - output, // -o - debug, // -g - strip, // -s - warn_all, // -Wall - warnings_as_errors, // -Werror - generate_dep_tree, // -MMD - no_link, // -c - include_path, // -I<arg> - library_path, // -L<arg> - link, // -l<arg> - cpp_std, // -std=<arg> - build_shared, // -shared - threads, // -pthread - optimization, // -O<arg> - position_independent_code, // -fPIC - position_independent_executable, // -fPIE - custom, // entire option taken verbatim from <arg> -}; - //! Get tool-chain type from compiler path string ctor::toolchain getToolChain(const std::string& compiler); @@ -39,11 +17,11 @@ ctor::toolchain getToolChain(ctor::output_system system); //! Get tool argument(s) for specific option type matching the supplied //! tool-chain std::vector<std::string> getOption(ctor::toolchain toolchain, - opt option, + ctor::opt option, const std::string& arg = {}); //! Get opt enum value and argument from string, //! ie. { opt::InludePath, "foo/bar" } from "-Ifoo/bar" //! Returns { opt::Custom, flag } if unknown. -std::pair<opt, std::string> getOption(const std::string& flag, - ctor::toolchain toolchain = ctor::toolchain::gcc); +std::pair<ctor::opt, std::string> getOption(const std::string& flag, + ctor::toolchain toolchain = ctor::toolchain::gcc); diff --git a/test/tools_test.cc b/test/tools_test.cc index 4cc9a77..118490f 100644 --- a/test/tools_test.cc +++ b/test/tools_test.cc @@ -5,7 +5,9 @@ #include <tools.h> std::ostream& operator<<(std::ostream& stream, const std::vector<std::string>& vs); -std::ostream& operator<<(std::ostream& stream, const ctor::toolchain& tool_chain); +std::ostream& operator<<(std::ostream& stream, const ctor::toolchain& toolchain); +std::ostream& operator<<(std::ostream& stream, const ctor::opt& opt); +std::ostream& operator<<(std::ostream& stream, const std::pair<ctor::opt, std::string>& vs); #include <uunit.h> @@ -14,9 +16,9 @@ std::ostream& operator<<(std::ostream& stream, const ctor::toolchain& tool_chain using namespace std::string_literals; -std::ostream& operator<<(std::ostream& stream, const ctor::toolchain& tool_chain) +std::ostream& operator<<(std::ostream& stream, const ctor::toolchain& toolchain) { - switch(tool_chain) + switch(toolchain) { case ctor::toolchain::none: stream << "ctor::toolchain::none"; @@ -52,34 +54,34 @@ std::ostream& operator<<(std::ostream& stream, const std::vector<std::string>& v return stream; } -std::ostream& operator<<(std::ostream& stream, opt o) +std::ostream& operator<<(std::ostream& stream, const ctor::opt& opt) { // Adding to this enum should also imply adding to the unit-tests below - switch(o) + switch(opt) { - case opt::output: stream << "opt::output"; break; - case opt::debug: stream << "opt::debug"; break; - case opt::strip: stream << "opt::strip"; break; - case opt::warn_all: stream << "opt::warn_all"; break; - case opt::warnings_as_errors: stream << "opt::warnings_as_errors"; break; - case opt::generate_dep_tree: stream << "opt::generate_dep_tree"; break; - case opt::no_link: stream << "opt::no_link"; break; - case opt::include_path: stream << "opt::include_path"; break; - case opt::library_path: stream << "opt::library_path"; break; - case opt::link: stream << "opt::link"; break; - case opt::cpp_std: stream << "opt::cpp_std"; break; - case opt::build_shared: stream << "opt::build_shared"; break; - case opt::threads: stream << "opt::threads"; break; - case opt::optimization: stream << "opt::optimization"; break; - case opt::position_independent_code: stream << "opt::position_independent_code"; break; - case opt::position_independent_executable: stream << "opt::position_independent_executable"; break; - case opt::custom: stream << "opt::custom"; break; + case ctor::opt::output: stream << "ctor::opt::output"; break; + case ctor::opt::debug: stream << "ctor::opt::debug"; break; + case ctor::opt::strip: stream << "ctor::opt::strip"; break; + case ctor::opt::warn_all: stream << "ctor::opt::warn_all"; break; + case ctor::opt::warnings_as_errors: stream << "ctor::opt::warnings_as_errors"; break; + case ctor::opt::generate_dep_tree: stream << "ctor::opt::generate_dep_tree"; break; + case ctor::opt::no_link: stream << "ctor::opt::no_link"; break; + case ctor::opt::include_path: stream << "ctor::opt::include_path"; break; + case ctor::opt::library_path: stream << "ctor::opt::library_path"; break; + case ctor::opt::link: stream << "ctor::opt::link"; break; + case ctor::opt::cpp_std: stream << "ctor::opt::cpp_std"; break; + case ctor::opt::build_shared: stream << "ctor::opt::build_shared"; break; + case ctor::opt::threads: stream << "ctor::opt::threads"; break; + case ctor::opt::optimization: stream << "ctor::opt::optimization"; break; + case ctor::opt::position_independent_code: stream << "ctor::opt::position_independent_code"; break; + case ctor::opt::position_independent_executable: stream << "ctor::opt::position_independent_executable"; break; + case ctor::opt::custom: stream << "ctor::opt::custom"; break; } return stream; } -std::ostream& operator<<(std::ostream& stream, const std::pair<opt, std::string>& vs) +std::ostream& operator<<(std::ostream& stream, const std::pair<ctor::opt, std::string>& vs) { stream << "{ " << vs.first << ", " << vs.second << " }"; @@ -142,160 +144,160 @@ public: std::vector<std::string> act; exp = { "-o", "foo" }; - act = getOption(ctor::toolchain::clang, opt::output, "foo"); + act = getOption(ctor::toolchain::clang, ctor::opt::output, "foo"); uASSERT_EQUAL(exp, act); exp = { "-g" }; - act = getOption(ctor::toolchain::clang, opt::debug); + act = getOption(ctor::toolchain::clang, ctor::opt::debug); uASSERT_EQUAL(exp, act); exp = { "-s" }; - act = getOption(ctor::toolchain::clang, opt::strip); + act = getOption(ctor::toolchain::clang, ctor::opt::strip); uASSERT_EQUAL(exp, act); exp = { "-Wall" }; - act = getOption(ctor::toolchain::clang, opt::warn_all); + act = getOption(ctor::toolchain::clang, ctor::opt::warn_all); uASSERT_EQUAL(exp, act); exp = { "-Werror" }; - act = getOption(ctor::toolchain::clang, opt::warnings_as_errors); + act = getOption(ctor::toolchain::clang, ctor::opt::warnings_as_errors); uASSERT_EQUAL(exp, act); exp = { "-MMD" }; - act = getOption(ctor::toolchain::clang, opt::generate_dep_tree); + act = getOption(ctor::toolchain::clang, ctor::opt::generate_dep_tree); uASSERT_EQUAL(exp, act); exp = { "-c" }; - act = getOption(ctor::toolchain::clang, opt::no_link); + act = getOption(ctor::toolchain::clang, ctor::opt::no_link); uASSERT_EQUAL(exp, act); exp = { "-Ifoo" }; - act = getOption(ctor::toolchain::clang, opt::include_path, "foo"); + act = getOption(ctor::toolchain::clang, ctor::opt::include_path, "foo"); uASSERT_EQUAL(exp, act); exp = { "-Lfoo" }; - act = getOption(ctor::toolchain::clang, opt::library_path, "foo"); + act = getOption(ctor::toolchain::clang, ctor::opt::library_path, "foo"); uASSERT_EQUAL(exp, act); exp = { "-lfoo" }; - act = getOption(ctor::toolchain::clang, opt::link, "foo"); + act = getOption(ctor::toolchain::clang, ctor::opt::link, "foo"); uASSERT_EQUAL(exp, act); exp = { "-std=foo" }; - act = getOption(ctor::toolchain::clang, opt::cpp_std, "foo"); + act = getOption(ctor::toolchain::clang, ctor::opt::cpp_std, "foo"); uASSERT_EQUAL(exp, act); exp = { "-shared" }; - act = getOption(ctor::toolchain::clang, opt::build_shared); + act = getOption(ctor::toolchain::clang, ctor::opt::build_shared); uASSERT_EQUAL(exp, act); exp = { "-pthread" }; - act = getOption(ctor::toolchain::clang, opt::threads); + act = getOption(ctor::toolchain::clang, ctor::opt::threads); uASSERT_EQUAL(exp, act); exp = { "-Ofoo" }; - act = getOption(ctor::toolchain::clang, opt::optimization, "foo"); + act = getOption(ctor::toolchain::clang, ctor::opt::optimization, "foo"); uASSERT_EQUAL(exp, act); exp = { "-fPIC" }; - act = getOption(ctor::toolchain::clang, opt::position_independent_code); + act = getOption(ctor::toolchain::clang, ctor::opt::position_independent_code); uASSERT_EQUAL(exp, act); exp = { "-fPIE" }; - act = getOption(ctor::toolchain::clang, opt::position_independent_executable); + act = getOption(ctor::toolchain::clang, ctor::opt::position_independent_executable); uASSERT_EQUAL(exp, act); exp = { "-foo" }; - act = getOption(ctor::toolchain::clang, opt::custom, "-foo"); + act = getOption(ctor::toolchain::clang, ctor::opt::custom, "-foo"); uASSERT_EQUAL(exp, act); exp = { "-o", "foo" }; - act = getOption(ctor::toolchain::gcc, opt::output, "foo"); + act = getOption(ctor::toolchain::gcc, ctor::opt::output, "foo"); uASSERT_EQUAL(exp, act); exp = { "-g" }; - act = getOption(ctor::toolchain::gcc, opt::debug); + act = getOption(ctor::toolchain::gcc, ctor::opt::debug); uASSERT_EQUAL(exp, act); exp = { "-s" }; - act = getOption(ctor::toolchain::gcc, opt::strip); + act = getOption(ctor::toolchain::gcc, ctor::opt::strip); uASSERT_EQUAL(exp, act); exp = { "-Wall" }; - act = getOption(ctor::toolchain::gcc, opt::warn_all); + act = getOption(ctor::toolchain::gcc, ctor::opt::warn_all); uASSERT_EQUAL(exp, act); exp = { "-Werror" }; - act = getOption(ctor::toolchain::gcc, opt::warnings_as_errors); + act = getOption(ctor::toolchain::gcc, ctor::opt::warnings_as_errors); uASSERT_EQUAL(exp, act); exp = { "-MMD" }; - act = getOption(ctor::toolchain::gcc, opt::generate_dep_tree); + act = getOption(ctor::toolchain::gcc, ctor::opt::generate_dep_tree); uASSERT_EQUAL(exp, act); exp = { "-c" }; - act = getOption(ctor::toolchain::gcc, opt::no_link); + act = getOption(ctor::toolchain::gcc, ctor::opt::no_link); uASSERT_EQUAL(exp, act); exp = { "-Ifoo" }; - act = getOption(ctor::toolchain::gcc, opt::include_path, "foo"); + act = getOption(ctor::toolchain::gcc, ctor::opt::include_path, "foo"); uASSERT_EQUAL(exp, act); exp = { "-Lfoo" }; - act = getOption(ctor::toolchain::gcc, opt::library_path, "foo"); + act = getOption(ctor::toolchain::gcc, ctor::opt::library_path, "foo"); uASSERT_EQUAL(exp, act); exp = { "-lfoo" }; - act = getOption(ctor::toolchain::gcc, opt::link, "foo"); + act = getOption(ctor::toolchain::gcc, ctor::opt::link, "foo"); uASSERT_EQUAL(exp, act); exp = { "-std=foo" }; - act = getOption(ctor::toolchain::gcc, opt::cpp_std, "foo"); + act = getOption(ctor::toolchain::gcc, ctor::opt::cpp_std, "foo"); uASSERT_EQUAL(exp, act); exp = { "-shared" }; - act = getOption(ctor::toolchain::gcc, opt::build_shared); + act = getOption(ctor::toolchain::gcc, ctor::opt::build_shared); uASSERT_EQUAL(exp, act); exp = { "-pthread" }; - act = getOption(ctor::toolchain::gcc, opt::threads); + act = getOption(ctor::toolchain::gcc, ctor::opt::threads); uASSERT_EQUAL(exp, act); exp = { "-Ofoo" }; - act = getOption(ctor::toolchain::gcc, opt::optimization, "foo"); + act = getOption(ctor::toolchain::gcc, ctor::opt::optimization, "foo"); uASSERT_EQUAL(exp, act); exp = { "-fPIC" }; - act = getOption(ctor::toolchain::gcc, opt::position_independent_code); + act = getOption(ctor::toolchain::gcc, ctor::opt::position_independent_code); uASSERT_EQUAL(exp, act); exp = { "-fPIE" }; - act = getOption(ctor::toolchain::gcc, opt::position_independent_executable); + act = getOption(ctor::toolchain::gcc, ctor::opt::position_independent_executable); uASSERT_EQUAL(exp, act); exp = { "-foo" }; - act = getOption(ctor::toolchain::gcc, opt::custom, "-foo"); + act = getOption(ctor::toolchain::gcc, ctor::opt::custom, "-foo"); uASSERT_EQUAL(exp, act); } void getOption_str_test() { - std::pair<opt, std::string> exp; - std::pair<opt, std::string> act; + std::pair<ctor::opt, std::string> exp; + std::pair<ctor::opt, std::string> act; - exp = { opt::include_path, "foo" }; + exp = { ctor::opt::include_path, "foo" }; act = getOption("-Ifoo", ctor::toolchain::gcc); uASSERT_EQUAL(exp, act); - exp = { opt::library_path, "foo" }; + exp = { ctor::opt::library_path, "foo" }; act = getOption("-Lfoo", ctor::toolchain::gcc); uASSERT_EQUAL(exp, act); - exp = { opt::include_path, "foo" }; + exp = { ctor::opt::include_path, "foo" }; act = getOption("-Ifoo", ctor::toolchain::clang); uASSERT_EQUAL(exp, act); - exp = { opt::library_path, "foo" }; + exp = { ctor::opt::library_path, "foo" }; act = getOption("-Lfoo", ctor::toolchain::clang); uASSERT_EQUAL(exp, act); } |