Skip to content

Commit

Permalink
Added Windows support to the xfBuild frontend script.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadlinger committed Feb 18, 2010
1 parent 232e66e commit ccb2b0a
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions build/xfbuild.rb
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
"viewer" => "../src/Viewer.d",
}

INCLUDE_DIRS = [
"../libs/dAssimp",
"../libs/derelict",
"../src"
]

#
# Parse the command line arguments.
#
require 'optparse'

compiler = "ldc"
target = "spinninglights"
target = TARGETS.keys.first
debug = false
verbose = false

Expand Down Expand Up @@ -44,12 +50,13 @@
#
require 'rbconfig'
os = Config::CONFIG['target_os']
raise "Operating system not supported" unless os == "linux"

#
# Construct the xfbuild command string.
#
command = "xfbuild -I../libs/dAssimp -I../libs/derelict -I../src -w"
command = "xfbuild -w"
INCLUDE_DIRS.each { |path| command += " -I#{path}" }

build = "#{target}-#{os}-#{compiler}-#{debug ? "debug" : "release"}"
command += " +D.deps-#{build} +O.objs-#{build}"

Expand All @@ -61,6 +68,7 @@
# +modLimit1 is required because LDC does not optimize well otherwise. This
# is a bug, but has not been tracked down yet.
command += " +cldc +q +modLimit1"
command += " +C.o" if os =~ /mswin/
release_opts = " -O5 -release"
debug_opts = " -gc -d-debug"
when "dmd"
Expand All @@ -78,16 +86,22 @@
end

if TARGETS.include? target
command += " +o../bin/#{target} #{TARGETS[target]}"
outfile = "../bin/#{target}"
outfile += ".exe" if os =~ /mswin/
command += " +o#{outfile} #{TARGETS[target]}"
else
raise "Target does not exist"
end

# Pass any additional command line options to xfBuild.
command += " " + ARGV.join(" ") unless ARGV.empty?

# Use a backslash as path separator if building on Windows.
command.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR

#
# Invoke xfBuild.
#
puts "Building #{target}..."
puts command if verbose
system command
raise "Build failed!" unless system command

0 comments on commit ccb2b0a

Please sign in to comment.