Browse Source

Merge branch 'feature/bootstrap-p3' into develop

default_compile_flags
vector-of-bool 5 years ago
parent
commit
32236dfb93
3 changed files with 61 additions and 8 deletions
  1. +32
    -8
      src/dds/toolchain/from_dds.cpp
  2. +28
    -0
      src/dds/toolchain/from_dds.test.cpp
  3. +1
    -0
      tools/ci.py

+ 32
- 8
src/dds/toolchain/from_dds.cpp View File

return cxx_ver_iter->second; return cxx_ver_iter->second;
}; };


auto get_flags = [&](language lang) -> string_seq {
auto get_link_flags = [&]() -> string_seq {
string_seq ret; string_seq ret;
if (flags) {
extend(ret, *flags);
if (is_msvc) {
strv rt_lib = "/MT";
if (do_optimize.value_or(false)) {
extend(ret, {"/O2"});
}
if (do_debug.value_or(false)) {
extend(ret, {"/Z7", "/DEBUG"});
rt_lib = "/MTd";
}
ret.emplace_back(rt_lib);
} else if (is_gnu_like) {
if (do_optimize.value_or(false)) {
extend(ret, {"-O2"});
}
if (do_debug.value_or(false)) {
extend(ret, {"-g"});
}
} }
if (link_flags) {
extend(ret, *link_flags);
}
return ret;
};

auto get_flags = [&](language lang) -> string_seq {
string_seq ret;
if (lang == language::cxx && cxx_flags) { if (lang == language::cxx && cxx_flags) {
extend(ret, *cxx_flags); extend(ret, *cxx_flags);
} }
extend(ret, {"/O2"}); extend(ret, {"/O2"});
} }
if (do_debug.has_value() && *do_debug) { if (do_debug.has_value() && *do_debug) {
extend(ret, {"/Z7", "/DEBUG", "/MTd"});
extend(ret, {"/Z7", "/DEBUG"});
rt_lib = "/MTd"; rt_lib = "/MTd";
} }
ret.emplace_back(rt_lib); ret.emplace_back(rt_lib);
extend(ret, {"/nologo", "<FLAGS>", "/c", "<IN>", "/permissive-", "/Fo<OUT>"});
extend(ret, {"/nologo", "<FLAGS>", "/permissive-", "/c", "<IN>", "/Fo<OUT>"});
if (lang == language::cxx) { if (lang == language::cxx) {
extend(ret, {"/EHsc"}); extend(ret, {"/EHsc"});
} }
"<IN>", "<IN>",
"-o<OUT>"}); "-o<OUT>"});
} }
if (flags) {
extend(ret, *flags);
}
return ret; return ret;
}; };


assert(false && "No link-exe command"); assert(false && "No link-exe command");
std::terminate(); std::terminate();
} }
if (link_flags) {
extend(ret, *link_flags);
}
extend(ret, get_link_flags());
return ret; return ret;
}); });



+ 28
- 0
src/dds/toolchain/from_dds.test.cpp View File

"ar rcs stuff.a foo.o bar.o", "ar rcs stuff.a foo.o bar.o",
"g++ -fPIC -fdiagnostics-color foo.o bar.a -pthread -lstdc++fs -omeow.exe"); "g++ -fPIC -fdiagnostics-color foo.o bar.a -pthread -lstdc++fs -omeow.exe");


check_tc_compile(
"Compiler-ID: GNU\nDebug: True",
"g++ -g -fPIC -fdiagnostics-color -pthread -c foo.cpp -ofoo.o",
"g++ -g -fPIC -fdiagnostics-color -pthread -Wall -Wextra -Wpedantic -Wconversion "
"-c foo.cpp -ofoo.o",
"ar rcs stuff.a foo.o bar.o",
"g++ -fPIC -fdiagnostics-color foo.o bar.a -pthread -lstdc++fs -omeow.exe -g");

check_tc_compile(
"Compiler-ID: GNU\nDebug: True\nOptimize: True",
"g++ -O2 -g -fPIC -fdiagnostics-color -pthread -c foo.cpp -ofoo.o",
"g++ -O2 -g -fPIC -fdiagnostics-color -pthread -Wall -Wextra -Wpedantic -Wconversion "
"-c foo.cpp -ofoo.o",
"ar rcs stuff.a foo.o bar.o",
"g++ -fPIC -fdiagnostics-color foo.o bar.a -pthread -lstdc++fs -omeow.exe -O2 -g");

check_tc_compile("Compiler-ID: MSVC",
"cl.exe /MT /nologo /permissive- /c foo.cpp /Fofoo.o /EHsc",
"cl.exe /MT /nologo /W4 /permissive- /c foo.cpp /Fofoo.o /EHsc",
"lib /nologo /OUT:stuff.a foo.o bar.o",
"cl.exe /nologo /EHsc foo.o bar.a /Femeow.exe /MT");

check_tc_compile("Compiler-ID: MSVC\nDebug: True",
"cl.exe /Z7 /DEBUG /MTd /nologo /permissive- /c foo.cpp /Fofoo.o /EHsc",
"cl.exe /Z7 /DEBUG /MTd /nologo /W4 /permissive- /c foo.cpp /Fofoo.o /EHsc",
"lib /nologo /OUT:stuff.a foo.o bar.o",
"cl.exe /nologo /EHsc foo.o bar.a /Femeow.exe /Z7 /DEBUG /MTd");

auto tc = dds::parse_toolchain_dds(R"( auto tc = dds::parse_toolchain_dds(R"(
Compiler-ID: GNU Compiler-ID: GNU
)"); )");

+ 1
- 0
tools/ci.py View File

'--durations=10', '--durations=10',
f'--basetemp={paths.BUILD_DIR / "_tmp"}', f'--basetemp={paths.BUILD_DIR / "_tmp"}',
'-n4', '-n4',
'tests/',
]) ])





Loading…
Cancel
Save