您的位置:首页 > 运维架构 > Linux

arm Linux平台下SDL及扩展库的移植

2017-11-16 15:24 351 查看
  参考文章:http://blog.csdn.net/kof98765/article/details/18264859

  SDL(Simple DirectMedia Layer)是一个自由的跨平台的多媒体开发包,适用于 游戏、游戏SDK、演示软件、模拟器、MPEG播放器和其他应用软件。

  基于SDL库目前已提供丰富的函数库,非常方便开发者使用。常用的如下:

    1、SDL_Image:提供显示多种格式的图像显示接口,它支持bmp,png,jpeg,gif,tiff等.

    2、SDL_Draw:提供画点线圆等几何图形的接口.

    3、SDL_ttf:提供显示TTF文字的接口.

    4、SDL_mixer:提供播放各种声音文件的接口.

    5、SDL_net:提供网络通信的接口.

1、SDL的移植

  下载地址 http://www.libsdl.org/download-1.2.php 。使用版本:SDL-1.2.15.tar.gz。

[b]1.1 配置[/b]

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-pulseaudio --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-video-x11 --disable-nasm --disable
4000
-joystick --disable-input-tslib \
-enable-video-fbcon --host=arm-linux


1.2 编译

$ make


[b]1.3 安装[/b]

$ make install


  

2、libjpeg的移植

  libjpeg是一个用c语言编写支持jpeg解码、编码的库。下载地址:http://linux.softpedia.com/get/Programming/Libraries/libjpeg-160.shtml 。使用版本:jpegsrc.v9.tar.gz。

[b]2.1 配置[/b]

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--host=arm-linux cc=arm-linux-gcc


[b]2.2 编译[/b]

$ make


[b]2.3 安装[/b]

$ make install


  

3、libconv的移植

  libiconv库为需要做转换的程序,实现了一个字符编码到另一个字符编码的转换。下载地址 http://www.gnu.org/software/libiconv/#downloading 。使用版本:libiconv-1.9.2.tar.gz。

[b]3.1 配置[/b]

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--with-libiconv-prefix=/home/horo/arm/software/sdl_arm \
--host=arm-linux cc=arm-linux-gcc


[b]3.2 编译[/b]

$ make


[b]3.3 安装[/b]

$ make install


  

4、libpng的移植

  libpng是多种应用程序所使用的解析PNG图形格式的函数库。下载地址 http://www.libpng.org/pub/png/libpng.html 。使用版本:libpng-1.6.34.tar.xz。

[b]4.1 配置[/b]

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--host=arm-linux cc=arm-linux-gcc


[b]4.2 编译[/b]

$ make


[b]4.3 安装[/b]

$ make install


  

5、SDL_image的移植

  SDL_image是用于处理图形文件的开源函数库,依赖SDL、libpng、libjpeg。下载地址 http://www.libsdl.org/projects/SDL_image/ 。使用版本:SDL_image-1.2.12.tar.gz。

[b]5.1 配置[/b]

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --host=arm-linux --disable-static \
--enable-shared --with-sdl-prefix=/home/horo/arm/software/sdl_arm \
CPPFLAGS=-I/home/horo/arm/software/sdl_arm/include/SDL  \
LDFLAGS=-L/home/horo/arm/software/sdl_arm/lib


[b]5.2 编译[/b]

$ make


[b]5.3 安装[/b]

$ make install


  

6、SDL_gfx的移植

  图形库,也就是传统的一些图形操作,几个基本的功能包括了缩放,旋转,几何图形绘制,FPS控制。依赖SDL。下载地址 http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-2.0.22.tar.gz 。使用版本:SDL_gfx-2.0.22.tar.gz

[b]6.1 配置[/b]

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--with-sdl-prefix=/home/horo/arm/software/sdl_arm \
CPPFLAGS=-I/home/horo/arm/software/sdl_arm/include/SDL  \
LDFLAGS=-L/home/horo/arm/software/sdl_arm/lib --host=arm-linux  --enable-mmx=no


[b]6.2 编译[/b]

$ make


