Skip to content

Commit 05ab8cb

Browse files
committed
Use response file to support command line length limit
1 parent bc11656 commit 05ab8cb

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

premake-ninja.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ local function c_cpp_compilation_rules(cfg, toolset, pch)
416416
ninja.emit_rule('rc', rc .. ' /nologo /fo$out $in $RESFLAGS', 'rc $out')
417417

418418
if cfg.kind == p.STATICLIB then
419-
ninja.emit_rule('ar', ar .. ' $in /nologo -OUT:$out', 'ar $out')
419+
ninja.emit_rule('ar', ar .. ' @$out.rsp /nologo -OUT:$out', 'ar $out', { rspfile = '$out.rsp', rspfile_content = '$in_newline'})
420420
else
421-
ninja.emit_rule('link', link .. ' $in ' .. ninja.list(ninja.shesc(toolset.getlinks(cfg, true))) .. ' /link ' .. all_ldflags .. ' /nologo /out:$out', 'link $out')
421+
ninja.emit_rule('link', link .. ' @$out.rsp ' .. ninja.list(ninja.shesc(toolset.getlinks(cfg, true))) .. ' /link ' .. all_ldflags .. ' /nologo /out:$out', 'link $out', { rspfile = '$out.rsp', rspfile_content = '$in_newline'})
422422
end
423423
elseif toolset == p.tools.clang or toolset == p.tools.gcc or toolset == p.tools.emcc then
424424
local force_include = pch and (' -include ' .. ninja.shesc(pch.placeholder)) or ''
@@ -436,21 +436,21 @@ local function c_cpp_compilation_rules(cfg, toolset, pch)
436436
ninja.emit_rule('cxx', cxx_command, 'cxx $out', { depfile = '$out.d', deps = 'gcc' })
437437

438438
ninja.emit_flags('CFLAGS', all_cflags)
439-
ninja.emit_rule('clangtidy_cc', build_command({ 'clang-tidy $in -- -x c $CFLAGS' .. force_include, cc_command }, ';'), 'cc $out', { depfile = '$out.d', deps = 'gcc' }, ';')
439+
ninja.emit_rule('clangtidy_cc', build_command({ 'clang-tidy $in -- -x c $CFLAGS' .. force_include, cc_command }, ';'), 'cc $out', { depfile = '$out.d', deps = 'gcc' })
440440

441441
ninja.emit_flags('CXXFLAGS', all_cxxflags)
442-
ninja.emit_rule('clangtidy_cxx', build_command({ 'clang-tidy $in -- -x c++ $CFLAGS' .. force_include, cxx_command }, ';'), 'cxx $out', { depfile = '$out.d', deps = 'gcc' }, ';')
442+
ninja.emit_rule('clangtidy_cxx', build_command({ 'clang-tidy $in -- -x c++ $CFLAGS' .. force_include, cxx_command }, ';'), 'cxx $out', { depfile = '$out.d', deps = 'gcc' })
443443

444444
ninja.emit_flags('RESFLAGS', all_resflags)
445445
if rc then
446446
ninja.emit_rule('rc', rc .. ' -i $in -o $out $RESFLAGS', 'rc $out')
447447
end
448448

449449
if ar and cfg.kind == p.STATICLIB then
450-
ninja.emit_rule('ar', ar .. ' rcs $out $in', 'ar $out')
450+
ninja.emit_rule('ar', ar .. ' rcs $out @$out.rsp', 'ar $out', { rspfile = '$out.rsp', rspfile_content = '$in_newline'})
451451
else
452452
local groups = iif(cfg.linkgroups == premake.ON, { '-Wl,--start-group ', ' -Wl,--end-group' }, { '', '' })
453-
ninja.emit_rule('link', link .. ' -o $out ' .. groups[1] .. '$in' .. ninja.list(ninja.shesc(toolset.getlinks(cfg, true, true))) .. all_ldflags .. groups[2], 'link $out')
453+
ninja.emit_rule('link', link .. ' -o $out ' .. groups[1] .. '@$out.rsp' .. ninja.list(ninja.shesc(toolset.getlinks(cfg, true, true))) .. all_ldflags .. groups[2], 'link $out', { rspfile = '$out.rsp', rspfile_content = '$in_newline'})
454454
end
455455
end
456456

0 commit comments

Comments
 (0)