7th January 2008, 01:14 PM | #1 |
Member
Advanced member
Join Date: May 2006
Posts: 36
|
Compiling for GNU/Linux, OSX, and XP
Hello all,
So I have developed some plugins under GNU/Linux. I am able to compile the plugins and run them in the GNU/Linux version of AC3D without any trouble. I created a script to handle the compiling for me which is listed below in the code section. So I guess what I would like to know is how do you compile under OSX and Windows? When I try to run this script in OSX, it fails b/c "ld" doens't know what the "-shared" flag is. I have no idea how to compile in windows. Does anyone have a script for compiling in either of the metioned OS's? Code:
#!/bin/bash AC3D_HOME=/Applications/creators/ac3dmac AC3D_PLUGIN=$AC3D_HOME/plugins AC3D_SCRIPTS=$AC3D_HOME/scripts function compile { g++ -c $PROG.cpp } function linkIt { ld -shared $PROG.o -o $PROG.p } function copy { cp $PROG.p $AC3D_PLUGIN/. #cp $PROG.tcl $AC3D_SCRIPTS/. cp $PROG.tcl $AC3D_PLUGIN/. } if [ $1 ]; then PROG=$1 echo 'Compiling ' compile echo 'Linking' linkIt echo 'Copying' copy else echo "Usage: compile <prog name>" fi |
7th January 2008, 02:57 PM | #2 | |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,565
|
Re: Compiling for GNU/Linux, OSX, and XP
OS X is slightly different to Linux
from a makefile: Quote:
|
|
7th January 2008, 05:01 PM | #3 |
Member
Advanced member
Join Date: May 2006
Posts: 36
|
Re: Compiling for GNU/Linux, OSX, and XP
So I've created a script for OSX; however, I get the following error when I try to run it.
Code:
i686-apple-darwin9-g++-4.0.1: ppc: No such file or directory Code:
#!/bin/bash UNIVERSAL="-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" CFLAGS="-dynamic -DMAC -DMACINTOSH -I$INCLUDE $UNIVERSAL" CC=g++ LD=g++ function compile { $CC $CFLAGS -c $PROG.cpp } function linkIt { $LD $CFLAGS -shared $PROG.o -o $PROG.p } if [ $1 ]; then PROG=$1 echo 'Compiling ' compile echo 'Linking' linkIt else echo "Usage: compile <prog name>" fi |
9th January 2008, 06:16 PM | #4 |
Member
Advanced member
Join Date: May 2006
Posts: 36
|
Re: Compiling for GNU/Linux, OSX, and XP
Ok guys, I figured out how to compile the plugin for OS X.
The code for this is shown below Code:
CFLAGS="-dynamic -DMAC -DMACINTOSH" PROG=$1 g++ $CFLAGS -c $PROG.cpp g++ -dynamiclib -flat_namespace -undefined suppress -o $PROG.p $PROG.o |
10th January 2008, 07:09 AM | #5 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,565
|
Re: Compiling for GNU/Linux, OSX, and XP
Here's a bit from a windows makefile:
Code:
.cpp.p: cl -DWINDOWS -I..\src -c $*.cpp -o $*.obj /Zi link /dll /out:$@ $*.obj ..\ac3d.lib /DEBUG /DEBUGTYPE:CV |
|
|