[b]6.3 安装[/b]

$ make install


  

7、SDL_ttf的移植

  SDL_ttf是让应用程序能渲染汉字的扩展库,依赖SDL、freetype、libiconv。下载地址 http://www.libsdl.org/projects/SDL_ttf/ 。使用版本:SDL_ttf-2.0.11.tar.gz。

  

  freetype是矢量字库处理工具,下载地址http://www.linuxfromscratch.org/blfs/view/6.2.0/general/freetype2.html 。使用版本:freetype-2.1.10.tar.bz2。安装SDL_tty之前必须先安装freetype。

[b]7.1 配置[/b]

freetype

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static \
--enable-shared --host=arm-linux


SDL_ttf

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--disable-sdltest --with-sdl-prefix=/home/horo/arm/software/sdl_arm \
--with-freetype-prefix=/home/horo/arm/software/sdl_arm \
CPPFLAGS=-I/home/horo/arm/software/sdl_arm/include/ \
LDFLAGS="-L/home/horo/arm/software/sdl_arm/lib -liconv" --host=arm-linux


  修改Makefile,去掉OpenGL相关处理(我编译的时候没有遇到前三种情况,可能和版本有关):

    1、删除CFLAGS中的
-I/usr/include -DHAVE_OPENGL


    2、将
GL_LIBS = -L/usr/lib -lGL
修改为
GL_LIBS =


    3、将
glfont_LDADD = libSDL_ttf.la -L/usr/lib -lGL -lm
修改成
glfont_LDADD = libSDL_ttf.la -lm


    4、将glfont.c.全部清空,修改为
int main(int argc ,char **argv) { return 0;}


[b]7.2 编译[/b]

$ make


[b]7.3 安装[/b]

$ make install


  

8、SDL_mixer的移植

  SDL2_mixer对于音频的处理,依赖SDL、libmad、libmikmod。下载地址:http://www.libsdl.org/projects/SDL_mixer/ 。使用版本:SDL_mixer-1.2.12.tar.gz。

  libmad是一个开源mp3解码库,其对mp3解码算法做了很多优化,性能较好。安装SDL_mixer前先安装libmad。下载地址:http://www.linuxfromscratch.org/blfs/view/6.3/multimedia/libmad.html 。使用版本:libmad-0.15.1b.tar.gz。

libmikmod是SDL_mixer所依赖的对MID格式的音频的支持的底层库。安装SDL_mixer前先安装libmikmod。下载地址http://mikmod.sourceforge.net/ 。使用版本:libmikmod-3.3.11.tar.gz。

[b]8.1 配置[/b]

libmad

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --host=arm-linux


  修改Makefile,删除CFLAGS中的
-fforce-mem
。gcc3.4或者更高版本已经将其删除。

libmikmod

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --host=arm-linux


SDL_mixer

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--disable-sdltest --with-sdl-prefix=/home/horo/arm/software/sdl_arm \
--with-freetype-prefix=/home/horo/arm/software/sdl_arm \
CPPFLAGS=-I/home/horo/arm/software/sdl_arm/include/ \
LDFLAGS="-L/home/horo/arm/software/sdl_arm/lib -liconv" --host=arm-linux


[b]8.2 编译[/b]

$ make


[b]8.3 安装[/b]

$ make install


  

9、SDL_net的移植

  SDL_net用于网络通信,依赖SDL。下载地址http://www.libsdl.org/projects/SDL_net/ 。使用版本:SDL_net-1.2.8.tar.gz。

[b]9.1 配置[/b]

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --host=arm-linux \
--with-sdl-prefix=/home/horo/arm/software/sdl_arm \
CPPFLAGS=-I/home/horo/arm/software/sdl_arm/include  \
LDFLAGS=-L/home/horo/arm/software/sdl_arm/lib


[b]9.2 编译[/b]

$ make


[b]9.3 安装[/b]

$ make install


  

  

  至此,将SDL及其部分扩展库安装到/home/horo/arm/software/sdl_arm目录下,将目录下的所有文件拷贝到开发板中。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: