From: Michael D. Lowis Date: Mon, 14 Jul 2014 20:57:13 +0000 (-0400) Subject: Added rakefile in preparation of switch to rscons X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=e6608b396dd7fca193b120e857452ae00d9d614b;p=projs%2Fopts.git Added rakefile in preparation of switch to rscons --- diff --git a/Rakefile b/Rakefile new file mode 100644 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 }