Commit Graph

1362 Commits (4bc6e67d51df4c12e150fe4769911e239c627a47)

Author SHA1 Message Date
David Snopek 4bc6e67d51
Merge pull request #1694 from dsnopek/4.2-cherrypicks-9
Cherry-picks for the godot-cpp 4.2 branch - 9th batch
2025-01-28 11:28:25 -06:00
Brecht Kuppens b889fc3ce8 Fix buffer overrun with enums pointers cast to int64_t* when enum is only 32-bit
(cherry picked from commit 7576dc5930)
2025-01-27 15:59:15 -06:00
Brecht Kuppens ef4c38418e Update README.md with new pre-commit instructions
(cherry picked from commit bd3cf478c6)
2025-01-27 15:59:06 -06:00
Fabio Alessandrelli 9445595df2 [CI] Re-add generated files consistency check
(cherry picked from commit 0cfe01eff2)
2025-01-27 15:58:42 -06:00
Fabio Alessandrelli 71b5b84fb1 [Bindings] Build profile now strips methods and skip files
This allows removing dependencies that are not explicitly unused by the
gdextension being built and is implemented using an intermediate json
API file with the methods and classes stripped (i.e. without touching
the file generators).

(cherry picked from commit c4f1abe3f9)
2025-01-27 15:58:30 -06:00
Lukas Tenbrink 95a29550a7 Add a separate setup-godot-cpp github action.
(cherry picked from commit 9943675dcb)
2025-01-27 15:54:46 -06:00
A Thousand Ships f5fa712138 [Web] Don't cache emsdk
Due to how caches are accessed this cache is almost useless, it only
matters if it is from the same branch or a base branch, and is identical
between branches, so caching it just clutters the build cache

(cherry picked from commit 1e3b24f658)
2025-01-27 15:54:35 -06:00
David Snopek 142e5d4302 Sync `Quaternion` with the version in Godot
(cherry picked from commit 2004af63a0)
2025-01-27 15:54:26 -06:00
ruffenman c532b919df Remove unimplemented static variant functions 'blend' and 'interpolate'. If a user attempts to call either of these it will introduce a linker error and it may not be immediately clear to them why. Also, variant interpolation can already be accessed via 'UtilityFunctions::lerp', making at least the interpolate function unecessary here.
(cherry picked from commit 42a35a1852)
2025-01-27 15:54:17 -06:00
Thaddeus Crews d42d913edd CI: Add `runner` workflow to call other workflows
(cherry picked from commit c1524f7c86)
2025-01-27 15:54:07 -06:00
Zhehang Ding cb41b472f4 Use namespace in defs.hpp
A global alias of godot::real_t is defined for backward compatibility

(cherry picked from commit 450c3d65cd)
2025-01-27 15:53:56 -06:00
David Snopek d8b46e3426 Don't print an error when decoding a null Ref<T>
(cherry picked from commit 7f02301a91)
2025-01-27 15:53:44 -06:00
Lukas Tenbrink 397669a3f6 Rename Vector4.components -> coords.
The use of .components is deprecated.

(cherry picked from commit 23c9d41d2a)
2025-01-27 15:53:00 -06:00
Lukas Tenbrink 17818534d9 Add lto scons option, defaulting to "none". 2025-01-27 15:51:38 -06:00
David Snopek 549f5d6550
Merge pull request #1631 from dsnopek/4.2-cherrypicks-8
Cherry-picks for the godot-cpp 4.2 branch - 8th batch
2024-10-30 09:38:23 -05:00
Florent Guiocheau 5f3a66a326 Add p_use_model_front to Basis::looking_at()
(cherry picked from commit 02fd535454)
2024-10-28 16:23:27 -05:00
Thaddeus Crews 810b0ce13e SCons: Don't cache librarys
(cherry picked from commit 83c0f15ab9)
2024-10-28 16:23:17 -05:00
Fabio Alessandrelli a2a336546a [SCons] Remove use_clang_cl windows flag in favor of generic use_llvm
This is consistent with Godot upstream.

(cherry picked from commit 4717a78144)
2024-10-28 16:23:07 -05:00
Samuel Nicholas 5e7d2472dd VSProj Configure type on build command - to resolve #1582
Visual Studio projects are multi-config projects like Ninja-MultiConfig which means you can't set the configuration at configure time as there are multiple, it always chooses the first one by default when not specified in the build command.

Instead of this:
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 17 2022" .
cmake --build . --verbose

It should be this
cmake -G"Visual Studio 17 2022" .
cmake --build . --verbose --config Release

Update ci.yml

Because the current build system doesnt use generator expressions for multi config builds, both the CMAKE_BUILD_TYPE and the build --config options need to be set

