Skip to content

Commit a6dc3fc

Browse files
committed
Add Building.md
1 parent f6c431f commit a6dc3fc

File tree

1 file changed

+145
-0
lines changed

1 file changed

+145
-0
lines changed

Diff for: Building.md

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
The X-Plane Scenery Tools are available as source code, as well as binaries. This article describes how to get, compile, and modify the scenery tools code. See also the [Scenery Tools Bug Database](http://developer.x-plane.com/scenery-tools-bug-database/ "Scenery Tools Bug Database").
2+
3+
## Contents
4+
5+
- [Setting Up Your Build Environment](#setting-up-your-build-environment)
6+
- [macOS](#macos)
7+
- [Windows](#windows)
8+
- [Linux](#linux)
9+
- [Getting the Source Code](#getting-the-source-code)
10+
- [Compiling the Program](#compiling-the-program)
11+
- [Building Libraries (Mac, Linux, and MinGW only)](#building-libraries-mac-linux-and-mingw-only)
12+
- [Getting the libraries (windows-only)](#getting-the-libraries-windows-only)
13+
- [Building the Applications from the command line on Linux or macOS](#building-the-applications-from-the-command-line-on-linux-or-macos)
14+
- [Building on Windows Using Visual Studio](#building-on-windows-using-visual-studio)
15+
- [Building on macOS Using XCode](#building-on-macos-using-xcode)
16+
- [Building on Linux Using Code::Blocks](#building-on-linux-using-codeblocks)
17+
18+
19+
## Setting Up Your Build Environment
20+
21+
The X-Plane scenery tools code (XPTools) can be compiled for Mac, Windows, or Linux. Before you can work on the tools, you may need to get/update your development environment.
22+
23+
### macOS
24+
25+
To build on macOS, you’ll need at least macOS 10.11 (El Capitan) and Xcode 8.3 or higher ([free in the Mac App Store](https://apps.apple.com/us/app/xcode/id497799835?mt=12)).
26+
27+
You also need a command-line version of [CMake](http://www.cmake.org/) installed. Beside downloading a binary from the cmake website, it can also be installed via [Homebrew](https://brew.sh): `$ brew install cmake`
28+
29+
### Windows
30+
31+
Building on Windows requires [Visual Studio](https://visualstudio.microsoft.com/vs/features/cplusplus/) 2017 or later (the free Community edition is fine).
32+
33+
In addition to the standard installation of Microsoft Visual Studio Community, you’ll also need some kind of Git client; [Git GUI](http://msysgit.github.io/) is a simple choice, and the command-line syntax listed here will work in the “GIT Bash” shell that comes with it.
34+
35+
Very old (WED 1.3 and earlier) versions were built using MingW - but this toolchain isn't maintained since.
36+
37+
### Linux
38+
39+
You will need the gcc compiler, version 5.4 or newer, which should be installed by default on pretty much any system. In addition you will need cmake version 3.0+ and developer files for a few libraries installed:
40+
41+
* libc and make tools, package gcc-?-dev (the ? denotes the gcc version you want to use)
42+
43+
* X11 and openGL. When the binary AMD or Nvida video drivers are installed - these all come with a full set of developer bindings. When using MESA drivers, package libglu-mesa and its dependencies will provide all these.
44+
45+
* FTTK toolkit version 1.3, package libfltk1.3-dev
46+
* cURL, package libcurl4-openssl-dev
47+
48+
When compiling WED 2.2 and earlier or XPTools version 15-3 and earlier - the Qt4 toolkit, package Qt4-dev is required instead of the FLTK toolkit.
49+
50+
It is also highly recommended to install the Code::Blocks IDE, version 13 or higher, for which solution files are available for most xptools starting with WED 1.7. But pure command line builds for all tools are fully supported as well.
51+
52+
## Getting the Source Code
53+
54+
The source code now lives on [GitHub](https://github.com/X-Plane/xptools)! You can browse the code online, download it, or clone it using all of the standard GitHub techniques. Clone the complete repo like this:
55+
56+
git clone https://github.com/X-Plane/xptools.git
57+
58+
If you don’t want a complete clone of the code, you can of course use GitHub to just download a ZIP of the most recent code, or download any major release; binary tools releases have matching tags in the repo.
59+
60+
## Compiling the Program
61+
62+
The scenery tools source code depends on a large number of third party libraries; to make cross-platform development easier, they live in a Git sub-module (`libs` for Mac, Linux and MinGW, `msvc_libs` for Visual Studio on Windows).
63+
64+
### Building Libraries (Mac, Linux and MinGW only)
65+
66+
(This step is not necessary on Windows using MSVC)
67+
68+
The first time you want to compile, you need to first download and compile your libraries. These libraries are updated infrequently. From your repository you can do this:
69+
70+
git submodule init
71+
git submodule update libs
72+
cd libs
73+
make -j
74+
75+
The libraries can take 5-10 minutes to compile!
76+
77+
### Getting the Libraries (Windows only)
78+
79+
(This step is not necessary on macOS or Linux)
80+
81+
Compiling the required libraries requires a number of manual steps - so a precompiled set of libraries along with the patched source code is provided in the msvc_libs subdirectory. To get this from the repository do this:
82+
83+
git submodule init
84+
git submodule update msvc_libs
85+
86+
Note that WED versions 1.X and xptools before version 19-4 are using 32bit tools and MSVC 2010, while WED 2.x and xptools 19-4 and later are 64bit binaries and all libraries are created for Win10 / MSVC 2017 toolchains, only. So the `submodule update` step needs to be repeated anytime a different branch with changes to the submodule pointer is checked out.
87+
88+
### Building the Applications from the command line on Linux or macOS
89+
90+
Go to the Scenery Tools root directory (same dir as where these instructions can be found) and just do a
91+
92+
make -j
93+
94+
This will build the tool using default options for debugging. After awhile, the output can be found under
95+
96+
[xptools dir]/build/[platform]/[configuration]
97+
98+
The platform is determined automatically (when building on Linux it is Linux of course). The configuration defaults to `debug_opt`. You can specify the configuration when building the tools this way:
99+
100+
make conf=[configuration]
101+
102+
where `[configuration]` can be one of the following:
103+
104+
* `release`
105+
* `release_opt`
106+
* `debug`
107+
* `debug_opt`
108+
109+
The `release` configuration is built with maximum optimizations `-Ofast -flto`, `debug` with no optimization at all '-O0' and when no configuration is specified, optimizations suitable for most debugging tasks (platform dependent) are used.
110+
111+
The `release` configuration are built with `-DDEV=0` set, while `debug` and default variants have `-DDEV=1`.
112+
113+
To clean the tree you can do:
114+
115+
* `make clean`, this just deletes the `build` directory
116+
* `make distclean`, this deletes the `build` directory and the built 3rd-party libraries located in `libs/local`
117+
118+
You can also build a single tool or a set of tools like this:
119+
120+
conf=release_opt make [tool_1] [tool_2] [...tool_n]
121+
122+
Available tools are:
123+
124+
* `ac3d`
125+
* `DDSTool`
126+
* `DSFTool`
127+
* `MeshTool`
128+
* `ObjView`
129+
* `RenderFarm`
130+
* `RenderFarmUI`
131+
* `WED`
132+
* `XGrinder`
133+
134+
### Building on Windows Using Visual Studio
135+
136+
The MSVC solution file (`.sln`) can be found in `msvc/XPTools.sln`, and it contains projects that build WorldEditor and the reset of the tools.
137+
138+
### Building on macOS Using XCode
139+
140+
The XCode project is in the root of the repo, `SceneryTools.xcodeproj`. There is one target for each of the scenery tools—simply pick a configuration, target, and build.
141+
142+
### Building on Linux Using Code::Blocks
143+
144+
The project files (`.cbp`) for most xptools can be found in the `codeblocks` directory. The IDE is set up to build using the regular command line makefiles and not its internal build tools - so the results are guaranteed identical to command line builds.
145+

0 commit comments

Comments
 (0)