Mar 26, 2008

swig & opencv & ruby

1.swig commands to link ruby & c++
swig -c++ -ruby Wrapper.i
ruby mkmf.rb Wrapper
make
ruby hello.rb

2.modify the makefile
2.1add the following lines below definition of CFLAGS & DLDFLAGS
CFLAGS += `pkg-config opencv --cflags`
DLDFLAGS += `pkg-config opencv --libs`

2.2 remove -arch ppc at following lines
DLDFLAGS = -L. -arch ppc -arch i386
LDSHARED = cc -arch ppc -arch i386 -pipe -bundle

3.If you don't want to mess your makefile

require 'mkmf'
$libs = append_library($libs, "stdc++")
$CFLAGS << " `pkg-config opencv --cflags`"
$LDFLAGS << " `pkg-config opencv --libs`"
create_makefile(ARGV[0])

from
http://developer.apple.com/releasenotes/OpenSource/PerlExtensionsRelNotes/index.html
% env ARCHFLAGS='-arch ppc' ruby extconf.rb
% make
% make install

0 comments:

 
TEMPLATE HACKS AND TWEAKS BY [ METAMUSE ] BLACKCAT 1.1
/scripts/shBrushJScript.js'/>