-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprepare.py
94 lines (72 loc) · 3.03 KB
/
prepare.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import os
import configparser
from urllib.request import urlopen
from shutil import copyfile
import zipfile
import sys
import platform
print(">> Updating submodules...")
os.system("git submodule update --init --recursive")
os.system("git submodule update")
config = configparser.ConfigParser()
# OS X specific
if sys.platform == "darwin":
vsymlink = os.path.join("projects", "plugin", "JuceLibraryCode", "version.h")
vsymsource = os.path.join("projects", "plugin", "src", "version.h")
if not os.path.isfile(vsymlink):
os.symlink(os.path.abspath(vsymsource), os.path.abspath(vsymlink))
if not os.path.isfile("make/config.ini"):
config.add_section("local")
config.set("local", "vst-x86-output", "C:/Audio/VSTx86")
config.set("local", "vst-x64-output", "C:/Audio/VSTx64")
with open("make/config.ini", "w") as f:
config.write(f, True)
print(">> Creating default configuration...")
else:
print(">> Reading configuration...")
print(">> Setting up symlinks...")
def dirlink(source, dest):
if os.name == "nt":
print("Creating junction for: " + dest)
os.system("mklink /J \"" + dest + "\" \"" + source + "\"")
else:
print("Creating symlink for: " + dest)
os.symlink(os.path.abspath(source), os.path.abspath(dest))
for filename in os.listdir("projects"):
path = os.path.join("projects", filename)
if os.path.isdir(path):
for subfilename in os.listdir(path):
if subfilename == "JuceLibraryCode":
subpath = os.path.join(path, subfilename)
if os.path.isdir(subpath):
moduleFolder = os.path.join(subpath, "modules")
if not os.path.isdir(moduleFolder):
dirlink("external/JuceLibraryCode/modules", moduleFolder)
print(">> Setting up skeletons...")
print(">> Downloading latest cpp-jit binaries...")
if platform.system() == "Windows":
cppjit_url = "https://bitbucket.org/Mayae/cppjit/downloads/libCppJit-0.5-windows.zip"
elif platform.system() == "Darwin":
cppjit_url = "https://bitbucket.org/Mayae/cppjit/downloads/libCppJit-0.5-macos.zip"
latest_cppjit = urlopen(cppjit_url)
with open("temp.zip", "wb") as out:
out.write(latest_cppjit.read())
print(">> Extracting cpp-jit...")
with zipfile.ZipFile("temp.zip") as cppjit:
if platform.system() == "Windows":
with cppjit.open("libCppJit.dll") as dll:
with open(os.path.join("make", "skeleton", "compilers", "CppAPE", "libCppJit.dll"), "wb") as outdll:
outdll.write(dll.read())
with cppjit.open("libCppJit.lib") as lib:
with open(os.path.join("projects", "cppape", "builds", "VisualStudio", "libCppJit.lib"), "wb") as outlib:
outlib.write(lib.read())
elif platform.system() == "Darwin":
with cppjit.open("libcppjit.dylib") as dylib:
with open(os.path.join("make", "skeleton", "compilers", "CppAPE", "libcppjit.dylib"), "wb") as outdyld:
outdyld.write(dylib.read())
with cppjit.open("libCppJit.h") as header:
with open(os.path.join("projects", "cppape", "src", "libCppJit.h"), "wb") as outheader:
outheader.write(header.read())
if os.path.exists("temp.zip"):
os.remove("temp.zip")
print(">> Dev environment setup without errors.")