Bladeren bron

Toolchain options for linking executables

default_compile_flags
vector-of-bool 5 jaren geleden
bovenliggende
commit
d4060dddf4
2 gewijzigde bestanden met toevoegingen van 23 en 1 verwijderingen
  1. +20
    -1
      src/dds/toolchain.cpp
  2. +3
    -0
      src/dds/toolchain.hpp

+ 20
- 1
src/dds/toolchain.cpp Bestand weergeven

@@ -31,6 +31,7 @@ toolchain toolchain::load_from_file(fs::path p) {
opt_string c_compile_template;
opt_string cxx_compile_template;
opt_string create_archive_template;
opt_string link_exe_template;
opt_string warning_flags;

opt_string archive_suffix;
@@ -71,6 +72,7 @@ toolchain toolchain::load_from_file(fs::path p) {
|| try_single("Warning-Flags", warning_flags)
|| try_single("Archive-Suffix", archive_suffix)
|| try_single("Object-Suffix", object_suffix)
|| try_single("Link-Executable-Template", link_exe_template)
|| false;
// clang-format on

@@ -85,6 +87,7 @@ toolchain toolchain::load_from_file(fs::path p) {
require_key("Compile-C-Template", c_compile_template);
require_key("Compile-C++-Template", cxx_compile_template);
require_key("Create-Archive-Template", create_archive_template);
require_key("Link-Executable-Template", link_exe_template);

require_key("Archive-Suffix", archive_suffix);
require_key("Object-Suffix", object_suffix);
@@ -95,6 +98,7 @@ toolchain toolchain::load_from_file(fs::path p) {
inc_template.value(),
def_template.value(),
create_archive_template.value(),
link_exe_template.value(),
warning_flags.value_or(""),
archive_suffix.value(),
object_suffix.value(),
@@ -295,9 +299,22 @@ std::optional<toolchain> toolchain::get_builtin(std::string_view s) noexcept {
ret._c_compile.push_back(c_compiler_name);
extend(ret._c_compile, common_flags);
extend(ret._c_compile, c_flags);

ret._cxx_compile.push_back(cxx_compiler_name);
extend(ret._cxx_compile, common_flags);
extend(ret._cxx_compile, cxx_flags);

ret._link_exe_template.push_back(cxx_compiler_name);
extend(ret._link_exe_template,
{
"-g",
"-fPIC",
"-fdiagnostics-color",
"-pthread",
"<INPUTS>",
"-o",
"<OUT>",
});
} else if (s == "msvc") {
ret._inc_template = {"/I<PATH>"};
ret._def_template = {"/D<DEF>"};
@@ -316,7 +333,9 @@ std::optional<toolchain> toolchain::get_builtin(std::string_view s) noexcept {
ret._archive_suffix = ".lib";
ret._object_suffix = ".obj";
ret._archive_template = {"lib", "/nologo", "/OUT:<ARCHIVE>", "<OBJECTS>"};
ret._warning_flags = {"/W4"};
ret._link_exe_template
= {"cl.exe", "/nologo", "/std:c++latest", "/EHsc", "<INPUTS>", "/Fe<OUT>"};
ret._warning_flags = {"/W4"};
} else {
return std::nullopt;
}

+ 3
- 0
src/dds/toolchain.hpp Bestand weergeven

@@ -39,6 +39,7 @@ class toolchain {
string_seq _inc_template;
string_seq _def_template;
string_seq _archive_template;
string_seq _link_exe_template;
string_seq _warning_flags;
std::string _archive_suffix;
std::string _object_suffix;
@@ -51,6 +52,7 @@ public:
std::string_view inc_template,
std::string_view def_template,
std::string_view archive_template,
std::string_view link_exe_template,
std::string_view warning_flags,
std::string_view archive_suffix,
std::string_view object_suffix)
@@ -59,6 +61,7 @@ public:
, _inc_template(split_shell_string(inc_template))
, _def_template(split_shell_string(def_template))
, _archive_template(split_shell_string(archive_template))
, _link_exe_template(split_shell_string(link_exe_template))
, _warning_flags(split_shell_string(warning_flags))
, _archive_suffix(archive_suffix)
, _object_suffix(object_suffix) {}

Laden…
Annuleren
Opslaan