From 2dbd86ae23fa4f77ecbbbceabb39d765849d571c Mon Sep 17 00:00:00 2001 From: gibbed Date: Thu, 18 Apr 2019 10:14:18 -0500 Subject: [PATCH 1/4] Rework Xenia/premake build scripts to use VsDevCmd for VS2017+ instead of vcvarsall.bat, this removes Windows Universal CRT SDK as a required dependency. --- tools/build/premake | 48 ++++++++++++++++++++++++--------------------- xenia-build | 48 ++++++++++++++++++++++++--------------------- 2 files changed, 52 insertions(+), 44 deletions(-) diff --git a/tools/build/premake b/tools/build/premake index c4c471d99..ceb72db72 100644 --- a/tools/build/premake +++ b/tools/build/premake @@ -139,33 +139,40 @@ 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) + args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) variables, _ = popen.communicate() envvars_to_save = ( 'devenvdir', @@ -188,9 +195,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 c863ccfb7..4409bb2b6 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,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 -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() @@ -138,10 +146,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. From 28a7334f5c02ea1468ebd75254bb03cd38abcec2 Mon Sep 17 00:00:00 2001 From: gibbed Date: Thu, 18 Apr 2019 10:20:18 -0500 Subject: [PATCH 2/4] [Vulkan] Fix missing aes_128 link for trace viewer/dumper. --- src/xenia/gpu/vulkan/premake5.lua | 2 ++ 1 file changed, 2 insertions(+) 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", From b594f970273db56a379e05a59fb6061bd0f74057 Mon Sep 17 00:00:00 2001 From: gibbed Date: Thu, 18 Apr 2019 10:28:32 -0500 Subject: [PATCH 3/4] Oops. Forgot json import in premake build script. --- tools/build/premake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build/premake b/tools/build/premake index ceb72db72..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 @@ -172,7 +173,7 @@ def import_vs_environment(): def import_subprocess_environment(args): 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() envvars_to_save = ( 'devenvdir', From 3d56d6c46c9f358fbd3d5e4ae932801fa3c1c2a6 Mon Sep 17 00:00:00 2001 From: gibbed Date: Thu, 18 Apr 2019 10:56:27 -0500 Subject: [PATCH 4/4] Use vcvarsall in Xenia build script when available, VcDevCmd otherwise. --- xenia-build | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xenia-build b/xenia-build index 4409bb2b6..2199c12de 100755 --- a/xenia-build +++ b/xenia-build @@ -110,8 +110,12 @@ def import_vs_environment(): 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'] + 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: return None