HowToBuild

Serge Camille edited this page Jul 22, 2018 · 15 revisions

Downloading the Source

  • Downloading via Git

    • The repository address can be found on the SimulationCraft Github page. Click the green Clone or Download button on the right.
      • OSX and most Linux installs should already include git, if not, try to install it through your package manager.
      • You can download Git for all platforms directly from here.
      • Git client integrated with Windows Explorer: TortoiseGit
  • Downloading release code

    • For each releases you can find a source code archive used to build that release on the download page
    • Helpful if you want to simply insert a quick modification (or fix a bug!)
    • Not really helpful if you want to live on the bleeding edge of ongoing development

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 libraries be downloaded and installed
    • Qt DLLs are used at runtime, so they need to be in your PATH; to create a release package, a subset must be shipped with it.
    • Refer to platform-specific directions below

Building SimulationCraft on Windows

Building using Microsoft Visual Studio

  • Download and install Microsoft Visual Studio Community 2017
  • Download and install Qt 5.9.1 for Windows 64-bit (VS 2017 ) or newer.
  • Add C:\Qt\Qt5.9.1\5.5\msvc2017_64\bin to your PATH.
  • If you have installed QT to a different location, edit your_simc_source_dir\vs\Qt_vs2017.props
  • Open your_simc_source_dir\simc_vs2017.sln project file
  • Build Project simc for command line interface (CLI). Creates executable your_simc_source_dir\x64\WebEngine\simc.exe
  • Build project SimcGUI_qt5.9.1 for the Graphical User Interface (GUI). Creates executable your_simc_source_dir\x64\WebEngine\SimulationCraft.exe

Advanced Settings

  • Make sure you have openssl (ssleay32.dll) available, or install OpenSSL Light.
  • If you want to deploy SimulationCraft.exe without having QT installed and added to PATH, execute win64_release_mcvc(11/12).bat (after adjusting the path inside if necessary). This will copy over the necessary DLL's which you need to send along with the executable.

Alternative way using command line QMake with simulationcraft.pro

  • Install Visual Studio and Qt as above
  • Once your Qt version is installed, open a developer command prompt for it (shortcut in start menu), for example Qt 5.8 64-bit for Desktop (MSVC 2015).
  • In the command prompt, navigate to your_simc_source_dir.
  • In your_simc_source_dir, issue the command
    • qmake -r -tp vc -spec win32-msvc<version> simulationcraft.pro, where <version> is your Visual Studio version (e.g., 2017).
    • Output should look something like Reading <your_simc_source_dir>/lib/lib.pro (similarly for gui and cli).
  • Open the generated simulationcraft.sln in your_simc_source_dir with Visual Studio.
    • Three solutions are available, Simulationcraft Engine, which is the core library, Simulationcraft CLI, which is the command line client (i.e., simc.exe), and Simulationcraft GUI, which is the graphical user interface (i.e., Simulationcraft.exe).
  • For release builds, you can also enable Profile Guided Optimization by issuing the qmake command above with PGO=1
    • qmake PGO=1 -r -tp vc -spec win32-msvc<version> simulationcraft.pro.

Alternate way using QtCreator with simulationcraft.pro

  • Install Visual Studio and Qt as above
  • Once your Qt version is installed, open your_simc_source_dir/simulationcraft.pro file with QtCreator.
  • Build Simulationcraft CLI/GUI

Building SimulationCraft on Linux

Command Line Interface

  • If not already installed, install build-essential and libssl-dev (e.g., a compilation toolchain and OpenSSL include headers).
  • cd your_simc_source_dir/engine
  • make OPENSSL=1 optimized
  • This builds an optimized executable named simc

Graphical User Interface

  • Install qt5-qmake. On Ubuntu, the package is called qt5-default.
  • Install libqt5webkit5-dev.
  • cd your_simc_source_dir
  • qmake simcqt.pro
  • make
  • Optional: Install to ~/SimulationCraft:
    • make install

Install Script

  • run the install script found in the main SimC folder. This will create a command line + GUI version, install it to your home directory/SimulationCraft and install a .desktop file for it.

Building Debian/Ubuntu packages

If you wish to have SimulationCraft installed via debian packages rather than make install, and packages for your distribution are not (yet) available, you can build your own. Mind that debian package data is not included in the core sources, and is only present on git. The debian data structure is maintained following the guidelines from git-buildpackage: http://honk.sigxcpu.org/projects/git-buildpackage/manual-html/gbp.html

Accessing the debian/ data

According to gbp documentation (see above), every supported debian/ubuntu distribution has its own debian/ data directory on a separate branch on git. So, if you were to access debian/data for ubuntu/precise:

  • git clone https://code.google.com/p/simulationcraft/
  • cd simulationcraft
  • git checkout ubuntu/precise

Requirements

