mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-24 10:20:24 +01:00
Support universal (x86_64/arm64) builds for macOS
The macOS binary (libgodot-xterm.osx.64.dylib) is now a universal binary that runs natively on both x86_64 and arm64.
This commit is contained in:
parent
110e4eff2d
commit
fd4e383cae
4 changed files with 23 additions and 13 deletions
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
|
@ -130,7 +130,8 @@ jobs:
|
||||||
OS: ${{ matrix.os }}
|
OS: ${{ matrix.os }}
|
||||||
run: |
|
run: |
|
||||||
cd addons/godot_xterm/native/thirdparty/libuv
|
cd addons/godot_xterm/native/thirdparty/libuv
|
||||||
args="-DCMAKE_BUILD_TYPE=$TARGET -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE"
|
args="-DCMAKE_BUILD_TYPE=$TARGET -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
|
||||||
|
-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
|
||||||
if [ "$TARGET" == "release" ]; then
|
if [ "$TARGET" == "release" ]; then
|
||||||
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL"
|
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL"
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,7 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
|
|
||||||
## [Unreleased](https://github.com/lihop/godot-xterm/compare/v2.0.0...HEAD)
|
## [Unreleased](https://github.com/lihop/godot-xterm/compare/v2.0.0...HEAD)
|
||||||
|
### Added
|
||||||
|
- Support for macOS universal (x86_64/arm64) binaries. The macOS binary
|
||||||
|
`libgodot-xterm.osx.64.dylib` is now a universal binary that runs natively
|
||||||
|
on both x86_64 and arm64.
|
||||||
|
|
||||||
## [v2.0.0](https://github.com/lihop/godot-xterm/compare/v1.2.1...v2.0.0) - 2021-07-25
|
## [v2.0.0](https://github.com/lihop/godot-xterm/compare/v1.2.1...v2.0.0) - 2021-07-25
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -62,6 +62,8 @@ opts.Add(EnumVariable(
|
||||||
allowed_values=('debug', 'release'),
|
allowed_values=('debug', 'release'),
|
||||||
ignorecase=2
|
ignorecase=2
|
||||||
))
|
))
|
||||||
|
opts.Add(EnumVariable("macos_arch", "Target macOS architecture",
|
||||||
|
"universal", ["universal", "x86_64", "arm64"]))
|
||||||
opts.Add(BoolVariable(
|
opts.Add(BoolVariable(
|
||||||
'disable_pty',
|
'disable_pty',
|
||||||
'Disables the PTY and its dependencies (LibuvUtils and Pipe). Has no effect on platforms where PTY is not supported',
|
'Disables the PTY and its dependencies (LibuvUtils and Pipe). Has no effect on platforms where PTY is not supported',
|
||||||
|
@ -139,15 +141,17 @@ elif env['platform'] == 'osx':
|
||||||
|
|
||||||
if env['bits'] == '32':
|
if env['bits'] == '32':
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'Only 64-bit builds are supported for the macOS target.'
|
'Only 64-bit builds are supported for the osx platform.'
|
||||||
)
|
)
|
||||||
|
|
||||||
env.Append(CCFLAGS=['-arch', 'x86_64'])
|
if env["macos_arch"] == "universal":
|
||||||
env.Append(LINKFLAGS=[
|
env.Append(LINKFLAGS=["-arch", "x86_64", "-arch", "arm64"])
|
||||||
'-arch',
|
env.Append(CCFLAGS=["-arch", "x86_64", "-arch", "arm64"])
|
||||||
'x86_64',
|
else:
|
||||||
'-Wl,-undefined,dynamic_lookup',
|
env.Append(LINKFLAGS=["-arch", env["macos_arch"]])
|
||||||
])
|
env.Append(CCFLAGS=["-arch", env["macos_arch"]])
|
||||||
|
|
||||||
|
env.Append(LINKFLAGS=['-Wl,-undefined,dynamic_lookup'])
|
||||||
|
|
||||||
if env['target'] == 'debug':
|
if env['target'] == 'debug':
|
||||||
env.Append(CCFLAGS=['-Og', '-g'])
|
env.Append(CCFLAGS=['-Og', '-g'])
|
||||||
|
@ -249,7 +253,8 @@ env.Append(LIBS=[
|
||||||
env.File('thirdparty/godot-cpp/bin/libgodot-cpp.{}.{}.{}{}'.format(
|
env.File('thirdparty/godot-cpp/bin/libgodot-cpp.{}.{}.{}{}'.format(
|
||||||
env['platform'],
|
env['platform'],
|
||||||
env['target'],
|
env['target'],
|
||||||
'wasm' if env['platform'] == 'javascript' else env['bits'],
|
'wasm' if env['platform'] == 'javascript' else env['macos_arch'] if (
|
||||||
|
env['macos_arch'] != 'universal' and env['platform'] == 'osx') else env['bits'],
|
||||||
env['LIBSUFFIX'],
|
env['LIBSUFFIX'],
|
||||||
)),
|
)),
|
||||||
env.File('thirdparty/libtsm/build/bin/libtsm.{}.{}.{}{}'.format(
|
env.File('thirdparty/libtsm/build/bin/libtsm.{}.{}.{}{}'.format(
|
||||||
|
|
|
@ -58,13 +58,14 @@ updateSubmodules GODOT_CPP_DIR ${NATIVE_DIR}/thirdparty/godot-cpp
|
||||||
# Build godot-cpp bindings.
|
# Build godot-cpp bindings.
|
||||||
cd ${GODOT_CPP_DIR}
|
cd ${GODOT_CPP_DIR}
|
||||||
echo "scons generate_bindings=yes target=$target -j$nproc"
|
echo "scons generate_bindings=yes target=$target -j$nproc"
|
||||||
scons generate_bindings=yes target=$target -j$nproc
|
scons generate_bindings=yes macos_arch=$(uname -m) target=$target -j$nproc
|
||||||
|
|
||||||
# Build libuv as a static library.
|
# Build libuv as a static library.
|
||||||
cd ${LIBUV_DIR}
|
cd ${LIBUV_DIR}
|
||||||
mkdir build || true
|
mkdir build || true
|
||||||
cd build
|
cd build
|
||||||
args="-DCMAKE_BUILD_TYPE=$target -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE"
|
args="-DCMAKE_BUILD_TYPE=$target -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
|
||||||
|
-DCMAKE_OSX_ARCHITECTURES=$(uname -m)"
|
||||||
if [ "$target" == "release" ]; then
|
if [ "$target" == "release" ]; then
|
||||||
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL"
|
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL"
|
||||||
else
|
else
|
||||||
|
@ -76,7 +77,7 @@ cmake --build build --config $target -j$nproc
|
||||||
|
|
||||||
# Build libgodot-xterm.
|
# Build libgodot-xterm.
|
||||||
cd ${NATIVE_DIR}
|
cd ${NATIVE_DIR}
|
||||||
scons target=$target disable_pty=$disable_pty -j$nproc
|
scons target=$target macos_arch=$(uname -m) disable_pty=$disable_pty -j$nproc
|
||||||
|
|
||||||
# Use Docker to build libgodot-xterm javascript.
|
# Use Docker to build libgodot-xterm javascript.
|
||||||
if [ -x "$(command -v docker-compose)" ]; then
|
if [ -x "$(command -v docker-compose)" ]; then
|
||||||
|
|
Loading…
Reference in a new issue