]> git.mdlowis.com Git - projs/opts.git/commitdiff
Added rakefile in preparation of switch to rscons
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 14 Jul 2014 20:57:13 +0000 (16:57 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 14 Jul 2014 20:57:13 +0000 (16:57 -0400)
Rakefile [new file with mode: 0644]

diff --git a/Rakefile b/Rakefile
new file mode 100644 (file)
index 0000000..62f6cf7
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,43 @@
+require 'rscons'
+require 'rbconfig'
+
+is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
+
+desc "Force the build to build in Posix mode"
+task(:posix){ is_windows = false }
+
+base = Rscons::Environment.new do |env|
+  #env["CFLAGS"] += ['-Wall', '-Werror']
+  env['CXXSUFFIX'] = '.cpp'
+end
+
+task :default => [:staticlib]
+
+task :build => [:staticlib]
+
+task :test => [:unittest_pp] do
+    base.clone do |env|
+        env['CPPFLAGS'] << 'tools/UnitTest++/src/'
+        env.Program('build/test_libopts', Dir['source/**/*.{c,cpp}', "tests/**/*.{c,cpp}"])
+    end.process
+end
+
+desc "Build the OPTS static library"
+task :staticlib do
+    base.Library('build/libopts.a', Dir['source/**.{c,cpp}'])
+    base.process
+end
+
+task :unittest_pp do
+    sources = Dir['tools/UnitTest++/src/*.{c,cpp}']
+    if is_windows
+        sources += Dir['tools/UnitTest++/src/Win32/*.{c,cpp}']
+    else
+        sources += Dir['tools/UnitTest++/src/Posix/*.{c,cpp}']
+    end
+    base.Library('build/UnitTest++.a', sources)
+    base.process
+end
+
+desc "Clean all generated files and directories"
+task(:clean) { Rscons.clean }