Add support for MacOS on ARM
Also build with real -no-pie on ghactions, and fix SDL include directories (it's probably blind luck that they worked correctly on most systems).
This commit is contained in:
parent
6ef505ccca
commit
656ace10c6
12
.github/build.sh
vendored
12
.github/build.sh
vendored
@ -111,7 +111,17 @@ if [ $TOOLSET_SHORT == "mingw" ]; then
|
||||
other_flags+=$'\t--cross-file=.github/mingw-ghactions.ini'
|
||||
fi
|
||||
fi
|
||||
meson -Dbuildtype=release -Db_pie=false -Db_staticpic=false $lto_flag $static_flag -Dinstall_check=true $other_flags build
|
||||
if [ $PLATFORM_SHORT == "mac" ]; then
|
||||
macosx_version_min=10.9
|
||||
if [ $MACHINE_SHORT == "arm64" ]; then
|
||||
macosx_version_min=10.15
|
||||
other_flags+=$'\t--cross-file=.github/macaa64-ghactions.ini'
|
||||
fi
|
||||
export CFLAGS=-mmacosx-version-min=$macosx_version_min
|
||||
export CXXFLAGS=-mmacosx-version-min=$macosx_version_min
|
||||
export LDFLAGS=-mmacosx-version-min=$macosx_version_min
|
||||
fi
|
||||
meson -Dbuildtype=release -Db_pie=false -Dworkaround_gcc_no_pie=true -Db_staticpic=false $lto_flag $static_flag -Dinstall_check=true $other_flags build
|
||||
cd build
|
||||
ninja
|
||||
if [ $PLATFORM_SHORT == "lin" ] || [ $PLATFORM_SHORT == "mac" ]; then
|
||||
|
16
.github/macaa64-ghactions.ini
vendored
Normal file
16
.github/macaa64-ghactions.ini
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
[built-in options]
|
||||
c_args = [ '-arch', 'arm64' ]
|
||||
cpp_args = [ '-arch', 'arm64' ]
|
||||
c_link_args = [ '-arch', 'arm64' ]
|
||||
cpp_link_args = [ '-arch', 'arm64' ]
|
||||
|
||||
[binaries]
|
||||
c = 'clang'
|
||||
cpp = 'clang++'
|
||||
strip = 'strip'
|
||||
|
||||
[host_machine]
|
||||
system = 'darwin'
|
||||
cpu_family = 'aarch64'
|
||||
cpu = 'armv8'
|
||||
endian = 'little'
|
39
.github/workflows/build.yaml
vendored
39
.github/workflows/build.yaml
vendored
@ -44,14 +44,17 @@ jobs:
|
||||
needs: [release]
|
||||
strategy:
|
||||
matrix:
|
||||
# | lin-x86_64 | mac-x86_64 | win-x86_64 | lin-i686 | mac-i686 | win-i686 |
|
||||
# --------------+------------+------------+------------+------------+------------+------------+
|
||||
# gcc-static | | | NO | NO | NO | NO |
|
||||
# msvc-static | NO | NO | | NO | NO | |
|
||||
# mingw-static | | NO | | NO | NO | NO |
|
||||
# gcc-dynamic | | | NO | NO | NO | NO |
|
||||
# msvc-dynamic | NO | NO | | NO | NO | |
|
||||
# mingw-dynamic | | NO | | NO | NO | NO |
|
||||
# | lin-x86_64 | mac-x86_64 | win-x86_64 | lin-i686 | mac-i686 | win-i686 | lin-arm64 | mac-arm64 | win-arm64
|
||||
# --------------+------------+------------+------------+------------+------------+------------+------------+------------+------------
|
||||
# gcc-static | | | NO | NO | NO | NO | NO | | NO
|
||||
# msvc-static | NO | NO | | NO | NO | | NO | NO | NO
|
||||
# mingw-static | | NO | | NO | NO | NO | NO | NO | NO
|
||||
# gcc-dynamic | | | NO | NO | NO | NO | NO | NO [1] | NO
|
||||
# msvc-dynamic | NO | NO | | NO | NO | | NO | NO | NO
|
||||
# mingw-dynamic | | NO | | NO | NO | NO | NO | NO | NO
|
||||
#
|
||||
# [1] This is only required for development on ARM Macs. We have no access to such devices, so someone will
|
||||
# have to help us figure out how to get dynamic libraries.
|
||||
#
|
||||
# Please keep this matrix in sync with the other one in this file, see the ### blocks.
|
||||
# The only difference should be that the second matrix has all mingw cells disabled; we don't publish mingw builds on starcatcher.
|
||||
@ -60,7 +63,7 @@ jobs:
|
||||
#########################################################
|
||||
platform_short: [lin, mac, win]
|
||||
toolset_short: [gcc, msvc, mingw]
|
||||
machine_short: [x86_64, i686]
|
||||
machine_short: [x86_64, i686, arm64]
|
||||
static_dynamic: [static, dynamic]
|
||||
exclude:
|
||||
- toolset_short: mingw
|
||||
@ -77,6 +80,13 @@ jobs:
|
||||
platform_short: mac
|
||||
- toolset_short: gcc
|
||||
platform_short: win
|
||||
- platform_short: lin
|
||||
machine_short: arm64
|
||||
- platform_short: win
|
||||
machine_short: arm64
|
||||
- platform_short: mac # see [1]
|
||||
static_dynamic: dynamic
|
||||
machine_short: arm64
|
||||
#########################################################
|
||||
############## END BLOCK FOR COPYING BELOW ##############
|
||||
#########################################################
|
||||
@ -85,7 +95,7 @@ jobs:
|
||||
os: ubuntu-18.04
|
||||
suffix: ''
|
||||
- platform_short: mac
|
||||
os: macos-10.15
|
||||
os: macos-11.0
|
||||
suffix: ''
|
||||
- platform_short: win
|
||||
os: windows-2019
|
||||
@ -146,7 +156,7 @@ jobs:
|
||||
#########################################################
|
||||
platform_short: [lin, mac, win]
|
||||
toolset_short: [gcc, msvc, mingw]
|
||||
machine_short: [x86_64, i686]
|
||||
machine_short: [x86_64, i686, arm64]
|
||||
static_dynamic: [static, dynamic]
|
||||
exclude:
|
||||
- toolset_short: mingw
|
||||
@ -160,6 +170,13 @@ jobs:
|
||||
platform_short: mac
|
||||
- toolset_short: gcc
|
||||
platform_short: win
|
||||
- platform_short: lin
|
||||
machine_short: arm64
|
||||
- platform_short: win
|
||||
machine_short: arm64
|
||||
- platform_short: mac # see [1]
|
||||
static_dynamic: dynamic
|
||||
machine_short: arm64
|
||||
#########################################################
|
||||
############## END BLOCK COPIED FROM ABOVE ##############
|
||||
#########################################################
|
||||
|
16
cross-examples/macaa64.ini
Normal file
16
cross-examples/macaa64.ini
Normal file
@ -0,0 +1,16 @@
|
||||
[built-in options]
|
||||
c_args = [ '-arch', 'arm64', '-mmacosx-version-min=10.15' ]
|
||||
cpp_args = [ '-arch', 'arm64', '-mmacosx-version-min=10.15' ]
|
||||
c_link_args = [ '-arch', 'arm64', '-mmacosx-version-min=10.15' ]
|
||||
cpp_link_args = [ '-arch', 'arm64', '-mmacosx-version-min=10.15' ]
|
||||
|
||||
[binaries]
|
||||
c = 'clang'
|
||||
cpp = 'clang++'
|
||||
strip = 'strip'
|
||||
|
||||
[host_machine]
|
||||
system = 'darwin'
|
||||
cpu_family = 'aarch64'
|
||||
cpu = 'armv8'
|
||||
endian = 'little'
|
21
meson.build
21
meson.build
@ -1,5 +1,6 @@
|
||||
project('the-powder-toy', [ 'c', 'cpp' ], version: 'the.cake.is.a.lie', default_options: [
|
||||
'cpp_std=c++17',
|
||||
'build.cpp_std=c++17', # used when cross-compiling
|
||||
])
|
||||
|
||||
to_array = generator(
|
||||
@ -31,6 +32,8 @@ if host_machine.cpu_family() in [ 'x86_64' ]
|
||||
copt_architecture = 'x86_64'
|
||||
elif host_machine.cpu_family() in [ 'x86' ]
|
||||
copt_architecture = 'i686'
|
||||
elif host_machine.cpu_family() in [ 'aarch64' ]
|
||||
copt_architecture = 'arm64'
|
||||
else
|
||||
warning('unsupported architecture: ' + host_machine.cpu_family() + '; you are on your own')
|
||||
copt_architecture = 'i686'
|
||||
@ -53,7 +56,7 @@ endif
|
||||
|
||||
uopt_static = get_option('static')
|
||||
use_tpt_libs = 'no'
|
||||
tpt_libs_vtag = 'v20211224205921'
|
||||
tpt_libs_vtag = 'v20220217170412'
|
||||
if uopt_static == 'system'
|
||||
if copt_platform == 'win'
|
||||
error('no way to find static system libraries on windows')
|
||||
@ -73,6 +76,9 @@ if use_tpt_libs != 'no'
|
||||
if copt_architecture == 'x86_64' and (copt_platform == 'lin' or copt_platform == 'mac') and copt_compiler != 'gcc'
|
||||
nope = true
|
||||
endif
|
||||
if copt_architecture == 'arm64' and copt_platform != 'mac'
|
||||
nope = true
|
||||
endif
|
||||
quad_compiler = copt_compiler
|
||||
if copt_platform == 'win' and copt_compiler == 'gcc'
|
||||
quad_compiler = 'mingw'
|
||||
@ -221,8 +227,12 @@ else
|
||||
args_ccomp += [ '-mmacosx-version-min=10.9' ]
|
||||
project_link_args += [ '-mmacosx-version-min=10.9' ]
|
||||
endif
|
||||
if copt_platform == 'lin' and not get_option('b_pie') and get_option('workaround_gcc_no_pie') # nice one, meson
|
||||
project_link_args += [ '-no-pie' ]
|
||||
if not get_option('b_pie') and get_option('workaround_gcc_no_pie') # nice one, meson
|
||||
if cpp_compiler.get_id() in [ 'clang' ]
|
||||
project_link_args += [ '-Wl,-no_pie' ]
|
||||
else
|
||||
project_link_args += [ '-no-pie' ]
|
||||
endif
|
||||
endif
|
||||
project_c_args += args_ccomp
|
||||
project_cpp_args += args_ccomp + [ '-Wno-invalid-offsetof' ]
|
||||
@ -250,7 +260,7 @@ elif copt_platform == 'lin'
|
||||
endif
|
||||
endif
|
||||
|
||||
if copt_platform == 'mac' and uopt_lua == 'luajit'
|
||||
if copt_platform == 'mac' and uopt_lua == 'luajit' and copt_architecture != 'arm64'
|
||||
project_link_args += [
|
||||
'-pagezero_size', '10000',
|
||||
'-image_base', '100000000',
|
||||
@ -310,7 +320,7 @@ if get_option('build_powder')
|
||||
include_directories: [ project_inc, powder_inc ],
|
||||
c_args: project_c_args,
|
||||
cpp_args: project_cpp_args,
|
||||
gui_app: true,
|
||||
gui_app: not get_option('debug'),
|
||||
link_args: project_link_args,
|
||||
dependencies: powder_deps,
|
||||
)
|
||||
@ -347,7 +357,6 @@ if get_option('build_font')
|
||||
include_directories: [ project_inc, font_inc ],
|
||||
c_args: project_c_args,
|
||||
cpp_args: project_cpp_args,
|
||||
gui_app: true,
|
||||
link_args: project_link_args,
|
||||
dependencies: font_deps,
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "Config.h"
|
||||
#include "SDL2/SDL.h"
|
||||
#include <SDL.h>
|
||||
#ifdef INCLUDE_SYSWM
|
||||
# if defined(WIN)
|
||||
# include <SDL2/SDL_syswm.h>
|
||||
# include <SDL_syswm.h>
|
||||
# endif // WIN
|
||||
#endif // INCLUDE_SYSWM
|
||||
|
@ -1 +1 @@
|
||||
#include "SDL2/SDL_mouse.h"
|
||||
#include <SDL_mouse.h>
|
||||
|
@ -0,0 +1,6 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-arm64-mac-gcc-static-v20220217170412
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-arm64-mac-gcc-static-v20220217170412.zip
|
||||
source_filename = tpt-libs-prebuilt-arm64-mac-gcc-static-v20220217170412.zip
|
||||
source_hash = f5cb8a1e434bbd732235482a75fd5eaf338fa020d95aa2be201748e5366b7e81
|
@ -1,6 +0,0 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-i686-win-msvc-dynamic-v20211224205921
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20211224205921/tpt-libs-prebuilt-i686-win-msvc-dynamic-v20211224205921.zip
|
||||
source_filename = tpt-libs-prebuilt-i686-win-msvc-dynamic-v20211224205921.zip
|
||||
source_hash = 76102a3e3d325d51325ed3213a1fa86f949656306b16b29c7674eba0dd8ac684
|
@ -0,0 +1,6 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-i686-win-msvc-dynamic-v20220217170412
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-i686-win-msvc-dynamic-v20220217170412.zip
|
||||
source_filename = tpt-libs-prebuilt-i686-win-msvc-dynamic-v20220217170412.zip
|
||||
source_hash = 79e5c97d991dbcbdc2950cfd58fe57eee00bace7d0accf31a1a1e14a105d5a77
|
@ -1,6 +0,0 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-i686-win-msvc-static-v20211224205921
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20211224205921/tpt-libs-prebuilt-i686-win-msvc-static-v20211224205921.zip
|
||||
source_filename = tpt-libs-prebuilt-i686-win-msvc-static-v20211224205921.zip
|
||||
source_hash = 66c481a81ec37f55f1c3aa82eecee4ab12f35142d2501b2f8c2a87c8855345f2
|
@ -0,0 +1,6 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-i686-win-msvc-static-v20220217170412
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-i686-win-msvc-static-v20220217170412.zip
|
||||
source_filename = tpt-libs-prebuilt-i686-win-msvc-static-v20220217170412.zip
|
||||
source_hash = cf84e7b5b31ac947bae2d2cddafd11840a158982c533789035afe1b4c881bc82
|
@ -1,6 +0,0 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-lin-gcc-static-v20211224205921
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20211224205921/tpt-libs-prebuilt-x86_64-lin-gcc-static-v20211224205921.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-lin-gcc-static-v20211224205921.zip
|
||||
source_hash = 5e8ff34c738b85ef22735feba5da4991d385e94b7e518c7f12a127745fa64c7f
|
@ -0,0 +1,6 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-lin-gcc-static-v20220217170412
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-lin-gcc-static-v20220217170412.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-lin-gcc-static-v20220217170412.zip
|
||||
source_hash = 50384ef30e77317bc8e11ef0e3dd5dcca46ed2a223a74ae917e6b19926de905a
|
@ -1,6 +0,0 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-mac-gcc-static-v20211224205921
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20211224205921/tpt-libs-prebuilt-x86_64-mac-gcc-static-v20211224205921.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-mac-gcc-static-v20211224205921.zip
|
||||
source_hash = b83ad4162d9443bcb22413d2f6107f2a3f479893a9901d2a4dc42993f4c2c7e5
|
@ -0,0 +1,6 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-mac-gcc-static-v20220217170412
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-mac-gcc-static-v20220217170412.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-mac-gcc-static-v20220217170412.zip
|
||||
source_hash = a648b73d0bf9e5fba790f3720a82e972192676c25b8cadded6bbf4b831aedb87
|
@ -1,6 +0,0 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20211224205921
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20211224205921/tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20211224205921.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20211224205921.zip
|
||||
source_hash = 8fa1313574d8cb5a69ca5e05da299885295cc9f205164725d517e2ee762d7cca
|
@ -0,0 +1,6 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20220217170412
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20220217170412.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20220217170412.zip
|
||||
source_hash = 0243eaa887e902f1567e7ef86c29dc0b28aea4532fd7a71216f5aa812647d85c
|
@ -1,6 +0,0 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-win-mingw-static-v20211224205921
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20211224205921/tpt-libs-prebuilt-x86_64-win-mingw-static-v20211224205921.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-win-mingw-static-v20211224205921.zip
|
||||
source_hash = 4ce448c60122606f942cf8fb25c66e442879390e6cd8ad23eaa3c3780b9c54fc
|
@ -0,0 +1,6 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-win-mingw-static-v20220217170412
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-win-mingw-static-v20220217170412.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-win-mingw-static-v20220217170412.zip
|
||||
source_hash = 8f2c42d336ce9160ceb8624bbeaeb9155ea7a3a995c573fe95bdf3f2292bc630
|
@ -1,6 +0,0 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20211224205921
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20211224205921/tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20211224205921.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20211224205921.zip
|
||||
source_hash = 190af54e3b9433c4d7adfd4069ee1768e91aeea917e726087bb15989a93dedd8
|
@ -0,0 +1,6 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20220217170412
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20220217170412.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20220217170412.zip
|
||||
source_hash = 6ce386393aacaa62b153c63b45c695bef764b3fe62e138f7c5459688a1987235
|
@ -1,6 +0,0 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-win-msvc-static-v20211224205921
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20211224205921/tpt-libs-prebuilt-x86_64-win-msvc-static-v20211224205921.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-win-msvc-static-v20211224205921.zip
|
||||
source_hash = 1faaf30a96b29cd6255f6f2919b1e14b81ad5e5a95ec37854b6273b5020cd572
|
@ -0,0 +1,6 @@
|
||||
[wrap-file]
|
||||
directory = tpt-libs-prebuilt-x86_64-win-msvc-static-v20220217170412
|
||||
|
||||
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-win-msvc-static-v20220217170412.zip
|
||||
source_filename = tpt-libs-prebuilt-x86_64-win-msvc-static-v20220217170412.zip
|
||||
source_hash = 72a8a40c90e79fd19c9030517006b699ef8adbba68341c5501d30265444bf0b9
|
Loading…
Reference in New Issue
Block a user