Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Sun Apr 28, 2024 4:38 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: multiple c files?
PostPosted: Sat Jun 24, 2006 7:48 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
My project is growing fast and now i need to split the code in a few .c files (and .h files).
There is an "official" method to do that?
Right now, with my current test, I can't get a good compile with more than one file.
??


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 24, 2006 9:57 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
You can make your own Makefile (or script), wich compiles all your .c and links to libraydium.so. Another quick (temporary) method is to include all your .c in your main .c an compile only this last one.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 24, 2006 10:48 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
finally i have made a hack in odyncomp.sh.
I just have added a $2 in the gcc line, so the file left as this:

Code:
#!/bin/sh

# Small and ugly "dynamic compiler" for Raydium apps, with ODE
# Use "./odyncomp.sh test6.c" for example.

ulimit -c 0
make

if [ "$?" != "0" ]; then
    echo "build failed"
    exit 1
fi

rm test
gcc $1 $2 -g -Wall -DFORCE_LIBRAYDIUM -o test libraydium.so \
-Iraydium/php/ -Iraydium/php/main/ -Iraydium/php/Zend -Iraydium/php/TSRM -Iraydium/ode/include/
sync
export LD_LIBRARY_PATH=.
shift
./test "$@"

Simple, but it works :)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 24, 2006 11:17 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Except you should do a double "shift" at the bottom of this script ;) (be careful to not commit this file :) )


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 24, 2006 3:01 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
really i don't know what is "shift" for... ?
I mean, i know what does "shift" but i don't know which could be its use.
I never used it :P


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 25, 2006 4:49 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Compilation scripts use "$@" to give arguments to the test binary. It means "all command line arguments from the current command line". The problem is that the first arg is the .c file (the two firsts for you). Shift will push away the first argument from the list. Call it again will also push the second one, and so on ...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 25, 2006 5:07 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
aham... i got it, thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 188 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group