SLADE Wiki
Advertisement

Unix Compilation

Required Libraries

To compile SLADE3 on unix based systems, the following libraries are required:

  • wxWidgets 2.9 (NOT 2.8): As wxWidgets 2.9 is not currently considered 'stable', there may not be a package for it in package-based distros, and it will have to be compiled itself. When compiling wxWidgets, the extra option --with-opengl is needed when ./configure-ing, or else GLCanvas support will not be enabled, which SLADE3 requires. Instructions for compiling wxWidgets can be found in "docs/gtk/install.txt" in the wxWidgets tarball.
  • FreeImage: It is recommended to download/compile/install the latest version of FreeImage from the website, as compilation is very simple and the version in the package manager may be out of date.
  • SFML v1.6: Packages and compilation instructions can be found on the SFML website. Make sure to install v1.6 and not any earlier or later version.
  • FluidSynth v1.1.3.

Compiling with CodeLite IDE

The recommended method of compiling SLADE3 is to open the CodeLite project and build from within the IDE. Once CodeLite is installed, simply run it, select "Workspace->Switch to Workspace...", and open the SLADE.workspace file.

Once it's open, it's a simple matter of making sure the 'Release' configuration is selected (unless you really want to compile Debug), and selecting "Build->Build Project". If the required libraries have all been installed correctly, SLADE should compile successfully, and the executable will be placed in the 'dist' folder. Note that the debug build of SLADE requires that the debug build of wxWidgets 2.9 is also installed.


Compiling with CMake

As a secondary compilation method, CMake can be used to compile slade (trunk only for now). To build using cmake, first make sure cmake is installed, then cd to <slade repo directory>/trunk/dist, run 'cmake ..' then 'make'. That should be all there is to it.


Ubuntu Step-By-Step Compilation

This section will detail how to compile slade trunk in Ubuntu (and probably anything else using apt-get, like Debian). This method has been tested on a fresh install of Ubuntu 11.10 and should work fine.


1. Download and install the required libraries and tools

First things first, we'll need to install all the libraries and tools required by SLADE and wxWidgets. Open a terminal window and type the following line:

sudo apt-get install subversion build-essential libgtk2.0-dev libglew1.6-dev libfreeimage-dev libftgl-dev libfluidsynth-dev libsfml-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgconf2-dev cmake

If any of the above libraries can't be found, try running 'sudo apt-cache search <libname>', as the library name may have changed or updated since this was written.

2. Compile and install wxWidgets from SVN

Now we have to compile and install wxWidgets, because as of now SLADE requires wxWidgets v2.9.2+, which currently isn't available in the debian/ubuntu package repositories.

The first step is to get the latest wxWidgets sources from SVN. To do this, open a terminal window and cd to some directory, eg. 'libs'. Now enter the following line:

svn co http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets

This should download the wxWidgets sources and put them in the 'wxWidgets' directory. Now enter the following commands to compile and install it:

cd wxWidgets
mkdir buildgtk
cd buildgtk
../configure --with-opengl --enable-mediactrl
make
sudo make install
sudo ldconfig

* To make compilation faster if you have a multi-core system, you can replace the 'make' line with 'make -j #' where # is the number of CPU cores your system has.

Hopefully everything goes right here. This has been tested on a fresh install of Ubuntu 11.10, but may not work on earlier or later versions (should, though).

3. Compile SLADE trunk from SVN

The last step is to get SLADE sources from SVN and compile them. First up, open Terminal and cd to some directory (or you can just use home if you want). Then enter the following line:

svn co http://mancubus.net/svn/hosted/slade/trunk slade

This should download the SLADE sources and put them in the 'slade' directory. Now enter the following commands to compile SLADE (using CMake):

cd slade/dist
cmake ..
make

* As with compiling wxWidgets, the 'make' line can also be changed here to take advantage of multi-core compilation.

And that should be it, you should now be able to run SLADE by entering './slade' in the terminal window (from the slade directory).


Windows Compilation

Required Software

Microsoft Visual Studio is required to build SLADE3 in Windows. "Express" versions of VS can be downloaded from Microsoft for free. It may also be possible to compile SLADE3 using CodeLite in Windows, but the CodeLite project settings may have to be modified to do so.

Visual Studio solution files are provided for VS 2005 and 2010. If you are using any version in between these two it should be fine to use the 2005 solution. VS 2011 will also open the 2010 solution without any problems.

Please note that in the SVN not all the projects/solutions may be up to date, and some may be missing files. Generally the safest to use is the VS2010 solution.

Required Libraries

The libraries required to compile SLADE3 in Windows are the same as for Unix as above. To compile wxWidgets in Windows, you must open the wxWidgets solution file for the version of Visual Studio you have, open the setup.h file (in VS) and search for wxUSE_GLCANVAS, which must be set to 1. Save setup.h, select the Release build, and build the solution.

FreeImage comes with precompiled libraries for Windows, and you only need to setup Visual Studio to search the FreeImage 'Dist' folder for extra libraries and includes.

