SDL和SDL扩展库交叉编译

http://blog.csdn.net/lqx4_3/article/details/18614529

宿主机: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

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #./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  
  2. #make  
  3. #make install  

2.2 编译SDL_image-1.2.10

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #./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 \  
  2. SDL_LIBS="-L/opt/mipsel/sdl/lib -lSDL" \  
  3. SDL_CFLAGS="-I/opt/mipsel/sdl/include/SDL" \  
  4. LIBPNG_CFLAGS="-I/opt/mipsel/libpng/include" \  
  5. LIBPNG_LIBS="-L/opt/mipsel/libpng/lib" \  
  6. CFLAGS="-I/opt/mipsel/libjpeg/include -I/opt/mipsel/libz/include" \  
  7. LIBS="-L/opt/mipsel/libz/lib -lz -L/opt/mipsel/libjpeg/lib -L/opt/mipsel/libpng/lib -lpng -L/opt/mipsel/tslib/lib -lts "  
  8. #make  
  9. #make install  

2.3 编译SDL2_ttf-2.0.12

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #./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  
  2. #make  
  3. #make install  

2.4 编译SDL_net-1.2.7

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #./configure --prefix=/opt/mipsel/sdl_net --build=i686-linux --host=mipsel-linux --with-sdl-prefix=/opt/mipsel/sdl -enable-gui=no  
  2. #make   
  3. #make install  

2.5 编译SDL_mixer-1.2.11

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #./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 \  
  2. CFLAGS="-I/opt/mipsel/libmad/include -I/opt/mipsel/sdl/include -DPATH_MAX=260" \  
  3. LDFLAGS="-L/opt/mipsel/libmad/lib -lmad" \  
  4. SDL_LIBS="-L/opt/mipsel/sdl/lib -lSDL"  
  5. #make  
  6. #make install  

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

2.6 编译SDL_gfx-2.0.23

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #./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  
  2. #make  
  3. #make install  

 

3.编译其它的第三方库

3.1 编译字体引擎库freetype-2.5.0.1

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #./configure --prefix=/opt/mipsel/freetype --disable-static --enable-shared --build=i386-linux  --host=mipsel-linux --without-png  
  2. #make   
  3. #make install  

3.2 编译字符编码库libiconv-1.14

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #./configure --prefix=/opt/mipsel/libiconv --build=i686-linux --host=mipsel-linux   
  2. #make  
  3. #make install  

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

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #./configure --prefix=/opt/mipsel/libjpeg --build=i386-linux --host=mipsel-linux --disable-static --enable-shared   
  2. #make  
  3. #make install  

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

[cpp]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. #./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  
  2. #make   
  3. #make install  

 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值