diff --git a/src/xenia/gpu/vulkan/premake5.lua b/src/xenia/gpu/vulkan/premake5.lua index 6a7b9200b..82b843b59 100644 --- a/src/xenia/gpu/vulkan/premake5.lua +++ b/src/xenia/gpu/vulkan/premake5.lua @@ -32,6 +32,7 @@ project("xenia-gpu-vulkan-trace-viewer") kind("WindowedApp") language("C++") links({ + "aes_128", "capstone", "gflags", "glslang-spirv", @@ -102,6 +103,7 @@ project("xenia-gpu-vulkan-trace-dump") kind("ConsoleApp") language("C++") links({ + "aes_128", "capstone", "gflags", "glslang-spirv", diff --git a/tools/build/premake b/tools/build/premake index c4c471d99..79cfd454e 100644 --- a/tools/build/premake +++ b/tools/build/premake @@ -8,6 +8,7 @@ __author__ = 'ben.vanik@gmail.com (Ben Vanik)' +import json import os import subprocess import sys @@ -139,31 +140,38 @@ def import_vs_environment(): interesting environment variables into os.environ. 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 + 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) - candidate_path = candidate_path.strip() + vswhere = subprocess.check_output('third_party/vswhere/vswhere.exe -version "[15,)" -latest -format json', shell=False, universal_newlines=True) + 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) + + if version < 2017: + if 'VS140COMNTOOLS' in os.environ: + version = 2015 + vcvars_path = os.environ['VS140COMNTOOLS'] + 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'] - tools_path = '' - if candidate_path: - 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 - tools_path = os.environ['VS140COMNTOOLS'] - tools_path = os.path.join(tools_path, '..\\..\\vc\\vcvarsall.bat') if version == 0: 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( args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) variables, _ = popen.communicate() @@ -188,9 +196,6 @@ def import_vs_environment(): os.environ[var.upper()] = setting break - os.environ['VSVERSION'] = str(version) - return version - def git_submodule_update(): """Runs a full recursive git submodule init and update. diff --git a/xenia-build b/xenia-build index 0e7c27d2b..a40dbbadc 100755 --- a/xenia-build +++ b/xenia-build @@ -9,6 +9,7 @@ Run with --help or no arguments for possible commands. from __future__ import print_function import argparse +import json import os import re import shutil @@ -89,31 +90,42 @@ def import_vs_environment(): interesting environment variables into os.environ. 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 + 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) - candidate_path = candidate_path.strip() + vswhere = subprocess.check_output('third_party/vswhere/vswhere.exe -version "[15,)" -latest -format json', shell=False, universal_newlines=True) + 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) + + if version < 2017: + if 'VS140COMNTOOLS' in os.environ: + version = 2015 + vcvars_path = os.environ['VS140COMNTOOLS'] + 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'] - tools_path = '' - if candidate_path: - 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 - tools_path = os.environ['VS140COMNTOOLS'] - tools_path = os.path.join(tools_path, '..\\..\\vc\\vcvarsall.bat') if version == 0: 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( args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) variables, _ = popen.communicate() @@ -138,10 +150,6 @@ def import_vs_environment(): os.environ[var.upper()] = setting break - os.environ['VSVERSION'] = str(version) - return version - - def has_bin(binary): """Checks whether the given binary is present.