Revision: 7564 https://osdn.net/projects/ttssh2/scm/svn/commits/7564 Author: zmatsuo Date: 2019-04-10 01:23:23 +0900 (Wed, 10 Apr 2019) Log Message: ----------- libs/ フォルダで cmakeを使って Visual Studio 2019でライブラリが生成できるようにした Modified Paths: -------------- trunk/libs/SFMT.cmake trunk/libs/buildall.cmake trunk/libs/buildall_cmake.bat trunk/libs/oniguruma.cmake trunk/libs/openssl.cmake trunk/libs/script_support.cmake trunk/libs/zlib.cmake trunk/version_info.h.in -------------- next part -------------- Modified: trunk/libs/SFMT.cmake =================================================================== --- trunk/libs/SFMT.cmake 2019-04-09 16:23:03 UTC (rev 7563) +++ trunk/libs/SFMT.cmake 2019-04-09 16:23:23 UTC (rev 7564) @@ -10,6 +10,7 @@ -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_CONFIGURATION_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake + -DARCHITECTURE=${ARCHITECTURE} -P SFMT.cmake ) execute_process( @@ -17,6 +18,7 @@ -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_CONFIGURATION_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake + -DARCHITECTURE=${ARCHITECTURE} -P SFMT.cmake ) return() @@ -63,7 +65,7 @@ set(SRC_DIR "${CMAKE_SOURCE_DIR}/build/SFMT/src/${SRC_DIR_BASE}") set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build/SFMT/build_${TOOLSET}") set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/SFMT_${TOOLSET}") -if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32")) +if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32")) set(BUILD_DIR "${BUILD_DIR}_x64") set(INSTALL_DIR "${INSTALL_DIR}_x64") endif() @@ -123,8 +125,11 @@ ######################################## multi configuration + if(NOT "${ARCHITECTURE}" STREQUAL "") + set(CMAKE_A_OPTION -A ${ARCHITECTURE}) + endif() execute_process( - COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G ${CMAKE_GENERATOR} + COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G ${CMAKE_GENERATOR} ${CMAKE_A_OPTION} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} ${TOOLCHAINFILE} Modified: trunk/libs/buildall.cmake =================================================================== --- trunk/libs/buildall.cmake 2019-04-09 16:23:03 UTC (rev 7563) +++ trunk/libs/buildall.cmake 2019-04-09 16:23:23 UTC (rev 7564) @@ -1,4 +1,5 @@ -# cmake -DCMAKE_GENERATOR="Vsual Studio 15 2017" -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="Unix Makefiles" -P buildall.cmake -DCMAKE_TOOLCHAIN_FILE=../mingw.toolchain.cmake if("${CMAKE_GENERATOR}" STREQUAL "") @@ -5,19 +6,28 @@ message(FATAL_ERROR "set CMAKE_GENERATOR!") endif() +if(NOT "${ARCHITECTURE}" STREQUAL "") + set(ARCHITECTURE_OPTION -DARCHITECTURE=${ARCHITECTURE}) +endif() + # build +message("oniguruma") execute_process( - COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -P oniguruma.cmake + COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} ${ARCHITECTURE_OPTION} -P oniguruma.cmake ) +message("zlib") execute_process( - COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -P zlib.cmake + COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} ${ARCHITECTURE_OPTION} -P zlib.cmake ) +message("putty") execute_process( COMMAND ${CMAKE_COMMAND} -P putty.cmake ) +message("SFMT") execute_process( - COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -P SFMT.cmake + COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} ${ARCHITECTURE_OPTION} -P SFMT.cmake ) +message("openssl") execute_process( - COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -P openssl.cmake + COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} ${ARCHITECTURE_OPTION} -P openssl.cmake ) Modified: trunk/libs/buildall_cmake.bat =================================================================== --- trunk/libs/buildall_cmake.bat 2019-04-09 16:23:03 UTC (rev 7563) +++ trunk/libs/buildall_cmake.bat 2019-04-09 16:23:23 UTC (rev 7564) @@ -2,29 +2,32 @@ setlocal cd /d %~dp0 -set CMAKE="cmake.exe2" -set opt= +set CMAKE="C:\Program Files\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" +set OPT= :retry_vs -echo 1. Visual Studio 15 2017 -echo 2. Visual Studio 14 2015 -echo 3. Visual Studio 12 2013 -echo 4. Visual Studio 11 2012 -echo 5. Visual Studio 10 2010 -echo 6. Visual Studio 9 2008 -echo 7. Visual Studio 8 2005 +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) set /p no="select no " echo %no% -if "%no%" == "1" set GENERATOR="Visual Studio 15 2017" & goto build_all -if "%no%" == "2" set GENERATOR="Visual Studio 14 2015" & goto build_all -if "%no%" == "3" set GENERATOR="Visual Studio 12 2013" & goto build_all -if "%no%" == "4" set GENERATOR="Visual Studio 11 2012" & goto build_all -if "%no%" == "5" set GENERATOR="Visual Studio 10 2010" & goto build_all -if "%no%" == "6" set GENERATOR="Visual Studio 9 2008" & goto build_all -if "%no%" == "7" set GENERATOR="Visual Studio 8 2005" & call :cmake_3_11_4 & goto build_all_2 +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 echo ? retry @@ -31,11 +34,10 @@ goto retry_vs :build_all -where %CMAKE% +if exist %CMAKE% goto build_all_2 +where %CMAKE% 2> nul if %errorlevel% == 0 goto build_all_2 -set CMAKE="C:\Program Files\CMake\bin\cmake.exe" -if exist %CMAKE% echo %CMAKE% \x82\xF0\x8Eg\x97p & goto build_all_2 -echo cmake\x82\xAA\x8C\xA9\x82\xA9\x82\xE8\x82܂\xB9\x82\xF1 +echo cmake not found pause exit Modified: trunk/libs/oniguruma.cmake =================================================================== --- trunk/libs/oniguruma.cmake 2019-04-09 16:23:03 UTC (rev 7563) +++ trunk/libs/oniguruma.cmake 2019-04-09 16:23:23 UTC (rev 7564) @@ -1,5 +1,7 @@ # cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P oniguruma.cmake # cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DCMAKE_CONFIGURATION_TYPE=Release -P oniguruma.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -DCMAKE_CONFIGURATION_TYPE=Release -P oniguruma.cmake +# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=x64 -DCMAKE_CONFIGURATION_TYPE=Release -P oniguruma.cmake #### if(("${CMAKE_BUILD_TYPE}" STREQUAL "") AND ("${CMAKE_CONFIGURATION_TYPE}" STREQUAL "")) @@ -10,6 +12,7 @@ -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_CONFIGURATION_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake + -DARCHITECTURE=${ARCHITECTURE} -P oniguruma.cmake ) execute_process( @@ -17,6 +20,7 @@ -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_CONFIGURATION_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake + -DARCHITECTURE=${ARCHITECTURE} -P oniguruma.cmake ) return() @@ -63,7 +67,7 @@ set(SRC_DIR "${CMAKE_SOURCE_DIR}/build/oniguruma/src/${SRC_DIR_BASE}") set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build/oniguruma/build_${TOOLSET}") set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/oniguruma_${TOOLSET}") -if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32")) +if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32")) set(BUILD_DIR "${BUILD_DIR}_x64") set(INSTALL_DIR "${INSTALL_DIR}_x64") endif() @@ -96,8 +100,11 @@ ######################################## multi configuration + if(NOT "${ARCHITECTURE}" STREQUAL "") + set(CMAKE_A_OPTION -A ${ARCHITECTURE}) + endif() execute_process( - COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G ${CMAKE_GENERATOR} + COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G ${CMAKE_GENERATOR} ${CMAKE_A_OPTION} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} ${TOOLCHAINFILE} Modified: trunk/libs/openssl.cmake =================================================================== --- trunk/libs/openssl.cmake 2019-04-09 16:23:03 UTC (rev 7563) +++ trunk/libs/openssl.cmake 2019-04-09 16:23:23 UTC (rev 7564) @@ -124,6 +124,13 @@ (${CMAKE_GENERATOR} MATCHES "NMake Makefiles")) ######################################## VS if(${CMAKE_GENERATOR} MATCHES "NMake Makefiles") + elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019") + find_program( + VCVARS32 vcvarsall.bat + HINTS "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build" + HINTS "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Auxiliary/Build" + HINTS "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build" + ) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017") find_program( VCVARS32 vcvarsall.bat @@ -181,7 +188,7 @@ endif() file(WRITE "${SRC_DIR}/build_cmake.bat" - "cd %~dp0\n" + "cd /d %~dp0\n" "setlocal\n" ) file(TO_NATIVE_PATH ${PERL} PERL_N) @@ -195,6 +202,7 @@ "perl Configure no-asm ${CONFIG_TARGET} --prefix=${INSTALL_DIR_N}\n" "call ${DO_MS}\n" "endlocal\n" + "set PATH=\n" ) if(${CMAKE_GENERATOR} MATCHES "Visual Studio 8 2005") ## Visual Studio 2005 特別処理 @@ -205,13 +213,17 @@ "set LIB=%SDK%\\lib;%LIB%\n" ) endif() - if(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017 Win64") + if(${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019") file(APPEND "${SRC_DIR}/build_cmake.bat" - "call \"${VCVARS32_N}\" x86_amd64 10.0.17134.0\n" + "call \"${VCVARS32_N}\" x86\n" ) + elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017 Win64") + file(APPEND "${SRC_DIR}/build_cmake.bat" + "call \"${VCVARS32_N}\" amd64\n" + ) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017") file(APPEND "${SRC_DIR}/build_cmake.bat" - "call \"${VCVARS32_N}\" x86 10.0.17134.0\n" + "call \"${VCVARS32_N}\" x86\n" ) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio") file(APPEND "${SRC_DIR}/build_cmake.bat" @@ -219,8 +231,8 @@ ) endif() file(APPEND "${SRC_DIR}/build_cmake.bat" - "set PATH=${PERL_N_PATH};%PATH%\n" - "nmake -f ms\\nt.mak install ${NMAKE_OPTION}\n" + "set PATH=%PATH%;${PERL_N_PATH}\n" + "nmake -f ms\\nt.mak install\n" ) set(BUILD_CMAKE_BAT "${SRC_DIR}/build_cmake.bat") Modified: trunk/libs/script_support.cmake =================================================================== --- trunk/libs/script_support.cmake 2019-04-09 16:23:03 UTC (rev 7563) +++ trunk/libs/script_support.cmake 2019-04-09 16:23:23 UTC (rev 7564) @@ -1,6 +1,8 @@ # TOOLSET ツールセット名 if(${CMAKE_GENERATOR} MATCHES "Visual Studio") - if(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017") + if(${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) elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 14 2015") set(MSVC_TOOLSET_VERSION 140) Modified: trunk/libs/zlib.cmake =================================================================== --- trunk/libs/zlib.cmake 2019-04-09 16:23:03 UTC (rev 7563) +++ trunk/libs/zlib.cmake 2019-04-09 16:23:23 UTC (rev 7564) @@ -10,6 +10,7 @@ -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_CONFIGURATION_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake + -DARCHITECTURE=${ARCHITECTURE} -P zlib.cmake ) execute_process( @@ -17,6 +18,7 @@ -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_CONFIGURATION_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake + -DARCHITECTURE=${ARCHITECTURE} -P zlib.cmake ) return() @@ -63,7 +65,7 @@ set(SRC_DIR "${CMAKE_SOURCE_DIR}/build/zlib/src/${SRC_DIR_BASE}") set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build/zlib/build_${TOOLSET}") set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/zlib_${TOOLSET}") -if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32")) +if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32")) set(BUILD_DIR "${BUILD_DIR}_x64") set(INSTALL_DIR "${INSTALL_DIR}_x64") endif() @@ -96,8 +98,11 @@ ######################################## multi configuration + if(NOT "${ARCHITECTURE}" STREQUAL "") + set(CMAKE_A_OPTION -A ${ARCHITECTURE}) + endif() execute_process( - COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G ${CMAKE_GENERATOR} + COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G ${CMAKE_GENERATOR} ${CMAKE_A_OPTION} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} ${TOOLCHAINFILE} Modified: trunk/version_info.h.in =================================================================== --- trunk/version_info.h.in 2019-04-09 16:23:03 UTC (rev 7563) +++ trunk/version_info.h.in 2019-04-09 16:23:23 UTC (rev 7564) @@ -1,6 +1,7 @@ #cmakedefine USE_UNICODE_API #cmakedefine SVNVERSION @SVNVERSION@ +#cmakedefine ENABLE_DPIAWARENESS @ENABLE_DPIAWARENESS@ // infos when generated #cmakedefine MSVC @@ -7,6 +8,8 @@ #cmakedefine MINGW // CMAKE_GENERATOR // @CMAKE_GENERATOR@ +// CMAKE_GENERATOR_TOOLSET (VS 2010 and above) +// @CMAKE_GENERATOR_TOOLSET@ // CMAKE_COMMAND // @CMAKE_COMMAND@ // CMAKE_C_COMPILER