summaryrefslogtreecommitdiff
path: root/src/ctor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ctor.h')
-rw-r--r--src/ctor.h86
1 files changed, 79 insertions, 7 deletions
diff --git a/src/ctor.h b/src/ctor.h
index 388ec1b..36aa46a 100644
--- a/src/ctor.h
+++ b/src/ctor.h
@@ -66,34 +66,106 @@ enum class toolchain
clang,
};
-enum class opt
+enum class cxx_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>
+ cpp_std, // -std=<arg>
+ optimization, // -O<arg>
+ position_independent_code, // -fPIC
+ position_independent_executable, // -fPIE
+ custom, // entire option taken verbatim from <arg>
+};
+
+enum class c_opt
+{
+ // gcc/clang
+ output, // -o
+ debug, // -g
+ warn_all, // -Wall
+ warnings_as_errors, // -Werror
+ generate_dep_tree, // -MMD
+ no_link, // -c
+ include_path, // -I<arg>
+ c_std, // -std=<arg>
+ optimization, // -O<arg>
+ position_independent_code, // -fPIC
+ position_independent_executable, // -fPIE
+ custom, // entire option taken verbatim from <arg>
+};
+
+enum class ld_opt
+{
+ // gcc/clang
+ output, // -o
+ strip, // -s
+ warn_all, // -Wall
+ warnings_as_errors, // -Werror
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>
};
+enum class ar_opt
+{
+ // gcc/clang
+ custom, // entire option taken verbatim from <arg>
+};
+
+enum class asm_opt
+{
+ // gcc/clang
+ custom, // entire option taken verbatim from <arg>
+};
+
+template<typename T>
+class flag
+{
+public:
+ flag(const std::string& str);
+ flag(const char* str);
+ flag(T opt) : opt(opt) {}
+ flag(T opt, const std::string& arg) : opt(opt), arg(arg) {}
+ flag(T opt, const char* arg) : opt(opt), arg(arg) {}
+ flag(ctor::toolchain toolchain, T opt) : toolchain(toolchain), opt(opt) {}
+ flag(ctor::toolchain toolchain, T opt, const char* arg) : toolchain(toolchain), opt(opt), arg(arg) {}
+ flag(ctor::toolchain toolchain, T opt, const std::string& arg) : toolchain(toolchain), opt(opt), arg(arg) {}
+
+ ctor::toolchain toolchain{ctor::toolchain::any};
+ T opt;
+ std::string arg;
+};
+
+using c_flag = ctor::flag<ctor::c_opt>;
+using cxx_flag = ctor::flag<ctor::cxx_opt>;
+using ld_flag = ctor::flag<ctor::ld_opt>;
+using ar_flag = ctor::flag<ctor::ar_opt>;
+using asm_flag = ctor::flag<ctor::asm_opt>;
+
+using c_flags = std::vector<ctor::c_flag>;
+using cxx_flags = std::vector<ctor::cxx_flag>;
+using ld_flags= std::vector<ctor::ld_flag>;
+using ar_flags = std::vector<ctor::ar_flag>;
+using asm_flags = std::vector<ctor::asm_flag>;
+
struct flags
{
- std::vector<std::string> cxxflags; // flags for c++ compiler
- std::vector<std::string> cflags; // flags for c compiler
- std::vector<std::string> ldflags; // flags for linker
- std::vector<std::string> asmflags; // flags for asm translator
+ ctor::c_flags cflags; // flags for c compiler
+ ctor::cxx_flags cxxflags; // flags for c++ compiler
+ ctor::ld_flags ldflags; // flags for linker
+ ctor::ar_flags arflags; // flags for archiver
+ ctor::asm_flags asmflags; // flags for asm translator
};
struct settings