Compare commits

...

35 Commits

Author SHA1 Message Date
Rémi Verschelde
5c28d4675e headers: Track tag godot-3.3.4-stable 2021-10-01 08:29:05 +02:00
Rémi Verschelde
402e33a7dc headers: Track tag godot-3.3.3-stable 2021-09-26 13:20:50 +02:00
Rémi Verschelde
e96e49e63b Merge pull request #618 from akien-mga/ci-tests-godot-3.3.3 2021-09-26 13:16:24 +02:00
Rémi Verschelde
d9477fd0aa CI: Run tests with Godot 3.3.3 2021-09-26 12:43:41 +02:00
Rémi Verschelde
6e013e415d Merge pull request #617 from akien-mga/ci-linux-ubuntu-18.04 2021-09-26 12:40:46 +02:00
Rémi Verschelde
4b6ab10c5d CI: Update Linux runner to Ubuntu 18.04
Also cleanup needlessly specific dependencies.
2021-09-26 12:15:19 +02:00
Bastiaan Olij
1bb06e8507 Merge pull request #616 from raulsntos/fix-enum-params
Escape parameters named `enum`.
2021-09-23 09:54:33 +10:00
Raul Santos
54c2d23572 Escape parameters named enum.
Prefix parameters named `enum` with an underscore like all the other
reserved keywords.
2021-09-22 16:07:23 +02:00
Fabio Alessandrelli
466f2cdebf Merge pull request #590 from Faless/generator/fix_byte_array_default
Fix binding when default parameter is a PoolByteArray.
2021-09-07 20:08:56 +02:00
Bastiaan Olij
6e1af3bedb Merge pull request #594 from Calinou/error-list-remove-extraneous-values
Remove extraneous Error enum values that were removed in Godot 3.0
2021-09-04 23:31:38 +10:00
BoomerDev
8efe619e3a Fix typo in README.md (#608) 2021-09-03 16:43:01 +02:00
Hugo Locurcio
abab0715a0 Remove extraneous Error enum values that were removed in Godot 3.0 2021-08-02 18:23:41 +02:00
Hugo Locurcio
b56df8f6da Merge pull request #593 from maiself/fix-crash-cond
Fix typo in CRASH_COND leading to unexpected continuation after fail
2021-08-02 18:07:23 +02:00
Mai Lavelle
2f534ddd88 Fix typo in CRASH_COND leading to unexpected continuation after fail 2021-08-01 17:20:39 -04:00
Fabio Alessandrelli
024ffef50f Fix binding when default parameter is a PoolByteArray.
Like done for the other pool array types.
2021-07-17 18:06:50 +02:00
Fabio Alessandrelli
e08ecdc28c Merge pull request #584 from Faless/build/osx_arm64
Add OSX arm64 build target.
2021-07-09 16:03:49 +02:00
Fabio Alessandrelli
784103f676 Merge pull request #581 from Faless/build/optimization_flags
Add optimization flags for android and javascript.
2021-07-09 16:01:47 +02:00
Fabio Alessandrelli
98124aafe8 Merge pull request #580 from Faless/js/fix_suffix
Fix JavaScript library suffix.
2021-07-09 15:51:51 +02:00
Fabio Alessandrelli
5b8bcb7164 Add OSX arm64 build target.
New "macos_arch" to specify the desired arch, and "macos_sdk_path" to
override the default SDK path.
2021-07-07 11:08:33 +02:00
Fabio Alessandrelli
e5279d3d0f Add optimization flags for android and javascript. 2021-07-05 15:53:52 +02:00
Fabio Alessandrelli
26d4df4e17 Fix JavaScript library suffix.
Also add `.bc` files to `.gitignore`
2021-07-05 15:47:49 +02:00
dependabot[bot]
dbf3a13d0f Bump actions/upload-artifact from 2.2.3 to 2.2.4 (#571)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2.2.3 to 2.2.4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2.2.3...v2.2.4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-16 21:41:21 +02:00
Marc
fda7ddd158 Merge pull request #567 from DhruvMaroo/string
added String's move constructor and move assignment operator
2021-06-01 23:35:46 +01:00
DhruvMaroo
7a1890345b edited according to clang-format 2021-06-01 23:16:09 +05:30
Marc
59959b1a5b Merge pull request #566 from DhruvMaroo/master
added inverse trigonometric functions in Math.hpp
2021-06-01 18:08:59 +01:00
DhruvMaroo
67e2c6145c used godot_string_new_copy to copy 2021-05-31 09:31:11 +05:30
DhruvMaroo
b44b98a94c removed _deleted class member 2021-05-31 09:10:59 +05:30
DhruvMaroo
cd05371ce8 added class member, safety check in the destructor 2021-05-31 00:52:36 +05:30
DhruvMaroo
492285f681 changed spaces to tabs 2021-05-30 22:29:41 +05:30
DhruvMaroo
6e662223aa changed spaces to tabs 2021-05-30 22:15:37 +05:30
DhruvMaroo
bdc5674ace added move assignment operator 2021-05-30 12:33:40 +05:30
DhruvMaroo
689b5fb98b added mover constructor 2021-05-30 12:30:11 +05:30
DhruvMaroo
c296e9210b Revert "Revert "added inverse trigonometric functions in Math.hpp""
This reverts commit 8ef2e4f139.
2021-05-30 12:23:39 +05:30
DhruvMaroo
8ef2e4f139 Revert "added inverse trigonometric functions in Math.hpp"
This reverts commit 5128858b1e.
2021-05-30 12:22:45 +05:30
DhruvMaroo
5128858b1e added inverse trigonometric functions in Math.hpp 2021-05-30 11:45:47 +05:30
10 changed files with 113 additions and 28 deletions

View File

@@ -4,34 +4,34 @@ on: [push, pull_request]
jobs:
linux:
name: Build (Linux, GCC)
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python (for SCons)
uses: actions/setup-python@v2
with:
python-version: '3.9.1'
python-version: '3.x'
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qqq build-essential pkg-config
python -m pip install scons
curl -LO https://downloads.tuxfamily.org/godotengine/3.2.3/Godot_v3.2.3-stable_linux_server.64.zip
unzip Godot_v3.2.3-stable_linux_server.64.zip
curl -LO https://downloads.tuxfamily.org/godotengine/3.3.3/Godot_v3.3.3-stable_linux_server.64.zip
unzip Godot_v3.3.3-stable_linux_server.64.zip
- name: Build godot-cpp
run: |
scons target=release generate_bindings=yes -j $(nproc)
- name: Upload artifact
uses: actions/upload-artifact@v2.2.3
uses: actions/upload-artifact@v2
with:
name: godot-cpp-linux-glibc2.23-x86_64-release
name: godot-cpp-linux-glibc2.27-x86_64-release
path: bin/libgodot-cpp.linux.release.64.a
if-no-files-found: error
@@ -41,21 +41,21 @@ jobs:
- name: Run test GDNative library
run: |
./Godot_v3.2.3-stable_linux_server.64 --path test -s script.gd
./Godot_v3.3.3-stable_linux_server.64 --path test -s script.gd
windows-msvc:
name: Build (Windows, MSVC)
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python (for SCons)
uses: actions/setup-python@v2
with:
python-version: '3.9.1'
python-version: '3.x'
- name: Install dependencies
run: |
@@ -66,7 +66,7 @@ jobs:
scons target=release generate_bindings=yes -j $env:NUMBER_OF_PROCESSORS
- name: Upload artifact
uses: actions/upload-artifact@v2.2.3
uses: actions/upload-artifact@v2
with:
name: godot-cpp-windows-msvc2019-x86_64-release
path: bin/libgodot-cpp.windows.release.64.lib
@@ -77,14 +77,14 @@ jobs:
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python (for SCons)
uses: actions/setup-python@v2
with:
python-version: '3.9.1'
python-version: '3.x'
- name: Install dependencies
run: |
@@ -100,7 +100,7 @@ jobs:
scons target=release generate_bindings=yes use_mingw=yes -j $env:NUMBER_OF_PROCESSORS
- name: Upload artifact
uses: actions/upload-artifact@v2.2.3
uses: actions/upload-artifact@v2
with:
name: godot-cpp-linux-mingw-x86_64-release
path: bin/libgodot-cpp.windows.release.64.a
@@ -111,27 +111,27 @@ jobs:
runs-on: macos-10.15
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python (for SCons)
uses: actions/setup-python@v2
with:
python-version: '3.9.1'
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install scons
curl -LO https://downloads.tuxfamily.org/godotengine/3.2.3/Godot_v3.2.3-stable_osx.64.zip
unzip Godot_v3.2.3-stable_osx.64.zip
curl -LO https://downloads.tuxfamily.org/godotengine/3.3.3/Godot_v3.3.3-stable_osx.universal.zip
unzip Godot_v3.3.3-stable_osx.universal.zip
- name: Build godot-cpp
run: |
scons target=release generate_bindings=yes -j $(sysctl -n hw.logicalcpu)
- name: Upload artifact
uses: actions/upload-artifact@v2.2.3
uses: actions/upload-artifact@v2
with:
name: godot-cpp-macos-x86_64-release
path: bin/libgodot-cpp.osx.release.64.a
@@ -145,6 +145,33 @@ jobs:
run: |
./Godot.app/Contents/MacOS/Godot --path test -s script.gd
macos-arm64:
name: Build (macOS, Clang, cross-compile arm64)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python (for SCons)
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install scons
- name: Build godot-cpp
run: |
# The default SDK in github the actions environemnt seems to have problems compiling for arm64.
# Use the latest 11.x SDK.
SDK_BASE=/Library/Developer/CommandLineTools/SDKs
SDK_VER=$(ls $SDK_BASE | grep "MacOSX11." | sort -r | head -n1)
echo $SDK_BASE/$SDK_VER/
scons target=release generate_bindings=yes macos_arch=arm64 macos_deployment_target=10.15 macos_sdk_path="$SDK_BASE/$SDK_VER/" -j $(sysctl -n hw.logicalcpu)
static-checks:
name: Static Checks (clang-format)
runs-on: ubuntu-20.04

1
.gitignore vendored
View File

@@ -6,6 +6,7 @@ logs/*
*.os
*.so
*.obj
*.bc
*.pyc
*.dblite
*.pdb

View File

@@ -277,7 +277,7 @@ Godot headers repository for more information.
GDNative is supported on [specific exports](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_web.html#export-options) for the HTML5 platform since Godot `3.2.4`. Linking webassembly modules is currently underspecified in the standard, but [emscripten](https://emscripten.org/), which Godot uses to build the HTML5 version, implements its own linking system.
To build GDNative libraries you wwill need a recent version of [emscripten](https://emscripten.org/).
To build GDNative libraries, you will need a recent version of [Emscripten](https://emscripten.org/).
```bash
cd SimpleLibrary

View File

@@ -143,6 +143,17 @@ opts.Add(
'macOS deployment target',
'default'
)
opts.Add(
'macos_sdk_path',
'macOS SDK path',
''
)
opts.Add(EnumVariable(
'macos_arch',
'Target macOS architecture',
'x86_64',
['x86_64', 'arm64']
))
opts.Add(EnumVariable(
'ios_arch',
'Target iOS architecture',
@@ -217,14 +228,19 @@ elif env['platform'] == 'osx':
'Only 64-bit builds are supported for the macOS target.'
)
env.Append(CCFLAGS=['-std=c++14', '-arch', 'x86_64'])
env.Append(CCFLAGS=['-std=c++14', '-arch', env['macos_arch']])
if env['macos_deployment_target'] != 'default':
env.Append(CCFLAGS=['-mmacosx-version-min=' + env['macos_deployment_target']])
env.Append(LINKFLAGS=['-mmacosx-version-min=' + env['macos_deployment_target']])
if env['macos_sdk_path']:
env.Append(CCFLAGS=['-isysroot', env['macos_sdk_path']])
env.Append(LINKFLAGS=['-isysroot', env['macos_sdk_path']])
env.Append(LINKFLAGS=[
'-arch',
'x86_64',
env['macos_arch'],
'-framework',
'Cocoa',
'-Wl,-undefined,dynamic_lookup',
@@ -375,6 +391,11 @@ elif env['platform'] == 'android':
env.Append(CCFLAGS=['--target=' + arch_info['target'] + env['android_api_level'], '-march=' + arch_info['march'], '-fPIC'])#, '-fPIE', '-fno-addrsig', '-Oz'])
env.Append(CCFLAGS=arch_info['ccflags'])
if env['target'] == 'debug':
env.Append(CCFLAGS=['-Og', '-g'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['-O3'])
elif env["platform"] == "javascript":
env["ENV"] = os.environ
env["CC"] = "emcc"
@@ -397,12 +418,17 @@ elif env["platform"] == "javascript":
# Program() output consists of multiple files, so specify suffixes manually at builder.
env["PROGSUFFIX"] = ""
env["LIBPREFIX"] = "lib"
env["LIBSUFFIX"] = ".bc"
env["LIBSUFFIX"] = ".a"
env["LIBPREFIXES"] = ["$LIBPREFIX"]
env["LIBSUFFIXES"] = ["$LIBSUFFIX"]
env.Replace(SHLINKFLAGS='$LINKFLAGS')
env.Replace(SHLINKFLAGS='$LINKFLAGS')
if env['target'] == 'debug':
env.Append(CCFLAGS=['-O0', '-g'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['-O3'])
env.Append(CPPPATH=[
'.',
env['headers_dir'],

View File

@@ -294,7 +294,7 @@ def generate_class_header(used_classes, c, use_template_get_node):
return default_value.lower()
if _type == "Array":
return "Array()"
if _type in ["PoolVector2Array", "PoolStringArray", "PoolVector3Array", "PoolColorArray", "PoolIntArray", "PoolRealArray"]:
if _type in ["PoolVector2Array", "PoolStringArray", "PoolVector3Array", "PoolColorArray", "PoolIntArray", "PoolRealArray", "PoolByteArray"]:
return _type + "()"
if _type == "Vector2":
return "Vector2" + default_value
@@ -881,6 +881,7 @@ def is_primitive(name):
def escape_cpp(name):
escapes = {
"class": "_class",
"enum": "_enum",
"char": "_char",
"short": "_short",
"bool": "_bool",

View File

@@ -53,8 +53,6 @@ enum class Error {
ERR_HELP, ///< user requested help!!
ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior.
ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames
ERR_OMFG_THIS_IS_VERY_VERY_BAD, ///< shit happens, has never been used, though
ERR_WTF = ERR_OMFG_THIS_IS_VERY_VERY_BAD ///< short version of the above
};
} // namespace godot
@@ -208,7 +206,7 @@ typedef float real_t;
do { \
if (unlikely(cond)) { \
FATAL_PRINT(ERR_MSG_COND(cond)); \
return; \
GENERATE_TRAP; \
} \
} while (0)
#endif

View File

@@ -52,6 +52,27 @@ inline float tan(float p_x) {
return ::tanf(p_x);
}
inline double asin(double p_x) {
return ::asin(p_x);
}
inline float asin(float p_x) {
return ::asinf(p_x);
}
inline double acos(double p_x) {
return ::acos(p_x);
}
inline float acos(float p_x) {
return ::acosf(p_x);
}
inline double atan(double p_x) {
return ::atan(p_x);
}
inline float atan(float p_x) {
return ::atanf(p_x);
}
inline double atan2(double p_y, double p_x) {
return ::atan2(p_y, p_x);
}

View File

@@ -40,6 +40,7 @@ public:
String(const wchar_t *contents);
String(const wchar_t c);
String(const String &other);
String(String &&other);
~String();
@@ -55,6 +56,7 @@ public:
wchar_t operator[](const int idx) const;
void operator=(const String &s);
void operator=(String &&s);
bool operator==(const String &s) const;
bool operator!=(const String &s) const;
String operator+(const String &s) const;

View File

@@ -73,6 +73,10 @@ String::String(const String &other) {
godot::api->godot_string_new_copy(&_godot_string, &other._godot_string);
}
String::String(String &&other) {
godot::api->godot_string_new_copy(&_godot_string, &other._godot_string);
}
String::~String() {
godot::api->godot_string_destroy(&_godot_string);
}
@@ -94,6 +98,11 @@ void String::operator=(const String &s) {
godot::api->godot_string_new_copy(&_godot_string, &s._godot_string);
}
void String::operator=(String &&s) {
godot::api->godot_string_destroy(&_godot_string);
godot::api->godot_string_new_copy(&_godot_string, &s._godot_string);
}
bool String::operator==(const String &s) const {
return godot::api->godot_string_operator_equal(&_godot_string, &s._godot_string);
}