From 25bc144d18e6ccdcfd81701626ac07be184823ae Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Mon, 22 Nov 2021 12:51:49 -0500 Subject: [PATCH] Add VS 2022 support --- script_helpers/msvc.sh | 69 +++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/script_helpers/msvc.sh b/script_helpers/msvc.sh index 1acbf20..cbced57 100644 --- a/script_helpers/msvc.sh +++ b/script_helpers/msvc.sh @@ -18,27 +18,46 @@ get_msvc_bin_path() { _path="" _x64_toolset=0 - if [[ $VisualStudioVersion == "14.0" ]]; then - ########################################## - # Visual Studio 2015 - ########################################## - _path="$VCINSTALLDIR" - if [[ $(env | grep "LIB=" | grep "x64") != "" ]]; then - printf "${BOLD}${YELLOW}[VS2015 X64]${NORMAL}\n" + + ########################################## + # Visual Studio 2022 + ########################################## + if [[ $VisualStudioVersion == "17.0" ]]; then + _path="$VCToolsInstallDir" + + if [[ $VSCMD_ARG_HOST_ARCH == "x64" ]]; then + printf "${BOLD}${YELLOW}[VS2022 X64]${NORMAL}\n" _x64_toolset=1 - _path+="bin/amd64" - elif [[ $(env | grep "LIB=" | grep "x86") != "" ]]; then - printf "${BOLD}${YELLOW}[VS2015 X86]${NORMAL}\n" - _path+="bin/" + _path+="bin/Hostx64/x64" + elif [[ $VSCMD_ARG_HOST_ARCH == "x86" ]]; then + printf "${BOLD}${YELLOW}[VS2022 X86]${NORMAL}\n" + _path+="bin/Hostx86/x86" else error "Unable to determine if you're using an x86 or x64 MSVC toolset\n" exit 1 fi + ########################################## + # Visual Studio 2019 + ########################################## + elif [[ $VisualStudioVersion == "16.0" ]]; then + _path="$VCToolsInstallDir" + + if [[ $VSCMD_ARG_HOST_ARCH == "x64" ]]; then + printf "${BOLD}${YELLOW}[VS2019 X64]${NORMAL}\n" + _x64_toolset=1 + _path+="bin/Hostx64/x64" + elif [[ $VSCMD_ARG_HOST_ARCH == "x86" ]]; then + printf "${BOLD}${YELLOW}[VS2019 X86]${NORMAL}\n" + _path+="bin/Hostx86/x86" + else + error "Unable to determine if you're using an x86 or x64 MSVC toolset\n" + exit 1 + fi + ########################################## + # Visual Studio 2017 + ########################################## elif [[ $VisualStudioVersion == "15.0" ]]; then - ########################################## - # Visual Studio 2017 - ########################################## _path="$VCToolsInstallDir" if [[ $VSCMD_ARG_HOST_ARCH == "x64" ]]; then @@ -52,19 +71,19 @@ get_msvc_bin_path() { error "Unable to determine if you're using an x86 or x64 MSVC toolset\n" exit 1 fi - elif [[ $VisualStudioVersion == "16.0" ]]; then - ########################################## - # Visual Studio 2019 - ########################################## - _path="$VCToolsInstallDir" + ########################################## + # Visual Studio 2015 + ########################################## + elif [[ $VisualStudioVersion == "14.0" ]]; then + _path="$VCINSTALLDIR" - if [[ $VSCMD_ARG_HOST_ARCH == "x64" ]]; then - printf "${BOLD}${YELLOW}[VS2019 X64]${NORMAL}\n" + if [[ $(env | grep "LIB=" | grep "x64") != "" ]]; then + printf "${BOLD}${YELLOW}[VS2015 X64]${NORMAL}\n" _x64_toolset=1 - _path+="bin/Hostx64/x64" - elif [[ $VSCMD_ARG_HOST_ARCH == "x86" ]]; then - printf "${BOLD}${YELLOW}[VS2019 X86]${NORMAL}\n" - _path+="bin/Hostx86/x86" + _path+="bin/amd64" + elif [[ $(env | grep "LIB=" | grep "x86") != "" ]]; then + printf "${BOLD}${YELLOW}[VS2015 X86]${NORMAL}\n" + _path+="bin/" else error "Unable to determine if you're using an x86 or x64 MSVC toolset\n" exit 1