Nodus
28-07-2006 05:37:01
So I took what pjcast did and wrote a perl script that does much as the patch he wrote does. I also wrote a quick and dirty makefile.
I dont have any where to host them right now but here is the text
perl script
makefile:
I dont have any where to host them right now but here is the text
perl script
#!/usr/bin/perl
use strict;
use warnings;
sub read_file{
my ( $f ) = @_;
open F, "< $f" or die "Can't open $f : $!";
my @f = <F>;
close F;
return wantarray ? @f : \@f;
}
sub write_file{
my ( $f, @data ) = @_;
@data = () unless @data;
open F, "> $f" or die "Can't open $f : $!";
print F @data;
close F;
}
my %replace = (#'_cdecl'=>'_CDECL',
'newton.h'=>'Newton.h');
chdir("OgreNewt_Main");
foreach my $key (keys(%replace)){
foreach my $filename (split("\n",`grep -R $key *`)){
$filename =~ s/(.*):.*/$1/;
my @file;
foreach( read_file($filename)){
s/(.*)$key(.*)/$1$replace{$key}$2/;
push(@file,$_);
}
write_file($filename,@file);
}
}
makefile:
DEFINES =
LIBS = OGRE
CXX = g++
CXXFLAGS = $(shell pkg-config --cflags $(LIBS)) $(DEFINES) -I OgreNewt_Main/inc -I OgreNewt_Main/src -I newtonSDK/sdk -L newtonSDK/sdk -L OgreNewt_Main/src
LD = g++
#LDFLAGS = $(shell pkg-config --libs $(LIBS)) -Xlinker -R newtonSDK/sdk -Xlinker -s
all: OgreNewt
OgreNewt:
$(CXX) $(CXXFLAGS) -I ~/projects/ogrenew/Samples/Common/include/ $(LDFLAGS)-c -o OgreNewt_Main/OgreNewt.so OgreNewt_Main/inc/OgreNewt.h
clean:
rm -f OgreNewt_Main/OgreNewt.so