How To Compile - lifthrasiir/angolmois GitHub Wiki
How To Compile (Unix-like)
You need a C compiler with full C99 support. The author typically uses GCC 4.6
or later, but earlier versions or Clang may work. Have a path to the compiler
in your $PATH
.
You also need the following libraries:
- SDL version 1.2.15 or later (but not 2.0)
- SDL_image version 1.2 or later
- SDL_mixer version 1.2 or later
- smpeg version 0.4 or later
In Mac OS X, you'd better have Homebrew and issue the following:
$ brew install sdl sdl_image sdl_mixer smpeg
In other platforms, you probably have a decent package manager so go for it.
If your package manager has two versions of the library, use the "development"
version (e.g. with the name ending with -dev
).
Then the following command will do the work:
$ make
If not, you should check the result of sdl-config --cflags --libs
first.
How To Compile (Windows)
Again, you need a C compiler with full C99 support. Unfortunately Visual C++ compiler is not suitable for this task (it is a C++ compiler after all); so you need to install MinGW first. You will need C and C++ compiler, and MSYS environment. (C++ compiler is required because smpeg requires C++ runtime, sigh.)
And again, you need the libraries as above. Windows development without Visual studio is certainly complicated, so please download the following files:
- SDL:
SDL-devel-1.2.*-mingw32.tar.gz
- SDL_image:
SDL_image-devel-1.2.*-VC.zip
(yes, this is fine) - SDL_mixer:
SDL_mixer-devel-1.2.*-VC.zip
- smpeg: Actually,
smpeg.dll
is included in SDL_mixer (for MP3 support). You however need two smpeg header files: smpeg.h and MPEGfilter.h.
Now extract all the files to your MinGW directory. For SDL, you can safely
extract it to the MinGW root. For SDL_image and SDL_mixer, extract include
directory as is and lib\x64
or lib\x86
(depending on your Windows
settings) directory to lib
directory. Then copy all DLL files to
the directory where angolmois.c
lives.
Launch MSYS and go to the directory mentioned above. The following command is supposed to do the work:
$ make
...but normally not, as sdl-config
is broken. So try the following command
instead if the above does not work:
$ cc -Os -Wunused -Wall -W -std=c99 angolmois.c \
`sdl-config --prefix=/mingw --cflags --libs` \
-lSDL_mixer -lSDL_image -lsmpeg -o angolmois.exe
Then try launch it from MSYS:
$ ./angolmois.exe
It should launch a file dialog, and if you cancel it it will create
stderr.txt
file in the same directory as angolmois.exe
. (This is a default
behavior of SDLmain
library in Windows.) The file should contain the usage.
If it works fine in MSYS, also try launch it from outside. If it does not
launch with an error message that demands some DLL files, you should copy them
from your MinGW directory (typically libstdc++-*.dll
and libgcc_*.dll
).
You are greatly welcomed to suggest easier build instructions in Windows. :(