Compiling
From Me and My Shadow
Contents |
Getting the source code
The latest stable version MeAndMyShadow can be downloaded from our website.
If you want the latest development version you'll have to use SVN.
Compiling on Linux/Unix
Under Linux, you will need the following library packages (and their -dev(el) files) to be installed:
- libSDL
- libSDL_image
- libSDL_ttf
- libSDL_mixer
- libSDL_gfx
- libcurl
- libarchive
- openssl (for MD5 calculation)
- libLua 5.2 (if game version >= 0.5)
And following packages:
- cmake
- g++
The process is simple. Enter a terminal and move to meandmyshadow directory. Then just type
cmake .
to generate the Makefile. If everything configured properly you don't see any errors and then you can start compiling by typing
make
Finally you can run MeAndMyShadow with:
./meandmyshadow
To install MeAndMyShadow on your system, run following as root
make install
Compiling without GL
In some cases you might want to compile Me and My Shadow without openGL hardware accelaration. In order to do this follow the steps above but replace the cmake call with:
cmake -DHARDWARE_ACCELERATION=OFF .
Note that you can always run Me and My Shadow in SDL mode by setting gl to 0 in the config file or by running it as following:
meandmyshadow -set gl 0
Compiling on Windows
You need Visual Studio (>=2005, maybe express edition is enough). MinGW is untested. You also need cmake to generate solution file, unless you're very familiar with Visual Studio, and want to create solution file manually.
You need following libaries (just google for their official website and download library and header file):
- SDL
- SDL_image
- SDL_ttf
- SDL_mixer
- SDL_gfx
- libcurl
- libarchive. NOTE: Maybe you shouldn't use release version because it (maybe) contains a bad bug under Windows. Use latest SVN version instead. In order to compile it, you need zlib library and header file.
- Lua 5.2 (if game version >= 0.5)
Run cmake-gui.exe and follow the instructions. You can google for tutorial of cmake.
Finally, open the solution file and compile it. You may need to change the binary output path, if the game can't find data path.
This part isn't complete yet.
Compiling on Mac
You need to have Xcode 4+ and following frameworks:
- SDL.framework
- SDL_image.framework
- SDL_ttf.framewrok
- SDL_mixer.framework
- SDL_gfx.framework
Offical SDL binaries builded not builded for embeding with app. So you need to build them from sources or use unofficial binaries, please refer to this article: http://thirdcog.eu/apps/frameworks
This part isn't complete yet.
Compiling on Android
NOTE: This section is HIGHLY experimental. See also [1].
First you need Android SDK and NDK in Linux. (Windows sucks atm.) You don't need Eclipse, but you need Apache ant. Then you need git. Then find a good place, checkout pelya's SDL Android port:
git clone git://github.com/pelya/commandergenius.git
WARNING: Will download ~400MB of data.
After checkout completed, read the instruction carefully, especially how to compile your own app and how to add new libraries. Play around with demo app. Check the folders.
You should found that these libraries have already ported to Android:
- SDL
- SDL_image
- SDL_ttf
- SDL_mixer
- SDL_gfx
- libcurl
We don't want to port OpenSSL to android, so we need to find some MD5 code. Fortunately, you can found md5.c in curl folder.
Blah blah blah...
So we still need to port libarchive and lua_52 to Android (there was lua_51 only). Go to official website and download source code. Libarchive needs cmake to generate makefile, but there is no official Android support of cmake, so it's somewhat painful to make libarchive work. Blah blah blah...
For lua_52, you need to change luaconf.h. Check existing lua_51 folder and found where should be changed. Blah blah blah...
Finally, there is a dependency file available on SourceForge. Check out the project files and the forum post for more information. After downloading it, extract it to "don't remember/jni/" folder, and you'll get libarchive and lua_52.
Checkout the latest SVN code, it should contain code changes for compiling for Android. Copy "src" folder, "AndroidAppSettings.cfg" and "icon.png" to SDL Android folder "don't remember/jni/application/meandmyshadow/" and link it to "don't remember/jni/application/src/", just like the SDL Android documentation said.
You need a special config.h, looks like
#ifndef CONFIG_H #define CONFIG_H #if defined(WIN32) //#define DATA_PATH #else #define DATA_PATH "./data/" #endif // #define HARDWARE_ACCELERATION /* #undef DEBUG_MODE */ #endif
Essentially, it's empty. But things may change with new versions.
Now prepare the data archive. Compress the "data" folder of Me and My Shadow to "data.zip", except for "DroidSansFallback.ttf" because we don't need to waste space for Android built-in font. NOTE: Compress the folder, not only the contents in this folder! Then put this file to "don't remember/jni/application/meandmyshadow/AndroidData/" folder, if I remember correctly.
Now follow the instructions in SDL Android documentation, then you're done!
This part isn't complete yet.

