Skip to content
This repository was archived by the owner on Aug 25, 2020. It is now read-only.

HowToBuild.wiki

Serge Camille edited this page Aug 24, 2015 · 1 revision

Introduction

SimulationCraft is a C++ project based on C++11 / GNU compiler GCC 4.6 and uses some Boost ( http://www.boost.org ) libraries.

The graphical user interface is based on Qt and requires at least version 4.7.4 libraries, version 4.8.0 is recommended.

While we try to make it as easy for new and inexperienced developers to join the project, we choose to have such "steep" requirements to allow us to use the more sophisticated methods provided by C++11 and the boost library. Since coding time is always sparse, this enables us to use a very rich tool set without having to re-do all the work on basic mechanics.

We hope you manage to at least build the command line to begin with. If there are any problems, just contact us and we'll gladly help you.

Downloading the Source

  • Downloading via GIT
    • If you don't already have a GIT client, go to http://git-scm.com/ and get git. (See what I did there?)
      • Create a new parent folder with a name of your choice
      • Use the 'git clone' command found on the checkout page. For example, git clone https://code.google.com/p/simulationcraft-swtor/ will create a new subfolder /simulationcraft-swtor with the sources from the current master branch in the repository.

Building SimulationCraft

  • Building the command line interface (CLI) is very easy on all platforms
  • Building the graphical user interface (GUI) is considerably harder
    • The GUI was built using Qt
    • Building the GUI requires that the Qt SDK or Framework be downloaded and installed
    • Qt DLLs are used at runtime, so a subset must be copied into the build area
    • Refer to platform-specific directions below

Building SimulationCraft on Windows

You will need the MinGW compiler to build either the command line or graphical interfaces.

Installing MinGW

  • Use these instructions to download the MinGW compiler (a distribution of GCC that compiles native Windows executables).
    • I recommend using the mingw-get-inst graphical user interface installer. Add the C++ Compiler to the install list.
    • After installed, you need to update your PATH environment variable
      • Right-Click My Computer and choose Properties
      • Click Advanced tab
      • Click Environment Variables button
      • Scroll System Variables and select Path
      • Click Edit button
      • Add the directory where your MinGW binaries are at the end of the PATH, separated by ;. Typically ;c:\mingw\bin.

Command Line Interface

  • Open command prompt window and run
    • cd your_simc_source_dir\engine
    • mingw32-make
  • Creates executable your_simc_source_dir\engine\simc.exe

Graphical User Interface using QtSDK for Windows

  • Install QtSDK.
    • The SDK includes the QtCreator IDE, and optionally a ton of modules for writing applications on environments ranging from desktops to smart phones.
    • You really only need the IDE and Desktop QT for MinGW (4.8.0 as of this writing). The docs for QtCreator, the SDK, and Qt itself will come in handy of you intend to work on the actual GUI.
  • Edit your_simc_source_dir/mingw_qt_dll_setup.bat
    • Change the qt_dir= and mingw_dir= lines to point at the folders where you installed the QtSDK and MinGW respectively.
    • If you install in default locations, no editing should be necessary.
  • Run your_simc_source_dir/mingw_qt_dll_setup.bat to copy DLLs from Qt and MinGW into your build area
  • Open the simcqt.pro project file with QTCreator; it will prompt you to setup Debug & Release build configurations:
    • Be sure to specify the external MinGW toolchain for building, and not the older 4.4 version of MinGW that you may have installed as part of the SDK.
  • Build All (From the build menu, click the hammer icon in the lower left, or hit Control-B)
    • Creates executable your_simc_source_dir\release\SimulationCraft.exe or your_simc_source_dir\debug\SimulationCraft.exe depending on whether you have the Release or Debug build selected.
    • Clicking the computer icon in the lower left (Control-T) pops up the target selector that lets you pick Debug or Release config.
    • You can run from inside IDE with the green triangle icon (Control-R). If you want to be able to run your SimulationCraft.exe from outside the IDE, you need to move it from the debug or release folder into the top-level source folder where you copied all of those DLLs many steps ago.

Building SimulationCraft on Linux

Your Linux distro should have come with git and g++ by default. Check that your g++ is at least version 4.6 with g++ --version at the command line. If you do not have git or g++, or your g++ is an older version, use your distribution's software update mechanism to download and install the most current versions.

Command Line Interface

  • cd your_simc_source_dir/engine
  • make OS=UNIX
  • This builds an optimized executable named simc in your_simc_source_dir/engine.
  • If and when you get tired of remembering to add OS=UNIX to the make command line, put OS=UNIX in the file your_simc_source_dir/build.conf.

Graphical User Interface using Qt SDK (not just the Qt Framework)

  • Download and install the Qt SDK for Linux at Qt
  • Start QTCreator (qtcreator)
  • Open the project file your_simc_source_dir/simcqt.pro
  • Choose a target of Desktop
  • Build and run

Building SimulationCraft on OS X

Warning: OS X build instructions may be outdated since we currently do not have an active Mac developer.

Command Line Interface

  • same as for Linux above.

Graphical User Interface

  • Get and install Sparkle
    • Install Sparkle.framework to /Library/Frameworks
  • Get and install Qt
  • Open your_simc_source_dir/simc.xcodeproj
  • Build libsimc target
  • Build "Generate Qt Project" target
  • Build simc target
  • You should now have
    • your_simc_source_dir/simc, the command line simulator, and
    • your_simc_source_dir/simcqt.app, the simulator GUI.

Tips and Tricks

  • Compiler Options:
    • Add -j n where n is the number of threads used for compiling
    • The GCC flag -dM will stop the compiler after the preprocessing pass and make it dump all #defines

mingw-w64

Mingw-w64 is a MinGW version intended to build x64 targets. A 32bit version of SimC is usually more than enough and there is no significant gain in a 64bit version, but there might be circumstances where you need to allocate more memory than the amount allowed with a 32bit executable. For example if you want to simulate many players simultaneously and collect more than the default amount of data ( statistics_level > 1 ).

  • I recommend getting rubenvb's personal build, it offers gcc 4.7.0 and everything is configured.
  • Unzip it to your desired target, eg. C:\mingw64\ so that you have a folder structure C:\mingw64\bin
  • If necessary add C:\mingw64\bin to your PATH variable and remove C:\mingw\bin

Building QT libraries

Here I want to share some information about the endeavour of trying to build the QT libraries from source ( for example the 4.8.0 libraries with mingw-w64 ).

  • I recommend a 64bit version of mingw-w64 since there are some memory-intensive linkings necessary when building the qt gui. There are options to reduce that by reducing certain optimizations, but I can't help you there.
  • Get the QT 4.8.0 libraries from the QT download page.
  • Get Perl ( for example ActiveState Perl )
  • Patch this bug: patch for javascript core
  • warning: webkit cannot be built with -static linking, so don't even try it. See here
  • Go the the QT libraries source folder and run 'configure -platform win32-g++ -release -nomake demos -nomake examples'. There are no demos and examples for 4.8.0, so those options are necessary.
  • after the configuration process finished correctly, run 'set MAKE_COMMAND=mingw32-make -jn where n is the number of threads and then run 'mingw32-make'. This is necessary so that sub-makefiles get option as well and spawn more than 1 thread.

notes:

how to: http://binshi.typepad.com/blog/2012/01/compile-qt-480-with-mingw.html

Clone this wiki locally