Revision: 9612 https://osdn.net/projects/ttssh2/scm/svn/commits/9612 Author: zmatsuo Date: 2021-12-23 21:56:04 +0900 (Thu, 23 Dec 2021) Log Message: ----------- cmakeビルドでVisual Studio 2022 でビルドできるよう調整 - libs/getcmake.bat, ps1 を buildtools/ へ移動 - .gitignore追加 MFT r9419, r9508 Revision Links: -------------- https://osdn.net/projects/ttssh2/scm/svn/commits/9419 https://osdn.net/projects/ttssh2/scm/svn/commits/9508 Modified Paths: -------------- branches/4-stable/doc/ja/html/reference/build_library_with_cmake.md branches/4-stable/doc/ja/html/reference/build_with_cmake.md branches/4-stable/libs/buildall.cmake branches/4-stable/libs/buildall_cmake.bat branches/4-stable/libs/openssl11.cmake branches/4-stable/libs/script_support.cmake Added Paths: ----------- branches/4-stable/.gitignore branches/4-stable/buildtools/ branches/4-stable/buildtools/getcmake.bat branches/4-stable/buildtools/getcmake.ps1 Removed Paths: ------------- branches/4-stable/libs/getcmake.bat branches/4-stable/libs/getcmake.ps1 -------------- next part -------------- Added: branches/4-stable/.gitignore =================================================================== --- branches/4-stable/.gitignore (rev 0) +++ branches/4-stable/.gitignore 2021-12-23 12:56:04 UTC (rev 9612) @@ -0,0 +1,16 @@ +build*/ +*~ +/libs/* +*.obj +**/Debug/ +**/Release/ +**/.vs/ +*.aps +/GTAGS +/GPATH +/GRTAGS +*.ncb +*.suo +*.user +*.map +/gtags.files Added: branches/4-stable/buildtools/getcmake.bat =================================================================== --- branches/4-stable/buildtools/getcmake.bat (rev 0) +++ branches/4-stable/buildtools/getcmake.bat 2021-12-23 12:56:04 UTC (rev 9612) @@ -0,0 +1,10 @@ + @ echo off +setlocal +cd /d %~dp0 +IF NOT EXIST cmake-3.11.4-win32-x86 ( + echo cmake\x82\xF0\x83_\x83E\x83\x93\x83\x8D\x81[\x83h\x82\xB5\x82\xC4lib/cmake\x82ɓW\x8AJ\x82\xB5\x82܂\xB7 + IF NOT "%1" == "nopause" pause + powershell -NoProfile -ExecutionPolicy Unrestricted .\getcmake.ps1 +) +endlocal +IF NOT "%1" == "nopause" pause Copied: branches/4-stable/buildtools/getcmake.ps1 (from rev 9608, branches/4-stable/libs/getcmake.ps1) =================================================================== --- branches/4-stable/buildtools/getcmake.ps1 (rev 0) +++ branches/4-stable/buildtools/getcmake.ps1 2021-12-23 12:56:04 UTC (rev 9612) @@ -0,0 +1,33 @@ +$CMAKE_URL = "https://cmake.org/files/v3.11/cmake-3.11.4-win32-x86.zip" +$CMAKE_ZIP = ($CMAKE_URL -split "/")[-1] +$CMAKE_DIR = [System.IO.Path]::GetFileNameWithoutExtension($CMAKE_ZIP) + +$CMAKE_ZIP = "download\cmake\" + $CMAKE_ZIP + +echo $CMAKE_URL +echo $CMAKE_ZIP +echo $CMAKE_DIR + +# TLS1.2 \x82\xF0\x97L\x8C\xF8\x82ɂ\xB7\x82\xE9 (cmake.org\x82\xCD TLS1.2) +# [Net.ServicePointManager]::SecurityProtocol +# \x82\xF0\x8E\xC0\x8Ds\x82\xB5\x82\xC4 "Ssl3, Tls" \x82Əo\x82\xBD\x8Fꍇ\x81ATLS1.2\x82͖\xB3\x8C\xF8\x82ƂȂ\xC1\x82Ă\xA2\x82\xE9 +[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; + +# \x93W\x8AJ\x8Dς݃t\x83H\x83\x8B\x83_\x82\xAA\x82\xA0\x82\xE9? +if((Test-Path $CMAKE_DIR) -eq $true) { + # \x8D폜\x82\xB7\x82\xE9 + Remove-Item -Recurse -Force $CMAKE_DIR + # \x8FI\x97\xB9\x82\xB7\x82\xE9 + #exit +} + +# \x83_\x83E\x83\x93\x83\x8D\x81[\x83h\x82\xB7\x82\xE9 +if((Test-Path $CMAKE_ZIP) -eq $false) { + if((Test-Path "download\cmake") -ne $true) { + mkdir "download\cmake" + } + wget $CMAKE_URL -Outfile $CMAKE_ZIP +} + +# \x93W\x8AJ\x82\xB7\x82\xE9 +Expand-Archive $CMAKE_ZIP -DestinationPath . Modified: branches/4-stable/doc/ja/html/reference/build_library_with_cmake.md =================================================================== --- branches/4-stable/doc/ja/html/reference/build_library_with_cmake.md 2021-12-20 12:53:23 UTC (rev 9611) +++ branches/4-stable/doc/ja/html/reference/build_library_with_cmake.md 2021-12-23 12:56:04 UTC (rev 9612) @@ -32,21 +32,24 @@ ### batファイルを使用する場合 -buildall_cmake.bat を実行して使用する Visual Studioを選ぶ +libs/buildall_cmake.bat を実行して使用する Visual Studioを選ぶ - 1. Visual Studio 16 2019 - 2. Visual Studio 15 2017 - 3. Visual Studio 14 2015 - 4. Visual Studio 12 2013 - 5. Visual Studio 11 2012 - 6. Visual Studio 10 2010 - 7. Visual Studio 9 2008 - 8. Visual Studio 8 2005 + 1. Visual Studio 17 2022 + 2. Visual Studio 17 2022 x64 + 3. Visual Studio 16 2019 + 4. Visual Studio 16 2019 x64 + 5. Visual Studio 15 2017 + 6. Visual Studio 14 2015 + 7. Visual Studio 12 2013 + 8. Visual Studio 11 2012 + 9. Visual Studio 10 2010 + a. Visual Studio 9 2008 + b. Visual Studio 8 2005 select no VS2005を選択した場合、 -このバッチファイルから cmake 3.11.4 をダウンロードして `libs\cmake-3.11.4-win32-x86` に -インストールできます。 +このバッチファイルから cmake 3.11.4 をダウンロードして `buildtools\libs\cmake-3.11.4-win32-x86` に +展開されます。 ### cmakeを使用する場合 @@ -54,18 +57,14 @@ cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P buildall.cmake -Visual Studio 2017 x86 の場合 +Visual Studio 2019 x64 の場合 - cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P buildall.cmake + cmake -DCMAKE_GENERATOR="Visual Studio 15 2019" -DARCHITECTURE=x64 -P buildall.cmake` -Visual Studio 2017 x64 の場合 - - cmake -DCMAKE_GENERATOR="Visual Studio 15 2017 Win64" -P buildall.cmake` - Visual Studio 2005の場合は、cmakeのバージョン3.11.4以前を使用 -(cmake が libs\cmake-3.11.4-win32-x86 にインストールしてある場合) +(cmake が buildtools\cmake-3.11.4-win32-x86 にインストールしてある場合) - libs\cmake-3.11.4-win32-x86\bin\cmake.exe" -DCMAKE_GENERATOR="Visual Studio 8 2005" -P buildall.cmake + ..\buildtools\cmake-3.11.4-win32-x86\bin\cmake.exe" -DCMAKE_GENERATOR="Visual Studio 8 2005" -P buildall.cmake ## MinGW 共通 @@ -78,11 +77,12 @@ ## 生成されるライブラリフォルダ - 次のフォルダにライブラリの `*.h` , `*.lib` が生成される - - `oniguruma_{compiler}` - - `openssl_{compiler}` - - `putty` - - `SFMT_{compiler}` - - `zlib_{compiler}` + - `cJSON` + - `oniguruma_{compiler}` + - `openssl_{compiler}` + - `putty` + - `SFMT_{compiler}` + - `zlib_{compiler}` ## download アーカイブダウンロードフォルダ Modified: branches/4-stable/doc/ja/html/reference/build_with_cmake.md =================================================================== --- branches/4-stable/doc/ja/html/reference/build_with_cmake.md 2021-12-20 12:53:23 UTC (rev 9611) +++ branches/4-stable/doc/ja/html/reference/build_with_cmake.md 2021-12-23 12:56:04 UTC (rev 9612) @@ -7,8 +7,7 @@ - Visual Studio 2005 をサポートしている cmake の最後のバージョンは 3.11.4 です - Visual Studio 2005 (Expressも含む)以外を使用する場合は特に制限はありません -- Visual Studio 2017,2019 インストーラーで、オプションを選べば cmake をインストールできます -- cmake 3.14から Visual Studio 2019 をサポートしています +- Visual Studio 2017,2019,2022 インストーラーで、オプションを選べば cmake をインストールできます ## MinGW (very experimental) Modified: branches/4-stable/libs/buildall.cmake =================================================================== --- branches/4-stable/libs/buildall.cmake 2021-12-20 12:53:23 UTC (rev 9611) +++ branches/4-stable/libs/buildall.cmake 2021-12-23 12:56:04 UTC (rev 9612) @@ -1,4 +1,5 @@ -# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P buildall.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=Win32 -P buildall.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P buildall.cmake # cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=x64 -P buildall.cmake # cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P buildall.cmake # cmake -DCMAKE_GENERATOR="Visual Studio 15 2017 Win64" -P buildall.cmake Modified: branches/4-stable/libs/buildall_cmake.bat =================================================================== --- branches/4-stable/libs/buildall_cmake.bat 2021-12-20 12:53:23 UTC (rev 9611) +++ branches/4-stable/libs/buildall_cmake.bat 2021-12-23 12:56:04 UTC (rev 9612) @@ -7,29 +7,35 @@ set OPT= :retry_vs -echo 1. Visual Studio 16 2019 -echo 2. Visual Studio 15 2017 -echo 3. Visual Studio 14 2015 -echo 4. Visual Studio 12 2013 -echo 5. Visual Studio 11 2012 -echo 6. Visual Studio 10 2010 -echo 7. Visual Studio 9 2008 -echo 8. Visual Studio 8 2005 -rem echo 9. Visual Studio NMake (experimental) -rem echo z. Cygwin MinGW Release + Unix Makefiles (experimental) +echo 1. Visual Studio 17 2022 Win32 +echo 2. Visual Studio 17 2022 x64 +echo 3. Visual Studio 16 2019 Win32 +echo 4. Visual Studio 16 2019 x64 +echo 5. Visual Studio 15 2017 +echo 6. Visual Studio 14 2015 +echo 7. Visual Studio 12 2013 +echo 8. Visual Studio 11 2012 +echo 9. Visual Studio 10 2010 +echo a. Visual Studio 9 2008 +echo b. Visual Studio 8 2005 +rem echo c. Visual Studio NMake (experimental) +rem echo d. Cygwin MinGW Release + Unix Makefiles (experimental) set /p no="select no " echo %no% -if "%no%" == "1" set GENERATOR="Visual Studio 16 2019" & set OPT=-DARCHITECTURE=Win32 & goto build_all -if "%no%" == "2" set GENERATOR="Visual Studio 15 2017" & goto build_all -if "%no%" == "3" set GENERATOR="Visual Studio 14 2015" & goto build_all -if "%no%" == "4" set GENERATOR="Visual Studio 12 2013" & goto build_all -if "%no%" == "5" set GENERATOR="Visual Studio 11 2012" & goto build_all -if "%no%" == "6" set GENERATOR="Visual Studio 10 2010" & goto build_all -if "%no%" == "7" set GENERATOR="Visual Studio 9 2008" & goto build_all -if "%no%" == "8" set GENERATOR="Visual Studio 8 2005" & call :cmake_3_11_4 & goto build_all_2 -if "%no%" == "9" set GENERATOR="NMake Makefiles" & set OPT=-DCMAKE_BUILD_TYPE=Release & goto build_all -if "%no%" == "z" set GENERATOR="Unix Makefiles" & set OPT=-DCMAKE_TOOLCHAIN_FILE=../mingw.toolchain.cmake & goto build_all +if "%no%" == "1" set GENERATOR="Visual Studio 17 2022" & set OPT=-DARCHITECTURE=Win32 & goto build_all +if "%no%" == "2" set GENERATOR="Visual Studio 17 2022" & set OPT=-DARCHITECTURE=x64 & goto build_all +if "%no%" == "3" set GENERATOR="Visual Studio 16 2019" & set OPT=-DARCHITECTURE=Win32 & goto build_all +if "%no%" == "4" set GENERATOR="Visual Studio 16 2019" & set OPT=-DARCHITECTURE=x64 & goto build_all +if "%no%" == "5" set GENERATOR="Visual Studio 15 2017" & goto build_all +if "%no%" == "6" set GENERATOR="Visual Studio 14 2015" & goto build_all +if "%no%" == "7" set GENERATOR="Visual Studio 12 2013" & goto build_all +if "%no%" == "8" set GENERATOR="Visual Studio 11 2012" & goto build_all +if "%no%" == "9" set GENERATOR="Visual Studio 10 2010" & goto build_all +if "%no%" == "a" set GENERATOR="Visual Studio 9 2008" & goto build_all +if "%no%" == "b" set GENERATOR="Visual Studio 8 2005" & call :cmake_3_11_4 & goto build_all_2 +if "%no%" == "c" set GENERATOR="NMake Makefiles" & set OPT=-DCMAKE_BUILD_TYPE=Release & goto build_all +if "%no%" == "d" set GENERATOR="Unix Makefiles" & set OPT=-DCMAKE_TOOLCHAIN_FILE=../mingw.toolchain.cmake & goto build_all echo ? retry goto retry_vs @@ -55,10 +61,10 @@ exit :cmake_3_11_4 -set CMAKE=%~dp0cmake-3.11.4-win32-x86\bin\cmake.exe -echo 1. \x8E\xA9\x95\xAA\x82\xCCcmake.exe\x82\xF0\x8Eg\x97p\x82\xB7\x82\xE9(PATH\x82\xF0\x92ʂ\xB5\x82Ă\xA0\x82\xE9) +set CMAKE=%~dp0..\buildtools\cmake-3.11.4-win32-x86\bin\cmake.exe +echo 1. PATH\x8F\xE3\x82\xCCcmake.exe\x82\xF0\x8Eg\x97p\x82\xB7\x82\xE9 echo 2. VS2005\x82ł\xE0\x8Eg\x97p\x82ł\xAB\x82\xE9cmake\x8Eg\x97p\x82\xB7\x82\xE9 -echo (\x95K\x97v\x82Ȃ玩\x93\xAE\x82Ń_\x83E\x83\x93\x83\x8D\x81[\x83h\x82\xB5\x82āA\x82\xB1\x82̃t\x83H\x83\x8B\x83_\x82ɃC\x83\x93\x83X\x83g\x81[\x83\x8B\x82\xB7\x82\xE9) +echo (\x95K\x97v\x82Ȃ玩\x93\xAE\x82Ń_\x83E\x83\x93\x83\x8D\x81[\x83h\x82\xB5\x82āA\x82\xB1\x82\xCCbuildtools/\x82ɃC\x83\x93\x83X\x83g\x81[\x83\x8B\x82\xB7\x82\xE9) if exist %CMAKE% echo \x83C\x83\x93\x83X\x83g\x81[\x83\x8B\x8Dς\xDD(%CMAKE%) set /p no="select no " @@ -71,7 +77,7 @@ :download if exist %CMAKE% goto finish_cmake -call getcmake.bat +call ..\buildtools\getcmake.bat :finish_cmake exit /b Deleted: branches/4-stable/libs/getcmake.bat =================================================================== --- branches/4-stable/libs/getcmake.bat 2021-12-20 12:53:23 UTC (rev 9611) +++ branches/4-stable/libs/getcmake.bat 2021-12-23 12:56:04 UTC (rev 9612) @@ -1,8 +0,0 @@ - @ echo off -setlocal -cd /d %~dp0 -echo cmake\x82\xF0\x83_\x83E\x83\x93\x83\x8D\x81[\x83h\x82\xB5\x82\xC4lib/cmake\x82ɓW\x8AJ\x82\xB5\x82܂\xB7 -pause -powershell -NoProfile -ExecutionPolicy Unrestricted .\getcmake.ps1 -endlocal -pause Deleted: branches/4-stable/libs/getcmake.ps1 =================================================================== --- branches/4-stable/libs/getcmake.ps1 2021-12-20 12:53:23 UTC (rev 9611) +++ branches/4-stable/libs/getcmake.ps1 2021-12-23 12:56:04 UTC (rev 9612) @@ -1,33 +0,0 @@ -$CMAKE_URL = "https://cmake.org/files/v3.11/cmake-3.11.4-win32-x86.zip" -$CMAKE_ZIP = ($CMAKE_URL -split "/")[-1] -$CMAKE_DIR = [System.IO.Path]::GetFileNameWithoutExtension($CMAKE_ZIP) - -$CMAKE_ZIP = "download\cmake\" + $CMAKE_ZIP - -echo $CMAKE_URL -echo $CMAKE_ZIP -echo $CMAKE_DIR - -# TLS1.2 \x82\xF0\x97L\x8C\xF8\x82ɂ\xB7\x82\xE9 (cmake.org\x82\xCD TLS1.2) -# [Net.ServicePointManager]::SecurityProtocol -# \x82\xF0\x8E\xC0\x8Ds\x82\xB5\x82\xC4 "Ssl3, Tls" \x82Əo\x82\xBD\x8Fꍇ\x81ATLS1.2\x82͖\xB3\x8C\xF8\x82ƂȂ\xC1\x82Ă\xA2\x82\xE9 -[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; - -# \x93W\x8AJ\x8Dς݃t\x83H\x83\x8B\x83_\x82\xAA\x82\xA0\x82\xE9? -if((Test-Path $CMAKE_DIR) -eq $true) { - # \x8D폜\x82\xB7\x82\xE9 - Remove-Item -Recurse -Force $CMAKE_DIR - # \x8FI\x97\xB9\x82\xB7\x82\xE9 - #exit -} - -# \x83_\x83E\x83\x93\x83\x8D\x81[\x83h\x82\xB7\x82\xE9 -if((Test-Path $CMAKE_ZIP) -eq $false) { - if((Test-Path "download\cmake") -ne $true) { - mkdir "download\cmake" - } - wget $CMAKE_URL -Outfile $CMAKE_ZIP -} - -# \x93W\x8AJ\x82\xB7\x82\xE9 -Expand-Archive $CMAKE_ZIP -DestinationPath . Modified: branches/4-stable/libs/openssl11.cmake =================================================================== --- branches/4-stable/libs/openssl11.cmake 2021-12-20 12:53:23 UTC (rev 9611) +++ branches/4-stable/libs/openssl11.cmake 2021-12-23 12:56:04 UTC (rev 9612) @@ -136,6 +136,14 @@ (${CMAKE_GENERATOR} MATCHES "NMake Makefiles")) ######################################## VS if(${CMAKE_GENERATOR} MATCHES "NMake Makefiles") + elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 17 2022") + find_program( + VCVARS32 vcvarsall.bat + HINTS "C:/Program Files/Microsoft Visual Studio/2022/Preview/VC/Auxiliary/Build" + HINTS "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build" + HINTS "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Auxiliary/Build" + HINTS "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build" + ) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019") find_program( VCVARS32 vcvarsall.bat @@ -219,7 +227,7 @@ "set LIB=%SDK%\\lib;%LIB%\n" ) endif() - if(${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019") + if((${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019") OR ${CMAKE_GENERATOR} MATCHES "Visual Studio 17 2022") if("${ARCHITECTURE}" MATCHES "x64") file(APPEND "${SRC_DIR}/build_cmake.bat" "call \"${VCVARS32_N}\" amd64\n" Modified: branches/4-stable/libs/script_support.cmake =================================================================== --- branches/4-stable/libs/script_support.cmake 2021-12-20 12:53:23 UTC (rev 9611) +++ branches/4-stable/libs/script_support.cmake 2021-12-23 12:56:04 UTC (rev 9612) @@ -1,33 +1,35 @@ -# TOOLSET ツールセット名 +# TOOLSET ツールセット名 if(${CMAKE_GENERATOR} MATCHES "Visual Studio") - if(${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019") - set(MSVC_TOOLSET_VERSION 142) + if(${CMAKE_GENERATOR} MATCHES "Visual Studio 17 2022") + set(MSVC_TOOLSET_VERSION 143) + elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019") + set(MSVC_TOOLSET_VERSION 142) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017") - set(MSVC_TOOLSET_VERSION 141) + set(MSVC_TOOLSET_VERSION 141) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 14 2015") - set(MSVC_TOOLSET_VERSION 140) + set(MSVC_TOOLSET_VERSION 140) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 12 2013") - set(MSVC_TOOLSET_VERSION 120) + set(MSVC_TOOLSET_VERSION 120) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 11 2012") - set(MSVC_TOOLSET_VERSION 110) + set(MSVC_TOOLSET_VERSION 110) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 10 2010") - set(MSVC_TOOLSET_VERSION 100) + set(MSVC_TOOLSET_VERSION 100) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 9 2008") - set(MSVC_TOOLSET_VERSION 90) + set(MSVC_TOOLSET_VERSION 90) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 8 2005") - set(MSVC_TOOLSET_VERSION 80) + set(MSVC_TOOLSET_VERSION 80) else() - set(MSVC_TOOLSET_VERSION "Unknown") - message(FATAL_ERROR "unknown Visual Studio ${CMAKE_GENERATOR}") + set(MSVC_TOOLSET_VERSION "Unknown") + message(FATAL_ERROR "unknown Visual Studio ${CMAKE_GENERATOR}") endif() set(TOOLSET "VS_${MSVC_TOOLSET_VERSION}") elseif((${CMAKE_GENERATOR} MATCHES "Unix Makefiles") OR - (${CMAKE_GENERATOR} MATCHES "MSYS Makefiles") OR - (${CMAKE_GENERATOR} MATCHES "MinGW Makefiles") OR - (${CMAKE_GENERATOR} MATCHES "Ninja")) + (${CMAKE_GENERATOR} MATCHES "MSYS Makefiles") OR + (${CMAKE_GENERATOR} MATCHES "MinGW Makefiles") OR + (${CMAKE_GENERATOR} MATCHES "Ninja")) set(TOOLSET "mingw") elseif(${CMAKE_GENERATOR} MATCHES "NMake Makefiles") set(TOOLSET "VS_NMake") else() - message(FATAL_ERROR "unknown GENERATOR ${CMAKE_GENERATOR}") + message(FATAL_ERROR "unknown GENERATOR ${CMAKE_GENERATOR}") endif()