Commit graph

484 commits

Author SHA1 Message Date
Thaddeus Crews
a9810cffb4
SCons: Fix potential Windows ANSI exception 2024-05-18 13:14:31 -05:00
Rémi Verschelde
a63c37dca1
SCons: Bump min version to 3.1.2, test it on CI with one Linux job
The min SCons version had to be bumped as SCons 3.0 before 3.0.3 seems
broken (see #92043), and there's little gain from supporting 3.0.3-3.0.5.

3.1.2 is also the first version to avoid ambiguities between Python 2
and Python 3 usage, so we finally use it as the minimum baseline.

Also test against Python 3.6 which is also our minimum supported version.
This should help prevent regressions whenever we modernize the build scripts.
2024-05-17 11:18:57 +02:00
Rémi Verschelde
856fbc68b3
SCons: Restore compatibility with SCons < 4.0.0
Fixes #91986.
2024-05-17 09:01:07 +02:00
bruvzg
2818abe9ed [SCons] Add options to override AR, AR and RC flags, 2024-05-15 13:03:17 +03:00
Rémi Verschelde
5ae85fc6ab
Merge pull request #91833 from akien-mga/scons-min-gcc-version-9
SCons: Bump minimum supported GCC version to GCC 9
2024-05-14 18:09:54 +02:00
Rémi Verschelde
c5395d3ce2
Merge pull request #91866 from programneer/dont-splash-my-editor
Don't define `NO_EDITOR_SPLASH` in export templates
2024-05-13 12:05:56 +02:00
Programneer
efaba30116 Don't define NO_EDITOR_SPLASH in export templates 2024-05-12 13:12:56 +02:00
Rémi Verschelde
a04ba55790
SCons: Bump minimum supported GCC version to GCC 9
- GCC 7 supports C++17 but seems to have breaking regressions, see #79352.
- GCC 8 broke C++17 guaranteed copy elision support, fixed in 8.4, but...
- GCC 9 is old enough (2022) to use as a baseline and stop dealing with
  unmaintained and less efficient compiler versions.
2024-05-11 15:19:33 +02:00
Rémi Verschelde
d4d0e34bb4
SCons: Preserve Environment values when updating Variables
Finally reading the docs for `SCons.Variables.Update` let me find this optional
parameter, which solves the hacks and pain we've dealt with for years:

> args (optional) – a dictionary of keys and values to update in env.
> If omitted, uses the variables from the commandline.

By passing the environment itself, we preserve the values we've overridden in
`SConstruct` or `detect.py`.
2024-05-10 16:57:23 +02:00
Thaddeus Crews
34fb3f7730
SCons: Generate all scripts natively 2024-05-07 15:30:45 -05:00
Thaddeus Crews
e0e8ce1fc0
SCons: Colorize warnings/errors during generation 2024-04-28 16:24:48 -05:00
Thaddeus Crews
fd2ab721e2
SCons: scons_version to environment variable 2024-04-24 09:41:12 +02:00
Thaddeus Crews
e115f478ea
SCons: Only use alias if SCons v4.3 or later 2024-04-23 11:48:28 -05:00
Thaddeus Crews
5a87f0da21
SCons: Utilize native Variable alias functionality 2024-04-18 09:27:26 -05:00
Thaddeus Crews
41fee42c40
SCons: Convert env_base to env 2024-04-17 12:26:20 -05:00
Programneer
2980593995 Only define ENGINE_UPDATE_CHECK_ENABLED in editor builds 2024-04-17 10:00:48 +02:00
kobewi
49e69fabba Add automatic checking for engine updates 2024-04-15 15:08:27 +02:00
Rémi Verschelde
e5c689d028
SCons: Make new debug_paths_relative option opt-in
As pointed out in https://github.com/godotengine/godot/pull/78232#issuecomment-2056467297,
it actually makes it harder to run Godot locally while keeping the relationship with the
header files it was compiled from.
2024-04-15 12:19:36 +02:00
Rémi Verschelde
74e6b5a059
SCons: Add GCC/Clang option to make debug file paths relative 2024-04-12 10:08:03 +02:00
Rémi Verschelde
7e4c150573
SCons: Fix up build with Python 3.10
It gives:

> SyntaxError: f-string expression part cannot include a backslash

Follow-up to #90214.
2024-04-05 13:14:41 +02:00
Thaddeus Crews
c6995be6e4
SCons: Refactor selected_platform conditional 2024-04-04 12:38:58 -05:00
Riteo
55558fb175 SCons: Add an option to enable the experimental ninja build backend
With this option turned on, if properly set up, SCons generates a
`build.ninja` file and quits. To actually build the engine, the user can
then call `ninja` with whatever options they might prefer (not
everything is yet transferred properly to this new generated file).

Ideally, the scons file should never be called again, as ninja
automatically detects any SCons build script change and invokes
the required commands to regenerate itself.

This approach speeds up incremental builds considerably, as it limits
SCons to code generation and uses ninja's extremely fast timestamp-based
file change detector.
2024-03-15 16:05:25 +01:00
Adam Scott
4080992b38
Fix compiledb SCons tool availability 2024-03-14 11:58:57 -04:00
Thaddeus Crews
5a6e3cbcb0
SCons: Remove run_in_subprocess dependency 2024-03-11 13:20:09 -05:00
Thaddeus Crews
0ce9b6fd1d
Add two new COMSTR environment variables 2024-03-01 12:44:03 -06:00
Rémi Verschelde
0d1894736e
SCons: Fix CCFLAGS, LINKFLAGS, etc. command line overrides
Also adds `CPPDEFINES` which allows passing new pre-processor defines,
letting SCons handle passing `-D` or `/D` based on the compiler.
2024-02-20 15:57:53 +01:00
bruvzg
94238d0462
[iOS/macOS] Add option to automatically build (and sign / archive) bundles. 2024-02-13 16:36:41 +02:00
Rémi Verschelde
6b1e50ba97
Merge pull request #88025 from shana/fix-incremental-builds
SCons: Fix incremental builds breaking when querying the dependency tree from a SCsub
2024-02-07 11:05:36 +01:00
Andreia Gaita
0b43b0124f Use an absolute path for SConsignFile so all Sconscript invocations share the same database
SConscript("some SCsub path") calls create a new context where a relative path
to the .sconsign file is interpreted as being next to the currently executing
SCsub, and not the one at the root. This breaks incremental build detection
because scons can't find the build information of dependent files outside of the
SCsub directory and just rebuilds everything every time.
2024-02-06 19:52:30 +01:00
Andreia Gaita
7638a6c981 Add new VS proj generation logic that supports any platform that wants to opt in
Custom Visual Studio project generation logic that supports any platform that has a msvs.py
script, so Visual Studio can be used to run scons for any platform, with the right defines per target.

Invoked with `scons vsproj=yes`

To generate build configuration files for all platforms+targets+arch combinations, users should call

```
scons vsproj=yes platform=XXX target=YYY [other build flags]
```

for each combination of platform+target[+arch]. This will generate the relevant vs project files but
skip the build process, so that project files can be quickly generated without waiting for a command line
build. This lets project files be quickly generated even if there are build errors.

All possible combinations of platform+target are created in the solution file by default, but they
won't do anything until each one is set up with a scons vsproj=yes command for the respective platform
in the appropriate command line. This lets users only generate the combinations they need, and VS
won't have to parse settings for other combos.

Only platforms that opt in to vs proj generation by having a msvs.py file in the platform folder are included.
Platforms with a msvs.py file will be added to the solution, but only the current active platform+target+arch
will have a build configuration generated, because we only know what the right defines/includes/flags/etc are
on the active build target currently being processed by scons.

Platforms that don't support an editor target will have a dummy editor target that won't do anything on build,
but will have the files and configuration for the windows editor target.

To generate AND build from the command line, run

```
scons vsproj=yes vsproj_gen_only=no
```
2024-01-31 16:42:42 +01:00
Adam Scott
bd70b8e1f6
Add THREADS_ENABLED macro in order to compile Godot to run on the main thread 2024-01-17 13:58:29 -05:00
Yuri Sizov
718598e470 Merge pull request #84979 from Calinou/scons-web-platform-alias
Alias `platform=javascript` SCons option to `platform=web`
2023-12-20 15:07:40 +01:00
George Marques
ed52ac9b5d
Add option in SCons to copy environment variables
This allows custom environment variables to be used during the build,
which is useful when using alternative compilation tools such as caches
and distributed build systems.
2023-12-15 10:59:26 -03:00
Rémi Verschelde
2966db7d76
Merge pull request #84440 from Calinou/scons-android-add-generate-apk-option
Add `generate_apk=yes` to generate an APK after building
2023-12-13 10:31:32 +01:00
Hugo Locurcio
18152ac3a1
Add generate_apk=yes to generate an APK after building
This is useful to speed up iteration when working on the engine
(or editor).

This can be combined with a script that calls `adb` to deploy the APK
on a device (coupled with Godot's `--export-*` for projects)
to further speed up iteration.
2023-12-13 00:27:57 +01:00
Pedro J. Estébanez
2f47c57385 Add Direct3D 12 RenderingDevice implementation 2023-12-12 19:10:04 +01:00
Hugo Locurcio
0185835988
Alias platform=javascript SCons option to platform=web
This makes build scripts backward-compatible, as was already done
for other platforms that were renamed in 4.0.
2023-11-16 17:53:03 +01:00
Rémi Verschelde
495245ed89
SCons: Reduce and cleanup verbose output for SCU builds
Verbose output is meant for debugging the SCU mode itself and can be
triggered by changing the `_verbose` bool manually.

Prefix all prints with "SCU:" for context, and print the processed
folders all at once instead of when adding the sources.
2023-10-26 15:13:48 +02:00
Rémi Verschelde
3bfcbe7946
SCons: Use CXXFLAGS to disable exceptions, it's only for C++
Following discussion in https://github.com/godotengine/godot-cpp/pull/1216.
2023-10-19 16:28:07 +02:00
Mai Lavelle
a1e5ab6644 Add object_prefix scons option
Add `object_prefix` as an scons option to add a custom prefix to
all generated object files, via the `OBJPREFIX` and `SHOBJPREFIX`
environment variables.

This is useful for instance to hide object files on unix-like
systems and make the source directories less cluttered by
setting `object_prefix = '.'` in `custom.py`.
2023-10-05 14:49:14 -04:00
Rémi Verschelde
090a5b028b
Merge pull request #82638 from Repiteo/check_c_headers-to-dictionary
`check_c_headers` from tuple array to dictionary
2023-10-03 17:26:16 +02:00
Thaddeus Crews
e9b2af91cf
check_c_headers from tuple array to dictionary 2023-10-01 14:09:39 -05:00
Ithamar R. Adema
36ff0591f2 Add build option for MP1/MP2 audio format support.
Enabling this adds 3.5k to the template size (Win/64bits).

Co-authored-by: Riteo <riteo@posteo.net>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-09-30 21:46:59 +02:00
smix8
0ee7e3102b Add 2D navigation mesh baking
Adds 2D navigation mesh baking.
2023-09-25 19:48:14 +02:00
bruvzg
1887a9df19
[macOS/Windows] Add optional ANGLE backed OpenGL renderer support. Add EGL_ANDROID_blob_cache caching.
Co-authored-by: Riteo <riteo@posteo.net>
2023-09-21 14:21:00 +03:00
Valery Zhuk
6158578087 fix build options configuration for Visual Studio projects 2023-09-02 19:29:05 +03:00
Rémi Verschelde
30bdb23f03
SCons: Enable /WX on LINKFLAGS for MSVC with werror=yes 2023-08-17 15:51:54 +02:00
Rémi Verschelde
3907e53ff6
SCons: Disable C++ exception handling
Upon investigating the extremely slow MSVC build times in #80513, I noticed
that while Godot policy is to never use exceptions, we weren't enforcing it
with compiler flags, and thus still included exception handling code and
stack unwinding.

This is wasteful on multiple aspects:

- Binary size: Around 20% binary size reduction with exceptions disabled
  for both MSVC and GCC binaries.
- Compile time:
  * More than 50% build time reduction with MSVC.
  * 10% to 25% build time reduction with GCC + LTO.
- Performance: Possibly, needs to be benchmarked.

Since users may want to re-enable exceptions in their own thirdparty code
or the libraries they compile with Godot, this behavior can be toggled with
the `disable_exceptions` SCons option, which defaults to true.
2023-08-16 10:23:34 +02:00
Rémi Verschelde
2757c2a495
Merge pull request #78959 from lawnjelly/scu_limit
SCons : Add "scu_limit" argument
2023-08-08 16:56:21 +02:00
Yuri Sizov
661c3954a6 Merge pull request #73443 from akien-mga/unbundle-openxr
Allow unbundling OpenXR (for Linux distros)
2023-07-12 17:15:25 +02:00