Compilar PhysicFS con MinGW

PhysicsFS es una librería que permite acceder al contenido de archivos .zip transparentemente como si fueran parte de nuestro sistema de archivos. Allegro 5 cuenta con un addon para usar PhysicsFS en tus programas de Allegro. En posts anteriores describí la forma de compilar la versión de Allegro para Windows usando MinGW, en esa ocasión no compilamos PhysicsFS para Windows para poder usarla con Allegro pero ahora tengo un proyecto de Allegro que requiere usar este addon y por lo tanto debemos compilar la librería usando MinGW.

Compilar PhysicsFS para Windows no debería ser difícil ya que usa CMake, por lo que el archivo de toolchain que usamos en posts anteriores debería sernos útil:

monstruosoft@debian:~/build/physfs-3.0.2$ mkdir build-mingw32
monstruosoft@debian:~/build/physfs-3.0.2$ cd build-mingw32/
monstruosoft@debian:~/build/physfs-3.0.2/build-mingw32$ export PKG_CONFIG_LIBDIR=/home/monstruosoft/mingw32-i686/lib/pkgconfig/
monstruosoft@debian:~/build/physfs-3.0.2/build-mingw32$ cmake -DCMAKE_TOOLCHAIN_FILE=~/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=/home/monstruosoft/mingw32-i686/ ..
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc -- works
-- PhysicsFS will build with the following options:
--   ZIP support: enabled
--   7zip support: enabled
--   GRP support: enabled
--   WAD support: enabled
--   HOG support: enabled
--   MVL support: enabled
--   QPAK support: enabled
--   SLB support: enabled
--   VDF support: enabled
--   ISO9660 support: enabled
--   Build static library: enabled
--   Build shared library: enabled
--   Build stdio test program: enabled
--     Use readline in test program: disabled
-- Configuring done
-- Generating done
-- Build files have been written to: /home/monstruosoft/build/physfs-3.0.2/build-mingw32
monstruosoft@debian:~/build/physfs-3.0.2/build-mingw32$ make -j 4
Scanning dependencies of target physfs-static
Scanning dependencies of target physfs
...
[ 95%] Built target physfs
[100%] Built target test_physfs
monstruosoft@debian:~/build/physfs-3.0.2/build-mingw32$ make install
[ 47%] Built target physfs-static
[ 95%] Built target physfs
[100%] Built target test_physfs
Install the project...

Ahora simplemente debemos recompilar Allegro con el MinGW para generar el addon de PhysicsFS:

monstruosoft@debian:~/build/physfs-3.0.2/build-mingw32$ cd ..
monstruosoft@debian:~/build/physfs-3.0.2$ cd ..
monstruosoft@debian:~/build$ cd allegro-5.2.5.0/
monstruosoft@debian:~/build/allegro-5.2.5.0$ cd build-mingw32/
monstruosoft@debian:~/build/allegro-5.2.5.0/build-mingw32$ cmake -DCMAKE_TOOLCHAIN_FILE=~/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=/home/monstruosoft/mingw32-i686/ ..
...
-- Found PhysFS: /home/monstruosoft/mingw32-i686/bin/libphysfs.dll  
-- Found PHYSFS: /home/monstruosoft/mingw32-i686/bin/libphysfs.dll  
-- Could NOT find ZLIB (missing:  ZLIB_LIBRARY) (found version "1.2.8")
-- Performing Test PHYSFS_IMPLICIT_ZLIB
-- Performing Test PHYSFS_IMPLICIT_ZLIB - Success
...
monstruosoft@debian:~/build/allegro-5.2.5.0/build-mingw32$ make -j 4
monstruosoft@debian:~/build/allegro-5.2.5.0/build-mingw32$ make install

Ahora podemos usar PhysicsFS en nuestros programas de Allegro 5.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s