|
|
| Line 1: |
Line 1: |
| == Compiling on Ubuntu 12.10 or 12.04LTS ==
| | #REDIRECT [[OpenXcom]] |
| | |
| === Install the cross-compiler ===
| |
| | |
| <code>apt-get install g++-mingw-w64-i686</code>
| |
| | |
| This is the compiler targeting Win32/x86. If you want to build a 64-bit binary, you're on your own for libraries.
| |
| | |
| === Grab the source ===
| |
| | |
| e.g., <code>git clone https://github.com/SupSuper/OpenXcom.git</code>
| |
| | |
| Don't have git installed? Install it with <code>apt-get install git</code>.
| |
| | |
| === Download the prerequisite libraries ===
| |
| | |
| Building all the prerequisites from source is a good way to waste a day of your life. Some of them are availalbe in the stock package repositries, such as libsdl and libogg, but the majority are not. I recommend downloading [http://bumba.net/~hmaon/oxc/OXC-mingw32-cross-tools.tar.xz the tarball of static libraries I've compiled].
| |
| | |
| Supposing that you've downloaded the file to ~/Downloads, install the contents with the following commands: <code>cd / ; tar xvJf ~/Downloads/OXC-mingw32-cross-tools.tar.xz</code>. This will place a bunch of files in <code>/usr/local/cross-tools/i386-mingw32</code>.
| |
| | |
| This fileset includes a 64-bit pkg-config binary. If you need a 32-bit one, build it with the following steps:
| |
| : apt-get source pkg-config
| |
| : cd pkg-config-*
| |
| : ./configure --prefix=/usr/local/cross-tools/i386-mingw32
| |
| : make
| |
| : sudo make install
| |
| | |
| === Get the Makefile and make ===
| |
| | |
| [http://bumba.net/~hmaon/oxc/Makefile.mingw-hmaon Download my Makefile.] It's based on Makefile.simple and Michal's gitbuilder file. Place the file in OpenXcom/src and <code>make</code>!
| |
| | |
| Note: <code>-lws2_32</code> is only needed for <code>ntohl()</code>, used by the FLAC library iirc.
| |
| | |
| == Compiling 32bits on Windows ==
| |
| | |
| Here comes a way to build OpenXcom in a Windows environment having installed only MinGW (no MSYS, no bash, no sh, no Visual IDE or compiler). There could be others way to do, this is only an example. Some directories names will change to match the libraries versions, just adapt the paths.
| |
| | |
| === Install MinGW32 ===
| |
| | |
| See the [http://www.mingw.org/wiki/InstallationHOWTOforMinGW MinGW website].
| |
| Install at least C compiler, C++ compiler and GNU make.
| |
| | |
| === Set up your project directory with SDL ===
| |
| | |
| Choose your project directory. Let's call it <code><project></code>.
| |
| | |
| On [http://www.libsdl.org/index.php SDL website] download SDL 1.2 win32 development library for Mingw32.
| |
| Extract it in <code><project></code> keeping directory hierarchy, you should get it in a directory such as <code><project>\SDL-1.2.15</code>.
| |
| | |
| On [http://www.libsdl.org/projects/SDL_mixer/ SDL_mixer website] download SDL_mixer 1.2 source and SDL_mixer 1.2 Win32 32bits binaries. Extract the source in <code><project></code>, you should get it in a directory such as <code><project>\SDL_mixer-1.2.12</code>. Create a <code><project>\SDL_mixer-1.2.12\bin</code> directory and extract the binaries here.
| |
| | |
| On [http://www.libsdl.org/projects/SDL_image/ SDL_image website] download SDL_image 1.2 source and SDL_image 1.2 Win32 32bits binaries. Extract the source in <code><project></code>, you should get it in a directory such as <code><project>\SDL_image-1.2.12</code>. Create a <code><project>\SDL_image-1.2.12\bin</code> directory and extract the binaries here.
| |
| | |
| === Set up SDL_gfx ===
| |
| | |
| On [http://www.ferzkopp.net/joomla/content/view/19/14/ SDL_gfx website] download last SDL_gfx source and extract it in <code><project></code>. You should get it in a directory such as <code><project>\SDL_gfx-2.0.24</code>. Go to Other builds subdirectory and extract Makefile from mingw32.zip in the <code><project>\SDL_gfx-2.0.24</code> directory. Edit the Makefile to modify it to have:
| |
| | |
| CFLAGS = -O3 -march=athlon-xp -mmmx -msse -m3dnow -DBUILD_DLL -DWIN32 -I..\SDL-1.2.15\include\SDL
| |
| LIBS = -L..\SDL-1.2.15\lib -lSDL
| |
|
| |
| OBJS = SDL_framerate.o SDL_gfxBlitFunc.o SDL_gfxPrimitives.o SDL_imageFilter.o SDL_rotozoom.o
| |
| | |
| Then run in the <code><project>\SDL_gfx-2.0.24</code> directory:
| |
| | |
| mingw32-make SDL_gfx.dll
| |
| | |
| You should get a <code><project>\SDL_gfx-2.0.24\SDL_gfx.dll</code> file.
| |
| | |
| === Set up yaml-cpp ===
| |
| | |
| From the [http://code.google.com/p/yaml-cpp/ yaml-cpp website] download a yaml-cpp source higher than 0.5.0, such as 0.5.1.
| |
| From the [http://www.cmake.org/ CMake website] download the CMake Windows zip binaries distribution.
| |
| From the [http://www.boost.org/ boost website] download the current release.
| |
| Extract the three archives in <project>; you should get directories such as <code><project>\yaml-cpp-0.5.1</code>, <code><project>\cmake-2.8.11.2-win32-x86</code> and <code><project>\boost_1_54_0</code>
| |
| | |
| Go to the <code><project>\yaml-cpp-0.5.1</code> directory and run the following commands:
| |
| | |
| set Path=%Path%;<project>\cmake-2.8.11.2-win32-x86\bin
| |
| mkdir build
| |
| cd build
| |
| cmake -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=OFF -DBoost_INCLUDE_DIR=<project>\boost_1_54_0 ..
| |
| mingw32-make
| |
| | |
| This should build a static library <code><project>\yaml-cpp-0.5.1\build\libyaml-cpp.a</code>.
| |
| There are problems [http://stackoverflow.com/questions/18390694/undefined-reference-linking-yaml-cpp-program-with-mingw-w64-cmake building a dynamix library] with the 0.5.1 version, but this could work with later versions.
| |
| | |
| Thankfully yaml-cpp does not need boost to build (it only uses the header files) because boost does not support MinGW compiling.
| |
| | |
| === Build and run OpenXcom ===
| |
| | |
| Download the last available source and extract it in <code><project></code> directory, you should get a <code><project>\OpenXcom-master</code> directory.
| |
| Copy original game directories in <code><project>\OpenXcom-master\bin\data</code> directory.
| |
| Create a <code><project>\OpenXcom-master\makefile</code> such as this one:
| |
| | |
| PROG=OpenXCom
| |
|
| |
| MINGW=
| |
|
| |
| SRC=$(wildcard src/*.cpp src/*/*.cpp src/*/*/*.cpp)
| |
| OBJRES=src\$(PROG)_res.o
| |
| OBJ=$(OBJRES) $(SRC:.cpp=.o)
| |
| BIN=bin\$(PROG).exe
| |
| RES=src\$(PROG).rc src\resource.h src\version.h res\windows\openxcom.ico
| |
|
| |
| WINVER=0x0400
| |
| CXX=$(MINGW)g++
| |
| CXXFLAGS=-DWINVER=$(WINVER) -I..\SDL-1.2.15\include\SDL -I..\SDL_mixer-1.2.12 -I..\SDL_image-1.2.12 -I..\SDL_gfx-2.0.24
| |
| -I..\yaml-cpp-0.5.1\include -I..\boost_1_54_0 -Wall -Wextra -Wno-unused-function -O2
| |
| LDFLAGS=-L..\SDL-1.2.15\lib -L..\yaml-cpp-0.5.1\build -lshlwapi -lmingw32 -lopengl32 -lSDLmain ..\SDL-1.2.15\bin\SDL.dll
| |
| ..\SDL_mixer-1.2.12\bin\SDL_mixer.dll ..\SDL_image-1.2.12\bin\SDL_image.dll ..\SDL_gfx-2.0.24\bin\SDL_gfx.dll -lyaml-cpp
| |
| -mwindows
| |
| RC=$(MINGW)windres
| |
| RFLAGS=
| |
|
| |
| .PHONY:all compile depends mrproper clean rebuild
| |
|
| |
| all:compile
| |
|
| |
| compile:$(BIN)
| |
|
| |
| depends:
| |
| AppDep -n -l "# Dependencies" makefile
| |
| for %%i in ($(SRC:.cpp=)) do $(CXX) $(CXXFLAGS) -MM "%%i.cpp" -MT "%%i.o" >> makefile
| |
|
| |
| $(BIN):$(OBJ)
| |
| $(CXX) $(CXXFLAGS) -o $(BIN) $(OBJ) $(LDFLAGS)
| |
|
| |
| $(OBJRES):$(RES)
| |
| $(RC) $(RFLAGS) -o $@ $<
| |
|
| |
| %.o:%.cpp
| |
| $(CXX) $(CXXFLAGS) -o $@ -c $<
| |
|
| |
| mrproper:clean
| |
| for %%i in ($(BIN)) do if exist "%%~fi" del "%%~fi"
| |
|
| |
| clean:
| |
| for %%i in ($(OBJ)) do if exist "%%~fi" del "%%~fi"
| |
|
| |
| rebuild:mrproper all
| |
| | |
| You can also try to produce your makefile with CMake rather than using this example.
| |
| | |
| Fill MINGW variable if you have several MinGW instances (such as a 32bits one and a 64bits one).
| |
| Consider adding <code>-g -D_DEBUG</code> to CXXFLAGS variable to generate debug information.
| |
| | |
| AppDep utility can be downloaded [http://julien.darthenay.free.fr/progcmingw.php here].
| |
| If you don't want to use it, just add a #Dependencies line at the end of your makefile, remove the AppDep call, and clear all lines after #Dependencies before using make depends.
| |
| | |
| Go to <code><project>\OpenXcom-master</code> and run:
| |
| | |
| mingw32-make depends
| |
| mingw32-make all
| |
| | |
| The file <code><project>\OpenXcom-master\bin\OpenXcom.exe</code> should be produced.
| |
| If windres fails because of null characters, convert <code>src\resource.h</code> and <code>src\OpenXcom.rc</code> from UTF-16LE to ANSI.
| |
| | |
| To run the game, use the following commands in the same directory:
| |
| | |
| set Path=%Path;<project>\SDL-1.2.15\bin;<project>\SDL_mixer-1.2.12\bin;<project>\SDL_image-1.2.12\bin;<project>\SDL_gfx-2.0.24\bin
| |
| bin\OpenXcom.exe -user <your name>
| |
| | |
| == Compiling 32bits and 64bits on Windows ==
| |
| You can see instructions on how to build with MinGW-w64 in [https://github.com/JDarthenay/OpenXcom/tree/MinGW-w64 this GitHub fork of OpenXcom]. (By the author of previous section).
| |
| | |
| == MXE ==
| |
| Michal uses a different setup for his own builds and gitbuilder, based on [http://mxe.cc/ MXE]. I haven't tried MXE myself but supposedly its compiler rejects the -msse2 flag. On the other hand, it looks like it'll build all the libraries for you!
| |
| | |
| == Compiling and cross-compiling OpenXcom Extended ==
| |
| | |
| See [https://openxcom.org/forum/index.php/topic,7048.0.html Compiling and cross-compiling OXCE]
| |
| | |
| [[Category:OpenXcom]] | |