forked from jcsteh/osara
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sconstruct
74 lines (66 loc) · 2.64 KB
/
sconstruct
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
# OSARA: Open Source Accessibility for the REAPER Application
# SConstruct
# Copyright 2015-2024 NV Access Limited, James Teh
# License: GNU General Public License version 2.0
import os
from makePot import makePot
import multiprocessing
vars = Variables()
vars.Add("version", "The version of this build", "unknown")
vars.Add("publisher", "The publisher of this build", "unknown")
env = Environment(tools = ["default", "textfile"],
variables=vars,
copyright="Copyright (C) 2014-2024 NV Access Limited, James Teh & other contributors",
)
# Make sure to run the build on multiple threads so it runs faster
env.SetOption('num_jobs', multiprocessing.cpu_count())
print("Building using {} jobs".format(env.GetOption('num_jobs')))
if env["PLATFORM"] == "win32":
for arch, suffix in (("x86", "32"), ("x86_64", "64")):
archEnv = Environment(tools = ["default", "textfile"],
TARGET_ARCH=arch, HOST_ARCH=arch, libSuffix=suffix,
version=env["version"], copyright=env["copyright"],
# Hack around an odd bug where some tool after msvc states that static and shared objects are different.
STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME=1)
archEnv.SConscript("src/archBuild_sconscript",
exports={"env": archEnv},
variant_dir="build/%s" % arch, duplicate=False)
configRc = "build/x86_64/config.rc"
try:
import winreg
except ImportError:
import _winreg as winreg
def getMakensis():
"""Get the path to makensis."""
try:
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\NSIS\Unicode",
0, winreg.KEY_READ | winreg.KEY_WOW64_32KEY) as nsisKey:
return os.path.join(winreg.QueryValueEx(nsisKey, None)[0], "makensis.exe")
except WindowsError:
pass
try:
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\NSIS",
0, winreg.KEY_READ | winreg.KEY_WOW64_32KEY) as nsisKey:
return os.path.join(winreg.QueryValueEx(nsisKey, None)[0], "makensis.exe")
except WindowsError:
pass
return "makensis.exe"
installer = env.Command("installer/osara_${version}.exe", ["installer/osara.nsi", "build"],
[[getMakensis(), "/V2",
"/DVERSION=$version", '/DPUBLISHER="$publisher"','/DCOPYRIGHT="$copyright"',
"/DOUTFILE=${TARGET.abspath}",
"$SOURCE"]])
else: # Mac
env["libSuffix"] = ""
env.SConscript("src/archBuild_sconscript",
exports={"env": env},
variant_dir="build", duplicate=False)
installer = env.Command("installer/osara_${version}.dmg", ["installer/mac/build.sh", "build"],
[["$SOURCE", "$version"]])
configRc = "build/x86_64/config.rc"
env.Alias("installer", installer)
env.Default(installer)
pot = env.Command("locale/osara_${version}.pot",
[env.Glob("src/*.cpp"), env.Glob("src/*.rc"), configRc],
makePot)
env.Alias("pot", pot)