Skip to content

Commit 0dd43e8

Browse files
committed
Fixing SDL dynlib for macos port
1 parent 6352eb9 commit 0dd43e8

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

builder/macOS.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import os
22
import shutil
3+
import sys
34
from .unix import (
45
parse_args as _parse_args,
56
build_commands as _build_commands,
67
build_manifest as _build_manifest,
78
force_clean as _force_clean,
89
clean as _clean,
9-
build_sdl as _build_sdl,
1010
submodules as _submodules,
1111
compile as _compile,
1212
mpy_cross as _mpy_cross
@@ -44,11 +44,26 @@ def force_clean(clean_mpy_cross):
4444

4545
def build_sdl(addl_commands):
4646
dst = f'lib/micropython/ports/unix/build-{unix.variant}/SDL'
47-
48-
if os.path.exists(os.path.join(dst, 'libSDL2-2.0.0.dylib')):
47+
if not os.path.exists(dst):
48+
os.makedirs(dst)
49+
elif os.path.exists(os.path.join(dst, 'libSDL2-2.0.0.dylib')):
4950
return
5051

51-
_build_sdl(addl_commands.strip())
52+
cwd = os.getcwd()
53+
os.chdir(dst)
54+
cmd_ = [
55+
[
56+
f'cmake -DSDL_STATIC=ON -DSDL_SHARED=ON '
57+
f'-DCMAKE_BUILD_TYPE=Release {addl_commands} {unix.SCRIPT_PATH}/lib/SDL'
58+
],
59+
[f'cmake --build . --config Release --parallel {os.cpu_count()}']
60+
]
61+
62+
res, _ = unix.spawn(cmd_, cmpl=True)
63+
if res != 0:
64+
sys.exit(res)
65+
66+
os.chdir(cwd)
5267

5368

5469
unix.build_sdl = build_sdl

0 commit comments

Comments
 (0)