summaryrefslogtreecommitdiff
path: root/modules/mono/build_scripts
AgeCommit message (Collapse)Author
2022-12-10Rename `float=64` SCons option to `precision=double`Hugo Locurcio
This avoids confusion with the old `bits=64` option and building for 64-bit CPUs in general.
2022-10-05.NET: Generate SdkPackageVersions.props from version.pyRémi Verschelde
Ensures that the versions always match the Godot version, albeit following SemVer 2.0 so inserting a dot between "beta" and the build number. For "stable" status, we omit the suffix as this would be interpreted as a pre-release build too. So we have: | Godot version | Nupkg version | | -------------- | -------------- | | 4.0.0-beta | 4.0.0-beta | | 4.0.0-beta2 | 4.0.0-beta.2 | | 4.0.0-rc1 | 4.0.0-rc.1 | | 4.0.0-stable | 4.0.0 |
2022-09-30ci: add Python static analysis check via mypyJiri Suchan
2022-09-26SCons: Unify tools/target build type configurationRémi Verschelde
Implements https://github.com/godotengine/godot-proposals/issues/3371. New `target` presets ==================== The `tools` option is removed and `target` changes to use three new presets, which match the builds users are familiar with. These targets control the default optimization level and enable editor-specific and debugging code: - `editor`: Replaces `tools=yes target=release_debug`. * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2` - `template_debug`: Replaces `tools=no target=release_debug`. * Defines: `DEBUG_ENABLED`, `-O2`/`/O2` - `template_release`: Replaces `tools=no target=release`. * Defines: `-O3`/`/O2` New `dev_build` option ====================== The previous `target=debug` is now replaced by a separate `dev_build=yes` option, which can be used in combination with either of the three targets, and changes the following: - `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`), enables generating debug symbols, does not define `NDEBUG` so `assert()` works in thirdparty libraries, adds a `.dev` suffix to the binary name. Note: Unlike previously, `dev_build` defaults to off so that users who compile Godot from source get an optimized and small build by default. Engine contributors should now set `dev_build=yes` in their build scripts or IDE configuration manually. Changed binary names ==================== The name of generated binaries and object files are changed too, to follow this format: `godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]` For example: - `godot.linuxbsd.editor.dev.arm64` - `godot.windows.template_release.double.x86_64.mono.exe` Be sure to update your links/scripts/IDE config accordingly. More flexible `optimize` and `debug_symbols` options ==================================================== The optimization level and whether to generate debug symbols can be further specified with the `optimize` and `debug_symbols` options. So the default values listed above for the various `target` and `dev_build` combinations are indicative and can be replaced when compiling, e.g.: `scons p=linuxbsd target=template_debug dev_build=yes optimize=debug` will make a "debug" export template with dev-only code enabled, `-Og` optimization level for GCC/Clang, and debug symbols. Perfect for debugging complex crashes at runtime in an exported project.
2022-09-16Make `push_nupkgs_local` absoluteRaul Santos
Ensures the `push_nupkgs_local` argument in build_assemblies.py is an absolute path so the argument can be given as a relative path and it will be converted.
2022-09-07C#: Replace libnethost dependency to find hostfxrIgnacio Roldán Etcheverry
We want to replace libnethost as it gives us issues with some compilers. Our implementation tries to mimic libnethost's hostfxr_resolver search logic. We try to use the same function names for easier comparing in case we need to update this in the future.
2022-09-04Add float arg to build_assemblies.pyAlmighty Laxz
2022-08-29[Web] Rename JavaScript platform to Web.Fabio Alessandrelli
Also rename export name from "HTML5" to "Web".
2022-08-26.NET: Change NETCore.App version detection to use highest matchRémi Verschelde
`libnethost.a` detection failed on my Linux system (Mageia 9, using Fedora 36 dotnet repos), because it used the first match which isn't the one matching the rest of the SDK: ``` $ dotnet --list-runtimes Microsoft.AspNetCore.App 3.1.28 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.28 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App] ``` No idea why I still have 6.0.5 installed but it should pick the highest I guess.
2022-08-25C#: Fix buildsystem when `dotnet --info` does not specify archIgnacio Roldán Etcheverry
For some installations the architecture information is not printed.
2022-08-25Merge pull request #55778 from aaronfranke/use-arch-btwRémi Verschelde
[skip ci]
2022-08-25Unify bits, arch, and android_arch into env["arch"]Aaron Franke
Fully removes the `bits` option and adapts the code that relied on it. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-08-25[macOS] Check .NET binary architecture, and search for the cross compile SDK ↵bruvzg
in the subfolders.
2022-08-24Remove mentions of the Server platform from the Mono moduleAaron Franke
2022-08-22C#: Make GodotSharp API a NuGet packageIgnacio Roldán Etcheverry
In the past, the Godot editor distributed the API assemblies and copied them to project directories for projects to reference them. This changed with the move to .NET 5/6. Godot no longer copies the assemblies to project directories. However, the project Sdk still tried to reference them from the same location. From now on, the GodotSharp API is distributed as a NuGet package, which the Sdk can reference. Added an option to `build_assemblies.py` to copy all Godot NuGet packages to an existing local NuGet source. This will be needed during development, while packages are not published to a remote NuGet repository. This option also makes sure to remove packages of the same version installed (~/.nuget/packages). Very useful during development, when packages change, to make sure the package being used by a project is the same we just built and not one from a previous build. A local NuGet source can be created like this: ``` mkdir ~/MyLocalNuGetSource && \ dotnet nuget add source ~/MyLocalNuGetSource/ -n MyLocalNuGetSource ```
2022-08-22C#: Upgrade to .NET 6 (5.0 -> 6.0)Ignacio Roldán Etcheverry
2022-08-22C#/netcore: Add base desktop game export implementationIgnacio Roldán Etcheverry
This base implementation is still very barebones but it defines the path for how exporting will work (at least when embedding the .NET runtime). Many manual steps are still needed, which should be automatized in the future. For example, in addition to the API assemblies, now you also need to copy the GodotPlugins assembly to each game project.
2022-08-22Fix detection of .NET Sdk from snap and allow higher versionsIgnacio Roldán Etcheverry
2022-08-22C#: Fallback to `dotnet --info` to determine .NET RIDIgnacio Roldán Etcheverry
Some Linux distros use their distro name as the RID for directory names. If the .NET Host directory cannot be found with the generic RID, try to get the rid from `dotnet --info`. The generic RID should still be the first choice. Some platforms like Windows 10 define the RID as `win10-x64` but still use the generic `win-x64` for directory names. Co-authored-by: Lewis James <lewiji+github@gmail.com>
2022-08-22C#: Begin move to .NET CoreIgnacio Roldán Etcheverry
We're targeting .NET 5 for now to make development easier while .NET 6 is not yet released. TEMPORARY REGRESSIONS --------------------- Assembly unloading is not implemented yet. As such, many Godot resources are leaked at exit. This will be re-implemented later together with assembly hot-reloading.
2022-08-22C#: Move marshaling logic and generated glue to C#Ignacio Roldán Etcheverry
We will be progressively moving most code to C#. The plan is to only use Mono's embedding APIs to set things at launch. This will make it much easier to later support CoreCLR too which doesn't have rich embedding APIs. Additionally the code in C# is more maintainable and makes it easier to implement new features, e.g.: runtime codegen which we could use to avoid using reflection for marshaling everytime a field, property or method is accessed. SOME NOTES ON INTEROP We make the same assumptions as GDNative about the size of the Godot structures we use. We take it a bit further by also assuming the layout of fields in some cases, which is riskier but let's us squeeze out some performance by avoiding unnecessary managed to native calls. Code that deals with native structs is less safe than before as there's no RAII and copy constructors in C#. It's like using the GDNative C API directly. One has to take special care to free values they own. Perhaps we could use roslyn analyzers to check this, but I don't know any that uses attributes to determine what's owned or borrowed. As to why we maily use pointers for native structs instead of ref/out: - AFAIK (and confirmed with a benchmark) ref/out are pinned during P/Invoke calls and that has a cost. - Native struct fields can't be ref/out in the first place. - A `using` local can't be passed as ref/out, only `in`. Calling a method or property on an `in` value makes a silent copy, so we want to avoid `in`. REGARDING THE BUILD SYSTEM There's no longer a `mono_glue=yes/no` SCons options. We no longer need to build with `mono_glue=no`, generate the glue and then build again with `mono_glue=yes`. We build only once and generate the glue (which is in C# now). However, SCons no longer builds the C# projects for us. Instead one must run `build_assemblies.py`, e.g.: ```sh %godot_src_root%/modules/mono/build_scripts/build_assemblies.py \ --godot-output-dir=%godot_src_root%/bin \ --godot-target=release_debug` ``` We could turn this into a custom build target, but I don't know how to do that with SCons (it's possible with Meson). OTHER NOTES Most of the moved code doesn't follow the C# naming convention and still has the word Mono in the names despite no longer dealing with Mono's embedding APIs. This is just temporary while transitioning, to make it easier to understand what was moved where.
2022-07-21Rename OSX to macOS and iPhoneOS to iOS.bruvzg
2022-07-07Allows parsing of invalid UTF-16 surrogates (can be encountered in Windows ↵bruvzg
filenames) and some non-standard UTF-8 variants, makes Unicode parse errors more verbose.
2022-01-29Be more verbose about why msbuild tools could not be foundMarcel Admiraal
2021-10-29Use maximum zlib compression when generating editor translation headersHugo Locurcio
With comments stripped, this reduces the combined generated translation size from 28.7 MB to 28.4 MB (-240 KB).
2021-10-18Remove unused imports in .py, SCsub and SConstruct filesAnutrix
2021-07-01Remove unused code related to Travis CIHugo Locurcio
2021-03-06Add C# source generator for a new ScriptPath attributeIgnacio Etcheverry
This source generator adds a newly introduced attribute, `ScriptPath` to all classes that: - Are top-level classes (not inner/nested). - Have the `partial` modifier. - Inherit `Godot.Object`. - The class name matches the file name. A build error is thrown if the generator finds a class that meets these conditions but is not declared `partial`, unless the class is annotated with the `DisableGodotGenerators` attribute. We also generate an `AssemblyHasScripts` assembly attribute which Godot uses to get all the script classes in the assembly, eliminating the need for Godot to search them. We can also avoid searching in assemblies that don't have this attribute. This will be good for performance in the future once we support multiple assemblies with Godot script classes. This is an example of what the generated code looks like: ``` using Godot; namespace Foo { [ScriptPathAttribute("res://Player.cs")] // Multiple partial declarations are allowed [ScriptPathAttribute("res://Foo/Player.cs")] partial class Player {} } [assembly:AssemblyHasScripts(new System.Type[] { typeof(Foo.Player) })] ``` The new attributes replace script metadata which we were generating by determining the namespace of script classes with a very simple parser. This fixes several issues with the old approach related to parser errors and conditional compilation. It also makes the task part of the MSBuild project build, rather than a separate step executed by the Godot editor.
2020-12-17Merge pull request #44105 from neikeq/mono-wasm-m2n-hookRémi Verschelde
Mono: Make Godot provide its own WASM m2n trampolines
2020-12-14Mono: Don't use -rdynamic when compiling for WASMIgnacio Etcheverry
`-rdynamic` was causing the emsdk linker to silently fail to generate the output `.wasm` file (even though exit code was 0).
2020-12-06Mono: Add mono_bcl SCons option for a custom BCL locationIgnacio Etcheverry
Makes it let's bothersome to work with builds from our godotengine/godot-mono-builds scripts, as they write the BCL into an output directory separate from the runtime (which is good as two runtimes may share the same BCL).
2020-12-03Mono: Fix Android build after #36311Rémi Verschelde
2020-11-16Remove empty lines around braces with the formatting scriptAaron Franke
2020-10-23C#: Make editor create NuGet fallback folder for Godot packagesIgnacio Etcheverry
Main benefits: - Projects can be built offline. Previously you needed internet access the first time building to download the packages. - Changes to packages like Godot.NET.Sdk can be easily tested before publishing. This was already possible but required too many manual steps. - First time builds are a bit faster, as the Sdk package doesn't need to be downloaded. In practice, the package is very small so it makes little difference. Bumped Godot.NET.Sdk to 4.0.0-dev3 in order to enable the recent changes regarding '.mono/' -> '.godot/mono/'.
2020-09-25Enable the `copy_mono_root` SCons option by defaultHugo Locurcio
This closes #41652.
2020-09-11Remove unused Python local variables.Marcel Admiraal
2020-09-10Remove unused Python imports.Marcel Admiraal
2020-09-02Merge python EnvironmentError, IOError and WindowsError into OSError.Marcel Admiraal
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-06-25Mono/C#: Use /restore instead of /t:restore when buildingIgnacio Etcheverry
Documentation recommends not to use /t:restore together with other targets (like /t:build), as it messes with the environment.
2020-06-15Fix dynamic linking of MSVC Mono with MinGW GodotIgnacio Etcheverry
2020-06-15C#: Add VisualStudio supportIgnacio Etcheverry
2020-05-11C#: Support for building with the dotnet CLIIgnacio Etcheverry
By adding a reference to the 'Microsoft.NETFramework.ReferenceAssemblies' nuget package, we can build projects targeting .NET Framework with the dotnet CLI. By referencing this package we also don't need to install Mono on Linux/macOS or .NET Framework on Windows, as the assemblies are taken from the package.
2020-05-09Mono: Use msbuild instead of nuget.exe for restoringIgnacio Etcheverry
- Make GodotTools output directly to the SCons output directory. - Removed xbuild_fallback from the build system.
2020-03-31Mono/C#: Add iOS supportIgnacio Etcheverry
Right now, games only work on devices when exported with FullAOT+Interpreter. There are some issues left that need to addressed for FullAOT alone. Right now, it's giving issues with the Godot.NativeCalls static constructor.
2020-03-31Mono/C#: Fix MinGW build not supporting `.lib` librariesIgnacio Etcheverry
MinGW should support both its own format `.a` and MSVC's format `.lib`, but Mono's module was only using the former. With this change it's now possible to build with MinGW and link the official Mono for Windows which is built with MSVC.
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-26Multiple changes to DisplayServerX11Mateo Kuruk Miccino
- Travis: Change x11 to linuxbsd - SCons: Change x11 plataform to linuxbsd - Plugins: Remove ; to avoid fallthrough warning - DisplayServerX11: Implement set_icon - DisplayServerX11: Fix X11 bug when a window was erased from windows map, all the changes from that erased windows are sending to the main window - DisplayServerX11: Reorder create_window commands - DisplayServerX11: Change every Size2 to Size2i and Rect2 to Rect2i where it belongs + More X11 fixes which have been integrated directly back into reduz's original commits while rebasing the branch.
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-17Fix C# bindings after recent breaking changesIgnacio Etcheverry
Implementation for new Variant types Callable, Signal, StringName. Added support for PackedInt64Array and PackedFloat64Array. Add generation of signal members as events, as well as support for user created signals as events. NOTE: As of now, raising such events will not emit the signal. As such, one must use `EmitSignal` instead of raising the event directly. Removed old ThreadLocal fallback class. It's safe to use thread_local now since it's supported on all minimum versions of compilers we support.