(cherry picked from commit 07704f8f48)
2024-10-28 16:22:56 -05:00
Samuel Nicholas 6cb5eb9bca update .gitignore to add .idea for the Jetbrains CLion IDE
and also the default cmake build directory when building in clion cmake-build-*

(cherry picked from commit 9f5daa2d90)
2024-10-28 16:22:37 -05:00
Samuel Nicholas 43c66817ea Re-Structure cmake solution to be closer to the scons solution.
This is just a single step, re-arranging the code without actually changing its functionality.

new docs/cmake.md
moved the block of comments from the start of the CMakeLists.txt into the cmake.md file and converted content to markdown.

new cmake/godotcpp.cmake
Moved all exposed options into a new function godotcpp_options()
Moved configuration and generation code into godotcpp_generate()

To get all the options into the godotcpp_options() I changed the logic of GODOT_USE_HOT_RELOAD which I believe is a closer match to scons, that if the options is not set, and the build type is not release, then it defaults to ON.

I msvc builds require the default flags to be modified or it will throw errors. I have added the links to articles in the commit, but its about removing the runtime error checks /RTC1 from the CMAKE_CXX_FLAGS_DEBUG variable. This needs to happen before the files are included.
https://stackoverflow.com/questions/74426638/how-to-remove-rtc1-from-specific-target-or-file-in-cmake
https://discourse.cmake.org/t/how-do-i-remove-compile-options-from-target/5965

Renamed GodotCompilerWarnings.cmake to common_compiler_flags.cmake to match scons

Included files explicitly by path, as we dont need to append to the CMAKE_MODULES_PATH which effects the whole build tree.

This prevents consumers of the library from clobbering the names of the cmake include files and breaking the build.

(cherry picked from commit 2402a044eb)
2024-10-28 16:22:23 -05:00
Samuel Nicholas f8c258b3fe Updated all variable names to use GODOT_ prefix
changed cache type for api file and api dir to FILEPATH and PATH respectively.
Minor whitespace.
docstring parity

(cherry picked from commit 390a9a5590)
2024-10-28 16:17:36 -05:00
Samuel Nicholas d06b0283c2 Add GODOT_SYMBOL_VISIBILITY cache variable to match scons interface.
(cherry picked from commit 02bdc6665a)
2024-10-28 16:17:27 -05:00
Andreas Pokorny 463a0feb28 Add visibility-hidden
This should make all symbols that are not marked otherwise have hidden
visibility. There still may be exposed symbols if marked with respective
attributes.

(cherry picked from commit d18fa929fb)
2024-10-28 16:17:16 -05:00
ytnuf 4109e14f1b Add hot reload support when building with GCC and CMake
(cherry picked from commit 05571971cc)
2024-10-28 16:17:09 -05:00
bruvzg 5d745add13 Add support for LLVM/MinGW and ARM64 Windows builds.
(cherry picked from commit f2353da5a3)
2024-10-28 16:16:38 -05:00
David Snopek 67e84c04f2
Merge pull request #1570 from dsnopek/4.2-cherrypicks-7
Cherry-picks for the godot-cpp 4.2 branch - 7th batch
2024-09-11 17:16:26 -05:00
Fabio Alessandrelli 5921734784 [Web] Force emcc to use "wasm" longjmp mode
SUPPORT_LONGJMP have changed since emscripten 3.1.32 to default to
"wasm" mode when exceptions are enabled, and "emscripten" mode when
disabled.

While we generally doesn't use exception in core, linked libraries may
need them, and emscripten don't plan to support WASM EH + Emscripten
SjLj in the long term.

(cherry picked from commit 1bb543b6f4)
2024-09-04 09:40:34 -05:00
David Snopek fd31fabcfc Add a test to ensure that library path is absolute
(cherry picked from commit 92ace04989)
2024-09-03 17:17:08 -05:00
George L. Albany 9d26e3418c Fix GCC 14 -Wtemplate-id-cdtor warning
As was fixed with godotengine/godot#91208

(cherry picked from commit 7b31f39bea)
2024-09-03 17:16:17 -05:00
Fabio Alessandrelli 42d9ac3b08 [Web/SCons] Use CCFLAGS for SIDE_MODULE option
Was using CPPFLAGS, but should use the explicit scons CCFLAGS which
makes it clear they are applied to both the C and C++ compiler.

CPPFLAGS was also fine (they are preprocessor flags, also applied to
both C and C++), but we should try to stay consistent with what we do
in Godot.

