make.bat: Preliminary Visual Studio 2019 support.
authorRay Molenkamp <github@lazydodo.com>
Sat, 23 Feb 2019 03:49:22 +0000 (20:49 -0700)
committerRay Molenkamp <github@lazydodo.com>
Sat, 23 Feb 2019 03:49:22 +0000 (20:49 -0700)
VS2019 is binary compatible with the existing vc14 libraries and no
new libraries libs are required in svn.

VS2019 support requires cmake 3.14.

VS2019 is still in pre-release state, you are required to explicitly
select the pre-release version by using:

make full 2019pre

build_files/cmake/platform/platform_win32.cmake
build_files/windows/autodetect_msvc.cmd
build_files/windows/check_libraries.cmd
build_files/windows/configure_msbuild.cmd
build_files/windows/detect_msvc2017.cmd
build_files/windows/detect_msvc2019.cmd [new file with mode: 0644]
build_files/windows/detect_msvc_vswhere.cmd [new file with mode: 0644]
build_files/windows/parse_arguments.cmd

index 85974bc..2c5294d 100644 (file)
@@ -173,7 +173,10 @@ if(NOT DEFINED LIBDIR)
                set(LIBDIR_BASE "windows")
        endif()
        # Can be 1910..1912
                set(LIBDIR_BASE "windows")
        endif()
        # Can be 1910..1912
-       if(MSVC_VERSION GREATER 1909)
+       if(MSVC_VERSION GREATER 1919)
+               message(STATUS "Visual Studio 2019 detected.")
+               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
+       elseif(MSVC_VERSION GREATER 1909)
                message(STATUS "Visual Studio 2017 detected.")
                set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
        elseif(MSVC_VERSION EQUAL 1900)
                message(STATUS "Visual Studio 2017 detected.")
                set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
        elseif(MSVC_VERSION EQUAL 1900)
index 4dbe009..c2884bc 100644 (file)
@@ -3,6 +3,9 @@ echo No explicit msvc version requested, autodetecting version.
 call "%~dp0\detect_msvc2017.cmd"
 if %ERRORLEVEL% EQU 0 goto DetectionComplete
 
 call "%~dp0\detect_msvc2017.cmd"
 if %ERRORLEVEL% EQU 0 goto DetectionComplete
 
+call "%~dp0\detect_msvc2019.cmd"
+if %ERRORLEVEL% EQU 0 goto DetectionComplete
+
 call "%~dp0\detect_msvc2015.cmd"
 if %ERRORLEVEL% EQU 0 goto DetectionComplete
 
 call "%~dp0\detect_msvc2015.cmd"
 if %ERRORLEVEL% EQU 0 goto DetectionComplete
 
index 506728a..8c5f7ec 100644 (file)
@@ -1,5 +1,6 @@
 if "%BUILD_VS_YEAR%"=="2015" set BUILD_VS_LIBDIRPOST=vc14
 if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc14
 if "%BUILD_VS_YEAR%"=="2015" set BUILD_VS_LIBDIRPOST=vc14
 if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc14
