-
Notifications
You must be signed in to change notification settings - Fork 702
HowToBuild
-
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
- See UsingTortoiseGitWithSimcraft for help on installing/using TortoiseGit.
- The repository address can be found on the SimulationCraft Github page. Click the green Clone or Download button on the right.
-
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
- Starting from Simulationcraft 8.1.0 release 2, libcurl (https://curl.haxx.se) is required for armory imports on non-windows platforms
- 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, including the Webengine component
- 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
-
Download and install Microsoft Visual Studio Community 2017
- Just use basic install with the
Desktop development with C++
-
To build without networking support and Qt: Select the
NoNetworking
configurations from Visual Studios (WebEngine-NoNetworking
in VS2017 andDebug-NoNetworking
orRelease-NoNetworking
in VS2019) solutions (simc_vsversion.sln).
- Just use basic install with the
-
Download and install Qt 5.12.0 for Windows 64-bit (VS 2017) or newer.
- The Open Source version is fine for this use case, select the latest Qt version during "Select Components", i.e.
Qt 5.12.0
- Add C:\Qt\5.12.0\msvc2017_64\bin to your PATH (or where-ever the Qt is installed).
- The Open Source version is fine for this use case, select the latest Qt version during "Select Components", i.e.
-
Open a developer command prompt for Qt (shortcut in start menu), for example
Qt 5.12 64-bit for Desktop (MSVC 2017)
. -
In the command prompt, navigate to
your_simc_source_dir
. -
In
your_simc_source_dir
, issue the commandqmake -r -tp vc -spec win32-msvc simulationcraft.pro
- Note that for older Qt versions the spec parameter may require your visual studio version (e.g.,
win32-msvc2017
) - Output should look something like
Reading <your_simc_source_dir>/lib/lib.pro
(similarly forgui
andcli
). - If you have upgraded your Qt version, you should delete
.qmake.stash
file before issuing the qmake command
- Note that for older Qt versions the spec parameter may require your visual studio version (e.g.,
-
Open the generated
simulationcraft.sln
inyour_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), andSimulationcraft GUI
, which is the graphical user interface (i.e., Simulationcraft.exe).
- Three solutions are available,
-
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 simulationcraft.pro
.
-
- 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.
- 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
- Linux compilation using various g++ versions (at least 5, 6, and 8 series) may fail at the linking stage if Link Time Optimization (LTO) is used in conjunction with the new curl-based networking interface. Error message output will have something akin to
lto1: internal compiler error: in odr_types_equivalent_p, at ipa-devirt.c
. In this case, either switchllvm-clang
compiler, useSC_NO_NETWORKING
if you don't need the HTTP interfaces in Simulationcraft (to usearmory
orguild
options), or stop using LTO in compilation.
- If not already installed, install
build-essential
,libcurl-dev
, andpkg-config
(e.g., a compilation toolchain, libcurl include headers, and library metainformation tool). - Install qt5-qmake & qt5-webengine if you want to build the GUI. On Ubuntu, the package is called
qt5-default
. cd your_simc_source_dir
mkdir build && cd build
cmake ../
make
- This builds target
simc
(CLI) andqt/SimulationCraft
(GUI) - Additional cmake options:
-
cmake ../ -DCMAKE_BUILD_TYPE=Release
for Release build -
cmake ../ -DCMAKE_BUILD_TYPE=Debug
for Debug build -
make simc
build CLI only, no need to have Qt installed.
-
- If not already installed, install
build-essential
,libcurl-dev
(e.g., a compilation toolchain and libcurl include headers). cd your_simc_source_dir/engine
make optimized
- This builds an optimized executable named
simc
- Additional options:
- Build with clang: Add CXX=clang++, eg.
make optimized CXX=clang++
- Build with clang: Add CXX=clang++, eg.
- Note that if you issue the build with
SC_NO_NETWORKING=1
,libcurl-dev
package is not necessary
- Install qt5-qmake & qt5-webengine. On Ubuntu, the package is called
qt5-default
. cd your_simc_source_dir
qmake simulationcraft.pro
make
- Optional: Install to
~/SimulationCraft
:make install
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
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
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
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.
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
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
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 OS X requires you to install the XCode development environment, and in most cases, the command line tools.
cd your_simc_source_dir/engine
make optimized
- This builds an optimized executable named
simc
- 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 (theclang_64
directory). This is only relevant if you are building a release, though, or intend to use themacdeployqt
binary to create a framework independent bundle ofSimulationCraft.app
.
- If you use Qt 5.1, you should fix the install names for Qt frameworks by pointing the
- In terminal, issue "qmake simulationcraft.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 exampleqmake QMAKE_MAC_SDK=macosx<version> simulationcraft.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.
XCode builds no longer supported
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.
- On Windows7 go to Control Panel -> System -> Advanced system settings -> Environment Variables
- Under System Variables search for PATH. Click Edit and append it with a semicolon
;
, followed by your desired directory path. - For other versions of windows, see http://www.computerhope.com/issues/ch000549.htm.
- Under System Variables search for PATH. Click Edit and append it with a semicolon
* 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
- Features
- Starters guide
- Frequently asked questions
- Common Issues
- Textual configuration interface
- Classes
- Graphical User Interface
- Appendixes
- Developers Corner