mirror of
https://github.com/godotengine/godot-cpp.git
synced 2026-01-01 05:48:37 +03:00
Compare commits
35 Commits
godot-3.3.
...
3.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c28d4675e | ||
|
|
402e33a7dc | ||
|
|
e96e49e63b | ||
|
|
d9477fd0aa | ||
|
|
6e013e415d | ||
|
|
4b6ab10c5d | ||
|
|
1bb06e8507 | ||
|
|
54c2d23572 | ||
|
|
466f2cdebf | ||
|
|
6e1af3bedb | ||
|
|
8efe619e3a | ||
|
|
abab0715a0 | ||
|
|
b56df8f6da | ||
|
|
2f534ddd88 | ||
|
|
024ffef50f | ||
|
|
e08ecdc28c | ||
|
|
784103f676 | ||
|
|
98124aafe8 | ||
|
|
5b8bcb7164 | ||
|
|
e5279d3d0f | ||
|
|
26d4df4e17 | ||
|
|
dbf3a13d0f | ||
|
|
fda7ddd158 | ||
|
|
7a1890345b | ||
|
|
59959b1a5b | ||
|
|
67e2c6145c | ||
|
|
b44b98a94c | ||
|
|
cd05371ce8 | ||
|
|
492285f681 | ||
|
|
6e662223aa | ||
|
|
bdc5674ace | ||
|
|
689b5fb98b | ||
|
|
c296e9210b | ||
|
|
8ef2e4f139 | ||
|
|
5128858b1e |
65
.github/workflows/ci.yml
vendored
65
.github/workflows/ci.yml
vendored
@@ -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
1
.gitignore
vendored
@@ -6,6 +6,7 @@ logs/*
|
||||
*.os
|
||||
*.so
|
||||
*.obj
|
||||
*.bc
|
||||
*.pyc
|
||||
*.dblite
|
||||
*.pdb
|
||||
|
||||
@@ -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
|
||||
|
||||
32
SConstruct
32
SConstruct
@@ -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'],
|
||||
|
||||
@@ -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",
|
||||
|
||||
Submodule godot-headers updated: bd863357de...cd457bda8c
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user