Browse Source

always extend link_exe with link flags

otherwise custom link_executable templates do not work
compile_link_flags
John Robinson 3 years ago
parent
commit
4ad1cf7adf
No known key found for this signature in database
2 changed files with 17 additions and 1 deletions
  1. +1
    -1
      src/dds/toolchain/from_json.cpp
  2. +16
    -0
      src/dds/toolchain/from_json.test.cpp

+ 1
- 1
src/dds/toolchain/from_json.cpp View File

assert(false && "No link-exe command"); assert(false && "No link-exe command");
std::terminate(); std::terminate();
} }
extend(ret, get_link_flags());
return ret; return ret;
}); });
extend(tc.link_exe, get_link_flags());


tc.tty_flags = read_opt(tty_flags, [&]() -> string_seq { tc.tty_flags = read_opt(tty_flags, [&]() -> string_seq {
if (!compiler_id) { if (!compiler_id) {

+ 16
- 0
src/dds/toolchain/from_json.test.cpp View File

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


check_tc_compile("{compiler_id: 'gnu', link_flags: '-mthumb'}",
"g++ -fPIC -pthread -MD -MF foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"g++ -fPIC -pthread -Wall -Wextra -Wpedantic -Wconversion "
"-MD -MF foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"ar rcs stuff.a foo.o bar.o",
"g++ -fPIC foo.o bar.a -pthread -omeow.exe -mthumb");

check_tc_compile(
"{compiler_id: 'gnu', link_flags: '-mthumb', advanced: {link_executable: 'g++ [in] "
"-o[out]'}}",
"g++ -fPIC -pthread -MD -MF foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"g++ -fPIC -pthread -Wall -Wextra -Wpedantic -Wconversion "
"-MD -MF foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"ar rcs stuff.a foo.o bar.o",
"g++ foo.o bar.a -omeow.exe -mthumb");

check_tc_compile("{compiler_id: 'msvc'}", check_tc_compile("{compiler_id: 'msvc'}",
"cl.exe /MT /EHsc /nologo /permissive- /showIncludes /c foo.cpp /Fofoo.o", "cl.exe /MT /EHsc /nologo /permissive- /showIncludes /c foo.cpp /Fofoo.o",
"cl.exe /MT /EHsc /nologo /permissive- /W4 /showIncludes /c foo.cpp /Fofoo.o", "cl.exe /MT /EHsc /nologo /permissive- /W4 /showIncludes /c foo.cpp /Fofoo.o",

Loading…
Cancel
Save