Skip to content

Latest commit

 

History

History
219 lines (167 loc) · 6.6 KB

BUILD.md

File metadata and controls

219 lines (167 loc) · 6.6 KB

Building and running

Elkulator requires the following libraries:

  • Allegro 4.x
  • OpenAL
  • ALut
  • Zlib
  • CppUnit

Elkulator uses a CMake-based build system, so this is also a prerequisite. The following build instructions will detail how to install these dependencies, if required, and build Elkulator on Linux and Windows.

Elkulator has been tested on x86-32 and x86-64 machines. No other architectures are guaranteed to work and big-endian machines (eg PowerPC) almost certainly won't work.

Linux prerequisites

These steps have been tested on Ubuntu 12.04 x64.

Install dependencies

$ sudo apt-get install \
  liballegro4-dev \
  libopenal-dev \
  libalut-dev \
  zlib1g-dev \
  libcppunit-dev

Continue to Build with CMake

Windows prerequisites

These steps have been tested on Windows 7, Windows 8.1 and Windows 10 x64.

Install dependencies

The following assumes that your default Windows hard drive is C:. If this is not the case, adjust the instructions accordingly.

MinGW

  1. Download and install MinGW---these instructions were developed with version 0.6.2-beta-20131004-1
  2. Use default options
  3. Right-click and select "Mark for Installation" on following packages:
  • mingw-developer-toolkit
  • mingw32-base
  • mingw32-gcc-g++
  • msys-base
  1. Go to "Installation" and click "Apply Changes".
  2. Click "Apply" to proceed.
  3. Follow instructions at "After Installing You Should...":
  4. Create C:\MinGW\msys\1.0\etc\fstab with single line C:\MinGW /mingw
  5. Edit C:\MinGW\msys\1.0\etc\profile and add line export MINGDIR=/mingw
  6. Create an "msys" shortcut pointing to C:\MinGW\msys\1.0\msys.bat
  7. Open the MSYS terminal by double-clicking the "msys" shortcut
  8. Install wget: mingw-get.exe install msys-wget
  9. Install unzip: mingw-get.exe install msys-unzip

CMake

  1. Download the latest CMake distribution
  2. Unzip the archive to C:\cmake
  3. Edit C:\MinGW\msys\1.0\etc\profile and add C:\cmake\bin to path using export PATH=/c/cmake/bin:$PATH

Allegro

Background information

  1. Download minimal DirectX 7 SDK for MinGW
  2. Extract contents of include and lib directories from dx70_mgw.zip into C:\MinGW\include and C:\MinGW\lib directories respectively, choosing to overwrite any existing files
  3. Download the latest recent 4.x source archive of Allegro for MinGW
  4. Unzip contents into allegro directory alongside elkulator source directory
  5. Run following commands:
$ cd allegro/
$ mkdir build
$ cd build/
$ cmake .. -G "MSYS Makefiles"
$ make
$ make install
$ ln /mingw/lib/liballeg44.dll.a  /mingw/lib/liballeg.dll.a

zlib

Background information

Run following commands to build zlib and install it into the system default location:

$ wget http://zlib.net/zlib-1.2.8.tar.gz
$ tar xvfz zlib-1.2.8.tar.gz
$ cd zlib-1.2.8/
$ make -f win32/Makefile.gcc BINARY_PATH=$MINGDIR/bin INCLUDE_PATH=$MINGDIR/include LIBRARY_PATH=$MINGDIR/lib install

OpenAL

Background information and here

Run following commands:

$ wget http://kcat.strangesoft.net/openal-releases/openal-soft-1.16.0.tar.bz2
$ tar xjf openal-soft-1.16.0.tar.bz2
$ cd openal-soft-1.16.0/
$ cd build/
$ cmake .. -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=$MINGDIR
$ make
$ make install
$ ln /mingw/lib/libOpenAL32.dll.a  /mingw/lib/libopenal.dll.a

freealut

Run following commands:

$ git clone https://github.com/vancegroup/freealut
$ cd freealut/
$ mkdir build
$ cd build/
$ cmake .. -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=$MINGDIR -DOPENAL_INCLUDE_DIR=$MINGDIR/include/ -DOPENAL_LIBRARY=$MINGDIR/lib/libOpenAL32.dll.a
$ make
$ make install

CppUnit

Background information and here

Run following commands:

$ git clone git://anongit.freedesktop.org/git/libreoffice/cppunit/
$ cd cppunit/
$ ./autogen.sh
$ ./configure
$ make
$ make check
$ make install

Note that you may need to patch the following files so that the NOMINMAX macro is not multiply defined and to avoid warnings such as "ISO C++ forbids casting between pointer-to-function and pointer-to-object" etc.

  • cppunit/include/cppunit/plugin/DynamicLibraryManager.h
  • cppunit/include/cppunit/plugin/TestPlugIn.h
  • cppunit/src/cppunit/Win32DynamicLibraryManager.cpp

Runtime dependencies

Elkulator requires following binaries to be available on the system path:

  • OpenAL32.dll
  • alleg44.dll
  • libalut.dll
  • libgcc_s_dw2-1.dll
  • zlib1.dll

If you have built and installed the packages as described here, then these should already be available without any extra steps.

Continue to Build with CMake

Build with CMake

  1. Open terminal (Linux) or start MSYS environment by double-clicking "msys" shortcut (Windows)
  2. Run following commands:
$ cd elkulator/
$ script/cmake --build-type debug
$ cd build/debug/
$ make
$ make test # Optional: run unit tests
$ make install # Optional: install binaries

The script/cmake wrapper script will create build systems from the CMake build description under the build directory. On Windows, this will generate MSYS Makefiles while under Linux it will generate GNU Makefiles.

Options currently supported by script/cmake are:

  • --build-type (required): build type (debug or release)
  • --install-prefix (optional): install location

Run unit tests

Tests can be run using make test or by running the unit test executable elkulator-test (Linux) or elkulator-test.exe (Windows) directly.

Run Elkulator

Running Elkulator requires a valid elk.cfg configuration file and ROM images etc. in the locations referenced in elk.cfg. The install prefix can be set using the --install-prefix option to script/cmake. It is convenient to point at a directory containing a bin directory that is prepopulated with an elk.cfg configuration file and all required ROM images in a roms subdirectory.