Skip to content

Commit c0cf109

Browse files
authored
Merge pull request godotengine#8140 from YuriSizov/buildsystem-intro
Improve introduction into buildsystem
2 parents 20a6f9e + 7e64017 commit c0cf109

File tree

3 files changed

+103
-19
lines changed

3 files changed

+103
-19
lines changed
Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,46 @@
11
Building from source
22
====================
33

4+
.. highlight:: shell
5+
6+
Godot prides itself on being very easy to build, by C++ projects' standards.
7+
:ref:`Godot uses the SCons build system <doc_faq_why_scons>`, and after the initial
8+
setup compiling the engine for your current platform should be as easy as running::
9+
10+
scons
11+
12+
But you will probably need to use at least some of the available options to configure
13+
the build to match your specific needs, be it a custom engine fork, a lightweight build
14+
stripped of extra modules, or an executable targetting engine development.
15+
16+
The articles below should help you navigate configuration options available, as well as
17+
prerequisites required to compile Godot exactly the way you need.
18+
19+
Basics of building Godot
20+
------------------------
21+
22+
Let's start with basics, and learn how to get Godot's source code, and then which options
23+
to use to compile it regardless of your target platform.
24+
425
.. toctree::
526
:maxdepth: 1
627
:name: toc-devel-compiling
728

829
getting_source
930
introduction_to_the_buildsystem
31+
32+
Building for target platforms
33+
-----------------------------
34+
35+
Below you can find instructions for compiling the engine for your specific target platform.
36+
Note that Godot supports cross-compilation, which means you can compile it for a target platform
37+
that doesn't match your current platform (say, target Linux while being on Windows). The guides
38+
will try their best to cover all possible situations.
39+
40+
.. toctree::
41+
:maxdepth: 1
42+
:name: toc-devel-compiling-platforms
43+
1044
compiling_for_windows
1145
compiling_for_linuxbsd
1246
compiling_for_macos
@@ -15,6 +49,21 @@ Building from source
1549
cross-compiling_for_ios_on_linux
1650
compiling_for_uwp
1751
compiling_for_web
52+
53+
Other compilation targets and options
54+
-------------------------------------
55+
56+
Some additional universal compilation options require further setup. Namely, while Godot
57+
does have C#/.NET support as a part of its main codebase, it does not get compiled by
58+
default to reduce the executable size for users who don't need C# for their projects.
59+
60+
Articles below explain how to configure the buildsystem for cases like this, and also
61+
cover some optimization techniques.
62+
63+
.. toctree::
64+
:maxdepth: 1
65+
:name: toc-devel-compiling-options
66+
1867
compiling_with_dotnet
19-
optimizing_for_size
2068
compiling_with_script_encryption_key
69+
optimizing_for_size

contributing/development/compiling/introduction_to_the_buildsystem.rst

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,26 @@ Introduction to the buildsystem
66
.. highlight:: shell
77

88

9-
Setup
10-
-----
9+
Godot is a primarily C++ project and it :ref:`uses the SCons build system. <doc_faq_why_scons>`
10+
We love SCons for how maintainable and easy to set up it makes our buildsystem. And thanks to
11+
that compiling Godot from source can be as simple as running::
1112

12-
:ref:`Godot uses the SCons build system. <doc_faq_why_scons>`
13-
Please refer to the documentation for:
13+
scons
14+
15+
This produces an *export template* for your current platform, operating system, and architecture.
16+
An export template is a build of the engine that is used for running exported projects. To build
17+
the *editor* instead you can run the following command::
18+
19+
scons target=editor
20+
21+
If you plan to debug or develop the engine, then you might want to add another option to the command::
22+
23+
scons dev_build=yes
24+
scons target=editor dev_build=yes
25+
26+
Following sections in the article will explain these and other universal options in more detail. But
27+
before you can compile Godot, you need to install a few prerequisites. Please refer to the platform
28+
documentation to learn more:
1429

1530
- :ref:`doc_compiling_for_android`
1631
- :ref:`doc_compiling_for_ios`
@@ -20,6 +35,22 @@ Please refer to the documentation for:
2035
- :ref:`doc_compiling_for_web`
2136
- :ref:`doc_compiling_for_windows`
2237

38+
These articles cover in great detail both how to setup your environment to compile Godot on a specific
39+
platform, and how to compile for that platform. Please feel free to go back and forth between them and
40+
this article to reference platform-specific and universal configuration options.
41+
42+
Using multi-threading
43+
---------------------
44+
45+
The build process may take a while, depending on how powerful your system is. By default, Godot's
46+
SCons setup is configured to use all CPU threads but one (to keep the system responsive during
47+
compilation). If you want to adjust how many CPU threads SCons will use, use the ``-j <threads>``
48+
parameter to specify how many threads will be used for the build.
49+
50+
Example for using 4 threads::
51+
52+
scons -j4
53+
2354
Platform selection
2455
------------------
2556

@@ -53,18 +84,6 @@ To build for a platform (for example, ``linuxbsd``), run with the ``platform=``
5384

5485
scons platform=linuxbsd
5586

56-
This will start the build process, which will take a while. By default, Godot's
57-
SCons setup is configured to use all CPU threads but one (to keep the system
58-
responsive during compilation). If you want to adjust how many CPU threads SCons
59-
will use, use the ``-j <threads>`` parameter to specify how many threads will be
60-
used for the build.
61-
62-
Example for using 4 threads:
63-
64-
::
65-
66-
scons platform=linuxbsd -j4
67-
6887
.. _doc_introduction_to_the_buildsystem_resulting_binary:
6988

7089
Resulting binary

contributing/development/index.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,25 @@ especially if you're new to using Git or GitHub.
1717
best_practices_for_engine_contributors
1818
code_style_guidelines
1919
cpp_usage_guidelines
20+
21+
Buildsystem and work environment
22+
--------------------------------
23+
24+
.. toctree::
25+
:maxdepth: 1
26+
:name: toc-contributing-to-the-engine-environment
27+
28+
configuring_an_ide/index
2029
compiling/index
2130
debugging/index
22-
configuring_an_ide/index
31+
32+
Engine architecture
33+
-------------------
34+
35+
.. toctree::
36+
:maxdepth: 1
37+
:name: toc-contributing-to-the-engine-architecture
38+
2339
core_and_modules/index
24-
editor/index
2540
file_formats/index
41+
editor/index

0 commit comments

Comments
 (0)