Merge branch 'master' into d3d12

This commit is contained in:
gibbed 2019-04-18 11:23:41 -05:00
commit 827567a21a
3 changed files with 58 additions and 43 deletions

View File

@ -32,6 +32,7 @@ project("xenia-gpu-vulkan-trace-viewer")
kind("WindowedApp") kind("WindowedApp")
language("C++") language("C++")
links({ links({
"aes_128",
"capstone", "capstone",
"gflags", "gflags",
"glslang-spirv", "glslang-spirv",
@ -102,6 +103,7 @@ project("xenia-gpu-vulkan-trace-dump")
kind("ConsoleApp") kind("ConsoleApp")
language("C++") language("C++")
links({ links({
"aes_128",
"capstone", "capstone",
"gflags", "gflags",
"glslang-spirv", "glslang-spirv",

View File

@ -8,6 +8,7 @@
__author__ = 'ben.vanik@gmail.com (Ben Vanik)' __author__ = 'ben.vanik@gmail.com (Ben Vanik)'
import json
import os import os
import subprocess import subprocess
import sys import sys
@ -139,31 +140,38 @@ def import_vs_environment():
interesting environment variables into os.environ. interesting environment variables into os.environ.
Returns: Returns:
A version such as 2015 or None if no VS is found. A version such as 2015 or None if no installation is found.
""" """
version = 0 version = 0
install_path = None
env_tool_args = None
candidate_path = subprocess.check_output('../../third_party/vswhere/vswhere.exe -all -version "[15,)" -latest -format value -property installationPath', shell=False, universal_newlines=True) vswhere = subprocess.check_output('third_party/vswhere/vswhere.exe -version "[15,)" -latest -format json', shell=False, universal_newlines=True)
candidate_path = candidate_path.strip() if vswhere:
vswhere = json.loads(vswhere)
if vswhere and len(vswhere) > 0:
version = int(vswhere[0].get("catalog", {}).get("productLineVersion", 2017))
install_path = vswhere[0].get("installationPath", None)
tools_path = '' if version < 2017:
if candidate_path: if 'VS140COMNTOOLS' in os.environ:
tools_path = os.path.join(candidate_path, 'vc\\auxiliary\\build\\vcvarsall.bat')
if os.path.isfile(tools_path) and os.access(tools_path, os.X_OK):
version = subprocess.check_output('../../third_party/vswhere/vswhere.exe -version "[15,)" -latest -format value -property catalog_productLineVersion', shell=False, universal_newlines=True)
version = version.strip()
if version:
version = int(version)
else:
version = 2017
if version == 0 and 'VS140COMNTOOLS' in os.environ:
version = 2015 version = 2015
tools_path = os.environ['VS140COMNTOOLS'] vcvars_path = os.environ['VS140COMNTOOLS']
tools_path = os.path.join(tools_path, '..\\..\\vc\\vcvarsall.bat') vcvars_path = os.path.join(tools_path, '..\\..\\vc\\vcvarsall.bat')
env_tool_args = [vcvars_path, 'x64', '&&', 'set']
else:
vsdevcmd_path = os.path.join(install_path, 'Common7\\Tools\\VsDevCmd.bat')
env_tool_args = [vsdevcmd_path, '-arch=amd64', '-host_arch=amd64']
if version == 0: if version == 0:
return None return None
args = [tools_path, 'x64', '&&', 'set'] import_subprocess_environment(env_tool_args)
os.environ['VSVERSION'] = str(version)
return version
def import_subprocess_environment(args):
popen = subprocess.Popen( popen = subprocess.Popen(
args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
variables, _ = popen.communicate() variables, _ = popen.communicate()
@ -188,9 +196,6 @@ def import_vs_environment():
os.environ[var.upper()] = setting os.environ[var.upper()] = setting
break break
os.environ['VSVERSION'] = str(version)
return version
def git_submodule_update(): def git_submodule_update():
"""Runs a full recursive git submodule init and update. """Runs a full recursive git submodule init and update.

View File

@ -9,6 +9,7 @@ Run with --help or no arguments for possible commands.
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import json
import os import os
import re import re
import shutil import shutil
@ -89,31 +90,42 @@ def import_vs_environment():
interesting environment variables into os.environ. interesting environment variables into os.environ.
Returns: Returns:
A version such as 2015 or None if no VS is found. A version such as 2015 or None if no installation is found.
""" """
version = 0 version = 0
install_path = None
env_tool_args = None
candidate_path = subprocess.check_output('third_party/vswhere/vswhere.exe -version "[15,)" -latest -format value -property installationPath', shell=False, universal_newlines=True) vswhere = subprocess.check_output('third_party/vswhere/vswhere.exe -version "[15,)" -latest -format json', shell=False, universal_newlines=True)
candidate_path = candidate_path.strip() if vswhere:
vswhere = json.loads(vswhere)
if vswhere and len(vswhere) > 0:
version = int(vswhere[0].get("catalog", {}).get("productLineVersion", 2017))
install_path = vswhere[0].get("installationPath", None)
tools_path = '' if version < 2017:
if candidate_path: if 'VS140COMNTOOLS' in os.environ:
tools_path = os.path.join(candidate_path, 'vc\\auxiliary\\build\\vcvarsall.bat')
if os.path.isfile(tools_path) and os.access(tools_path, os.X_OK):
version = subprocess.check_output('third_party/vswhere/vswhere.exe -version "[15,)" -latest -format value -property catalog_productLineVersion', shell=False, universal_newlines=True)
version = version.strip()
if version:
version = int(version)
else:
version = 2017
if version == 0 and 'VS140COMNTOOLS' in os.environ:
version = 2015 version = 2015
tools_path = os.environ['VS140COMNTOOLS'] vcvars_path = os.environ['VS140COMNTOOLS']
tools_path = os.path.join(tools_path, '..\\..\\vc\\vcvarsall.bat') vcvars_path = os.path.join(tools_path, '..\\..\\vc\\vcvarsall.bat')
env_tool_args = [vcvars_path, 'x64', '&&', 'set']
else:
vcvars_path = os.path.join(install_path, 'VC\\Auxiliary\\Build\\vcvarsall.bat')
if os.path.isfile(vcvars_path) and os.access(vcvars_path, os.X_OK):
env_tool_args = [vcvars_path, 'x64', '&&', 'set']
else:
vsdevcmd_path = os.path.join(install_path, 'Common7\\Tools\\VsDevCmd.bat')
env_tool_args = [vsdevcmd_path, '-arch=amd64', '-host_arch=amd64']
if version == 0: if version == 0:
return None return None
args = [tools_path, 'x64', '&&', 'set'] import_subprocess_environment(env_tool_args)
os.environ['VSVERSION'] = str(version)
return version
def import_subprocess_environment(args):
popen = subprocess.Popen( popen = subprocess.Popen(
args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
variables, _ = popen.communicate() variables, _ = popen.communicate()
@ -138,10 +150,6 @@ def import_vs_environment():
os.environ[var.upper()] = setting os.environ[var.upper()] = setting
break break
os.environ['VSVERSION'] = str(version)
return version
def has_bin(binary): def has_bin(binary):
"""Checks whether the given binary is present. """Checks whether the given binary is present.