Last active
September 16, 2015 21:23
-
-
Save tibaes/0d9077e509b8309c35e0 to your computer and use it in GitHub Desktop.
OpenCV Rakefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rake' | |
require 'rake/clean' | |
targetname = "a.out" | |
cc = "g++ -Wall -Wno-overloaded-virtual -std=c++11 -O2" | |
paths = "/usr/local/opt/opencv3/lib/pkgconfig/opencv.pc" | |
libs = `#{"pkg-config --libs " + paths}` | |
flags = `#{"pkg-config --cflags " + paths}` | |
sourcefiles = Rake::FileList["**/*.cpp"] | |
task :default => 'build:all' | |
namespace :build do | |
multitask :obj => sourcefiles.ext(".o") | |
task :target do | |
sh "#{cc} -o #{targetname} #{sourcefiles.ext(".o")} #{libs}" | |
CLEAN.include(sourcefiles.ext(".o")) | |
end | |
task :all => [:obj, :target] | |
end | |
rule ".o" => ".cpp" do |t| | |
sh "#{cc} #{t.source} -c -o #{t.name} #{flags}" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment