Installation / compilation instructions

Summary
Installation / compilation instructions
Installing the precompiled Win32 binary
PrerequisitiesDependencies required by SamHaXe.
FreeType settingsSteps required using FreeType for font import.
ImageMagick settingsSteps required when using ImageMagick for image import.
DevIL settingsSteps required when using DevIL for image import.
Compiling from source
PrerequisitiesDependencies required by SamHaXe.
Build configurationConfiguring build options, dependencies and installation paths.
Building SamHaXeCompiling the source, building the documentation.

Installing the precompiled Win32 binary

Summary
PrerequisitiesDependencies required by SamHaXe.
FreeType settingsSteps required using FreeType for font import.
ImageMagick settingsSteps required when using ImageMagick for image import.
DevIL settingsSteps required when using DevIL for image import.

Prerequisities

Dependencies required by SamHaXe.  Please note that the following applies only to win32 binary versions.  You don’t have to configure anything when using the win32 installer.

To use the precompiled Win32 binary you will need the following software installed on your system:

FreeType 2http://sourceforge.net/projects/freetype/files/
ImageMagickhttp://www.imagemagick.org/script/binary-releases.php#windows
... or ...(depending on your choice of binary)
DevILhttp://openil.sourceforge.net/download.php

FreeType settings

Steps required using FreeType for font import.

Let’s assume that FreeType is installed under C:\Program Files\FreeType2.  Then the following path has to be added to PATH environment variable:

C:\Program Files\FreeType2\binRequired for locating freetype6.dll.

ImageMagick settings

Steps required when using ImageMagick for image import.

Let’s assume that ImageMagick is installed under C:\Program Files\ImageMagick.  Then the two additional paths have to be added to PATH environment variable:

C:\Program Files\ImageMagickRequired for locating CORE_RL_XXXX_.dll files.
C:\Program Files\ImageMagick\modulesRequired for sub-modules used by ImageMagick.

Furthermore it looks like that windows binary releases of ImageMagick link to Visual C’s runtime libraries so you have to install those too.  From ImageMagick’s website:

If you have any problems, install the
Visual C++ 2008 Redistributable Package (x86) or
Visual C++ 2008 Redistributable Package (x64).
64-bit Windows requires both packages (x86 & x64).

Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) - http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2

Microsoft Visual C++ 2008 SP1 Redistributable Package (x64) - http://www.microsoft.com/downloads/details.aspx?familyid=BA9257CA-337F-4B40-8C14-157CFDFFEE4E

DevIL settings

Steps required when using DevIL for image import.

Let’s assume that DevIL is installed under C:\Program Files\DevIL.  Then the following path has to be added to PATH environment variable:

C:\Program Files\DevIL\libRequired for locating DevIL.dll and ILU.dll files.

Compiling from source

Summary
PrerequisitiesDependencies required by SamHaXe.
Build configurationConfiguring build options, dependencies and installation paths.
Building SamHaXeCompiling the source, building the documentation.

Prerequisities

Dependencies required by SamHaXe.

To compile SamHaXe you will need several software packages installed on your system.

Required software

HaXe compilerhttp://haxe.org/download
Neko virtual with C dev packagehttp://nekovm.org/download
Some supported C/C++ sompiler suiteGCC, MinGW or VisualStudio
ImageMagick with C/C++ dev packagehttp://www.imagemagick.org/script/binary-releases.php
DevIL with C/C++ dev packagehttp://openil.sourceforge.net/download.php
FreeType 2 with C/C++ dev packagehttp://sourceforge.net/projects/freetype/files/
Apache Ant 1.7 or betterhttp://ant.apache.org/bindownload.cgi
NaturalDocshttp://www.naturaldocs.org/download.html

Build configuration

Configuring build options, dependencies and installation paths.

After installing the required software packages you should take a look at config.ant.sample file and create config.ant with the appropriate options for your system.

Available options

