-
Notifications
You must be signed in to change notification settings - Fork 28
/
SConscript.cocoa
87 lines (74 loc) · 2.86 KB
/
SConscript.cocoa
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Builds the rlvm.app with all binaries and files.
import re
import string
Import('env')
static_env = env.Clone()
static_env.Append(
CPPDEFINES = [
"CASE_SENSITIVE_FILESYSTEM",
"_THREAD_SAFE"
],
CXXFLAGS = [
"--ansi",
"-Wall",
"-Wno-sign-compare",
"-Wno-narrowing",
"-std=c++17"
]
)
def MergeEverythingButSDLMain(env, cmd):
"""
Filters out the libSDLmain.a argument from the return value of sdl-config.
"""
p = re.compile('libSDLmain')
def isSDLMain(x):
return not p.search(x)
filtered_args = filter(isSDLMain, cmd.split(' '))
filtered_string = " ".join(filtered_args)
return env.MergeFlags(filtered_args, 0)
static_env.ParseConfig("sdl-config --static-libs", MergeEverythingButSDLMain)
cocoarlvm_files = [
# Technically cross platform, but put here for SDL dependency.
"src/machine/rlvm_instance.cc",
"src/platforms/osx/CocoaRLVMInstance.mm",
"src/platforms/osx/SDLMain.mm"
]
# Builds a fullstatic version of rlvm and then builds a bundle
static_env.RlvmProgram('rlvm-static', cocoarlvm_files,
use_lib_set = ["SDL"],
full_static_build = True,
rlvm_libs = ["guichan_platform", "system_sdl", "rlvm"])
static_env.InstallAs(target='$OUTPUT_DIR/rlvm.app/Contents/Info.plist',
source='src/platforms/osx/Info.plist.in')
static_env.Install(target='$OUTPUT_DIR/rlvm.app/Contents/Resources/',
source=["COPYING.TXT", "GPL.TXT", "README.md",
'resources/rlvm.icns', '$OUTPUT_DIR/locale/'])
static_env.InstallAs(
target='$OUTPUT_DIR/rlvm.app/Contents/Resources/'
'Japanese.lproj/InfoPlist.strings',
source='src/platforms/osx/StubInfoPlist.strings')
static_env.InstallAs(
target='$OUTPUT_DIR/rlvm.app/Contents/Resources/'
'English.lproj/InfoPlist.strings',
source='src/platforms/osx/StubInfoPlist.strings')
static_env.InstallAs(target='$OUTPUT_DIR/rlvm.app/Contents/MacOS/rlvm',
source='rlvm-static')
AddOption('--dmgname', action='store',
help='Builds a release package with the attached name. '
'(Example: "rlvm 0.12" -> "rlvm_0.12.dmg"')
if GetOption('dmgname'):
dmgname = GetOption('dmgname')
filename = string.replace(dmgname, ' ', '_') + ".dmg"
if not GetOption('fullstatic'):
print "**** WARNING: RELEASE BUILDS MUST HAVE --fullstatic ****"
exit
static_env.Command('$OUTPUT_DIR/' + filename,
'$OUTPUT_DIR/rlvm.app/',
"scripts/pkg-dmg "
" --tempdir build/"
" --source build/rlvm.app"
" --target build/" + filename +
" --sourcefile"
" --volname \"" + dmgname + "\""
" --copy src/platforms/osx/dmg-ds-store:/.DS_Store"
" --format UDBZ")