-
Notifications
You must be signed in to change notification settings - Fork 1
/
mrbgem.rake
115 lines (108 loc) · 6.99 KB
/
mrbgem.rake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
MRuby::Gem::Specification.new('mruby-webcam') do |spec|
spec.license = 'MIT'
spec.authors = 'Junichi Kajiwara'
if build.kind_of?(MRuby::CrossBuild)
if %w(x86_64-w64-mingw32 i686-w64-mingw32).include?(build.host_target)
spec.cxx.flags << "-I/usr/#{build.host_target}/include"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_objdetect310.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_highgui310.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_videoio310.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_imgcodecs310.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_imgproc310.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_core310.a"
#spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_hal310.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libIlmImf.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libzlib.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibjasper.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibjpeg.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibtiff.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibwebp.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibpng.a"
spec.linker.flags_before_libraries << "-lvfw32 -lole32 -loleaut32 -lgdi32 -lcomdlg32 -luuid"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libwinpthread.a"
spec.linker.flags_before_libraries << "-static-libgcc -static-libstdc++"
end
if %w(i686-pc-linux-gnu x86_64-pc-linux-gnu).include?(build.host_target)
spec.cxx.flags << "-I/usr/#{build.host_target}/include"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_objdetect.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_highgui.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_videoio.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_imgcodecs.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_imgproc.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_core.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libIlmImf.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibjasper.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibjpeg.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibtiff.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibwebp.a"
spec.linker.flags_before_libraries << "-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype -lpng"
spec.linker.flags_before_libraries << "-ldl -lpthread -lz -static-libgcc -static-libstdc++"
end
if %w(x86_64-apple-darwin14 i386-apple-darwin14).include?(build.host_target)
spec.cxx.flags << "-I/usr/#{build.host_target}/include"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_objdetect.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_highgui.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_videoio.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_imgcodecs.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_imgproc.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libopencv_core.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libIlmImf.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/libzlib.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibjasper.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibjpeg.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibtiff.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibwebp.a"
spec.linker.flags_before_libraries << "/usr/#{build.host_target}/lib/liblibpng.a"
spec.linker.flags_before_libraries << "-framework OpenCL -framework Cocoa -framework QTKit"
spec.linker.flags_before_libraries << "-framework QuartzCore -framework AppKit"
end
elsif system('pkg-config opencv4')
spec.cc.flags << `pkg-config --cflags opencv4`.strip
spec.linker.flags_before_libraries << `pkg-config --libs opencv4`.strip
else
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] then
worldLib = "opencv_world320.lib"
useWorldLib = false
paths = ENV["LIB"].split(";")
paths.each{|path|
checkPath = "#{path}\\#{worldLib}"
#puts "#{path}\\#{worldlib}"
if File.exist?(checkPath) then
useWorldLib = true
end
}
if useWorldLib then
spec.linker.flags_before_libraries << "#{worldLib}"
else
spec.linker.flags_before_libraries << "opencv_highgui320.lib"
spec.linker.flags_before_libraries << "opencv_videoio320.lib"
spec.linker.flags_before_libraries << "opencv_imgcodecs320.lib"
spec.linker.flags_before_libraries << "opencv_objdetect320.lib"
spec.linker.flags_before_libraries << "opencv_imgproc320.lib"
spec.linker.flags_before_libraries << "opencv_core320.lib"
#spec.linker.flags_before_libraries << "stdc++"
end
else
if RUBY_PLATFORM =~ /darwin/i
if File.exists?("/usr/local/opt/opencv") then
spec.cxx.flags << "-I/usr/local/opt/opencv/include"
spec.linker.flags_before_libraries << "-Wl,-rpath /usr/local/opt/opencv/lib -L/usr/local/opt/opencv/lib"
spec.linker.flags_before_libraries << "-lopencv_videoio"
spec.linker.flags_before_libraries << "-lopencv_imgcodecs"
else
spec.cxx.flags << "-I/usr/local/opt/opencv/include"
spec.linker.flags_before_libraries << "-L/usr/local/opt/opencv/lib"
end
end
spec.linker.flags_before_libraries << "-lopencv_objdetect"
spec.linker.flags_before_libraries << "-lopencv_highgui"
if File.exists?("/usr/local/lib/libopencv_videoio.so") then
spec.linker.flags_before_libraries << "-lopencv_videoio"
spec.linker.flags_before_libraries << "-lopencv_imgcodecs"
end
spec.linker.flags_before_libraries << "-lopencv_imgproc"
spec.linker.flags_before_libraries << "-lopencv_core"
spec.linker.flags_before_libraries << "-lstdc++"
end
end
end