File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change 11import os
22import shutil
3+ import sys
34from .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
4545def 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
5469unix .build_sdl = build_sdl
You can’t perform that action at this time.
0 commit comments