Linux patch

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

#!/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

samsaga2

10-08-2006 20:40:36

To create a static library we can use cmake:

PROJECT(OgreNewt)

INCLUDE_DIRECTORIES(/usr/local/include/OGRE OgreNewt_Main/inc /home/victor/src/newtonSDK/sdk)
AUX_SOURCE_DIRECTORY(OgreNewt_Main/src SRCS)
ADD_LIBRARY(OgreNewt STATIC ${SRCS})


There will be one day support for linux on the cvs?

Nodus

11-08-2006 04:40:43

I dont know im just some shmuck.

walaber

11-08-2006 07:24:46

I would love to add proper Linux support... I just haven't gotten around to it. I actually have my dev PC set up with a dual-boot of WinXP and SUSE Linux.

if someone already has most of the work done to get OgreNewt compiling on linux, I'd love to work together to get it added to CVS.

I've just been quite busy lately, and have unfortunately been neglecting OgreNewt :P

it sounds like for a start, I need to replace "_cdecl" with "_CDECL", is that right? and fix the capitalization on newton.h?

walaber

11-08-2006 07:30:13

I have updated CVS to fix the various _CDECL problems, and I also fixed all cases of the "newton.h" -> "Newton.h" thing.

I will update my website binary now.

Nodus

12-08-2006 04:11:38

Sweet! I can't belive that that actualy got stuff done.

persoontje

22-08-2006 14:09:44

We use our own version of ogrenewt (see http://svn.sourceforge.net/viewvc/boomwar/trunk/dependencies/OgreNewt/ ) with cmake. If somebody likes to use it, please do.

pratty70

23-11-2006 18:24:17

Can anyone elaborate on this.

I want a clean command line makefile for OgreNewt on Linux. I have never really delved too deeply into makefiles and so I'm just picking up the book now, but it would be useful if someone could give me some pointers as it seems that some people have posted they are having success on Linux.

I don't want to set up and IDE, I would just rather build from CLI.

I cannot get Nodus makefile to do anything sensible.

Any pointers??

PS Apologies for double posting. This is rather desparate. I was hoping that by the time I got to this point, Linux support would be within the OgreNewt distribution, but it seems to have stagnated a few months ago.