A basic understanding of debian/ contents and package building is not strictly required for package building per se, but comes very helpful.

To build debian source packages you will need the following tools at the very least:

  • sudo aptitude install devscripts dpkg-dev git git-buildpackage debhelper autotools-dev

If your plan is to upload the packages to the PPA this is sufficient. In order to build binary packages, you will need a derivate of either debuild or pbuilder. While debuild is simpler to use and requires almost zero knowledge (you just run debuild -us -uc to build a package), i would recommend pbuilder or better yet pbuilder-dist, as they have the great benefit of not tainting your running distribution with building dependencies. For more information see: https://wiki.ubuntu.com/PbuilderHowto

Building the source package

If your distribution is supported on the source tree (you can check by typing git branch), then building the source package is quite straightforward. An example for ubuntu/precise, release 5.4.8-4 (check releases with git tag):

  • git checkout ubuntu/precise
  • ./debian/_gbp_build release-548-4

This will leave you with debian source data in ~/tmp/gbp/precise.

Building the binary package

If you're not using the PPA builder and wish to manually build the package, you can either do it using debuild, from the directory where your debian source data is in:

  • dpkg-source -x simulationcraft-x.y.z_foo.dsc
  • cd simulationcraft-x.y.z
  • debuild -us -uc

or use pbuilder, after having configured it (see Requirements section), e.g.:

  • pbuilder-dist trusty amd64 build simulationcraft-x.y.z_foo.dsc

Releasing a new simulationcraft version on a supported release

If a new simc version needs debian support, you can build a new source release by following a few simple steps. Example for ubuntu/precise, updating to release-548-4:

  • git checkout ubuntu/precise
  • git merge release-548-4
  • dch -i - Make sure you follow the version numbering trend, and explicitly type the release name on the right of the version (in this case, precise).
  • ./debian/_gbp_build release-548-4
  • git commit and push your changes

Please be mindful, if you're considering to upload the source packages to a PPA, that Launchpad only accepts one source tarball for every given source, so if you are publishing more than a release (which is likely the case), subsequent builds should avoid adding the source tarball. This is done by changing the last command to this:

  • ./debian/_gbp_build release-548-4 -sd

Adding support for more Debian/Ubuntu releases

Only a few releases are supported currently, so if you wish to add support for other releases, follow these steps:

  • Identify the closest supported release
  • Duplicate the branch and name it according to the desired release, e.g.:
    • git checkout ubuntu/trusty
    • git checkout -b ubuntu/utopic
  • Adjust debian metadata to reflect the change, including but not necessarily limited to:
    • debian/changelog - Add a new entry or edit the last one with the right release name
    • debian/control - If dependency package names differ on your release, or even if you're just building against a different library version, make sure you edit the proper data (for example, check the diff between ubuntu/precise and ubuntu/trusty, which are built against a different QT major release)
    • debian/_gbp_build - Update it to reflect your change in the current branch name
    • debian/gbp.conf - Same as above
  • git commit and push your changes

Building SimulationCraft on OSX

Building SimulationCraft on OS X requires you to install the XCode development environment, and in most cases, the command line tools.

Command Line Interface / Makefile builds

  • cd your_simc_source_dir/engine
  • make
  • This builds an optimized executable named simc

Graphical User Interface / Qmake builds

  • Install Qt 5
    • If you use Qt 5.1, you should fix the install names for Qt frameworks by pointing the qt/fix_qt51_osx_paths.sh to your qt install directory (the clang_64 directory). This is only relevant if you are building a release, though, or intend to use the macdeployqt binary to create a framework independent bundle of SimulationCraft.app.
  • In terminal, issue "qmake simcqt.pro". This will create a Makefile in your simc source directory.
  • If you receive an error from Qmake such as Project ERROR: Could not resolve SDK path for 'macosx10.9', you will need to explicitly tell make what OS X SDK to use, for example qmake QMAKE_MAC_SDK=macosx<version> simcqt.pro, where is your OS X version (e.g., 10.10, 10.11). Note that the "OS X" version here is at least partly determined by your Xcode version, and may not match 1:1 with your operating system version.
  • Then, issuing "make" in the terminal will build SimulationCraft.app to your source directory.

Graphical User Interface / XCode builds

XCode builds no longer supported

Release package

The easiest way to build a release package for OS X is to use the qmake system. Open a terminal and issue "qmake simcqt.pro" in the simc source directory, followed by "make create_release" will build an optimized GUI and command line clients, and package them in a disk image file. You can also build the release package through the XCode project, by building the Create Release target. Note that in this case, you will need to specify the release configuration to get optimized versions of the command line and the GUI client.

Tips and Tricks

Adding directory to PATH

  • On Windows7 go to Control Panel -> System -> Advanced system settings -> Environment Variables

GNU Make 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 #define
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.