-
Notifications
You must be signed in to change notification settings - Fork 16
/
setup.py
66 lines (51 loc) · 2.78 KB
/
setup.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
#!/usr/bin/env python3
import os
import subprocess
import shutil
from pathlib import Path
import argparse
this_dir = Path(__file__).parent.resolve()
def _msbuild(*args, **kwargs):
p = subprocess.Popen(["msbuild", *args], **kwargs)
return p.wait()
def _instantiateTemplates(dir):
for p in os.scandir(dir):
if p.is_dir():
_instantiateTemplates(p.path)
else:
name, ext = os.path.splitext(p.path)
if ext == ".template" and not os.path.exists(name):
print(p.path)
shutil.copy2(p.path, name)
def _build(project_file, platform, *configurations):
for configuration in configurations:
if _msbuild("/m", "/p:Platform={}".format(platform), "/p:Configuration={}".format(configuration), project_file.resolve().as_posix()) != 0:
raise Exception("build error")
def _buildDependencies():
deps_dir = this_dir/"build/dependencies"
tools_dir = this_dir/"tools"
_build(deps_dir/"COFF_tools/dotNET/COFF_tools.sln", "Any CPU", "Debug")
_build(deps_dir/"CUDA_build_tools/embedCUDA/source/embedCUDA.sln", "Any CPU", "Debug")
_build(deps_dir/"Win32_core_tools/build/vs2017/Win32_core_tools.vcxproj", "x64", "Debug", "Release")
_build(deps_dir/"COM_core_tools/build/vs2017/COM_core_tools.vcxproj", "x64", "Debug", "Release")
_build(deps_dir/"image_tools/build/vs2017/image_tools.vcxproj", "x64", "Debug", "Release")
_build(deps_dir/"CUDA_compiler_tools/build/vs2017/CUDA_compiler_tools.vcxproj", "x64", "Debug", "Release")
_build(deps_dir/"CUDA_binary_tools/build/vs2017/CUDA_binary_tools.vcxproj", "x64", "Debug", "Release")
_build(deps_dir/"CUDA_core_tools/build/vs2017/CUDA_core_tools.vcxproj", "x64", "Debug", "Release")
_build(deps_dir/"CUPTI_core_tools/build/vs2017/CUPTI_core_tools.vcxproj", "x64", "Debug", "Release")
_build(deps_dir/"CUDA_graphics_interop_tools/build/vs2017/CUDA_graphics_interop_tools.vcxproj", "x64", "Debug", "Release")
_build(deps_dir/"GL_platform_tools/build/vs2017/glcore.vcxproj", "x64", "Debug", "Release", "Debug DLL", "Release DLL")
_build(deps_dir/"GL_platform_tools/build/vs2017/GL_platform_tools.vcxproj", "x64", "Debug", "Release", "Debug DLL", "Release DLL")
_build(deps_dir/"config_tools/build/vs2017/config_tools.vcxproj", "x64", "Debug", "Release")
_build(deps_dir/"GL_core_tools/build/vs2017/GL_core_tools.vcxproj", "x64", "Debug", "Release", "Debug DLL", "Release DLL")
_build(deps_dir/"GLSL_build_tools/build/vs2017/GLSL_build_tools.sln", "x64", "Debug")
_build(tools_dir/"sceneconverter/build/vs2017/sceneconverter.vcxproj", "x64", "Release")
def main(args):
print("instantiating templates...")
_instantiateTemplates(this_dir)
print("building dependencies...")
_buildDependencies()
print("...done")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
main(parser.parse_args())