[Ttssh2-commit] [7872] Build libs for VS2019 Win32/x64

scmno****@osdn***** scmno****@osdn*****
2019年 7月 21日 (日) 00:19:04 JST


Revision: 7872
          https://osdn.net/projects/ttssh2/scm/svn/commits/7872
Author:   zmatsuo
Date:     2019-07-21 00:19:04 +0900 (Sun, 21 Jul 2019)
Log Message:
-----------
Build libs for VS2019 Win32/x64

Modified Paths:
--------------
    branches/x64/libs/SFMT.cmake
    branches/x64/libs/buildall.cmake
    branches/x64/libs/oniguruma.cmake
    branches/x64/libs/openssl.cmake
    branches/x64/libs/zlib.cmake

Added Paths:
-----------
    branches/x64/libs/jom.cmake

-------------- next part --------------
Modified: branches/x64/libs/SFMT.cmake
===================================================================
--- branches/x64/libs/SFMT.cmake	2019-07-20 15:18:54 UTC (rev 7871)
+++ branches/x64/libs/SFMT.cmake	2019-07-20 15:19:04 UTC (rev 7872)
@@ -1,4 +1,5 @@
-# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P SFMT.cmake
+# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P oniguruma.cmake
+# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P SFMT.cmake
 # cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DCMAKE_CONFIGURATION_TYPE=Release -P SFMT.cmake
 
 ####

Modified: branches/x64/libs/buildall.cmake
===================================================================
--- branches/x64/libs/buildall.cmake	2019-07-20 15:18:54 UTC (rev 7871)
+++ branches/x64/libs/buildall.cmake	2019-07-20 15:19:04 UTC (rev 7872)
@@ -1,6 +1,8 @@
-# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -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="Unix Makefiles" -P buildall.cmake -DCMAKE_TOOLCHAIN_FILE=../mingw.toolchain.cmake
+# cmake -DCMAKE_GENERATOR="Unix Makefiles" -P buildall.cmake
 
 if("${CMAKE_GENERATOR}" STREQUAL "")
   message(FATAL_ERROR "set CMAKE_GENERATOR!")
@@ -10,6 +12,12 @@
   set(ARCHITECTURE_OPTION -DARCHITECTURE=${ARCHITECTURE})
 endif()
 
+# install tool
+message("jom")
+execute_process(
+  COMMAND ${CMAKE_COMMAND} -P jom.cmake
+  )
+
 # build
 message("oniguruma")
 execute_process(
@@ -31,3 +39,4 @@
 execute_process(
   COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} ${ARCHITECTURE_OPTION} -P openssl.cmake
   )
+message("done buildall.cmake")

Added: branches/x64/libs/jom.cmake
===================================================================
--- branches/x64/libs/jom.cmake	                        (rev 0)
+++ branches/x64/libs/jom.cmake	2019-07-20 15:19:04 UTC (rev 7872)
@@ -0,0 +1,29 @@
+# cmake -P jom.cmake
+
+set(SRC_ARC "jom_1_1_3.zip")
+set(SRC_URL "http://download.qt.io/official_releases/jom/jom_1_1_3.zip")
+set(SRC_ARC_HASH_SHA256 128fdd846fe24f8594eed37d1d8929a0ea78df563537c0c1b1861a635013fff8)
+set(DOWN_DIR "${CMAKE_SOURCE_DIR}/download/jom")
+set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/jom")
+
+if(NOT EXISTS ${INSTALL_DIR}/nmake.exe)
+
+  file(DOWNLOAD
+    ${SRC_URL}
+    ${DOWN_DIR}/${SRC_ARC}
+    EXPECTED_HASH SHA256=${SRC_ARC_HASH_SHA256}
+    SHOW_PROGRESS
+    )
+
+  file(MAKE_DIRECTORY ${INSTALL_DIR})
+
+  execute_process(
+    COMMAND ${CMAKE_COMMAND} -E tar "xvf" ${DOWN_DIR}/${SRC_ARC}
+    WORKING_DIRECTORY ${INSTALL_DIR}
+    )
+
+  execute_process(
+    COMMAND ${CMAKE_COMMAND} -E copy ${INSTALL_DIR}/jom.exe ${INSTALL_DIR}/nmake.exe
+    )
+
+endif()

Modified: branches/x64/libs/oniguruma.cmake
===================================================================
--- branches/x64/libs/oniguruma.cmake	2019-07-20 15:18:54 UTC (rev 7871)
+++ branches/x64/libs/oniguruma.cmake	2019-07-20 15:19:04 UTC (rev 7872)
@@ -1,4 +1,5 @@
-# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P oniguruma.cmake
+# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P oniguruma.cmake
+# 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

