From 22811a142dac64041635b40e2427a1c994c36ce4 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 18 Jul 2014 12:27:14 -0400 Subject: [PATCH] Added rakefile in prep for move to rscons --- Gemfile | 3 +++ Gemfile.lock | 14 +++++++++++ Rakefile | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 Rakefile diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..c8d6a78 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source 'http://rubygems.org' +gem 'rscons' +gem 'rake' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..d50a9c5 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,14 @@ +GEM + remote: http://rubygems.org/ + specs: + json (1.8.1) + rake (10.3.2) + rscons (1.6.0) + json (~> 1.0) + +PLATFORMS + x86-mingw32 + +DEPENDENCIES + rake + rscons diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..84d0bc5 --- /dev/null +++ b/Rakefile @@ -0,0 +1,67 @@ +#------------------------------------------------------------------------------ +# Bundler Setup +#------------------------------------------------------------------------------ +require "bundler" +begin + Bundler.setup(:default, :development) +rescue Bundler::BundlerError => e + raise LoadError.new("Unable to Bundler.setup(): You probably need to run `bundle install`: #{e.message}") +end +require 'rscons' +require 'rbconfig' + +#------------------------------------------------------------------------------ +# Envrionment Definitions +#------------------------------------------------------------------------------ +# Detect the windows platform and provide a task to force posix +is_windows = (Object.const_get('RUBY_PLATFORM') =~ /mswin|mingw|cygwin/) +task(:posix){ is_windows = false } + +# Define the compiler environment +Env = Rscons::Environment.new do |env| + #env["CFLAGS"] += ['-Wall', '-Werror'] + env['CXXSUFFIX'] = '.cpp' +end + +# Define the test environment +TestEnv = Env.clone do |env| + env['CPPPATH'] += Dir['tools/UnitTest++/src/', 'source/**/'] +end + +# Make sure the environment is processed before we quit +at_exit { Env.process; TestEnv.process} + +#------------------------------------------------------------------------------ +# Main Build Targets +#------------------------------------------------------------------------------ +task :default => [:test, :build] + +desc "Build the OPTS static library" +task :build do + Env.Library('build/libcds.a', Dir['source/**.{c,cpp}']) +end + +#------------------------------------------------------------------------------ +# Unit Testing Targets +#------------------------------------------------------------------------------ +desc "Run all unit tests" +task :test => [:unittest_pp] do + TestEnv.Program('build/test_libcds', + Dir[ 'source/**/*.{c,cpp}', 'tests/**/*.{c,cpp}', 'build/libUnitTest++.a' ]) + TestEnv.process + sh "build/test_libcds" +end + +task :unittest_pp do + TestEnv.Library('build/UnitTest++.a', Dir[ + 'tools/UnitTest++/src/*.{c,cpp}', + "tools/UnitTest++/src/#{(is_windows ? 'Win32' : 'Posix')}/*.{c,cpp}" + ]) +end + +#------------------------------------------------------------------------------ +# Cleanup Target +#------------------------------------------------------------------------------ +desc "Clean all generated files and directories" +task(:clean) { Rscons.clean } + -- 2.52.0