Revision: 10723 https://osdn.net/projects/ttssh2/scm/svn/commits/10723 Author: zmatsuo Date: 2023-05-29 23:29:06 +0900 (Mon, 29 May 2023) Log Message: ----------- cmake ビルドを調整 - Linux上などでもMinGW64bit版をビルドできるよう修正 - -DARCHITECHTER=64 or 32 でに変更 - install_cygwin.cmake が2箇所に存在したので buildtools/ のみとした - ci_scripts/install_cygwin.cmake は削除 - ci_scripts/build_local_appveyor_vs20*.bat を修正 - ci_scripts/find_cmake.bat - 誤りを修正 - cygwin\CMakeLists.txt - MinGWビルド時、cygwinに関するビルドを行わないようにした - libs - cmake の2重呼び出しを行わないようにした Modified Paths: -------------- trunk/buildtools/install_cygwin.bat trunk/buildtools/install_cygwin.cmake trunk/buildtools/svnrev/svnrev.bat trunk/ci_scripts/build_appveyor.bat trunk/ci_scripts/build_appveyor.cmake trunk/ci_scripts/build_local_appveyor_vs2019.bat trunk/ci_scripts/build_local_appveyor_vs2019_x64.bat trunk/ci_scripts/find_cmake.bat trunk/ci_scripts/install.bat trunk/cygwin/CMakeLists.txt trunk/cygwin/cygterm/.gitignore trunk/doc/en/html/reference/build_library_with_cmake.md trunk/doc/ja/html/reference/build_library_with_cmake.md trunk/libs/VSToolchain.cmake trunk/libs/buildall.cmake trunk/libs/buildall_cmake.bat trunk/libs/buildlibressl.cmake trunk/libs/buildoniguruma.cmake trunk/libs/buildsfmt.cmake trunk/libs/buildzlib.cmake trunk/mingw.toolchain.cmake Added Paths: ----------- trunk/ci_scripts/build_local_appveyor_vs2022.bat trunk/ci_scripts/build_local_appveyor_vs2022_x64.bat Removed Paths: ------------- trunk/ci_scripts/build_local_appveyor_vs2005.bat trunk/ci_scripts/install_cygwin.cmake -------------- next part -------------- Modified: trunk/buildtools/install_cygwin.bat =================================================================== --- trunk/buildtools/install_cygwin.bat 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/buildtools/install_cygwin.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,5 +1,9 @@ +setlocal cd /d %~dp0 -set PATH=C:\Program Files\CMake\bin;%PATH% -cmake -P install_cygwin.cmake +if "%CMAKE_COMMAND%" == "" ( + call ..\ci_scripts\find_cmake.bat +) +"%CMAKE_COMMAND%" -P ../buildtools/install_cygwin.cmake +rem "%CMAKE_COMMAND%" -DREMOVE_TMP=ON -P ../buildtools/install_cygwin.cmake pause Modified: trunk/buildtools/install_cygwin.cmake =================================================================== --- trunk/buildtools/install_cygwin.cmake 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/buildtools/install_cygwin.cmake 2023-05-29 14:29:06 UTC (rev 10723) @@ -13,6 +13,12 @@ file(MAKE_DIRECTORY "${CYGWIN_ROOT}") endif() +if("${CYGWIN_ROOT}" MATCHES "cygdrive") + # cygwin の cmake を使用するとpath(CYGWIN_ROOT) が /cygdrive/c.. となり + # setup.exe の --root オプションで処理できない + message(FATAL_ERROR "check CMAKE_COMMAND (${CMAKE_COMMAND})") +endif() + ############################## # cygwin (64bit) latest @@ -34,7 +40,7 @@ # install packages execute_process( - COMMAND ${SETUP} --quiet-mode --wait --no-admin --root ${CYGWIN_ROOT} --site ${DOWNLOAD_SITE} --local-package-dir ${PACKAGE} --packages bash,tar,make,perl,gcc-core,gcc-g++ + COMMAND ${SETUP} --quiet-mode --wait --no-admin --root ${CYGWIN_ROOT} --site ${DOWNLOAD_SITE} --local-package-dir ${PACKAGE} --packages cmake,bash,tar,make,perl,gcc-core,gcc-g++,icoutils WORKING_DIRECTORY ${CYGWIN_ROOT} ) Modified: trunk/buildtools/svnrev/svnrev.bat =================================================================== --- trunk/buildtools/svnrev/svnrev.bat 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/buildtools/svnrev/svnrev.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -20,8 +20,10 @@ set PERL=perl.exe where %PERL% > nul 2>&1 if %errorlevel% == 0 goto found_perl -set PERL=%~dp0..\buildtools\perl\perl\bin\perl.exe +set PERL=%~dp0..\cygwin64\bin\perl.exe if exist %PERL% goto found_perl +set PERL=%~dp0..\perl\perl\bin\perl.exe +if exist %PERL% goto found_perl set PERL=C:\Strawberry\perl\bin\perl.exe if exist %PERL% goto found_perl set PERL=C:\Perl64\bin\perl.exe Modified: trunk/ci_scripts/build_appveyor.bat =================================================================== --- trunk/ci_scripts/build_appveyor.bat 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/ci_scripts/build_appveyor.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -3,18 +3,6 @@ call ci_scripts\install.bat call buildtools\svnrev\svnrev.bat call buildtools\svnrev\sourcetree_info.bat -if exist c:\cygwin64\setup-x86_64.exe ( - c:\cygwin64\setup-x86_64.exe --quiet-mode --packages cmake - rem c:\cygwin64\setup-x86_64.exe --quiet-mode --packages cygwin32-gcc-g++ --packages cygwin32-gcc-core -) -if exist c:\msys64\usr\bin\pacman.exe ( - c:\msys64\usr\bin\pacman.exe -S --noconfirm --needed cmake -) -if "%GENERATOR%" == "Visual Studio 8 2005" ( - cd buildtools - call getcmake.bat nopause - cd .. -) if "%COMPILER%" == "mingw" ( set PATH=C:\msys64\mingw32\bin;C:\msys64\usr\bin pacman -S --noconfirm --needed mingw-w64-i686-cmake mingw-w64-i686-gcc make @@ -39,24 +27,20 @@ set CMAKE_OPTION_BUILD=-- -s -j set CMAKE_OPTION_GENERATE=%CMAKE_OPTION_GENERATE% -DCMAKE_BUILD_TYPE=Release ) +if exist libs\omit_build_libs_%COMPILER% goto omit_build_libs cd libs -if not exist openssl11_%COMPILER% ( - "%CMAKE_COMMAND%" -DCMAKE_GENERATOR="%GENERATOR%" %CMAKE_OPTION_LIBS% -P buildall.cmake - if exist build rmdir /s /q build - if exist download rmdir /s /q download - if exist openssl_%COMPILER%\html rmdir /s /q openssl_%COMPILER%\html - if exist openssl_%COMPILER%_debug\html rmdir /s /q openssl_%COMPILER%_debug\html - if exist ..\buildtools\perl\c rmdir /s /q ..\buildtools\perl\c - if exist ..\buildtools\download rmdir /s /q ..\buildtools\download -) +"%CMAKE_COMMAND%" -DCMAKE_GENERATOR="%GENERATOR%" %CMAKE_OPTION_LIBS% -P buildall.cmake +rem if exist build rmdir /s /q build +rem if exist download rmdir /s /q download cd .. +:omit_build_libs if not exist %BUILD_DIR% mkdir %BUILD_DIR% cd %BUILD_DIR% if exist build_config.cmake del build_config.cmake if exist cmakecache.txt del cmakecache.txt -set ZIP_FILE=snapshot-%VERSION%-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY%.zip -set SETUP_FILE=snapshot-%VERSION%-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY% -set SNAPSHOT_DIR=snapshot-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY% +set ZIP_FILE=teraterm-%VERSION%-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY%.zip +set SETUP_FILE=teraterm-%VERSION%-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY% +set SNAPSHOT_DIR=teraterm-%VERSION%-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY% "%CMAKE_COMMAND%" .. -G "%GENERATOR%" %CMAKE_OPTION_GENERATE% -DSNAPSHOT_DIR=%SNAPSHOT_DIR% -DSETUP_ZIP=%ZIP_FILE% -DSETUP_EXE=%SETUP_FILE% -DSETUP_RELEASE=%RELEASE% "%CMAKE_COMMAND%" --build . --target install %CMAKE_OPTION_BUILD% "%CMAKE_COMMAND%" --build . --target zip Modified: trunk/ci_scripts/build_appveyor.cmake =================================================================== --- trunk/ci_scripts/build_appveyor.cmake 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/ci_scripts/build_appveyor.cmake 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,5 +1,20 @@ -option(REMOVE_BUILD_DIR "for clean bulid" OFF) +# +# input +# CMAKE_C_COMPILER +# CMAKE_CXX_COMPILER +# CMAKE_RC_COMPILER +# filenames +# GENERATE_OPTIONS +# cmake の generate 時の引数 +# BUILD_TOOL_OPTIONS +# cmake --build の最後に追加される +# BUILD_DIR +# build directry +# COMPILER_FRIENDLY +# インストーラ、zipファイル名の最後に追加される +option(REMOVE_BUILD_DIR "for clean bulid" OFF) + # create build dir message(STATUS "BUILD_DIR=${BUILD_DIR}") if(EXISTS "${BUILD_DIR}") @@ -15,9 +30,9 @@ # svn revision -file(MAKE_DIRECTORY ${BUILD_DIR}/teraterm/ttpdlg) +file(MAKE_DIRECTORY ${BUILD_DIR}/teraterm/common) execute_process( - COMMAND perl ${CMAKE_CURRENT_LIST_DIR}/../buildtools/svnrev/svnrev.pl -v --root "${CMAKE_CURRENT_LIST_DIR}/.." --header ${BUILD_DIR}/teraterm/ttpdlg/svnversion.h --cmake ${BUILD_DIR}/build_config.cmake + COMMAND perl ${CMAKE_CURRENT_LIST_DIR}/../buildtools/svnrev/svnrev.pl -v --root "${CMAKE_CURRENT_LIST_DIR}/.." --header ${BUILD_DIR}/teraterm/common/svnversion.h --cmake ${BUILD_DIR}/build_config.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../buildtools/svnrev ) Deleted: trunk/ci_scripts/build_local_appveyor_vs2005.bat =================================================================== --- trunk/ci_scripts/build_local_appveyor_vs2005.bat 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/ci_scripts/build_local_appveyor_vs2005.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,12 +0,0 @@ -setlocal -set COMPILER=VS_80 -set COMPILER_FRIENDLY=vs2005 -set GENERATOR=Visual Studio 8 2005 -set CMAKE_COMMAND=..\libs\cmake-3.11.4-win32-x86\bin\cmake.exe -set CMAKE_OPTION_LIBS=-DARCHITECTURE=Win32 -set CMAKE_OPTION_GENERATE= -set CMAKE_OPTION_BUILD=--config Release -set BUILD_DIR=build_%COMPILER_FRIENDLY% - -cd /d %~dp0.. -call ci_scripts\build_appveyor.bat Modified: trunk/ci_scripts/build_local_appveyor_vs2019.bat =================================================================== --- trunk/ci_scripts/build_local_appveyor_vs2019.bat 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/ci_scripts/build_local_appveyor_vs2019.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -3,7 +3,7 @@ set COMPILER_FRIENDLY=vs2019 set GENERATOR=Visual Studio 16 2019 set CMAKE_COMMAND=cmake -set CMAKE_OPTION_LIBS=-DARCHITECTURE=Win32 +set CMAKE_OPTION_LIBS=-DARCHITECTURE=32 set CMAKE_OPTION_GENERATE=-A Win32 set CMAKE_OPTION_BUILD=--config Release set BUILD_DIR=build_%COMPILER_FRIENDLY% Modified: trunk/ci_scripts/build_local_appveyor_vs2019_x64.bat =================================================================== --- trunk/ci_scripts/build_local_appveyor_vs2019_x64.bat 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/ci_scripts/build_local_appveyor_vs2019_x64.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -3,7 +3,7 @@ set COMPILER_FRIENDLY=vs2019_x64 set GENERATOR=Visual Studio 16 2019 set CMAKE_COMMAND=cmake -set CMAKE_OPTION_LIBS=-DARCHITECTURE=x64 +set CMAKE_OPTION_LIBS=-DARCHITECTURE=64 set CMAKE_OPTION_GENERATE=-A x64 set CMAKE_OPTION_BUILD=--config Release set BUILD_DIR=build_%COMPILER_FRIENDLY% Copied: trunk/ci_scripts/build_local_appveyor_vs2022.bat (from rev 10722, trunk/ci_scripts/build_local_appveyor_vs2019.bat) =================================================================== --- trunk/ci_scripts/build_local_appveyor_vs2022.bat (rev 0) +++ trunk/ci_scripts/build_local_appveyor_vs2022.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -0,0 +1,15 @@ +setlocal +set PATH= +set COMPILER=VS_143 +set COMPILER_FRIENDLY=vs2022 +set GENERATOR=Visual Studio 17 2022 +set CMAKE_COMMAND=cmake +set CMAKE_OPTION_LIBS=-DARCHITECTURE=32 +set CMAKE_OPTION_GENERATE=-A Win32 +set CMAKE_OPTION_BUILD=--config Release +set BUILD_DIR=build_%COMPILER_FRIENDLY% + +cd /d %~dp0.. +call ci_scripts\find_cmake.bat +call ci_scripts\build_appveyor.bat +pause Copied: trunk/ci_scripts/build_local_appveyor_vs2022_x64.bat (from rev 10722, trunk/ci_scripts/build_local_appveyor_vs2019_x64.bat) =================================================================== --- trunk/ci_scripts/build_local_appveyor_vs2022_x64.bat (rev 0) +++ trunk/ci_scripts/build_local_appveyor_vs2022_x64.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -0,0 +1,15 @@ +setlocal +set PATH= +set COMPILER=VS_143_x64 +set COMPILER_FRIENDLY=vs2022_x64 +set GENERATOR=Visual Studio 17 2022 +set CMAKE_COMMAND=cmake +set CMAKE_OPTION_LIBS=-DARCHITECTURE=64 +set CMAKE_OPTION_GENERATE=-A x64 +set CMAKE_OPTION_BUILD=--config Release +set BUILD_DIR=build_%COMPILER_FRIENDLY% + +cd /d %~dp0.. +call ci_scripts\find_cmake.bat +call ci_scripts\build_appveyor.bat +pause Modified: trunk/ci_scripts/find_cmake.bat =================================================================== --- trunk/ci_scripts/find_cmake.bat 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/ci_scripts/find_cmake.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,14 +1,21 @@ -"%SystemRoot%\system32\where.exe" %CMAKE_COMMAND% 2> nul > nul && exit /b +rem if "%CMAKE_COMMAND%" == "" goto pass_where +rem "%SystemRoot%\system32\where.exe" %CMAKE_COMMAND% 2> nul > nul && exit /b +:pass_where set CMAKE_COMMAND=C:\Program Files\CMake\bin\cmake.exe if exist "%CMAKE_COMMAND%" exit /b +set CMAKE_DIR=C:\Program Files\Microsoft Visual Studio\2022 +call :search_vs +if %errorlevel% == 1 exit /b set CMAKE_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2019 call :search_vs -if %errorlevel% == 0 exit /b +if %errorlevel% == 1 exit /b set CMAKE_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2017 call :search_vs -if %errorlevel% == 0 exit /b +if %errorlevel% == 1 exit /b +set CMAKE_DIR= +set CMAKE_COMMAND= echo Install cmake pause Modified: trunk/ci_scripts/install.bat =================================================================== --- trunk/ci_scripts/install.bat 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/ci_scripts/install.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,6 +1,12 @@ echo %~dp0\install.bat setlocal -if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2013" ( - cd %~dp0 - "%CMAKE_COMMAND%" -P install_cygwin.cmake +if "%CMAKE_COMMAND%" == "" ( + call find_cmake.bat ) + +cd %~dp0 +"%CMAKE_COMMAND%" -P ../buildtools/install_cygwin.cmake + +if exist c:\msys64\usr\bin\pacman.exe ( + c:\msys64\usr\bin\pacman.exe -S --noconfirm --needed cmake +) Deleted: trunk/ci_scripts/install_cygwin.cmake =================================================================== --- trunk/ci_scripts/install_cygwin.cmake 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/ci_scripts/install_cygwin.cmake 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,14 +0,0 @@ - -set(SETUP_URL "https://cygwin.com/setup-x86_64.exe") -set(SETUP_HASH_SHA256 "b9219acd1241ffa4d38e19587f1ccc2854f951e451f3858efc9d2e1fe19d375c") - -file(DOWNLOAD - ${SETUP_URL} - "c:/cygwin64/setup-x86_64.exe" - EXPECTED_HASH SHA256=${SETUP_HASH_SHA256} - SHOW_PROGRESS - ) - -execute_process( - COMMAND c:/cygwin64/setup-x86_64.exe --quiet-mode --upgrade-also - ) Modified: trunk/cygwin/CMakeLists.txt =================================================================== --- trunk/cygwin/CMakeLists.txt 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/cygwin/CMakeLists.txt 2023-05-29 14:29:06 UTC (rev 10723) @@ -8,8 +8,8 @@ cyglib PROPERTIES FOLDER cygwin) -if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") - # linux上ではcygwinが必要なものはビルドできない +if((CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") OR MINGW) + # linux, MinGW上ではcygwinが必要なものはビルドできない return() endif() Modified: trunk/cygwin/cygterm/.gitignore =================================================================== --- trunk/cygwin/cygterm/.gitignore 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/cygwin/cygterm/.gitignore 2023-05-29 14:29:06 UTC (rev 10723) @@ -3,3 +3,5 @@ cygterm.rc cygterm.res *.o +cygterm*/ +msys2term/ Modified: trunk/doc/en/html/reference/build_library_with_cmake.md =================================================================== --- trunk/doc/en/html/reference/build_library_with_cmake.md 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/doc/en/html/reference/build_library_with_cmake.md 2023-05-29 14:29:06 UTC (rev 10723) @@ -10,13 +10,14 @@ ## Visual Studio - cmake - - It is OK if PATH is passed. - - Do not use Cygwin's cmake(Not supporting for Visual Studio). - - Use cmake 3.11.4 when Visual Studio 2005 is used. + - It is OK if PATH is passed. + - Do not use Cygwin's cmake(Not supporting for Visual Studio). + - Use cmake 3.11.4 when Visual Studio 2005 is used. - perl - - It is necessary for compiling OpenSSL, and converting character code of document and code of carriage return. - - ActivePerl 5.8 or later, also cygwin perl. - - It will be searched automatically if PATH is not passed. + - It is necessary for converting character code of document and code of carriage return. + - compiling OpenSSL (Tera Term 5 does not link OpenSSL because it switched to LibreSSL) + - ActivePerl 5.8 or later, also cygwin perl. + - It will be searched automatically if PATH is not passed. ## MinGW common (experimental) @@ -49,17 +50,17 @@ Case of Visual Studio 2022 x86 - cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=Win32 -P buildall.cmake + cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=32 -P buildall.cmake Case of Visual Studio 2022 x64 - cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=x64 -P buildall.cmake` + cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=64 -P buildall.cmake` ## MinGW common Using cmake in each environment. - cmake -DCMAKE_GENERATOR="Unix Makefiles" -P buildall.cmake + cmake -DCMAKE_GENERATOR="Unix Makefiles" -DARCHITECTURE=32 -P buildall.cmake # Regarding each directory Modified: trunk/doc/ja/html/reference/build_library_with_cmake.md =================================================================== --- trunk/doc/ja/html/reference/build_library_with_cmake.md 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/doc/ja/html/reference/build_library_with_cmake.md 2023-05-29 14:29:06 UTC (rev 10723) @@ -10,18 +10,19 @@ ## Visual Studio - cmake - - PATHが通してあればok - - cygwinのcmakeはつかえない(Visual Studioをサポートしていない) - - Visual Studio 2005 を使う場合は cmake 3.11.4 を使用する必要がある + - PATHが通してあればok + - cygwinのcmakeはつかえない(Visual Studioをサポートしていない) + - Visual Studio 2005 を使う場合は cmake 3.11.4 を使用する必要がある - perl - - OpenSSL のコンパイル、ドキュメントファイルの文字コード・改行コード変換に必要 - - ActivePerl 5.8 以上、または cygwin perl - - PATHが通っていなければ自動で探す + - ドキュメントファイルの文字コード・改行コード変換に必要 + - OpenSSL のコンパイル (Tera Term 5は OpenSSL から LibReSSL に切り替えたため使用していない) + - ActivePerl 5.8 以上、または cygwin perl + - PATHが通っていなければ自動で探す ## MinGW 共通 (experimental) - Cygwin,MSYS2,linux(wsl)上のMinGWでビルド可能 -- 各環境で動作するcmake,make,(MinGW)gcc,(clang),perlが必要 +- 各環境で動作するcmake,make,(MinGW)gcc,(clang)が必要 # ビルド手順 @@ -50,17 +51,17 @@ Visual Studio 2022 x86 の場合 - cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=Win32 -P buildall.cmake + cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=32 -P buildall.cmake Visual Studio 2022 x64 の場合 - cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=x64 -P buildall.cmake` + cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=64 -P buildall.cmake` ## MinGW 共通 各々の環境のcmakeを使用する - cmake -DCMAKE_GENERATOR="Unix Makefiles" -P buildall.cmake + cmake -DCMAKE_GENERATOR="Unix Makefiles" -DARCHITECTURE=32 -P buildall.cmake # 各フォルダについて Modified: trunk/libs/VSToolchain.cmake =================================================================== --- trunk/libs/VSToolchain.cmake 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/libs/VSToolchain.cmake 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,4 +1,5 @@ -# write to CMakeCache.txt +# このファイルは zlib と sfmt で コンパイルオプションを変更するために使用 +# write to CMakeCache.txt set(CMAKE_C_FLAGS_DEBUG "/DWIN32 /D_WINDOWS /W3 /MTd /Zi /Ob0 /Od /RTC1" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_DEBUG "/DWIN32 /D_WINDOWS /W3 /MTd /Zi /Ob0 /Od /RTC1" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_RELEASE "/DWIN32 /D_WINDOWS /W3 /MT /O2 /Ob2 /DNDEBUG" CACHE STRING "" FORCE) Modified: trunk/libs/buildall.cmake =================================================================== --- trunk/libs/buildall.cmake 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/libs/buildall.cmake 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,11 +1,9 @@ -# 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 +# cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=32 -P buildall.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=32 -P buildall.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=64 -P buildall.cmake # .\cmake-3.11.4-win32-x86\bin\cmake.exe -DCMAKE_GENERATOR="Visual Studio 8 2005" -P buildall.cmake -# cmake -DCMAKE_GENERATOR="Unix Makefiles" -P buildall.cmake -# cmake -DCMAKE_GENERATOR="Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../mingw.toolchain.cmake -P buildall.cmake +# cmake -DCMAKE_GENERATOR="Unix Makefiles" -DARCHITECTURE=32 -P buildall.cmake +# cmake -DCMAKE_GENERATOR="Unix Makefiles" -DARCHITECTURE=64 -P buildall.cmake # cmake -DCMAKE_GENERATOR="NMake Makefiles" -DBUILD_SSL_LIBRARY=OFF -P buildall.cmake set(BUILD_OPENSSL1 OFF) @@ -15,20 +13,25 @@ message(FATAL_ERROR "set CMAKE_GENERATOR!") endif() -if(NOT "${ARCHITECTURE}" STREQUAL "") - set(ARCHITECTURE_OPTION -DARCHITECTURE=${ARCHITECTURE}) +if((${CMAKE_GENERATOR} MATCHES "Visual Studio 8 2005") OR + (${CMAKE_GENERATOR} MATCHES "Visual Studio 9 2008")) + set(BUILD_SSL_LIBRARY OFF) + set(ARCHITECTURE 32) endif() +if(NOT DEFINED ARCHITECTURE) + message(FATAL_ERROR "check ARCHITECTURE") +endif() + if(NOT DEFINED BUILD_SSL_LIBRARY) - if((${CMAKE_GENERATOR} MATCHES "Visual Studio 8 2005") OR - (${CMAKE_GENERATOR} MATCHES "Visual Studio 9 2008")) - set(BUILD_SSL_LIBRARY OFF) - else() - set(BUILD_SSL_LIBRARY ON) - endif() + set(BUILD_SSL_LIBRARY ON) endif() -message("BUILD_SSL_LIBRARY=${BUILD_SSL_LIBRARY}") +if(${ARCHITECTURE} EQUAL 64) + set(ARCHITECTURE_OPTION -DARCHITECTURE=64) +else() + set(ARCHITECTURE_OPTION -DARCHITECTURE=32) +endif() # install tools include(${CMAKE_CURRENT_LIST_DIR}/../buildtools/checkperl.cmake) Modified: trunk/libs/buildall_cmake.bat =================================================================== --- trunk/libs/buildall_cmake.bat 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/libs/buildall_cmake.bat 2023-05-29 14:29:06 UTC (rev 10723) @@ -2,11 +2,8 @@ setlocal cd /d %~dp0 -if NOT "%CMAKE%" == "" goto pass_set_cmake -rem set CMAKE=cmake.exe -set CMAKE="C:\Program Files\CMake\bin\cmake.exe" -rem set CMAKE="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -rem set CMAKE="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" +if NOT "%CMAKE_COMMAND%" == "" goto pass_set_cmake +call ..\ci_scripts\find_cmake.bat set OPT= :pass_set_cmake @@ -27,10 +24,10 @@ set /p no="select no " echo %no% -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%" == "1" set GENERATOR="Visual Studio 17 2022" & set OPT=-DARCHITECTURE=32 & goto build_all +if "%no%" == "2" set GENERATOR="Visual Studio 17 2022" & set OPT=-DARCHITECTURE=64 & goto build_all +if "%no%" == "3" set GENERATOR="Visual Studio 16 2019" & set OPT=-DARCHITECTURE=32 & goto build_all +if "%no%" == "4" set GENERATOR="Visual Studio 16 2019" & set OPT=-DARCHITECTURE=64 & 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 @@ -44,8 +41,8 @@ goto retry_vs :build_all -if exist %CMAKE% goto build_all_2 -where %CMAKE% 2> nul +if exist "%CMAKE_COMMAND%" goto build_all_2 +where "%CMAKE_COMMAND%" 2> nul if %errorlevel% == 0 goto build_all_2 echo cmake not found pause @@ -52,7 +49,7 @@ exit :build_all_2 -set C=%CMAKE% -DCMAKE_GENERATOR=%GENERATOR% %OPT% -P buildall.cmake +set C="%CMAKE_COMMAND%" -DCMAKE_GENERATOR=%GENERATOR% %OPT% -P buildall.cmake echo %C% title %C% pause @@ -65,22 +62,22 @@ exit :cmake_3_11_4 -set CMAKE=%~dp0..\buildtools\cmake-3.11.4-win32-x86\bin\cmake.exe +set CMAKE_COMMAND=%~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\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%) +if exist %CMAKE_COMMAND% echo \x83C\x83\x93\x83X\x83g\x81[\x83\x8B\x8Dς\xDD(%CMAKE_COMMAND%) set /p no="select no " echo %no% if "%no%" == "2" goto download -set CMAKE="cmake.exe" -where %CMAKE% +set CMAKE_COMMAND="cmake.exe" +where %CMAKE_COMMAND% goto finish_cmake :download -if exist %CMAKE% goto finish_cmake +if exist %CMAKE_COMMAND% goto finish_cmake call ..\buildtools\getcmake.bat :finish_cmake Modified: trunk/libs/buildlibressl.cmake =================================================================== --- trunk/libs/buildlibressl.cmake 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/libs/buildlibressl.cmake 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,7 +1,8 @@ # for libreSSL -# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P buildlibressl.cmake -# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P buildlibressl.cmake -# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DCMAKE_CONFIGURATION_TYPE=Release -P buildlibressl.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=64 -P buildlibressl.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=32 -P buildlibressl.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DARCHITECTURE=32 -P buildlibressl.cmake +# cmake -DCMAKE_GENERATOR="Unix Makefiles" -DARCHITECTURE=64 -P buildlibressl.cmake include(script_support.cmake) @@ -9,14 +10,11 @@ set(SRC_DIR "${EXTRACT_DIR}/libressl") set(BUILD_DIR "${CMAKE_CURRENT_LIST_DIR}/build/libressl/build_${TOOLSET}") set(INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/libressl_${TOOLSET}") -if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("${CMAKE_COMMAND}" MATCHES "mingw64")) +if(${ARCHITECTURE} EQUAL 64) set(INSTALL_DIR "${INSTALL_DIR}_x64") set(BUILD_DIR "${BUILD_DIR}_x64") endif() -#message("BUILD_DIR=${BUILD_DIR}") -#message("INSTALL_DIR=${INSTALL_DIR}") - ######################################## # Configure + Generate @@ -66,53 +64,56 @@ file(MAKE_DIRECTORY "${BUILD_DIR}") -if(("${CMAKE_BUILD_TYPE}" STREQUAL "") AND ("${CMAKE_CONFIGURATION_TYPE}" STREQUAL "")) - if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - # multi-configuration +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + # multi-configuration + unset(GENERATE_OPTIONS) + if(${ARCHITECTURE} EQUAL 64) + list(APPEND GENERATE_OPTIONS "-A" "x64") + else() + list(APPEND GENERATE_OPTIONS "-A" "Win32") + endif() + list(APPEND GENERATE_OPTIONS "-DCMAKE_DEBUG_POSTFIX=d") + list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") + list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") + list(APPEND GENERATE_OPTIONS "-DLIBRESSL_TESTS=off") + list(APPEND GENERATE_OPTIONS "-DMSVC=on") + list(APPEND GENERATE_OPTIONS "-DUSE_STATIC_MSVC_RUNTIMES=on") - unset(GENERATE_OPTIONS) - list(APPEND GENERATE_OPTIONS -A ${ARCHITECTURE}) - list(APPEND GENERATE_OPTIONS "-DCMAKE_DEBUG_POSTFIX=d") - list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") - list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") - list(APPEND GENERATE_OPTIONS "-DLIBRESSL_TESTS=off") - if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - list(APPEND GENERATE_OPTIONS "-DMSVC=on") - list(APPEND GENERATE_OPTIONS "-DUSE_STATIC_MSVC_RUNTIMES=on") - endif() + cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") - cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") + unset(BUILD_OPTIONS) + list(APPEND BUILD_OPTIONS --config Debug) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") - unset(BUILD_OPTIONS) - list(APPEND BUILD_OPTIONS --config Debug) - cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") - - unset(BUILD_OPTIONS) - list(APPEND BUILD_OPTIONS --config Release) - cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") - - return() + unset(BUILD_OPTIONS) + list(APPEND BUILD_OPTIONS --config Release) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") +else() + # single-configuration + unset(GENERATE_OPTIONS) + if(${ARCHITECTURE} EQUAL 64) + list(APPEND GENERATE_OPTIONS "-DUSE_GCC_64=ON") else() - # single-configuration - unset(GENERATE_OPTIONS) - if(CMAKE_HOST_UNIX) - list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/../mingw.toolchain.cmake") - endif(CMAKE_HOST_UNIX) - list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") - list(APPEND GENERATE_OPTIONS "-DCMAKE_BUILD_TYPE=Release") - if(("${CMAKE_GENERATOR}" MATCHES "Visual Studio") OR ("${CMAKE_GENERATOR}" MATCHES "NMake Makefiles")) - list(APPEND GENERATE_OPTIONS "-DMSVC=on") - list(APPEND GENERATE_OPTIONS "-DUSE_STATIC_MSVC_RUNTIMES=on") - endif() + list(APPEND GENERATE_OPTIONS "-DUSE_GCC_32=ON") + endif() + if(CMAKE_HOST_UNIX) + list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/../mingw.toolchain.cmake") + endif(CMAKE_HOST_UNIX) + if(("${CMAKE_GENERATOR}" MATCHES "Visual Studio") OR ("${CMAKE_GENERATOR}" MATCHES "NMake Makefiles")) + list(APPEND GENERATE_OPTIONS "-DMSVC=on") + list(APPEND GENERATE_OPTIONS "-DUSE_STATIC_MSVC_RUNTIMES=on") + endif() + list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") + list(APPEND GENERATE_OPTIONS "-DCMAKE_BUILD_TYPE=Release") + list(APPEND GENERATE_OPTIONS "-DLIBRESSL_TESTS=off") - cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") + cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") - if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles") - list(APPEND BUILD_TOOL_OPTIONS "-j") - endif() + if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles") + list(APPEND BUILD_TOOL_OPTIONS "-j") + endif() - unset(BUILD_OPTIONS) - cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "${BUILD_TOOL_OPTIONS}") + unset(BUILD_OPTIONS) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "${BUILD_TOOL_OPTIONS}") - endif() endif() Modified: trunk/libs/buildoniguruma.cmake =================================================================== --- trunk/libs/buildoniguruma.cmake 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/libs/buildoniguruma.cmake 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,8 +1,7 @@ # for oniguruma -# cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=x64 -P buildoniguruma.cmake -# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P buildoniguruma.cmake -# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P buildoniguruma.cmake -# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DCMAKE_CONFIGURATION_TYPE=Release -P buildoniguruma.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=64 -P buildoniguruma.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=32 -P buildoniguruma.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DARCHITECTURE=32 -P buildoniguruma.cmake # cmake -DCMAKE_GENERATOR="Visual Studio 8 2005" -P buildoniguruma.cmake include(script_support.cmake) @@ -11,7 +10,7 @@ set(SRC_DIR "${EXTRACT_DIR}/oniguruma") set(INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/oniguruma_${TOOLSET}") set(BUILD_DIR "${CMAKE_CURRENT_LIST_DIR}/build/oniguruma/build_${TOOLSET}") -if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("${CMAKE_COMMAND}" MATCHES "mingw64")) +if(${ARCHITECTURE} EQUAL 64) set(INSTALL_DIR "${INSTALL_DIR}_x64") set(BUILD_DIR "${BUILD_DIR}_x64") endif() @@ -77,56 +76,53 @@ file(MAKE_DIRECTORY "${BUILD_DIR}") -if(("${CMAKE_BUILD_TYPE}" STREQUAL "") AND ("${CMAKE_CONFIGURATION_TYPE}" STREQUAL "")) - if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - # multi-configuration +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + # multi-configuration + unset(GENERATE_OPTIONS) + if(${ARCHITECTURE} EQUAL 64) + list(APPEND GENERATE_OPTIONS "-A" "x64") + else() + list(APPEND GENERATE_OPTIONS "-A" "Win32") + endif() + list(APPEND GENERATE_OPTIONS "-DCMAKE_DEBUG_POSTFIX=d") + list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") + list(APPEND GENERATE_OPTIONS "-DBUILD_SHARED_LIBS=OFF") + list(APPEND GENERATE_OPTIONS "-DMSVC_STATIC_RUNTIME=ON") - unset(GENERATE_OPTIONS) - if(DEFINED ARCHITECTURE) - list(APPEND GENERATE_OPTIONS -A ${ARCHITECTURE}) - endif() - list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") - list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") - list(APPEND GENERATE_OPTIONS "-DCMAKE_DEBUG_POSTFIX=d") - list(APPEND GENERATE_OPTIONS "-DBUILD_SHARED_LIBS=OFF") - if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - list(APPEND GENERATE_OPTIONS "-DMSVC=on") - list(APPEND GENERATE_OPTIONS "-DMSVC_STATIC_RUNTIME=ON") - endif() + cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") - cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") + unset(BUILD_OPTIONS) + list(APPEND BUILD_OPTIONS --config Debug) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") - unset(BUILD_OPTIONS) - list(APPEND BUILD_OPTIONS "--config;Debug") - cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") - - unset(BUILD_OPTIONS) - list(APPEND BUILD_OPTIONS "--config;Release") - cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") - - return() + unset(BUILD_OPTIONS) + list(APPEND BUILD_OPTIONS --config Release) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") +else() + # single-configuration + unset(GENERATE_OPTIONS) + if(${ARCHITECTURE} EQUAL 64) + list(APPEND GENERATE_OPTIONS "-DUSE_GCC_64=ON") else() - # single-configuration - unset(GENERATE_OPTIONS) - if(CMAKE_HOST_UNIX) - list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/../mingw.toolchain.cmake") - endif(CMAKE_HOST_UNIX) - list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") - list(APPEND GENERATE_OPTIONS "-DCMAKE_BUILD_TYPE=Release") - list(APPEND GENERATE_OPTIONS "-DBUILD_SHARED_LIBS=OFF") - if(("${CMAKE_GENERATOR}" MATCHES "Visual Studio") OR ("${CMAKE_GENERATOR}" MATCHES "NMake Makefiles")) - list(APPEND GENERATE_OPTIONS "-DMSVC=on") - list(APPEND GENERATE_OPTIONS "-DMSVC_STATIC_RUNTIME=ON") - endif() + list(APPEND GENERATE_OPTIONS "-DUSE_GCC_32=ON") + endif() + if(CMAKE_HOST_UNIX) + list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/../mingw.toolchain.cmake") + endif(CMAKE_HOST_UNIX) + if(("${CMAKE_GENERATOR}" MATCHES "Visual Studio") OR ("${CMAKE_GENERATOR}" MATCHES "NMake Makefiles")) + list(APPEND GENERATE_OPTIONS "-DMSVC_STATIC_RUNTIME=ON") + endif() + list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") + list(APPEND GENERATE_OPTIONS "-DCMAKE_BUILD_TYPE=Release") + list(APPEND GENERATE_OPTIONS "-DBUILD_SHARED_LIBS=OFF") - cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") + cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") - if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles") - list(APPEND BUILD_TOOL_OPTIONS "-j") - endif() + if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles") + list(APPEND BUILD_TOOL_OPTIONS "-j") + endif() - unset(BUILD_OPTIONS) - cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "${BUILD_TOOL_OPTIONS}") + unset(BUILD_OPTIONS) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "${BUILD_TOOL_OPTIONS}") - endif() endif() Modified: trunk/libs/buildsfmt.cmake =================================================================== --- trunk/libs/buildsfmt.cmake 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/libs/buildsfmt.cmake 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,73 +1,50 @@ -# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P buildsfmt.cmake -# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=x64 -P buildsfmt.cmake -# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P buildsfmt.cmake -# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DCMAKE_CONFIGURATION_TYPE=Release -P buildsfmt.cmake +# for SFMT +# cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=64 -P buildsfmt.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=32 -P buildsfmt.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DARCHITECTURE=32 -P buildsfmt.cmake +# cmake -DCMAKE_GENERATOR="Unix Makefiles" -DARCHITECTURE=64 -P buildsfmt.cmake -#### -if(("${CMAKE_BUILD_TYPE}" STREQUAL "") AND ("${CMAKE_CONFIGURATION_TYPE}" STREQUAL "")) - if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - # multi-configuration - execute_process( - COMMAND ${CMAKE_COMMAND} - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_CONFIGURATION_TYPE=Release - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake - -DARCHITECTURE=${ARCHITECTURE} - -P buildsfmt.cmake - ) - execute_process( - COMMAND ${CMAKE_COMMAND} - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_CONFIGURATION_TYPE=Debug - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake - -DARCHITECTURE=${ARCHITECTURE} - -P buildsfmt.cmake - ) - return() - elseif(("$ENV{MSYSTEM}" MATCHES "MINGW") OR ("${CMAKE_COMMAND}" MATCHES "mingw")) - # mingw on msys2 - if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Release) - endif() - elseif("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") - # mingw - # single-configuration - if("${CMAKE_TOOLCHAIN_FILE}" STREQUAL "") - set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/../mingw.toolchain.cmake") - endif() - if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Release) - endif() - elseif("${CMAKE_GENERATOR}" MATCHES "NMake Makefiles") - # VS nmake - # single-configuration - if("${CMAKE_TOOLCHAIN_FILE}" STREQUAL "") - set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/VSToolchain.cmake") - endif() - if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Release) - endif() - else() - # single-configuration - if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Release) - endif() - endif() -endif() - include(script_support.cmake) set(EXTRACT_DIR "${CMAKE_CURRENT_LIST_DIR}/build/SFMT/src") set(SRC_DIR "${EXTRACT_DIR}/SFMT") +set(INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/SFMT_${TOOLSET}") set(BUILD_DIR "${CMAKE_CURRENT_LIST_DIR}/build/SFMT/build_${TOOLSET}") -set(INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/SFMT_${TOOLSET}") -if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32") OR ("${CMAKE_COMMAND}" MATCHES "mingw64")) +if(${ARCHITECTURE} EQUAL 64) + set(INSTALL_DIR "${INSTALL_DIR}_x64") set(BUILD_DIR "${BUILD_DIR}_x64") - set(INSTALL_DIR "${INSTALL_DIR}_x64") endif() ######################################## +# Configure + Generate +function(cmake_generate GENERATOR SRC_DIR WORKING_DIR OPTIONS) + execute_process( + COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G "${GENERATOR}" ${OPTIONS} + WORKING_DIRECTORY "${BUILD_DIR}" + ENCODING AUTO + RESULT_VARIABLE rv + ) + if(NOT rv STREQUAL "0") + message(FATAL_ERROR "cmake build fail ${rv}") + endif() +endfunction() + +# build + install +function(cmake_build WORKING_DIR OPTIONS BUILD_TOOL_OPTIONS) + execute_process( + COMMAND ${CMAKE_COMMAND} --build . ${OPTIONS} --target install -- ${BUILD_TOOL_OPTIONS} + WORKING_DIRECTORY "${BUILD_DIR}" + ENCODING AUTO + RESULT_VARIABLE rv + ) + if(NOT rv STREQUAL "0") + message(FATAL_ERROR "cmake build fail ${rv}") + endif() +endfunction() + +######################################## + file(MAKE_DIRECTORY ${SRC_DIR}) execute_process( @@ -74,7 +51,7 @@ COMMAND ${CMAKE_COMMAND} -DTARGET=sfmt -DEXT_DIR=${EXTRACT_DIR} -P download.cmake ) -if(${SRC_DIR}/COPYING IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/LibreSSL-LICENSE.txt) +if(${SRC_DIR}/COPYING IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/SFMT-LICENSE.txt) file(COPY ${SRC_DIR}/LICENSE.txt DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help) @@ -117,55 +94,49 @@ file(MAKE_DIRECTORY "${BUILD_DIR}") if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + # multi-configuration + unset(GENERATE_OPTIONS) + if(${ARCHITECTURE} EQUAL 64) + list(APPEND GENERATE_OPTIONS "-A" "x64") + else() + list(APPEND GENERATE_OPTIONS "-A" "Win32") + endif() + list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") + list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/VSToolchain.cmake") - ######################################## multi configuration + cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") - if(NOT "${ARCHITECTURE}" STREQUAL "") - set(CMAKE_A_OPTION -A ${ARCHITECTURE}) + unset(BUILD_OPTIONS) + list(APPEND BUILD_OPTIONS --config Debug) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") + + unset(BUILD_OPTIONS) + list(APPEND BUILD_OPTIONS --config Release) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") +else() + # single-configuration + unset(GENERATE_OPTIONS) + if(${ARCHITECTURE} EQUAL 64) + list(APPEND GENERATE_OPTIONS "-DUSE_GCC_64=ON") + else() + list(APPEND GENERATE_OPTIONS "-DUSE_GCC_32=ON") endif() - execute_process( - COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G ${CMAKE_GENERATOR} ${CMAKE_A_OPTION} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} - ${TOOLCHAINFILE} - WORKING_DIRECTORY ${BUILD_DIR} - RESULT_VARIABLE rv - ) - if(NOT rv STREQUAL "0") - message(FATAL_ERROR "cmake generate fail ${rv}") + if(CMAKE_HOST_UNIX) + list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/../mingw.toolchain.cmake") + endif(CMAKE_HOST_UNIX) + if(("${CMAKE_GENERATOR}" MATCHES "Visual Studio") OR ("${CMAKE_GENERATOR}" MATCHES "NMake Makefiles")) + list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/VSToolchain.cmake") endif() + list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") + list(APPEND GENERATE_OPTIONS "-DCMAKE_BUILD_TYPE=Release") - execute_process( - COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_CONFIGURATION_TYPE} --target install - WORKING_DIRECTORY ${BUILD_DIR} - RESULT_VARIABLE rv - ) - if(NOT rv STREQUAL "0") - message(FATAL_ERROR "cmake install fail ${rv}") - endif() + cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") -else() - ######################################## single configuration - - execute_process( - COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G ${CMAKE_GENERATOR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} - WORKING_DIRECTORY ${BUILD_DIR} - RESULT_VARIABLE rv - ) - if(NOT rv STREQUAL "0") - message(FATAL_ERROR "cmake build fail ${rv}") + if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles") + list(APPEND BUILD_TOOL_OPTIONS "-j") endif() - execute_process( - COMMAND ${CMAKE_COMMAND} --build . --target install - WORKING_DIRECTORY ${BUILD_DIR} - RESULT_VARIABLE rv - ) - if(NOT rv STREQUAL "0") - message(FATAL_ERROR "cmake install fail ${rv}") - endif() + unset(BUILD_OPTIONS) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "${BUILD_TOOL_OPTIONS}") endif() Modified: trunk/libs/buildzlib.cmake =================================================================== --- trunk/libs/buildzlib.cmake 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/libs/buildzlib.cmake 2023-05-29 14:29:06 UTC (rev 10723) @@ -1,59 +1,9 @@ -# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P buildzlib.cmake -# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P buildzlib.cmake -# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DCMAKE_CONFIGURATION_TYPE=Release -P buildzlib.cmake +# for zlib +# cmake -DCMAKE_GENERATOR="Visual Studio 17 2022" -DARCHITECTURE=64 -P buildzlib.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=32 -P buildzlib.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DARCHITECTURE=32 -P buildzlib.cmake +# cmake -DCMAKE_GENERATOR="Unix Makefiles" -DARCHITECTURE=64 -P buildzlib.cmake -#### -if(("${CMAKE_BUILD_TYPE}" STREQUAL "") AND ("${CMAKE_CONFIGURATION_TYPE}" STREQUAL "")) - if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - # multi-configuration - execute_process( - COMMAND ${CMAKE_COMMAND} - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_CONFIGURATION_TYPE=Release - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake - -DARCHITECTURE=${ARCHITECTURE} - -P buildzlib.cmake - ) - execute_process( - COMMAND ${CMAKE_COMMAND} - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_CONFIGURATION_TYPE=Debug - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake - -DARCHITECTURE=${ARCHITECTURE} - -P buildzlib.cmake - ) - return() - elseif(("$ENV{MSYSTEM}" MATCHES "MINGW") OR ("${CMAKE_COMMAND}" MATCHES "mingw")) - # mingw on msys2 - if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Release) - endif() - elseif("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") - # mingw - # single-configuration - if("${CMAKE_TOOLCHAIN_FILE}" STREQUAL "") - set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/../mingw.toolchain.cmake") - endif() - if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Release) - endif() - elseif("${CMAKE_GENERATOR}" MATCHES "NMake Makefiles") - # VS nmake - # single-configuration - if("${CMAKE_TOOLCHAIN_FILE}" STREQUAL "") - set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/VSToolchain.cmake") - endif() - if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Release) - endif() - else() - # single-configuration - if("${CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE Release) - endif() - endif() -endif() - include(script_support.cmake) set(EXTRACT_DIR "${CMAKE_CURRENT_LIST_DIR}/build/zlib/src") @@ -60,13 +10,41 @@ set(SRC_DIR "${EXTRACT_DIR}/zlib") set(BUILD_DIR "${CMAKE_CURRENT_LIST_DIR}/build/zlib/build_${TOOLSET}") set(INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/zlib_${TOOLSET}") -if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32") OR ("${CMAKE_COMMAND}" MATCHES "mingw64")) +if(${ARCHITECTURE} EQUAL 64) + set(INSTALL_DIR "${INSTALL_DIR}_x64") set(BUILD_DIR "${BUILD_DIR}_x64") - set(INSTALL_DIR "${INSTALL_DIR}_x64") endif() ######################################## +# Configure + Generate +function(cmake_generate GENERATOR SRC_DIR WORKING_DIR OPTIONS) + execute_process( + COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G "${GENERATOR}" ${OPTIONS} + WORKING_DIRECTORY "${BUILD_DIR}" + ENCODING AUTO + RESULT_VARIABLE rv + ) + if(NOT rv STREQUAL "0") + message(FATAL_ERROR "cmake build fail ${rv}") + endif() +endfunction() + +# build + install +function(cmake_build WORKING_DIR OPTIONS BUILD_TOOL_OPTIONS) + execute_process( + COMMAND ${CMAKE_COMMAND} --build . ${OPTIONS} --target install -- ${BUILD_TOOL_OPTIONS} + WORKING_DIRECTORY "${BUILD_DIR}" + ENCODING AUTO + RESULT_VARIABLE rv + ) + if(NOT rv STREQUAL "0") + message(FATAL_ERROR "cmake build fail ${rv}") + endif() +endfunction() + +######################################## + file(MAKE_DIRECTORY ${SRC_DIR}) execute_process( @@ -73,13 +51,13 @@ COMMAND ${CMAKE_COMMAND} -DTARGET=zlib -DEXT_DIR=${EXTRACT_DIR} -P download.cmake ) -if(${SRC_DIR}/README IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/zlib-LICENSE.txt) +if(${SRC_DIR}/COPYING IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/Zlib-LICENSE.txt) file(COPY ${SRC_DIR}/README DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help) file(RENAME ${CMAKE_CURRENT_LIST_DIR}/doc_help/README - ${CMAKE_CURRENT_LIST_DIR}/doc_help/zlib-LICENSE.txt) + ${CMAKE_CURRENT_LIST_DIR}/doc_help/Zlib-LICENSE.txt) endif() ######################################## @@ -87,55 +65,48 @@ file(MAKE_DIRECTORY "${BUILD_DIR}") if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + # multi-configuration + unset(GENERATE_OPTIONS) + if(${ARCHITECTURE} EQUAL 64) + list(APPEND GENERATE_OPTIONS "-A" "x64") + else() + list(APPEND GENERATE_OPTIONS "-A" "Win32") + endif() + list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") + list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/VSToolchain.cmake") + cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") - ######################################## multi configuration + unset(BUILD_OPTIONS) + list(APPEND BUILD_OPTIONS --config Debug) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") - if(NOT "${ARCHITECTURE}" STREQUAL "") - set(CMAKE_A_OPTION -A ${ARCHITECTURE}) + unset(BUILD_OPTIONS) + list(APPEND BUILD_OPTIONS --config Release) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "") +else() + # single-configuration + unset(GENERATE_OPTIONS) + if(${ARCHITECTURE} EQUAL 64) + list(APPEND GENERATE_OPTIONS "-DUSE_GCC_64=ON") + else() + list(APPEND GENERATE_OPTIONS "-DUSE_GCC_32=ON") endif() - execute_process( - COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G ${CMAKE_GENERATOR} ${CMAKE_A_OPTION} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} - ${TOOLCHAINFILE} - WORKING_DIRECTORY ${BUILD_DIR} - RESULT_VARIABLE rv - ) - if(NOT rv STREQUAL "0") - message(FATAL_ERROR "cmake generate fail ${rv}") + if(CMAKE_HOST_UNIX) + list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/../mingw.toolchain.cmake") + endif(CMAKE_HOST_UNIX) + if(("${CMAKE_GENERATOR}" MATCHES "Visual Studio") OR ("${CMAKE_GENERATOR}" MATCHES "NMake Makefiles")) + list(APPEND GENERATE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/VSToolchain.cmake") endif() + list(APPEND GENERATE_OPTIONS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") + list(APPEND GENERATE_OPTIONS "-DCMAKE_BUILD_TYPE=Release") - execute_process( - COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_CONFIGURATION_TYPE} --target install - WORKING_DIRECTORY ${BUILD_DIR} - RESULT_VARIABLE rv - ) - if(NOT rv STREQUAL "0") - message(FATAL_ERROR "cmake install fail ${rv}") - endif() + cmake_generate("${CMAKE_GENERATOR}" "${SRC_DIR}" "${BUILD_DIR}" "${GENERATE_OPTIONS}") -else() - ######################################## single configuration - - execute_process( - COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G ${CMAKE_GENERATOR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} - WORKING_DIRECTORY ${BUILD_DIR} - RESULT_VARIABLE rv - ) - if(NOT rv STREQUAL "0") - message(FATAL_ERROR "cmake build fail ${rv}") + if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles") + list(APPEND BUILD_TOOL_OPTIONS "-j") endif() - execute_process( - COMMAND ${CMAKE_COMMAND} --build . --target install - WORKING_DIRECTORY ${BUILD_DIR} - RESULT_VARIABLE rv - ) - if(NOT rv STREQUAL "0") - message(FATAL_ERROR "cmake install fail ${rv}") - endif() + unset(BUILD_OPTIONS) + cmake_build("${BUILD_DIR}" "${BUILD_OPTIONS}" "${BUILD_TOOL_OPTIONS}") endif() Modified: trunk/mingw.toolchain.cmake =================================================================== --- trunk/mingw.toolchain.cmake 2023-05-29 14:28:54 UTC (rev 10722) +++ trunk/mingw.toolchain.cmake 2023-05-29 14:29:06 UTC (rev 10723) @@ -7,24 +7,44 @@ set(CMAKE_SYSTEM_NAME Windows) # option -option(USE_CLANG "use clang compiler" OFF) +option(USE_GCC_32 "use gcc 32bit compiler" OFF) +option(USE_GCC_64 "use gcc 64bit compiler" OFF) +option(USE_CLANG_32 "use clang 32bit compiler" OFF) +option(USE_CLANG_64 "use clang 64bit compiler" OFF) -# mingw on msys -#set(CMAKE_SYSROOT /mingw32/i686-w64-mingw32) -#set(CMAKE_FIND_ROOT_PATH /mingw32/i686-w64-mingw32) +if((NOT USE_GCC_32) AND (NOT USE_GCC_64) AND + (NOT USE_CLANG_32) AND (NOT USE_CLANG_64)) + # default compiler + set(USE_GCC_32 ON) +endif() -# mingw -set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) -#set(CMAKE_SYSROOT /usr/i686-w64-mingw32) +if(USE_GCC_32 OR USE_CLANG_32) + set(PREFIX "i686-w64-mingw32-") + set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) +endif() +if(USE_GCC_64 OR USE_CLANG_64) + set(PREFIX "x86_64-w64-mingw32-") + set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) +endif() -if(USE_CLANG) - set(CMAKE_C_COMPILER i686-w64-mingw32-clang) - set(CMAKE_CXX_COMPILER i686-w64-mingw32-clang++) +set(THREAD_MODEL "-win32") +#set(THREAD_MODEL "-posix") +if(${CMAKE_COMMAND} MATCHES "msys2") + # msys2にはposix版のみ + unset(THREAD_MODEL) +endif() + +if(USE_GCC_32 OR USE_GCC_64) + set(CMAKE_C_COMPILER ${PREFIX}gcc${THREAD_MODEL}) + set(CMAKE_CXX_COMPILER ${PREFIX}g++${THREAD_MODEL}) + set(CMAKE_RC_COMPILER ${PREFIX}windres) +elseif(USE_CLANG_32 OR USE_CLANG_64) + set(CMAKE_C_COMPILER ${PREFIX}clang${THREAD_MODEL}) + set(CMAKE_CXX_COMPILER ${PREFIX}clang++${THREAD_MODEL}) + set(CMAKE_RC_COMPILER ${PREFIX}windres) else() - set(CMAKE_C_COMPILER i686-w64-mingw32-gcc) - set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) + message(FATAL_ERROR "check compiler") endif() -set(CMAKE_RC_COMPILER i686-w64-mingw32-windres) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) @@ -32,4 +52,3 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE} CACHE PATH "toolchain file") -