]> granicus.if.org Git - openjpeg/commitdiff
Find out Visual Studio version
authormayeut <mayeut@users.noreply.github.com>
Sun, 11 Oct 2015 15:10:48 +0000 (17:10 +0200)
committermayeut <mayeut@users.noreply.github.com>
Sun, 11 Oct 2015 15:10:48 +0000 (17:10 +0200)
tools/travis-ci/run.sh

index 6b5a9949d18f793dc5921ec4ef13514c6604e203..7d6bd141af73ad8afc091e71c035b9e77eada332 100755 (executable)
@@ -68,7 +68,7 @@ if [ "${TRAVIS_OS_NAME:-}" == "" ]; then
                fi
        elif uname -s | grep -i CYGWIN &> /dev/null; then
                TRAVIS_OS_NAME=windows
-       elif uname -s | grep -i MINGW32 &> /dev/null; then
+       elif uname -s | grep -i MINGW &> /dev/null; then
                TRAVIS_OS_NAME=windows
        else
                echo "Failed to guess OS"; exit 1
@@ -101,7 +101,24 @@ elif [ "${TRAVIS_OS_NAME}" == "linux" ]; then
        fi
 elif [ "${TRAVIS_OS_NAME}" == "windows" ]; then
        OPJ_OS_NAME=windows
-       OPJ_CC_VERSION=vs2015
+       if which cl > /dev/null; then
+               OPJ_CL_VERSION=$(cl 2>&1 | grep Version | sed 's/.*Version \([0-9]*\).*/\1/')
+               if [ ${OPJ_CL_VERSION} -eq 19 ]; then
+                       OPJ_CC_VERSION=vs2015
+               elif [ ${OPJ_CL_VERSION} -eq 18 ]; then
+                       OPJ_CC_VERSION=vs2013
+               elif [ ${OPJ_CL_VERSION} -eq 17 ]; then
+                       OPJ_CC_VERSION=vs2012
+               elif [ ${OPJ_CL_VERSION} -eq 16 ]; then
+                       OPJ_CC_VERSION=vs2010
+               elif [ ${OPJ_CL_VERSION} -eq 15 ]; then
+                       OPJ_CC_VERSION=vs2008
+               elif [ ${OPJ_CL_VERSION} -eq 14 ]; then
+                       OPJ_CC_VERSION=vs2005
+               else
+                       OPJ_CC_VERSION=vs????
+               fi
+       fi
 else
        echo "OS not supported: ${TRAVIS_OS_NAME}"; exit 1
 fi