(cherry picked from commit f36acd8e31)
2024-09-03 17:16:05 -05:00
Mikael Hermansson f9095a5552 Fix incorrect generation of some C++ operators
(cherry picked from commit 9949d09f3e)
2024-09-03 17:14:57 -05:00
Raul Santos 63c67a9977 Avoid hardcoded type conversion for metadata
The engine uses the names `int` and `float` to refer to the 64-bit types, so in the bindings generator we have a hardcoded conversion for those types.

But this type conversion should not be used for metadata. Even though the underlying type should still be 64-bit for interop, metadata is meant to specify the correct type to expose. So if metadata says `float` it means the type is really meant to be a 32-bit `float` and not `double`. Other hardcoded type conversions (`int` and `Nil`) won't ever be metadata.

This change corrects the `float` type, to use the right type in the generated C++ code. Before we were always using `double` due to this type conversion.

(cherry picked from commit 4829199081)
2024-09-03 17:14:48 -05:00
A Thousand Ships 12f6eecf65 Make generated code mostly style compliant
(cherry picked from commit f131efb791)
2024-09-03 17:14:15 -05:00
Klaim (Joël Lamotte) deaf37120f removes warnings generated by GDCLASS usage
This change removes the warnings (unused parameters) coming from code injected by the GDCLASS macro.
Contrary to warnings coming from the normal source code which can be suppressed with most compiles by specifying the include directories of this library as external or system,
when the code is injected through a macro it is considered in the context of the user, which is the source code of user of the library.
That forces the users to modify their code to hide the warnings coming from the mandatory `GDCLASS` here.
That's why it's important to remove these warning from that specific macro and ideally any other macro that the user must use.

(cherry picked from commit 738859f49b)
2024-09-03 17:11:52 -05:00
Chris Cranford cc70884db3 Make sure `_get` and `_set` dispatch up the class hierarchy
(cherry picked from commit c77d44f3f6)
2024-09-03 17:11:10 -05:00
Joakim Stien 90e0c1515d PR comments — added doc, default 'ON' in Debug, 'OFF' in Release
(cherry picked from commit 0a078d9ec9)
2024-09-03 17:11:03 -05:00
Joakim Stien 13299e810b Added hot reload support to CMakeLists.txt
(cherry picked from commit 31179ee47c)
2024-09-03 17:10:55 -05:00
A Thousand Ships 18321318bb [CI] Upload build cache before running tests
(cherry picked from commit 76b38de01a)
2024-09-03 17:10:48 -05:00
Rémi Verschelde 806c38e189 SCons: Remove old Python 2 compat code
(cherry picked from commit 958776dfc3)
2024-09-03 17:10:40 -05:00
Fabio Alessandrelli aeb8be98ed [SCons] Add option to build without threads
This is relevant for the Web platform, where builds with and without
threads are incompatible.

(cherry picked from commit b0296bb562)
2024-09-03 17:10:30 -05:00
David Snopek 1f9a0b7171
Merge pull request #1559 from aaronfranke/4.2-fix-typed-packed-array-bind
[4.2] Fix missing MAKE_TYPED_ARRAY_INFO for Packed*Arrays
2024-08-26 10:34:43 -05:00
Aaron Franke a0d56336c3
[4.2] Fix missing MAKE_TYPED_ARRAY_INFO for Packed*Arrays 2024-08-22 21:04:51 -07:00
David Snopek d6e5286cc1
Merge pull request #1527 from dsnopek/4.2-cherrypicks-6
Cherry-picks for the godot-cpp 4.2 branch - 6th batch
2024-07-17 12:28:18 -05:00
Yuri Sizov 80aec184df Fix argument metadata when binding methods
While there doesn't seem to be any runtime issues,
this triggers the address sanitizer in a few ways,
depending on what kind of method you're
binding.

(cherry picked from commit 2b34bd0d8b)
2024-07-17 09:19:30 -05:00
A Thousand Ships 18c31e3e31 Fix sharing of typed arrays from constructor
(cherry picked from commit 41aa71f8c3)
2024-07-17 09:18:11 -05:00
Thaddeus Crews 52ea8f9101 SCons: Add `silence_msvc` option
(cherry picked from commit 1989b1bf57)
2024-07-17 09:17:49 -05:00
Thaddeus Crews c35e7545b7 Integrate `.pre-commit-config.yaml`
(cherry picked from commit e0d363aad8)
2024-07-17 09:17:36 -05:00
Thaddeus Crews 1a22e43075 Fix `#include` formatting
(cherry picked from commit 999018e7d1)
2024-07-17 09:14:04 -05:00
Thaddeus Crews 121ae8d116 Add `.editorconfig`, consolidate `.gitattributes`
(cherry picked from commit 7a96d0314e)
2024-07-17 09:13:49 -05:00