SFML comes with precompiled libraries for VS2005 and 2008, but not 2010. Fortunately it is simple to compile in VS2010. Just open the VS2008 SFML solution, and compile the release build.

FluidSynth can be difficult to compile in Windows. For some instructions on compiling it, see here.


Special note for setting up the required libraries in Visual Studio 2010+ In VS2010+, Microsoft moved the external include/library folder settings from being global to the IDE to being defined in the project file. The SLADE3 VS2010 project file therefore uses environment variables to find these folders. To compile SLADE3 in VS2010, you must set up the following environment variables:

  • %WXWIN% - This should point to the base wxWidgets directory (eg. C:\wxWidgets-2.9.0)
  • %FREEIMAGE% - This should point to the base FreeImage directory (eg. C:\FreeImage)
  • %SFML% - This should point to the base SFML directory (eg. C:\SFML-1.6-vc)
  • %FLUIDSYNTH% - This should point to the base FluidSynth directory (eg. C:\fluidsynth-1.1.3-win32)

Environment variables can either be set up in the OS, or in Visual Studio by opening the property manager window (View->Property Manager), selecting the SLADE project and opening 'Microsoft.Cpp.Win32.user' properties sheet. In here you can add the above variables to the 'User Macros' section (make sure to also enable 'use as environment variable for build' for each one).

Compiling with Visual Studio

Once the required libraries are set up, simply open the SLADE solution file for your version of Visual Studio, select the Release configuration, and select "Build->Build Solution". This should compile SLADE and place the executable file in the 'dist' folder.


Mac OSX Compilation

To compile on OSX you will need some kind of unix package manager installed. Homebrew is recommended, and used for the examples in this section, but if you already have another manager installed, use that instead. Having multiple package managers installed can cause problems.


Installing Homebrew:

Instructions on how to install Homebrew can be found here: https://github.com/mxcl/homebrew/wiki/installation


Required Library Installation:

The libraries needed to compile SLADE on Mac OSX are as follows:

  • wxWidgets 2.9+ (2.9.4+ recommended)
  • SFML (2.0+ recommended)
  • FTGL
  • GLEW
  • Fluidsynth
  • FreeImage
  • Libmodplug

In addition, to compile wxWidgets, gtk+ will need to be installed.

To download and install most needed libraries via Homebrew, type the following command into a terminal window:

brew install ftgl glew cmake fluidsynth gtk+ subversion freeimage
brew link gettext

The only required libraries not available on Homebrew are wxWidgets, SFML and libmodplug.

SFML can be downloaded for OSX from the SFML homepage: http://sfml-dev.org. An installer version for osx is available, simply download and run that.

To install libmodplug, download the latest libmodplug source from here: http://modplug-xmms.sourceforge.net/. To compile and install libmodplug, extract it to a folder somewhere, cd to said folder in a terminal window, and enter the following commands:

./configure
make
sudo make install

Compiling and Installing wxWidgets for Mac

The following section details how to download the latest svn version of wxWidgets and compile it on OSX.

Firstly, open a terminal window and enter the following command:

svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets

Once it has finished downloading, cd to the newly created wxWidgets folder, and enter the following commands:

mkdir buildosx
cd buildosx
../configure --with-opengl --with-osx_cocoa --enable-universal-binary=i386,x86_64
make

If you have a multi-core CPU, you can change the last line to "make -j #", where # is the number of cores your CPU has. Compiling wxWidgets can take a long time, so taking advantage of multiple cores is recommended.


Compiling SLADE

Once all the required libraries are installed, SLADE can be compiled using CMake. To do this, firsly take note of the folder that wxWidgets was built in (eg. ~/wxWidgets/buildosx). Open a terminal window, cd to the SLADE source directory, then enter the following commands:

cd dist
cmake .. -DwxWidgets_CONFIG_EXECUTABLE=<wx_build_path>/wx-config
make

Replace <wx_build_path> above with the folder that wxWidgets was built in (if you followed the instructions for compiling wxWidgets from svn above, it should be something like "~/wxWidgets/buildosx"

wxWidgets gotchas

All versions

If the mouse wheel does not consistently work in the text editor panels, this is because of a system-dependent bug in wxScintilla. To fix it, you have to seek in the wxSTC project this line:

    m_lastWheelTimestamp = 0;

Change it to the following:

    m_lastWheelTimestamp = std::numeric_limits<long>::min();

Recompile, and after relinking SLADE 3, the mouse wheel should scroll correctly. This is because wxEvent::GetTimestamp() may return negative values, incorrectly invalidating the m_lastWheelTimestamp <= evt.GetTimestamp() in wxScintilla::OnMouseWheel().

2.9.0

The Ctrl+click feature in the text editor is not available because CharPositionFromPointClose() is not available. There is compatibility code to handle the different interfaces for wxLogMessage. However, since this version is no longer used for the development of SLADE 3, it is possible that new incompatibilities have arisen since.

2.9.1

The use of wxMediaPlayer backend results on Windows in spurious messages whenever a new archive tab is opened.

Advertisement