mirror of
https://github.com/godotengine/godot-git-plugin.git
synced 2026-01-01 01:48:28 +03:00
Merge pull request #60 from bruvzg/macos_m1
Add macOS ARM64 (Apple Silicon) support.
This commit is contained in:
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -54,7 +54,7 @@ jobs:
|
||||
scons platform=windows target=release
|
||||
|
||||
build-macos-debug:
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-11
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: macOS Debug
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
scons platform=osx target=debug use_llvm=yes
|
||||
|
||||
build-macos-release:
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-11
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: macOS Release
|
||||
|
||||
1
.gitmodules
vendored
1
.gitmodules
vendored
@@ -1,3 +1,4 @@
|
||||
[submodule "godot-cpp"]
|
||||
path = godot-cpp
|
||||
url = https://github.com/godotengine/godot-cpp
|
||||
branch = 3.x
|
||||
|
||||
@@ -44,8 +44,6 @@ Required build tools:
|
||||
2. Run ```. ./build_libs_mac.sh Release```.
|
||||
3. Run ```scons platform=osx target=release```.
|
||||
|
||||
**Note:** [Compiling for the Apple Silicon architecture is not supported yet.](https://github.com/godotengine/godot-git-plugin/issues/68)
|
||||
|
||||
#### Debug build
|
||||
|
||||
Replace `Release` with `Debug` and `release` with `debug` in the above instructions for a debug build. You will also have to do the same in the paths mentioned in `demo/git_api.gdnlib` before opening the demo project in Godot.
|
||||
|
||||
13
SConstruct
13
SConstruct
@@ -45,11 +45,11 @@ if env['platform'] == "osx":
|
||||
cpp_library += '.osx'
|
||||
libgit2_lib_path += 'osx/'
|
||||
if env['target'] in ('debug', 'd'):
|
||||
env.Append(CCFLAGS = ['-g','-O2', '-arch', 'x86_64', '-std=c++17'])
|
||||
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
|
||||
env.Append(CCFLAGS = ['-g','-O2', '-arch', 'x86_64', '-arch', 'arm64', '-std=c++17'])
|
||||
env.Append(LINKFLAGS = ['-arch', 'x86_64', '-arch', 'arm64'])
|
||||
else:
|
||||
env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64', '-std=c++17'])
|
||||
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
|
||||
env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64', '-arch', 'arm64', '-std=c++17'])
|
||||
env.Append(LINKFLAGS = ['-arch', 'x86_64', '-arch', 'arm64'])
|
||||
|
||||
elif env['platform'] in ('x11', 'linux'):
|
||||
env['target_path'] += 'x11/'
|
||||
@@ -82,7 +82,10 @@ else:
|
||||
cpp_library += '.release'
|
||||
env['target_path'] += 'release/'
|
||||
|
||||
cpp_library += '.' + str(bits)
|
||||
if env['platform'] == 'osx':
|
||||
cpp_library += '.universal'
|
||||
else:
|
||||
cpp_library += '.' + str(bits)
|
||||
|
||||
# make sure our binding library properly includes
|
||||
env.Append(CPPPATH=['.', godot_headers_path, cpp_bindings_path + 'include/', cpp_bindings_path + 'include/core/', cpp_bindings_path + 'include/gen/'])
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/bin/sh
|
||||
git submodule init;
|
||||
git submodule update --init --recursive;
|
||||
|
||||
@@ -5,7 +6,7 @@ cd godot-git-plugin/thirdparty/libgit2/
|
||||
mkdir build
|
||||
cd build/
|
||||
rm -f CMakeCache.txt
|
||||
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=OFF -DUSE_SSH=OFF -DUSE_HTTPS=OFF -DUSE_BUNDLED_ZLIB=ON -DUSE_ICONV=OFF
|
||||
cmake .. -DCMAKE_C_FLAGS="-arch arm64 -arch x86_64" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=OFF -DUSE_SSH=OFF -DUSE_HTTPS=OFF -DUSE_BUNDLED_ZLIB=ON -DUSE_ICONV=OFF
|
||||
cmake --build . --config $1
|
||||
cd ../../../../
|
||||
mkdir -p "demo/bin/osx/"
|
||||
@@ -20,5 +21,11 @@ fi
|
||||
|
||||
cd godot-cpp/;
|
||||
CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
|
||||
scons platform=osx target=$1 generate_bindings=yes bits=64 -j$CORES;
|
||||
scons platform=osx target=$1 generate_bindings=yes macos_arch=x86_64 -j$CORES;
|
||||
scons platform=osx target=$1 generate_bindings=yes macos_arch=arm64 -j$CORES;
|
||||
shopt -s nocasematch; if [[ "release" =~ "$1" ]]; then
|
||||
lipo -create ./bin/libgodot-cpp.osx.release.64.a ./bin/libgodot-cpp.osx.release.arm64.a -output ./bin/libgodot-cpp.osx.release.universal.a
|
||||
else
|
||||
lipo -create ./bin/libgodot-cpp.osx.debug.64.a ./bin/libgodot-cpp.osx.debug.arm64.a -output ./bin/libgodot-cpp.osx.debug.universal.a
|
||||
fi
|
||||
cd ..
|
||||
|
||||
Submodule godot-cpp updated: d7c55b1ab2...99e9dd1d93
@@ -1,6 +1,8 @@
|
||||
#ifndef GIT_COMMON_H
|
||||
#define GIT_COMMON_H
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <Godot.hpp>
|
||||
|
||||
#include <git2.h>
|
||||
|
||||
Reference in New Issue
Block a user