summaryrefslogtreecommitdiff
path: root/methods.py
AgeCommit message (Collapse)Author
2020-04-04SCons: Expand CXX in check for vanilla ClangRémi Verschelde
I had missed it in df7ecfc4a7f8403144be2aa49bb47f9ead25926b it seems. Fixes #37575.
2020-03-30SCons: Format buildsystem files with psf/blackRémi Verschelde
Configured for a max line length of 120 characters. psf/black is very opinionated and purposely doesn't leave much room for configuration. The output is mostly OK so that should be fine for us, but some things worth noting: - Manually wrapped strings will be reflowed, so by using a line length of 120 for the sake of preserving readability for our long command calls, it also means that some manually wrapped strings are back on the same line and should be manually merged again. - Code generators using string concatenation extensively look awful, since black puts each operand on a single line. We need to refactor these generators to use more pythonic string formatting, for which many options are available (`%`, `format` or f-strings). - CI checks and a pre-commit hook will be added to ensure that future buildsystem changes are well-formatted.
2020-03-25SCons: Drop support for Python 2Rémi Verschelde
We now require SCons 3.0+ (first version with Python 3 support), and we set min required Python 3 version to 3.5 (3.4 and earlier are EOL).
2020-03-25Style: Harmonize header guards to style guide [Core]Rémi Verschelde
2020-03-18Remove the dead function win32_spawn from methods.py.unknown
2020-03-04SCons: Expand env variables to check compiler versionRémi Verschelde
Scons' `Environment.subst()` does that, and was already used in the other place where we query an env variable (`env["LINK"]` in x11 code). Fixes `3.2` iOS build after cherry-pick of #36559 (previously it only ran for GCC code, not iOS's Clang), and the same issue would likely affect `master` if iOS builds were enabled right now.
2020-02-26SCons: Fix get_compiler_version() to return intsRémi Verschelde
Otherwise comparisons would fail for compiler versions above 10. Also simplified code somewhat to avoid using subprocess too much needlessly.
2020-02-26SCons: Re-allow upcoming GCC 8.4, fixes C++17 copy elisionRémi Verschelde
Follow-up to #36484. The patches for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86521 have now landed in the `releases/gcc-8` branch and will be in GCC 8.4.
2020-02-24Scons: fixed build for vanilla clang in mac os xNickolai Korshunov
2020-02-23SCons: Add GCC/Clang minimum version checkRémi Verschelde
Prevent using GCC 8 as it does not properly support C++17's guaranteed copy elision which we now need. (Upstream bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86521) Follow-up to #36457 and #36436.
2020-02-11Moved the shader source compilation code outside RenderingDevice and VulkanJuan Linietsky
2020-02-07SCons: Split libmodules.a in folder-based libsRémi Verschelde
This removes the need for the hacky split_libmodules logic on Windows, since all libs are now of manageable size.
2020-02-07SCons: Generate header with info on which modules are enabledRémi Verschelde
We already had `MODULE_*_ENABLED` defines but only in the modules environment, and a few custom `*_ENABLED` defines in the main env when we needed the information in core. Now this is defined in a single header which can be included in the files that need this information.
2020-01-06PCK: Set VERSION_PATCH in header, factor out header magicJoost Heitbrink
Unify pack file version and magic to avoid hardcoded literals. `version.py` now always includes `patch` even for the first release in a new stable branch (e.g. 3.2). The public name stays without the patch number, but `Engine.get_version_info()` already included `patch == 0`, and we can remove some extra handling of undefined `VERSION_PATCH` this way. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-01-03Remove unused importsunknown
2019-12-11SCons: Add 'split_libmodules' option to workaround linker issueRémi Verschelde
The new 'split_libmodules=yes' option is useful to work around linker command line size limitations when linking a huge number of objects. We're currently over 64k chars when linking libmodules.a on Windows with MinGW, which triggers issues as seen in #30892. Even on Linux, we can also reach linker command line size limitations by adding more custom modules. We force this option to True for MinGW on Windows, which fixes #30892. Additional changes to lib splitting: - Fix linking of the split module libs with interdependent symbols, hacking our way into LINKCOM and SHLINKCOM to set the `--start-group` and `--end-group` flags. - Fix Python 3 compatibility in `methods.split_lib()`. - Drop seemingly obsolete condition for 'msys' on 'posix'. - Drop the unnecessary 'split_drivers' as the drivers lib is no longer too big since we moved all thirdparty builds to modules. Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2019-07-26fix getting correct mingw-w64 versionsantouits
When checking mingw-w64 version, at least on debian, the regex being used returned 86 because the name of the binary in debian starts with x86_64-w64 so we use the dumpversion option that gcc has. This fixes not compiling because gcc versions < 7 don't have some checks like shadow-local
2019-07-22SCons: Fix uses of [].append instead of env.add_source_files()Rémi Verschelde
Also added support for SCons project-absolute paths (starting with #) and warning about duplicates in add_source_files(), and fixed default_controller_mappings.gen.cpp being included twice after first build due to *.cpp globbing. Part of #30270.
2019-07-03SCons: Use CPPDEFINES instead of CPPFLAGS for pre-processor definesRémi Verschelde
It's the recommended way to set those, and is more portable (automatically prepends -D for GCC/Clang and /D for MSVC). We still use CPPFLAGS for some pre-processor flags which are not defines.
2019-06-29some variables in methods.py are not usedhbina085
Thus they can be safely ignored
2019-05-28Print engine version to stdout when starting GodotRémi Verschelde
Also include website URL and make it configurable via version.py together with the rest of the engine branding. Add mention to MIT license in --help output.
2019-04-24SCons: Review uses of CCFLAGS, CXXFLAGS and CPPFLAGSRémi Verschelde
Many contributors (me included) did not fully understand what CCFLAGS, CXXFLAGS and CPPFLAGS refer to exactly, and were thus not using them in the way they are intended to be. As per the SCons manual: https://www.scons.org/doc/HTML/scons-user/apa.html - CCFLAGS: General options that are passed to the C and C++ compilers. - CFLAGS: General options that are passed to the C compiler (C only; not C++). - CXXFLAGS: General options that are passed to the C++ compiler. By default, this includes the value of $CCFLAGS, so that setting $CCFLAGS affects both C and C++ compilation. - CPPFLAGS: User-specified C preprocessor options. These will be included in any command that uses the C preprocessor, including not just compilation of C and C++ source files [...], but also [...] Fortran [...] and [...] assembly language source file[s]. TL;DR: Compiler options go to CCFLAGS, unless they must be restricted to either C (CFLAGS) or C++ (CXXFLAGS). Preprocessor defines go to CPPFLAGS.
2019-04-24Also disable C and C++ specific warnings in thirdparty codeRémi Verschelde
Move the `Append` up to make sure that the keys exist and avoid the need to check `if CPPFLAGS in self`, etc.
2019-04-07Android now (optionally) builds the template when exportingJuan Linietsky
Added new way to create add-ons Removed old way to create add-ons
2019-04-06Remove unused importsHendrikto
2019-04-05SCons: add `methods.using_clang` to check used compilerRémi Verschelde
Also rename `use_gcc` to `using_gcc` to make it clear that it returns a config but does not alter it.
2019-03-05Move YEAR definition to version.pyRémi Verschelde
If it needs to be hardcoded (for the sake of reproducible builds), it should be together with the other hardcoded version info. And yeah, two months in, let's move to 2019.
2019-02-23Come up with use_gcc.marxin
Add new method. Fix wrong version condition for -fpie.
2019-02-20Add -Wshadow=local to warnings and fix reported issues.marxin
Fixes #25316.
2019-02-08Get Git commit hash when Godot is a submoduleGeorge Marques
Submodules don't have a .git folder in the same place, but a .git file that points to the actual folder. This change take this into account.
2018-11-26[macOS] Fixed a problem sdk path could not be detectedNaoto Kondo
2018-11-20Merge pull request #21339 from Placinta/masterRémi Verschelde
Fix regular macOS build by passing -isysroot to compiler so correct system headers are found
2018-11-20Remove trailing whitespaceRémi Verschelde
With `sed -i $(rg -l '[[:blank:]]*$' -g'!thirdparty') -e 's/[[:blank:]]*$//g'` (+ manual revert of some thirdparty code under `platform/android`).
2018-10-27Dont use equality operators with None singleton in python fileslupoDharkael
2018-10-04SCons: Add 'werror' opt-in to treat warning as errorsRémi Verschelde
Also reorder advanced options to a more natural order, and fix MSVC warning when disabling warnings in secondary environment.
2018-09-28SCons: Build thirdparty code in own env, disable warningsRémi Verschelde
Also remove unnecessary `Export('env')` in other SCsubs, Export should only be used when exporting *new* objects.
2018-09-13Fix #17843 inability to generate vs projects without being in a MSVC command ↵K. S. Ernest (iFire) Lee
prompt by guessing variables. The vcxproj extension has been in MSVC 2012. The sln extension has been in MSVC 2012.
2018-08-29BuildSystem: Sort input file listsBernhard M. Wiedemann
so that godot package builds reproducibly in spite of indeterministic filesystem readdir order and http://bugs.python.org/issue30461 See https://reproducible-builds.org/ for why this is good. Sort font input file list, so that builtin_fonts.gen.h is created in a reproducible way Sort list of platforms, so that editor/register_exporters.gen.cpp is created in a reproducible way Sort list of source files, so that .a files and resulting godot binaries are created in a reproducible way
2018-08-29Do not record year of buildBernhard M. Wiedemann
This value becomes part of get_version_info output, but if it is changing every year without any other change, it cannot be a useful indicator of anything. Using a constant value, makes the package build reproducible. See https://reproducible-builds.org/ for why this is good.
2018-08-27Pass -isysroot to compiler / linker when doing a macOS buildAlexandru Croitor
Previously the compiler would use system headers located at /System/Library/Frameworks, which could result in compilation failures due to the headers not always being up-to-date in regards to the latest installed macOS SDK headers that come with Xcode. Fix the issue by passing the SDK path via the -isysroot option to the compiler and linker invocations. If no custom SDK path is given, the build system queries the SDK path via xcrun --show-sdk-path, which returns something similar to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/ /Developer/SDKs/MacOSX.sdk/ Querying via xcrun is now also done for iphone (and simulator) platforms as well. Here is an example of a compilation failure message due to outdated headers: platform/osx/os_osx.mm:1421:41: error: use of undeclared identifier 'NSAppKitVersionNumber10_12'; did you mean 'NSAppKitVersionNumber'? if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) { ^~~~~~~~~~~~~~~~~~~~~~~~~~ NSAppKitVersionNumber /System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:26:28: note: 'NSAppKitVersionNumber' declared here
2018-07-28fix windows build using python 3.7dragmz
fixes NameError (missing "subprocess_main" and "basestring")
2018-07-27Running builder (content generator) functions in subprocesses on WindowsViktor Ferenczi
- Refactored all builder (make_*) functions into separate Python modules along to the build tree - Introduced utility function to wrap all invocations on Windows, but does not change it elsewhere - Introduced stub to use the builders module as a stand alone script and invoke a selected function There is a problem with file handles related to writing generated content (*.gen.h and *.gen.cpp) on Windows, which randomly causes a SHARING VIOLATION error to the compiler resulting in flaky builds. Running all such content generators in a new subprocess instead of directly inside the build script works around the issue. Yes, I tried the multiprocessing module. It did not work due to conflict with SCons on cPickle. Suggested workaround did not fully work either. Using the run_in_subprocess wrapper on osx and x11 platforms as well for consistency. In case of running a cross-compilation on Windows they would still be used, but likely it will not happen in practice. What counts is that the build itself is running on which platform, not the target platform. Some generated files are written directly in an SConstruct or SCsub file, before the parallel build starts. They don't need to be written in a subprocess, apparently, so I left them as is.
2018-07-27add initial GLES2 3D rendererkarroffel
2018-07-05added 'android_add_asset_dir('...') method to Android module gradle build configPatrick Kaster
(cherry picked from commit 9190ae2be7068c8a84f60766a2f7c1da3e0bcd4b)
2018-06-21add NoCache wrapper to CommandRhody Lugo
2018-05-28fixed building using scons with python3Ibrahn Sahir
I broke python 3 builds by using py2 specific dict functions in commit 98846b39ee039358584884b439b96e799f1d2bd0 Fixed with functions in compat.py
2018-05-19GDScript access to copyright, license, author and donor information.Ibrahn Sahir
Adds following functions to the Engine singleton: get_author_info - names of Godot authors get_copyright_info - detailed source copyright get_license_info get_donor_info - donor names get_license_info - full text of licenses used, indexed by license names get_license_text - the text of the Godot Expat license
2018-05-05Remove commented out code in methods.pyHenry Hirsch
2018-03-26Refactor JavaScript platform build scriptLeon Krause
2018-03-11Properly closing all files in Python codeViktor Ferenczi