Quellcode durchsuchen

Change spelling of toolchain template args

default_compile_flags
vector-of-bool vor 4 Jahren
Ursprung
Commit
692f720111
2 geänderte Dateien mit 24 neuen und 24 gelöschten Zeilen
  1. +14
    -14
      src/dds/toolchain/from_json.cpp
  2. +10
    -10
      src/dds/toolchain/toolchain.cpp

+ 14
- 14
src/dds/toolchain/from_json.cpp Datei anzeigen

@@ -445,7 +445,7 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
if (lang == language::cxx) {
extend(ret, {"/EHsc"});
}
extend(ret, {"/nologo", "/permissive-", "<FLAGS>", "/c", "<IN>", "/Fo<OUT>"});
extend(ret, {"/nologo", "/permissive-", "[flags]", "/c", "[in]", "/Fo[out]"});
} else if (is_gnu_like) {
if (do_optimize.has_value() && *do_optimize) {
extend(ret, {"-O2"});
@@ -453,7 +453,7 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
if (do_debug.has_value() && *do_debug) {
extend(ret, {"-g"});
}
extend(ret, {"-fPIC", "-pthread", "<FLAGS>", "-c", "<IN>", "-o<OUT>"});
extend(ret, {"-fPIC", "-pthread", "[flags]", "-c", "[in]", "-o[out]"});
}
if (common_flags) {
extend(ret, *common_flags);
@@ -500,9 +500,9 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
fail(context, "Cannot deduce 'include_template' without 'compiler_id'");
}
if (is_gnu_like) {
return {"-I", "<PATH>"};
return {"-I", "[path]"};
} else if (is_msvc) {
return {"/I", "<PATH>"};
return {"/I", "[path]"};
}
assert(false && "'include_template' deduction failed");
std::terminate();
@@ -514,10 +514,10 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
return tc.include_template;
}
if (is_gnu_like) {
return {"-isystem", "<PATH>"};
return {"-isystem", "[path]"};
} else if (is_msvc) {
// MSVC has external-header support inbound, but it is not fully ready yet
return {"/I", "<PATH>"};
return {"/I", "[path]"};
}
assert(false && "external_include_template deduction failed");
std::terminate();
@@ -528,9 +528,9 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
fail(context, "Cannot deduce 'define_template' without 'compiler_id'");
}
if (is_gnu_like) {
return {"-D", "<DEF>"};
return {"-D", "[def]"};
} else if (is_msvc) {
return {"/D", "<DEF>"};
return {"/D", "[def]"};
}
assert(false && "define_template deduction failed");
std::terminate();
@@ -593,9 +593,9 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
fail(context, "Unable to deduce archive creation rules without a 'compiler_id'");
}
if (is_msvc) {
return {"lib", "/nologo", "/OUT:<OUT>", "<IN>"};
return {"lib", "/nologo", "/OUT:[out]", "[in]"};
} else if (is_gnu_like) {
return {"ar", "rcs", "<OUT>", "<IN>"};
return {"ar", "rcs", "[out]", "[in]"};
}
assert(false && "No archive command");
std::terminate();
@@ -610,14 +610,14 @@ toolchain dds::parse_toolchain_json_data(const json5::data& dat, std::string_vie
ret = {get_compiler_executable_path(language::cxx),
"/nologo",
"/EHsc",
"<IN>",
"/Fe<OUT>"};
"[in]",
"/Fe[out]"};
} else if (is_gnu_like) {
ret = {get_compiler_executable_path(language::cxx),
"-fPIC",
"<IN>",
"[in]",
"-pthread",
"-o<OUT>"};
"-o[out]"};
} else {
assert(false && "No link-exe command");
std::terminate();

+ 10
- 10
src/dds/toolchain/toolchain.cpp Datei anzeigen

@@ -41,15 +41,15 @@ toolchain toolchain::realize(const toolchain_prep& prep) {
}

vector<string> toolchain::include_args(const fs::path& p) const noexcept {
return replace(_inc_template, "<PATH>", p.string());
return replace(_inc_template, "[path]", p.string());
}

vector<string> toolchain::external_include_args(const fs::path& p) const noexcept {
return replace(_extern_inc_template, "<PATH>", p.string());
return replace(_extern_inc_template, "[path]", p.string());
}

vector<string> toolchain::definition_args(std::string_view s) const noexcept {
return replace(_def_template, "<DEF>", s);
return replace(_def_template, "[def]", s);
}

compile_command_info toolchain::create_compile_command(const compile_file_spec& spec,
@@ -107,11 +107,11 @@ compile_command_info toolchain::create_compile_command(const compile_file_spec&
vector<string> command;
auto& cmd_template = lang == language::c ? _c_compile : _cxx_compile;
for (auto arg : cmd_template) {
if (arg == "<FLAGS>") {
if (arg == "[flags]") {
extend(command, flags);
} else {
arg = replace(arg, "<IN>", spec.source_path.string());
arg = replace(arg, "<OUT>", spec.out_path.string());
arg = replace(arg, "[in]", spec.source_path.string());
arg = replace(arg, "[out]", spec.out_path.string());
command.push_back(arg);
}
}
@@ -122,13 +122,13 @@ vector<string> toolchain::create_archive_command(const archive_spec& spec,
toolchain_knobs) const noexcept {
vector<string> cmd;
for (auto& arg : _link_archive) {
if (arg == "<IN>") {
if (arg == "[in]") {
std::transform(spec.input_files.begin(),
spec.input_files.end(),
std::back_inserter(cmd),
[](auto&& p) { return p.string(); });
} else {
cmd.push_back(replace(arg, "<OUT>", spec.out_path.string()));
cmd.push_back(replace(arg, "[out]", spec.out_path.string()));
}
}
return cmd;
@@ -138,13 +138,13 @@ vector<string> toolchain::create_link_executable_command(const link_exe_spec& sp
toolchain_knobs) const noexcept {
vector<string> cmd;
for (auto& arg : _link_exe) {
if (arg == "<IN>") {
if (arg == "[in]") {
std::transform(spec.inputs.begin(),
spec.inputs.end(),
std::back_inserter(cmd),
[](auto&& p) { return p.string(); });
} else {
cmd.push_back(replace(arg, "<OUT>", spec.output.string()));
cmd.push_back(replace(arg, "[out]", spec.output.string()));
}
}
return cmd;

Laden…
Abbrechen
Speichern