haxe.path(Default: HAXEPATH environment variable) Path to haXe executable.  It’s important to set either this variable correctly or define HAXEPATH otherwise ant won’t find haXe compiler.
haxe.stdpath(Default: haxe.path/std) Path to haXe standard library.
haxe.debug(true / false) Enable/disable debugging.
cpp.compiler(g++ / msvc) C++ compiler to use for compiling native modules.  The C++ compiler has to be accessible from the command line so you should add it to PATH.
image.module(imagemagick / devil) Specifies the native image loading module to use.  The default is ImageMagick right now but DevIL is the preferred one because it’s much more easier to install and can create images without alpha channel which reduces the size of resulting asset library.
imagemagick.include.pathPath to ImageMagick’s header files.  Required for compiling native image-imagemagick module.  You can obtain this value under linux by issuing the command: “pkg-config --cflags-only-I Wand” This is the directory where Magick++.h is located.
imagemagick.library.pathPath to ImageMagick’s shared library files.  This is the directory where CORE_RL_wand_.dll (MinGW), CORE_RL_wand_.lib (MSVC) or libMagickWand.so / libWand.so / MagickWand.dylib (gcc) is located.
imagemagick.library.nameName of ImageMagick’s shared library without any prefix or suffix.  Typical values are: CORE_RL_wand_ (MinGW and MSVC), MagickWand or Wand (gcc)
devil.include.pathPath to DevIL’s header files.  This is the directory where the IL/ directory opens from.
devil.library.pathPath to DevIL’s library files.  This is the directory where DevIL.dll, ILU.dll (MinGW and MSVC) / libIL.so, libILU.so (gcc) are located.
devil.base.library.nameName of DevIL’s base shared library without any prefix or suffix.  Typical values are: DevIL (MinGW and MSVC) or IL (gcc).
devil.util.library.nameName of DevIL’s util shared library without any prefix or suffix.  The typical value is: ILU.
neko.include.pathPath to neko’s include files.  Required for all native modules (image and font).  This is the directory where neko.h is located.
neko.library.pathPath to neko’s library files.  This is the directory where neko.dll (MinGW), neko.lib (MSVC) or libneko.so / neko.dylib (gcc) is located.
freetype.include.pathPath to FreeType’s include directory.  This is the directory where ft2build.h is located.
freetype.library.pathPath to FreeType’s shared library files.  This is the directory where freetype6.dll (MinGW), freetype.lib (MSVC) or libfreetype.so / freetype.dylib (gcc) is located.
freetype.library.nameName of FreeType’s shared library without any prefix or suffix.  Typical values are: freetype6 (MinGW) or freetype (MSVC or GCC).
naturaldocs.path(current working directory) Path to NaturalDocs’ installation directory.  NaturalDocs will be executed in this directory.
naturaldocs.executable(NaturalDocs) Full path to NaturalDocs’ executable.  Under windows you should use some\path\NaturalDocs.bat here.
install.path(/usr/local) Base installation path.
install.path.bin(install.path/bin) Binaries installation path.
install.path.modules(install.path/lib/samhaxe) Modules installation path.
install.path.doc(install.path/doc/samhaxe) Documentation installation path.
install.path.config(/etc) Configuration installation path.

Configuring the C++ compiler under windows

SamHaXe uses native modules (neko primitives in neko terms) to achieve tasks which require using external libraries not currently supported by neko.  These modules are written in C++ so ant has to be able to invoke the appropriate C++ compiler.  There are no options concerning the path to the compiler so make sure it’s accessible from the command line without problems.  For example MSVC provides a batch file called “Microsoft Visual Studio Command Prompt” which is accessible from the start menu.  Launching this command prompt appends MSVC to PATH environment variable.

Configuring FreeType under windows

FreeType requires some more configuration beyond specifying include and library paths.  That is because the compiled native modules have to be able to locate FreeType’s DLL.  This can be achieved with one more path added to the PATH environment variable.  Let’s assume that FreeType is installed under C:\Program Files\FreeType2.  Then the additional path is:

C:\Program Files\FreeType2\binRequired for locating freetype6.dll.

Configuring ImageMagick under windows

ImageMagick requires some more configuration beyond specifying include and library paths.  That is because the compiled native modules have to be able to locate ImageMagick’s DLLs.  This can be achieved with two more paths added to the PATH environment variable.  Let’s assume that ImageMagick is installed under C:\Program Files\ImageMagick.  Then the two additional paths are:

C:\Program Files\ImageMagickRequired for locating CORE_RL_XXXX_.dll files.
C:\Program Files\ImageMagick\modulesRequired for sub-modules used by ImageMagick.

Furthermore it looks like that windows binary releases of ImageMagick link to Visual C’s runtime libraries so you have to install those too.  From ImageMagick’s website:

If you have any problems, install the
Visual C++ 2008 Redistributable Package (x86) or
Visual C++ 2008 Redistributable Package (x64).
64-bit Windows requires both packages (x86 & x64).

Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) - http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2

Microsoft Visual C++ 2008 SP1 Redistributable Package (x64) - http://www.microsoft.com/downloads/details.aspx?familyid=BA9257CA-337F-4B40-8C14-157CFDFFEE4E

Configuring DevIL under windows

DevIL requires some more configuration beyond specifying include and library paths.  That is because the compiled native modules have to be able to locate DevIL’s DLLs.  This can be achieved with one more path added to the PATH environment variable.  Let’s assume that DevIL is installed under C:\Program Files\DevIL.  Then the additional path is:

C:\Program Files\DevIL\libRequired for locating DevIL.dll and ILU.dll files.

Building SamHaXe

Compiling the source, building the documentation.

Every component of SamHaXe can be built with the corresponding ant target.  You can build an ant target from the command line issuing the command from the project’s base directory:

prompt> ant target_name

Available targets are

cleanClean up previously built binaries, documentation, temporary files, etc.
demosBuild several assets and sample SWF applications.  Assembled assets go to demos/bin/assets, compiled applications go to demos/bin/apps.
distBuild a zip compressed binary distribution.
docBuild documentation with NaturalDocs.
installInstall SamHaXe and documentation into the specified directories.
modulesCompile SamHaXe modules
nativeCompile native modules.
samhaxeCompile the entire source including modules, native modules and SamHaXe itself.  This is the default target.
win32-installerBuild a NSIS (Nullsoft Scriptable Install System, http://nsis.sourceforge.net/) based win32 installer.  Only available under windows and with DevIL image library.

To compile SamHaxe issue the following command

prompt> ant

This will compile native modules, modules, SamHaXe and place the binaries under the bin directory.

To install binaries and documentation

prompt> ant install
Close