Modified: branches/x64/libs/openssl.cmake
===================================================================
--- branches/x64/libs/openssl.cmake	2019-07-20 15:18:54 UTC (rev 7871)
+++ branches/x64/libs/openssl.cmake	2019-07-20 15:19:04 UTC (rev 7872)
@@ -1,4 +1,5 @@
-# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P openssl.cmake
+# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P openssl.cmake
+# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P openssl.cmake
 # cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DCMAKE_CONFIGURATION_TYPE=Release -P openssl.cmake
 
 ####
@@ -10,6 +11,7 @@
       -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
       -DCMAKE_CONFIGURATION_TYPE=Release
       -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake
+      -DARCHITECTURE=${ARCHITECTURE}
       -P openssl.cmake
       )
     execute_process(
@@ -17,6 +19,7 @@
       -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
       -DCMAKE_CONFIGURATION_TYPE=Debug
       -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/VSToolchain.cmake
+      -DARCHITECTURE=${ARCHITECTURE}
       -P openssl.cmake
       )
     return()
@@ -63,7 +66,7 @@
 
 set(EXTRACT_DIR "${CMAKE_SOURCE_DIR}/build/openssl/src_${TOOLSET}")
 set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/openssl_${TOOLSET}")
-if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32"))
+if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32") OR ("${ARCHITECTURE}" MATCHES "x64"))
   set(EXTRACT_DIR "${EXTRACT_DIR}_x64")
   set(INSTALL_DIR "${INSTALL_DIR}_x64")
 endif()
@@ -171,11 +174,11 @@
   else()
     message(FATAL_ERROR "CMAKE_GENERATOR ${CMAKE_GENERATOR} not supported")
   endif()
-  if(VCVARS32-NOTFOUND)
+  if(VCVARS32-NOTFOUND OR (${VCVARS32} STREQUAL "VCVARS32-NOTFOUND"))
     message(FATAL_ERROR "vcvars32.bat not found")
   endif()
 
-  if(${CMAKE_GENERATOR} MATCHES "Win64")
+  if((${CMAKE_GENERATOR} MATCHES "Win64") OR ("${ARCHITECTURE}" MATCHES "x64"))
     set(CONFIG_TARGET "VC-WIN64A")
     set(DO_MS "ms\\do_win64a.bat")
   else()
@@ -212,9 +215,15 @@
       )
   endif()
   if(${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019")
-    file(APPEND "${SRC_DIR}/build_cmake.bat"
-      "call \"${VCVARS32_N}\" x86\n"
-      )
+    if("${ARCHITECTURE}" MATCHES "x64")
+      file(APPEND "${SRC_DIR}/build_cmake.bat"
+        "call \"${VCVARS32_N}\" amd64\n"
+        )
+    else()
+      file(APPEND "${SRC_DIR}/build_cmake.bat"
+        "call \"${VCVARS32_N}\" x86\n"
+        )
+    endif()
   elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017 Win64")
     file(APPEND "${SRC_DIR}/build_cmake.bat"
       "call \"${VCVARS32_N}\" amd64\n"
@@ -228,11 +237,18 @@
       "call \"${VCVARS32_N}\"\n"
       )
   endif()
+  # jomでビルドの高速化を試したが次のエラーが出てしまう
+  # 複数の CL.EXE が同じ .PDB ファイルに書き込む場合、/FS を使用してください。
+  # if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/jom/nmake.exe")
+  #   file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_SOURCE_DIR_N)
+  #   file(APPEND "${SRC_DIR}/build_cmake.bat"
+  #     "set PATH=${CMAKE_CURRENT_SOURCE_DIR_N}\\jom;%PATH%\n"
+  #     )
+  # endif()
   file(APPEND "${SRC_DIR}/build_cmake.bat"
     "set PATH=%PATH%;${PERL_N_PATH}\n"
     "nmake -f ms\\nt.mak install\n"
     )
-
   set(BUILD_CMAKE_BAT "${SRC_DIR}/build_cmake.bat")
   file(TO_NATIVE_PATH ${BUILD_CMAKE_BAT} BUILD_CMAKE_BAT_N)
   execute_process(

Modified: branches/x64/libs/zlib.cmake
===================================================================
--- branches/x64/libs/zlib.cmake	2019-07-20 15:18:54 UTC (rev 7871)
+++ branches/x64/libs/zlib.cmake	2019-07-20 15:19:04 UTC (rev 7872)
@@ -1,4 +1,5 @@
-# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P zlib.cmake
+# cmake -DCMAKE_GENERATOR="Visual Studio 16 2019" -DARCHITECTURE=Win32 -P zlib.cmake
+# cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -P zlib.cmake
 # cmake -DCMAKE_GENERATOR="Visual Studio 15 2017" -DCMAKE_CONFIGURATION_TYPE=Release -P zlib.cmake
 
 ####


Ttssh2-commit メーリングリストの案内