summaryrefslogtreecommitdiff
path: root/SConstruct
AgeCommit message (Collapse)Author
2021-05-04Port changes to the "raycast" module build files from 3.xjfons
2021-04-10Add option modules_enabled_by_defaulttotlmstr
2021-03-23Merge pull request #44398 from RevoluPowered/unit-tests-for-export-templatesRémi Verschelde
Add unit tests for export templates
2021-03-22Add unit tests for export templatesGordon MacPherson
2021-03-20Merge pull request #46966 from qarmin/faster_releaseRémi Verschelde
Allow to not optimize release build
2021-03-14Allow to not optimize release buildRafał Mikrut
2021-03-14Merge pull request #46799 from goostengine/module-includesRémi Verschelde
Provide missing include path for custom modules
2021-03-12Fixes small typos and grammar correctionAnshul7sp1
2021-03-10SCons: Use default env["ENV"] and prepend PATH to itRémi Verschelde
See discussion in #46814. Now going with the safe option again (like in 3.2) as it turns out that we can't rely on user environments on Windows, since each shell has a different set of env variables (especially the ones necessary to use MSVC). SCons does its own magic when we don't pass it an `ENV` dictionary, so we should preserve it and only add things in a second step. Fixes this warning when compiling with MSVC using git-bash.exe: ``` Missing environment variable: WindowsSdkDir ``` Possibly fixes build issues when having both MinGW and MSVC installed and an older SCons version.
2021-03-09SCons: Propagate the user's OS environment in env["ENV"]Rémi Verschelde
This fixes a regression from #46774 where `env["ENV"]` would miss some important env variables on Windows, such as `SystemRoot`, `PATHEXT`, etc. To have those, we can either use the default `ENV` created by SCons, or propagate the whole external environment. Fixes #46790.
2021-03-08Provide additional include paths for custom modulesAndrii Doroshenko (Xrayez)
Allows to use a module as a library, where an include path may start with module's name itself.
2021-03-07SCons: Fix parsing PATH when constructing base environmentRémi Verschelde
We constructed the SCons environment without taking any (shell) environment variables into account, and then appended a few, but too late. This would cause variables like `env[CXX]` not to be properly expanded to respect a non-standard `PATH`. With this fix, setting: ``` PATH=$GODOT_SDK/bin:$PATH ``` will now properly use `$GODOT_SDK/bin/gcc` if available over `/usr/bin/gcc`.
2021-02-25SCons: Fix profile type. It is a stringMateo Kuruk Miccino
2021-02-24SCons: Properly handle overriding default values to bool optionsRémi Verschelde
The `dev=yes` and `production=yes` options work as aliases to set a number of options, while still aiming to allow overriding specific options if the user wishes so. (E.g. `production=yes use_lto=no` should work to enable production defaults *but* disable LTO.) That wasn't working as `ARGUMENTS.get()` returns a string and not a boolean as expected by `BoolVariable`, and this wasn't flagged as a bug... So added a helper method using SCons' `BoolVariable._text2bool` to do the conversion manually.
2021-02-18SCons: Make freetype module a mandatory editor dependencyRémi Verschelde
Fixes #28650.
2021-02-08Merge pull request #43057 from Xrayez/custom_modules_recursiveRémi Verschelde
SCons: Add an option to detect C++ modules recursively
2021-02-03SCons: Add `production=yes` option to use production defaultsRémi Verschelde
This is meant for users making custom builds to match the options used on optimized, official builds. This enables, on the platforms which support them: - `use_static_cpp=yes` (portable binaries for Linux and Windows) - `use_lto=yes` (link time optimizations - note: requires a lot of RAM!) - `debug_symbols=no` (no debug symbols, smaller binaries) Also abort when using MSVC with `production=yes`, as: - It cannot optimize the GDScript VM like GCC or Clang do, leading to significant performance drops. - Its LTO support is unreliable, at least used to trigger crashes last we tried it extensively. All options can still be overridden if specified, and the `dev=yes` option was changed to also support overrides.
2021-02-01Fix incorrect version requirement in the SCons compilation DB commentHugo Locurcio
2020-12-17SCons: Fix build with `p` alias or platform auto-detectionRémi Verschelde
Fixes a pre-existing bug that #44433 exposed. It's pretty hacky, but we use `platform` in `env` both as an optional command line option (instead it can be autodetected, or passed via the `p` alias, and on Linux it might be overridden if you pass one of the convenience alias values), and as the reference value for what platform we're building on. Thus we override `env_base["platform"]` with the autodetected or validated platform, but any call to `opts.Update(env_base)` overrides it with the original command line option... causing e.g. #44448. The proper fix would be to refactor all this so that we don't reuse `env["platform"]` for platform detection (it could instead be e.g. `env.platform` as a member variable which holds the validated value), but for now I'm tapering over the immediate breakage. Fixes #44448 and other breakages induced by #44433.
2020-12-16SCons: Add only selected platform's opts to envRémi Verschelde
Otherwise we can get situations where platform-specific opts with the same name can override each other depending on the order at which platforms are parsed, as was the case with `use_static_cpp` in Linux/Windows. Fixes #44304. This also has the added benefit that the `scons --help` output will now only include the options which are relevant for the selected (or detected) platform.
2020-12-12Don't handle BaseException in build scriptsMarcel Admiraal
2020-11-26[Complex Text Layouts] Add third-party TextServer dependencies (ICU, ↵bruvzg
HarfBuzz, Graphite).
2020-11-25Core: Always enable ptrcall, remove PTRCALL_ENABLED defineRémi Verschelde
ptrcall is now also used to optimize calls in GDScript, on top of the existing use by the GDNative and Mono modules. It no longer makes sense to make it optional.
2020-10-24SCons: Add an option to detect C++ modules recursivelyAndrii Doroshenko (Xrayez)
This adds `custom_modules_recursive` which allows to detect and collect all nested C++ modules which may reside in any directory specified by `custom_modules` option. The detection logic is made to be more strict because `SCSub` may be used for organizing hierarchical builds within a module itself, so the existence of `register_types.h` and `config.py` is checked as well (these are all required for a C++ module to be compiled by Godot). For performance reasons, built-in modules are not checked recursively, and there's no benefit of doing so in the first place. It's now possible to specify a directory path pointing to a *single* module, as it may contain nested modules which are detected recursively.
2020-10-08SCons: Refactor and cleanup warnings definitionRémi Verschelde
2020-09-27Add all headers to VS ProjectBartłomiej T. Listwon
2020-09-10Remove unused Python imports.Marcel Admiraal
2020-08-13Merge pull request #41219 from akien-mga/gles2-takes-holidaysRémi Verschelde
Remove obsolete GLES2 backend code
2020-08-13Remove obsolete GLES2 backend codeRémi Verschelde
This code currently isn't compiled (and cannot compile). We plan to re-add OpenGL ES-based renderer(s) in Godot 4.0 alongside Vulkan (probably ES 3.0, possibly also a low-end ES 2.0), but the code will be quite different so it's not relevant to keep this old Godot 3.2 code. The `drivers/gles2` code from the `3.2` branch can be used as a reference for a potential new implementation.
2020-08-12update to use scons compile db toolGordon MacPherson
2020-07-28SCons: Refactor running commands through buildersAndrii Doroshenko (Xrayez)
A new `env.Run` method is added which allows to control the verbosity of builders output automatically depending on whether the "verbose" option is set. It also allows to optionally run any SCons commands in a subprocess using the existing `run_in_subprocess` method, unifying the interface. `Action` objects wrap all builder functions to include a short build message associated with any action. Notably, this removes quite verbose output generated by `make_doc_header` and `make_editor_icons_action` builders.
2020-07-26CI: Install master version of psf/blackRémi Verschelde
Until https://github.com/psf/black/pull/1328 makes it in a stable release, we have to use the latest from Git. Apply new style fixes done by latest black.
2020-07-26SCons: Build tests/ and main/ in cloned environmentsRémi Verschelde
Allows switching `tests=yes`/`no` and rebuilding only tests and main, instead of the whole engine. Co-authored-by: Andrii Doroshenko (Xrayez) <xrayez@gmail.com>
2020-07-26Move `tests` to the top-level directoryAndrii Doroshenko (Xrayez)
2020-07-25SCons: Add `tests` option to enable or disable unit testsAndrii Doroshenko (Xrayez)
2020-07-24t Add unit testing to Godot using DocTest and added to GitHub Actions CIRevoluPowered
Implements exit codes into the engine so tests can return their statuses. Ideally we don't do this, and we use FIXUP logic to 'begin' and 'end' the engine execution for tests specifically. Since realistically we're initialising the engine here we don't want to do that, since String should not require an engine startup to test a single header. This lowers the complexity of running the unit tests and even for physics should be possible to implement such a fix.
2020-07-14SCons: Do not enable werror=yes by defaultRémi Verschelde
There are too many users who compile Godot from source and are not familiar with the buildsystem or C/C++ compilation warnings, and thus report any kind of yet-unfixed warning as a (often duplicate) bug. Compiler warnings change at every compiler version and are different for each compiler, so it's difficult to ensure that the codebase would always be 100% warning-free, especially in the future. I already disabled it for stable releases in #37958, but having it on non stable commits could also become an annoyance in the future when trying to bisect issues with a new compiler version which emits warnings unknown at the time of commit. TL;DR: Contributors, use `dev=yes` or `werror=yes`. CI does and won't let you create new warnings ;)
2020-07-12Disable "misleading indentation" warning on GCCAaron Franke
2020-06-10Merge pull request #37248 from Xrayez/env-dumpRémi Verschelde
SCons: Dump construction environment to a file
2020-06-10SCons: Dump construction environment to a fileAndrii Doroshenko (Xrayez)
A new `methods.dump(env)` is added to dump the construction environment used by SCons to build Godot to a `.scons_env.json`. The file can be used for debugging purposes and any external tool.
2020-06-03SCons: Validate dependencies for linked multimedia modulesRémi Verschelde
This is still a bit hacky and eventually we should rework the way we handle optional dependencies (especially with regard to builtin/system libs), but it's a simple first step. Fixes #39219.
2020-05-29Merge pull request #39137 from Xrayez/custom-modules-profileRémi Verschelde
SCons: Allow to read `custom_modules` option via a file
2020-05-29SCons: Allow to read `custom_modules` option via a fileAndrii Doroshenko (Xrayez)
The `custom_modules` option was only read via the command line by fetching `ARGUMENTS` dictionary directly. Instead, the option's value can now be read via any existing configuration files (`custom.py`) as well as command line, while also updating the environment.
2020-05-28SCons: Prefer `Exit()` method over `sys.exit()`Andrii Doroshenko (Xrayez)
Sconscript provides it's own `Exit()` method which is currently an alias for `sys.exit()` internally, with the only difference that if no exit code is specified, it defaults to 0. This encourages the usage of SCons-implemented methods like `Glob()` over `glob.glob()`, which may overcome limitations of the built-in Python features in the future.
2020-05-28Merge pull request #39125 from Xrayez/py-modules-order-4.0Rémi Verschelde
SCons: use `OrderedDict` to ensure insertion order of modules
2020-05-28SCons: use `OrderedDict` to ensure insertion order of modulesAndrii Doroshenko (Xrayez)
The insertion order for dictionaries is only a language feature for Python 3.6/3.7+ implementations, and not prior to that. This ensures that the engine won't be rebuilt if the order of detected modules changes in any way, as the `OrderedDict` should guarantee inerstion order.
2020-05-27Merge pull request #37198 from Xrayez/progress-insideRémi Verschelde
SCons: Move build progress related logic out of main SConstruct
2020-05-25Add `custom_modules` build option to compile external user modulesAndrii Doroshenko (Xrayez)
This patch adds ability to include external, user-defined C++ modules to be compiled as part of Godot via `custom_modules` build option which can be passed to `scons`. ``` scons platform=x11 tools=yes custom_modules="../project/modules" ``` Features: - detects all available modules under `custom_modules` directory the same way as it does for built-in modules (not recursive); - works with both relative and absolute paths on the filesystem; - multiple search paths can be specified as a comma-separated list. Module custom documentation and editor icons collection and generation process is adapted to work with absolute paths needed by such modules. Also fixed doctool bug mixing absolute and relative paths respectively. Implementation details: - `env.module_list` is a dictionary now, which holds both module name as key and either a relative or absolute path to a module as a value. - `methods.detect_modules` is run twice: once for built-in modules, and second for external modules, all combined later. - `methods.detect_modules` was not doing what it says on the tin. It is split into `detect_modules` which collects a list of available modules and `write_modules` which generates `register_types` sources for each. - whether a module is built-in or external is distinguished by relative or absolute paths respectively. `custom_modules` scons converter ensures that the path is absolute even if relative path is supplied, including expanding user paths and symbolic links. - treats the parent directory as if it was Godot's base directory, so that there's no need to change include paths in cases where custom modules are included as dependencies in other modules.
2020-05-18SCons: Improve registration of compilation_db tool, check versionRémi Verschelde
There's a builtin `toolpath` option we can use for that, so no need to hack around a custom `scons_site` path. The script requires SCons 3.1.1 or later, so we enable it conditionally. Follow-up to #32848.
2020-05-12Added compilation database support for clang and gccRevoluPowered
This tool is originally from mongodb. - Updated CPPSUFFIXES to use scons suffixes - objective-c files will also be loaded into the compilation database where the compiler / tooling is available to compile the files. Known limitations: - This will not work with msvc as your compiler.