Skip to content

Commit 3fe02e7

Browse files
committed
Move godot-cpp custom bindings information to the 'build system' instructions from the intro doc, because most people won't need it for their first project.
1 parent 6ebd201 commit 3fe02e7

File tree

2 files changed

+34
-38
lines changed

2 files changed

+34
-38
lines changed

tutorials/scripting/cpp/build_system/scons.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,37 @@ There are two popular ways by which cross platform builds can be achieved:
7373
`godot-cpp-template <https://github.com/godotengine/godot-cpp-template>`__ contains an
7474
`example setup <https://github.com/godotengine/godot-cpp-template/tree/main/.github/workflows>`__
7575
for a GitHub based CI workflow.
76+
77+
Using custom bindings
78+
---------------------
79+
80+
Every branch of godot-cpp comes with bindings appropriate for the respective Godot version
81+
(e.g. the ``4.3`` branch comes with bindings compatible with Godot version ``4.3`` and
82+
later).
83+
84+
However, you may want to use custom bindings, for example:
85+
86+
* If you want to use the latest bindings from Godot ``master``.
87+
* If you want to use bindings exposed by custom modules.
88+
89+
To use custom bindings, you first have to generate them from the appropriate Godot
90+
executable:
91+
92+
.. code-block:: shell
93+
94+
godot --dump-extension-api
95+
96+
The resulting ``extension_api.json`` file will be created in the executable's
97+
directory. To use these custom bindings, you can add ``custom_api_file`` to
98+
your build command:
99+
100+
.. code-block:: shell
101+
102+
scons platform=<platform> custom_api_file=<PATH_TO_FILE>
103+
104+
Alternatively, you can add them as the default bindings to your project by adding
105+
the following line to your SConstruct file:
106+
107+
.. code-block:: python
108+
109+
localEnv["custom_api_file"] = "extension_api.json"

tutorials/scripting/cpp/gdextension_cpp_example.rst

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -97,44 +97,6 @@ following commands:
9797
9898
This will initialize the repository in your project folder.
9999

100-
Building the C++ bindings
101-
-------------------------
102-
103-
Now that we've downloaded our prerequisites, it is time to build the C++
104-
bindings.
105-
106-
The repository contains a copy of the metadata for the current Godot release,
107-
but if you need to build these bindings for a newer version of Godot, call
108-
the Godot executable:
109-
110-
.. code-block:: none
111-
112-
godot --dump-extension-api
113-
114-
The resulting ``extension_api.json`` file will be created in the executable's
115-
directory. Copy it to the project folder and add ``custom_api_file=<PATH_TO_FILE>``
116-
to the scons command below.
117-
118-
To generate and compile the bindings, use this command (replacing ``<platform>``
119-
with ``windows``, ``linux`` or ``macos`` depending on your OS):
120-
121-
The build process automatically detects the number of CPU threads to use for
122-
parallel builds. To specify a number of CPU threads to use, add ``-jN`` at the
123-
end of the SCons command line where ``N`` is the number of CPU threads to use.
124-
125-
.. code-block:: none
126-
127-
cd godot-cpp
128-
scons platform=<platform> custom_api_file=<PATH_TO_FILE>
129-
cd ..
130-
131-
This step will take a while. When it is completed, you should have static
132-
libraries that can be compiled into your project stored in ``godot-cpp/bin/``.
133-
134-
.. note::
135-
136-
You may need to add ``bits=64`` to the command on Windows or Linux.
137-
138100
Creating a simple plugin
139101
------------------------
140102

0 commit comments

Comments
 (0)