]> git.mdlowis.com Git - projs/libcds.git/commitdiff
Added rakefile in prep for move to rscons tree
authorMichael D. Lowis <mike.lowis@gentex.com>
Fri, 18 Jul 2014 16:27:14 +0000 (12:27 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Fri, 18 Jul 2014 16:27:14 +0000 (12:27 -0400)
Gemfile [new file with mode: 0644]
Gemfile.lock [new file with mode: 0644]
Rakefile [new file with mode: 0644]

diff --git a/Gemfile b/Gemfile
new file mode 100644 (file)
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 (file)
index 0000000..d50a9c5
--- /dev/null
@@ -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 (file)
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 }
+