+if "%BUILD_VS_YEAR%"=="2019" set BUILD_VS_LIBDIRPOST=vc14
 
 if "%BUILD_ARCH%"=="x64" (
        set BUILD_VS_SVNDIR=win64_%BUILD_VS_LIBDIRPOST%
 
 if "%BUILD_ARCH%"=="x64" (
        set BUILD_VS_SVNDIR=win64_%BUILD_VS_LIBDIRPOST%
index 28d9950..c316e22 100644 (file)
@@ -1,3 +1,5 @@
+set BUILD_GENERATOR_POST=
+set BUILD_PLATFORM_SELECT=
 if "%BUILD_ARCH%"=="x64" (
        set MSBUILD_PLATFORM=x64
 ) else if "%BUILD_ARCH%"=="x86" (
 if "%BUILD_ARCH%"=="x64" (
        set MSBUILD_PLATFORM=x64
 ) else if "%BUILD_ARCH%"=="x86" (
@@ -23,7 +25,14 @@ if "%WITH_CLANG%"=="1" (
 if "%WITH_PYDEBUG%"=="1" (
        set PYDEBUG_CMAKE_ARGS=-DWINDOWS_PYTHON_DEBUG=On
 )
 if "%WITH_PYDEBUG%"=="1" (
        set PYDEBUG_CMAKE_ARGS=-DWINDOWS_PYTHON_DEBUG=On
 )
-set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS% %CLANG_CMAKE_ARGS% %ASAN_CMAKE_ARGS% %PYDEBUG_CMAKE_ARGS%
+
+if "%BUILD_VS_YEAR%"=="2019" (
+       set BUILD_PLATFORM_SELECT=-A %MSBUILD_PLATFORM%
+) else (
+       set BUILD_GENERATOR_POST=%WINDOWS_ARCH%
+)
+
+set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%BUILD_GENERATOR_POST%" %BUILD_PLATFORM_SELECT% %TESTS_CMAKE_ARGS% %CLANG_CMAKE_ARGS% %ASAN_CMAKE_ARGS% %PYDEBUG_CMAKE_ARGS%
 
 if NOT EXIST %BUILD_DIR%\nul (
        mkdir %BUILD_DIR%
 
 if NOT EXIST %BUILD_DIR%\nul (
        mkdir %BUILD_DIR%
@@ -52,8 +61,8 @@ if "%MUST_CONFIGURE%"=="1" (
                %BUILD_CMAKE_ARGS% ^
                -H%BLENDER_DIR% ^
                -B%BUILD_DIR% 
                %BUILD_CMAKE_ARGS% ^
                -H%BLENDER_DIR% ^
                -B%BUILD_DIR% 
-
-       if %ERRORLEVEL% NEQ 0 (
+       
+       if errorlevel 1 (
                echo "Configuration Failed"
                exit /b 1
        )
                echo "Configuration Failed"
                exit /b 1
        )
index 029f98c..5f76027 100644 (file)
@@ -1,76 +1,3 @@
-if NOT "%verbose%" == "" (
-       echo Detecting msvc 2017
-)
 set BUILD_VS_VER=15
 set BUILD_VS_YEAR=2017
 set BUILD_VS_VER=15
 set BUILD_VS_YEAR=2017
-set ProgramFilesX86=%ProgramFiles(x86)%
-if not exist "%ProgramFilesX86%" set ProgramFilesX86=%ProgramFiles%
-
-set vs_where=%ProgramFilesX86%\Microsoft Visual Studio\Installer\vswhere.exe
-if not exist "%vs_where%" (
-       if NOT "%verbose%" == "" (
-               echo Visual Studio 2017 ^(15.2 or newer^) is not detected
-       )
-       goto FAIL
-)
-
-if NOT "%verbose%" == "" (
-               echo "%vs_where%" -latest %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`
-       )
-
-for /f "usebackq tokens=1* delims=: " %%i in (`"%vs_where%" -latest %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`) do (
-       if /i "%%i"=="installationPath" set VS_InstallDir=%%j
-)
-
-if "%VS_InstallDir%"=="" (
-       if NOT "%verbose%" == "" (
-               echo Visual Studio is detected but the "Desktop development with C++" workload has not been instlled
-               goto FAIL
-       )
-)
-
-set VCVARS=%VS_InstallDir%\VC\Auxiliary\Build\vcvarsall.bat
-if exist "%VCVARS%" (
-       call "%VCVARS%" %BUILD_ARCH%
-) else (
-       if NOT "%verbose%" == "" (
-               echo "%VCVARS%" not found
-       )
-       goto FAIL
-)
-
-rem try msbuild
-msbuild /version > NUL 
-if errorlevel 1 (
-       if NOT "%verbose%" == "" (
-               echo Visual Studio %BUILD_VS_YEAR% msbuild not found
-       )
-       goto FAIL
-)
-
-if NOT "%verbose%" == "" (
-               echo Visual Studio %BUILD_VS_YEAR% msbuild found 
-)
-
-REM try the c++ compiler
-cl 2> NUL 1>&2
-if errorlevel 1 (
-       if NOT "%verbose%" == "" (
-               echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler not found
-       )
-       goto FAIL
-)
-
-if NOT "%verbose%" == "" (
-               echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler found
-)
-
-if NOT "%verbose%" == "" (
-       echo Visual Studio 2017 is detected successfully  
-)
-goto EOF
-
-:FAIL
-exit /b 1 
-
-:EOF
+call "%~dp0\detect_msvc_vswhere.cmd"
diff --git a/build_files/windows/detect_msvc2019.cmd b/build_files/windows/detect_msvc2019.cmd
new file mode 100644 (file)
index 0000000..d75d6ba
--- /dev/null
@@ -0,0 +1,3 @@
+set BUILD_VS_VER=16
+set BUILD_VS_YEAR=2019
+call "%~dp0\detect_msvc_vswhere.cmd"
diff --git a/build_files/windows/detect_msvc_vswhere.cmd b/build_files/windows/detect_msvc_vswhere.cmd
new file mode 100644 (file)
index 0000000..a538e50
--- /dev/null
@@ -0,0 +1,79 @@
+if NOT "%verbose%" == "" (
+       echo Detecting msvc %BUILD_VS_YEAR%
+)
+
+set ProgramFilesX86=%ProgramFiles(x86)%
+if not exist "%ProgramFilesX86%" set ProgramFilesX86=%ProgramFiles%
+
+set vs_where=%ProgramFilesX86%\Microsoft Visual Studio\Installer\vswhere.exe
+if not exist "%vs_where%" (
+       if NOT "%verbose%" == "" (
+               echo Visual Studio %BUILD_VS_YEAR% is not detected
+       )
+       goto FAIL
+)
+
+if NOT "%verbose%" == "" (
+               echo "%vs_where%" -latest %VSWHERE_ARGS% -version ^[%BUILD_VS_VER%.0^,%BUILD_VS_VER%.99^) -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64
+       )
+
+for /f "usebackq tokens=1* delims=: " %%i in (`"%vs_where%" -latest -version ^[%BUILD_VS_VER%.0^,%BUILD_VS_VER%.99^) %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`) do (
+       if /i "%%i"=="installationPath" set VS_InstallDir=%%j
+)
+
+if NOT "%verbose%" == "" (
+       echo VS_Installdir="%VS_InstallDir%"
+)
+
+if "%VS_InstallDir%"=="" (
+       if NOT "%verbose%" == "" (
+               echo Visual Studio is detected but the "Desktop development with C++" workload has not been instlled
+               goto FAIL
+       )
+)
+
+set VCVARS=%VS_InstallDir%\VC\Auxiliary\Build\vcvarsall.bat
+if exist "%VCVARS%" (
+       call "%VCVARS%" %BUILD_ARCH%
+) else (
+       if NOT "%verbose%" == "" (
+               echo "%VCVARS%" not found
+       )
+       goto FAIL
+)
+
+rem try msbuild
+msbuild /version > NUL 
+if errorlevel 1 (
+       if NOT "%verbose%" == "" (
+               echo Visual Studio %BUILD_VS_YEAR% msbuild not found
+       )
+       goto FAIL
+)
+
+if NOT "%verbose%" == "" (
+               echo Visual Studio %BUILD_VS_YEAR% msbuild found 
+)
+
+REM try the c++ compiler
+cl 2> NUL 1>&2
+if errorlevel 1 (
+       if NOT "%verbose%" == "" (
+               echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler not found
+       )
+       goto FAIL
+)
+
+if NOT "%verbose%" == "" (
+               echo Visual Studio %BUILD_VS_YEAR% C/C++ Compiler found
+)
+
+if NOT "%verbose%" == "" (
+       echo Visual Studio %BUILD_VS_YEAR% is detected successfully  
+)
+goto EOF
+
+:FAIL
+exit /b 1 
+
+:EOF
index 30bd2eb..c76efd4 100644 (file)
@@ -53,10 +53,17 @@ if NOT "%1" == "" (
        ) else if "%1" == "2017pre" (
                set BUILD_VS_YEAR=2017
                set VSWHERE_ARGS=-prerelease
        ) else if "%1" == "2017pre" (
                set BUILD_VS_YEAR=2017
                set VSWHERE_ARGS=-prerelease
-               set BUILD_VS_YEAR=2017
        ) else if "%1" == "2017b" (
                set BUILD_VS_YEAR=2017
                set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
        ) else if "%1" == "2017b" (
                set BUILD_VS_YEAR=2017
                set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
+       ) else if "%1" == "2019" (
+               set BUILD_VS_YEAR=2019
+       ) else if "%1" == "2019pre" (
+               set BUILD_VS_YEAR=2019
+               set VSWHERE_ARGS=-prerelease
+       ) else if "%1" == "2019b" (
+               set BUILD_VS_YEAR=2019
+               set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
        ) else if "%1" == "2015" (
                set BUILD_VS_YEAR=2015
        ) else if "%1" == "packagename" (
        ) else if "%1" == "2015" (
                set BUILD_VS_YEAR=2015
        ) else if "%1" == "packagename" (