您的位置:首页 > 其它

SDL和SDL扩展库交叉编译

2014-01-21 16:40 495 查看
宿主机:Debian6

交叉编译器:mipsel-linux-gcc (龙芯gcc-3.4.6-2f)

硬件平台:龙芯1b开发板(http://item.taobao.com/item.htm?spm=a1z10.1.w4004-4678790104.8.WBYZuT&id=36562593290)

注:此方法同时适用ARM平台,只需要作少量的修改即可。

1、SDL的组成部分

SDL -- 封装各种操作系统平台的图形显示以及输入输出操作。

SDL_image -- SDL图像库,用来显示各种格式的图片。默认支持BMP格式图片,需要添加第三方库才可以支持JPEG/GIF/PNG等等格式的图片。

SDL_ttf -- 使用True Type Font类型的字体库,可以windows电脑里找到后缀名为ttf的字体文件。

SDL_net -- 网络接口部分。

SDL_mixer -- 实现各种音效、音乐播放等声音处理。

SDL_gfx -- SDL图形显示特殊处理及特效扩展部分。

2.1 编译SDL-1.2.13

#./configure --prefix=/opt/mipsel/sdl --disable-video-nanox --disable-video-qtopia --disable-static --enable-shared --disable-video-photon --disable-video-ggi --disable-video-svga --disable-video-aalib --disable-video-dummy --disable-video-dga --disable-arts --disable-esd --disable-alsa --disable-pulseaudio --disable-video-x11 --disable-nasm --disable-joystick --enable-input-tslib --enable-video-fbcon  --disable-video-directfb --host=mipsel-linux CFLAGS=-I/opt/mipsel/tslib/include LDFLAGS=-L/opt/mipsel/tslib/lib
#make
#make install

2.2 编译SDL_image-1.2.10

#./configure --disable-pcx --disable-pnm --disable-tga --disable-xcf --disable-xpm --disable-xv --disable-tif-shared --disable-tif --disable-lbm --prefix=/opt/mipsel/sdl_image --target=mipsel-liunx --host=mipsel-linux --build=i686-linux --with-sdl-prefix=/opt/mipsel/sdl --disable-static --enable-shared \
SDL_LIBS="-L/opt/mipsel/sdl/lib -lSDL" \
SDL_CFLAGS="-I/opt/mipsel/sdl/include/SDL" \
LIBPNG_CFLAGS="-I/opt/mipsel/libpng/include" \
LIBPNG_LIBS="-L/opt/mipsel/libpng/lib" \
CFLAGS="-I/opt/mipsel/libjpeg/include -I/opt/mipsel/libz/include" \
LIBS="-L/opt/mipsel/libz/lib -lz -L/opt/mipsel/libjpeg/lib -L/opt/mipsel/libpng/lib -lpng -L/opt/mipsel/tslib/lib -lts "
#make
#make install

2.3 编译SDL2_ttf-2.0.12

#./configure --prefix=/opt/mipsel/sdl2_ttf --build=i386-linux --host=mipsel-linux  --disable-static --enable-shared --disable-sdltest --with-sdl-prefix=/opt/mipsel/sdl CFLAGS="-I/opt/mipsel/sdl/incldue/SDL" LDFLAGS=-L/opt/mipsel/sdl/lib
#make
#make install

2.4 编译SDL_net-1.2.7

#./configure --prefix=/opt/mipsel/sdl_net --build=i686-linux --host=mipsel-linux --with-sdl-prefix=/opt/mipsel/sdl -enable-gui=no
#make
#make install

2.5 编译SDL_mixer-1.2.11

#./configure --prefix=/opt/mipsel/sdl_mixer --build=i686-linux --host=mipsel-linux --enable-music-mp3-mad-gpl --enable-music-mp3=no --enable-music-mod=no --enable-music-ogg=no --enable-music-flac=no \
CFLAGS="-I/opt/mipsel/libmad/include -I/opt/mipsel/sdl/include -DPATH_MAX=260" \
LDFLAGS="-L/opt/mipsel/libmad/lib -lmad" \
SDL_LIBS="-L/opt/mipsel/sdl/lib -lSDL"
#make
#make install

如果系统头文件里没有定义PATH_MAX宏的话,通过上述方面定义宏。

2.6 编译SDL_gfx-2.0.23

#./configure --prefix=/opt/mipsel/sdl_gfx --build=i386-linux --host=mipsel-linux --target=mipsel-linux CFLAGS=-I/opt/mipsel/sdl/include/SDL LDFLAGS=-L/opt/mipsel/sdl/lib
#make
#make install


3.编译其它的第三方库

3.1 编译字体引擎库freetype-2.5.0.1

#./configure --prefix=/opt/mipsel/freetype --disable-static --enable-shared --build=i386-linux  --host=mipsel-linux --without-png
#make
#make install

3.2 编译字符编码库libiconv-1.14

#./configure --prefix=/opt/mipsel/libiconv --build=i686-linux --host=mipsel-linux
#make
#make install

3.3 编译常用的jpeg库jpeg-7以支持jpeg格式图片显示

#./configure --prefix=/opt/mipsel/libjpeg --build=i386-linux --host=mipsel-linux --disable-static --enable-shared
#make
#make install

3.4 编译常用的png库libpng-1.4.2以支持png格式图片显示

#./configure  --prefix=/opt/mipsel/libpng --with-zlib-prefix=/opt/mipsel/libz --disable-static --enable-shared   --host=mipsel-linux   cc=mipsel-linux-gcc CFLAGS=-I/opt/mipsel/libz/include LDFLAGS=-L/opt/mipsel/libz/lib
#make
#make install
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: