[ttssh2-commit] [9648] LibreSSL のビルドを Visual Studio 2019, 2022 に対応

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2021年 12月 29日 (水) 22:33:30 JST


Revision: 9648
          https://osdn.net/projects/ttssh2/scm/svn/commits/9648
Author:   nmaya
Date:     2021-12-29 22:33:30 +0900 (Wed, 29 Dec 2021)
Log Message:
-----------
LibreSSL のビルドを Visual Studio 2019, 2022 に対応

Modified Paths:
--------------
    branches/libressl_3_4_2/libs/buildlibressl.bat

-------------- next part --------------
Modified: branches/libressl_3_4_2/libs/buildlibressl.bat
===================================================================
--- branches/libressl_3_4_2/libs/buildlibressl.bat	2021-12-29 13:24:00 UTC (rev 9647)
+++ branches/libressl_3_4_2/libs/buildlibressl.bat	2021-12-29 13:33:30 UTC (rev 9648)
@@ -5,11 +5,52 @@
 
 if exist "CMakeCache.txt" goto end
 
-cmake -G "Visual Studio 16 2019" -A Win32
+
+if not "%VSINSTALLDIR%" == "" goto vsinstdir
+
+:check_2019
+if "%VS160COMNTOOLS%" == "" goto check_2022
+if not exist "%VS160COMNTOOLS%\VsDevCmd.bat" goto check_2022
+call "%VS160COMNTOOLS%\VsDevCmd.bat"
+goto vs2019
+
+:check_2022
+if "%VS170COMNTOOLS%" == "" goto novs
+if not exist "%VS170COMNTOOLS%\VsDevCmd.bat" goto novs
+call "%VS170COMNTOOLS%\VsDevCmd.bat"
+goto vs2022
+
+:novs
+echo "Can't find Visual Studio"
+goto fail
+
+:vsinstdir
+rem Visual Studio\x82̃o\x81[\x83W\x83\x87\x83\x93\x94\xBB\x95\xCA
+set VSCMNDIR="%VSINSTALLDIR%\Common7\Tools\"
+set VSCMNDIR=%VSCMNDIR:\\=\%
+
+if /I %VSCMNDIR% EQU "%VS160COMNTOOLS%" goto vs2019
+if /I %VSCMNDIR% EQU "%VS170COMNTOOLS%" goto vs2022
+
+echo Unknown Visual Studio version
+goto fail
+
+:vs2019
+set CMAKE_PARAMETER=-G "Visual Studio 16 2019" -A Win32
+goto vsend
+
+:vs2022
+set CMAKE_PARAMETER=-G "Visual Studio 17 2022" -A Win32
+goto vsend
+
+:vsend
+
+
+cmake %CMAKE_PARAMETER%
 perl -e "open(IN,'CMakeCache.txt');while(<IN>){s|=/MD|=/MT|;print $_;}close(IN);" > CMakeCache.txt.tmp
 move /y CMakeCache.txt.tmp CMakeCache.txt
 rem \x95ύX\x82\xB5\x82\xBD CMakeCache.txt \x82Ɋ\xEE\x82Â\xA2\x82Đ\xB6\x90\xAC\x82\xB3\x82\xEA\x82\xE9\x82悤\x82ɍēx\x8E\xC0\x8Ds
-cmake -G "Visual Studio 16 2019" -A Win32
+cmake %CMAKE_PARAMETER%
 
 devenv /build Debug LibreSSL.sln /project crypto /projectconfig Debug
 
@@ -19,3 +60,10 @@
 :end
 cd ..
 exit /b 0
+
+
+:fail
+cd ..
+echo "buildlibressl.bat \x82\xF0\x8FI\x97\xB9\x82\xB5\x82܂\xB7"
+ @ echo on
+exit /b 1


ttssh2-commit メーリングリストの案内
Back to archive index