add support for building D sources (defaulting to gdc)
This commit is contained in:
parent
31abeed3d5
commit
c23bb8c5e0
@ -28,6 +28,12 @@ module Rscons
|
||||
'CXXSUFFIX' => '.cc',
|
||||
'CXXDEPGEN' => ['-MMD', '-MF', '$_DEPFILE'],
|
||||
'CXXCOM' =>['$CXX', '-c', '-o', '$_TARGET', '$CXXDEPGEN', '-I$[CPPPATH]', '$CPPFLAGS', '$CXXFLAGS', '$_SOURCES'],
|
||||
|
||||
'DC' => 'gdc',
|
||||
'DFLAGS' => [],
|
||||
'DSUFFIX' => '.d',
|
||||
'D_IMPORT_PATH' => [],
|
||||
'DCCOM' => ['$DC', '-c', '-o', '$_TARGET', '-I$[D_IMPORT_PATH]', '$DFLAGS', '$_SOURCES'],
|
||||
}
|
||||
end
|
||||
|
||||
@ -35,7 +41,8 @@ module Rscons
|
||||
target.has_suffix?(env['OBJSUFFIX']) and (
|
||||
source.has_suffix?(env['ASSUFFIX']) or
|
||||
source.has_suffix?(env['CSUFFIX']) or
|
||||
source.has_suffix?(env['CXXSUFFIX']))
|
||||
source.has_suffix?(env['CXXSUFFIX']) or
|
||||
source.has_suffix?(env['DSUFFIX']))
|
||||
end
|
||||
|
||||
def run(target, sources, cache, env, vars = {})
|
||||
@ -50,6 +57,8 @@ module Rscons
|
||||
'CC'
|
||||
elsif sources.first.has_suffix?(env['CXXSUFFIX'])
|
||||
'CXX'
|
||||
elsif sources.first.has_suffix?(env['DSUFFIX'])
|
||||
'DC'
|
||||
else
|
||||
raise "Error: unknown input file type: #{sources.first.inspect}"
|
||||
end
|
||||
|
@ -18,14 +18,19 @@ module Rscons
|
||||
# build sources to linkable objects
|
||||
objects = env.build_sources(sources, [env['OBJSUFFIX'], env['LIBSUFFIX']].flatten, cache, vars)
|
||||
if objects
|
||||
use_cxx = sources.map do |s|
|
||||
s.has_suffix?(env['CXXSUFFIX'])
|
||||
end.any?
|
||||
ld_alt = use_cxx ? env['CXX'] : env['CC']
|
||||
ld = if env["LD"]
|
||||
env["LD"]
|
||||
elsif sources.find {|s| s.has_suffix?(env["DSUFFIX"])}
|
||||
env["DC"]
|
||||
elsif sources.find {|s| s.has_suffix?(env["CXXSUFFIX"])}
|
||||
env["CXX"]
|
||||
else
|
||||
env["CC"]
|
||||
end
|
||||
vars = vars.merge({
|
||||
'_TARGET' => target,
|
||||
'_SOURCES' => objects,
|
||||
'LD' => env['LD'] || ld_alt,
|
||||
'LD' => ld,
|
||||
})
|
||||
command = env.build_command(env['LDCOM'], vars)
|
||||
standard_build("LD #{target}", target, command, objects, env, cache)
|
||||
|
Loading…
x
Reference in New Issue
Block a user