[Plib-users] cross-compiling with mingw32
Brought to you by:
sjbaker
From: Benjamin E. T. <be...@cs...> - 2004-12-09 04:24:21
|
hi, I've just started working with plib, and thought others might find this useful: To cross compile a windows plib binary from linux: 1) Install the mingw32 (also called xmingw32) tools. These can be emerged, apt-gotten, yummed, or whatever your favorite way of installing is. 2) compile plib using the mingw32-g++ compiler. The following should work: bash$ ./configure --build=i686-linux --target=i386-mingw32 --host=i386-mingw32 --prefix=/usr/local/i386-mingw32 (where prefix is the location of mingw. it might be /opt/xmingw for example) 3) I've been using the following makefile, and it has worked fine so far, although I might have left something out, since I haven't tested all the plib functions. You'll have to change it slightly to fit your system and project/object names, but this should serve as a good starting point. best, ben ## Makefile ## ======== # replace with the object files for your project OBJS=ui.o gfx.o util.o ## i might have missed some, or there might be too many, ## depending on your project PLIBS= -lplibpu -lplibpw \ -lplibsg -lplibssg \ -lplibfnt -lplibul \ -lplibssgaux ## linux (maybe windows or cygwin?) ## make sure the cross-compiling section is commented out CC=g++ FLAGS= -g INCS= LIBS= -lGL -lGLU -lm OUT_EXT= ## cross compiling from linux ## uncomment this section to cross-compile ## no need to comment the previous section since these ## variables will overwrite the former ones ## ## change the following variables to fit your system. The ## uncommented ones are for fc2, ## and the commented ones are for gentoo MINGW_BIN=/usr/local/bin#/opt/xmingw/bin MINGW_BASE=/usr/local/i386-mingw32#/opt/xmingw/i386-mingw32msvc CC=${MINGW_BIN}/i386-mingw32-g++#${MINGW_BIN}/i386-mingw32msvc-g++ FLAGS=-DWIN32 -g INCS=-I${MINGW_BASE}/include LIBS=-L${MINGW_BASE}/lib -lopengl32 -lm -lgdi32 -lwinmm PLIBS:=-L${MINGW_BASE}/lib ${PLIBS} OUT_EXT=.exe CarToon: ${OBJS} ${CC} ${FLAGS} ${OBJS} \ ${PLIBS} ${LIBS} cartoon.cc \ -o CarToon${OUT_EXT} %.o: %.cc %.h ${CC} ${FLAGS} ${INCS} -c $< clean: rm *.o ; rm *_test ; rm *.exe ; rm *~ ; rm CarToon ## end of Makefile p.s. sorry if i'm posting this twice. i didn't see it go through the first time... |