This commit will hard-lock your Mac
This commit is contained in:
parent
062cd1e2de
commit
731b5a6bba
|
@ -217,13 +217,19 @@ def build_wasm3_lib_win(release):
|
|||
|
||||
|
||||
def build_wasm3_lib_mac(release):
|
||||
includes = ["-I./ext/wasm3/source"]
|
||||
debug_flags = ["-O2"] if release else ["-g"]
|
||||
flags = [
|
||||
*debug_flags,
|
||||
"-foptimize-sibling-calls",
|
||||
"-Wno-extern-initializer",
|
||||
"-Dd_m3VerboseErrorMessages",
|
||||
]
|
||||
|
||||
for f in glob.iglob("./ext/wasm3/source/*.c"):
|
||||
name = os.path.splitext(os.path.basename(f))[0] + ".o"
|
||||
subprocess.run([
|
||||
"clang", "-c",
|
||||
"-g", *(["/O2"] if release else []),
|
||||
"-foptimize-sibling-calls", "-Wno-extern-initializer", "-Dd_m3VerboseErrorMessages",
|
||||
"-I./ext/wasm3/source",
|
||||
"clang", "-c", *flags, *includes,
|
||||
"-o", f"./bin/obj/{name}",
|
||||
f,
|
||||
], check=True)
|
||||
|
@ -239,8 +245,7 @@ def build_orca(release):
|
|||
if platform.system() == "Windows":
|
||||
build_orca_win(release)
|
||||
elif platform.system() == "Darwin":
|
||||
log_error("can't yet build Orca on Mac")
|
||||
exit(1)
|
||||
build_orca_mac(release)
|
||||
else:
|
||||
log_error(f"can't build Orca for unknown platform '{platform.system()}'")
|
||||
exit(1)
|
||||
|
@ -254,23 +259,7 @@ def build_orca_win(release):
|
|||
shutil.copy("milepost\\bin\\milepost.dll.lib", "bin")
|
||||
shutil.copy(os.path.join(pthread_dir, "bin\\pthreadVC3.dll"), "bin")
|
||||
|
||||
# generate wasm3 api bindings
|
||||
bindgen("core", "src")
|
||||
bindgen("gles", "src")
|
||||
bindgen2("canvas", "src\\canvas_api.json",
|
||||
guest_stubs="sdk\\orca_surface.c",
|
||||
guest_include="graphics.h",
|
||||
wasm3_bindings="src\\canvas_api_bind_gen.c",
|
||||
)
|
||||
bindgen2("clock", "src\\clock_api.json",
|
||||
guest_stubs="sdk\\orca_clock.c",
|
||||
guest_include="platform_clock.h",
|
||||
wasm3_bindings="src\\clock_api_bind_gen.c",
|
||||
)
|
||||
bindgen2("io", "src\\io_api.json",
|
||||
guest_stubs="sdk\\io_stubs.c",
|
||||
wasm3_bindings="src\\io_api_bind_gen.c",
|
||||
)
|
||||
gen_all_bindings()
|
||||
|
||||
# compile orca
|
||||
pthread_include = os.path.join(pthread_dir, "include")
|
||||
|
@ -301,6 +290,70 @@ def build_orca_win(release):
|
|||
], check=True)
|
||||
|
||||
|
||||
def build_orca_mac(release):
|
||||
# copy libraries
|
||||
shutil.copy("milepost/bin/mtl_renderer.metallib", "bin/")
|
||||
shutil.copy("milepost/bin/libmilepost.dylib", "bin/")
|
||||
shutil.copy("milepost/bin/libGLESv2.dylib", "bin/")
|
||||
shutil.copy("milepost/bin/libEGL.dylib", "bin/")
|
||||
|
||||
includes = [
|
||||
"-Isrc",
|
||||
"-Isdk",
|
||||
"-Imilepost/src",
|
||||
"-Imilepost/src/util",
|
||||
"-Imilepost/src/platform",
|
||||
"-Iext/wasm3/source",
|
||||
"-Imilepost/ext/",
|
||||
]
|
||||
libs = ["-Lbin", "-lmilepost", "-lwasm3"]
|
||||
debug_flags = ["-O2"] if release else ["-g", "-DLOG_COMPILE_DEBUG"]
|
||||
flags = [
|
||||
*debug_flags,
|
||||
"-mmacos-version-min=10.15.4",
|
||||
"-maes",
|
||||
]
|
||||
|
||||
gen_all_bindings()
|
||||
|
||||
# compile orca
|
||||
subprocess.run([
|
||||
"clang", *flags, *includes, *libs,
|
||||
"-o", "bin/orca",
|
||||
"src/main.c",
|
||||
], check=True)
|
||||
|
||||
# fix libs imports
|
||||
subprocess.run([
|
||||
"install_name_tool", "-change",
|
||||
"./bin/libmilepost.dylib", "@rpath/libmilepost.dylib", "bin/orca",
|
||||
], check=True)
|
||||
subprocess.run([
|
||||
"install_name_tool", "-add_rpath",
|
||||
"@executable_path/", "bin/orca",
|
||||
], check=True)
|
||||
|
||||
|
||||
def gen_all_bindings():
|
||||
bindgen("core", "src")
|
||||
bindgen("gles", "src")
|
||||
|
||||
bindgen2("canvas", "src/canvas_api.json",
|
||||
guest_stubs="sdk/orca_surface.c",
|
||||
guest_include="graphics.h",
|
||||
wasm3_bindings="src/canvas_api_bind_gen.c",
|
||||
)
|
||||
bindgen2("clock", "src/clock_api.json",
|
||||
guest_stubs="sdk/orca_clock.c",
|
||||
guest_include="platform_clock.h",
|
||||
wasm3_bindings="src/clock_api_bind_gen.c",
|
||||
)
|
||||
bindgen2("io", "src/io_api.json",
|
||||
guest_stubs="sdk/io_stubs.c",
|
||||
wasm3_bindings="src/io_api_bind_gen.c",
|
||||
)
|
||||
|
||||
|
||||
def ensure_programs():
|
||||
if platform.system() == "Windows":
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue