-
Notifications
You must be signed in to change notification settings - Fork 59
/
compile.py
executable file
·73 lines (61 loc) · 1.39 KB
/
compile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python
import os, sys
os.chdir(os.path.dirname(__file__))
# Import compile_utils from core.
sys.path += ["core"]
from compile_utils import *
import compile_utils as c
from glob import glob
# Compile core module.
sys_exec(["./core/compile.py"])
sys_exec(["cp", "core/musicplayer.so", "musicplayer.so"])
sys_exec(["mkdir", "-p", "build"])
os.chdir("build/")
# Compile _gui.so.
print("* Building _gui.so")
guiFiles = glob("../_gui/*.cpp")
cc(
guiFiles,
["-I../core"] + get_python_ccopts()
)
link(
"../_gui.so",
[c.get_cc_outfilename(fn) for fn in guiFiles],
get_python_linkopts()
)
if sys.platform == "darwin":
# Compile _guiCocoa.so.
print("* Building _guiCocoa.so")
guiCocoaFiles = glob("../mac/gui/*.m*") + glob("../mac/gui/*.cpp")
PyObjCBridgeFile = "../mac/gui/PyObjCBridge.m"
guiCocoaFiles.remove(PyObjCBridgeFile) # we will handle that differently
cc(
guiCocoaFiles,
[
"-I../core",
"-I../_gui",
"-fobjc-arc",
] +
get_python_ccopts()
)
guiCocoaFiles.append(PyObjCBridgeFile)
cc(
[PyObjCBridgeFile],
[
"-I../core",
"-I../_gui",
"-I../mac/pyobjc-core/Modules/objc",
"-I../mac/pyobjc-core/libffi-src/include",
] +
get_python_ccopts()
)
link(
"../_guiCocoa.so",
[c.get_cc_outfilename(fn) for fn in guiCocoaFiles],
[
"-framework", "Cocoa",
"-framework", "Foundation",
"-framework", "CoreFoundation",
] +
get_python_linkopts()
)