Skip to content

Commit

Permalink
ci: support vs2022 17.1x.y
Browse files Browse the repository at this point in the history
JIRA: STUDIO-6329
Change-Id: I788b6967a31a79542410e16a3d8bae2b53c24553
  • Loading branch information
MackBambu authored and lanewei120 committed Jun 18, 2024
1 parent 179acd1 commit 57e7714
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 11 deletions.
4 changes: 2 additions & 2 deletions deps/Boost/Boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
elseif (MSVC_VERSION LESS 1930)
# 1920-1929 = VS 16.0 (v142 toolset)
set(_boost_toolset "msvc-14.2")
elseif (MSVC_VERSION LESS 1940)
# 1930-1939 = VS 17.0 (v143 toolset)
elseif (MSVC_VERSION LESS 1950)
# 1930-1949 = VS 17.0 (v143 toolset)
set(_boost_toolset "msvc-14.3")
else ()
message(FATAL_ERROR "Unsupported MSVC version")
Expand Down
52 changes: 52 additions & 0 deletions deps/OpenCV/0001-OpenCV-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From 6fb3f6333150a777e835fc7c48e49750591bf7fe Mon Sep 17 00:00:00 2001
From: Benjamin Buch <[email protected]>
Date: Thu, 23 May 2024 16:05:19 +0200
Subject: [PATCH] Support VS 2022 17.1x.y

With 17.10.0 the MSVC toolset was set to 19.40.x which breaks the compatibility test in the OpenCV's CMake Config files.
---
cmake/templates/OpenCVConfig.root-WIN32.cmake.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmake/templates/OpenCVConfig.root-WIN32.cmake.in b/cmake/templates/OpenCVConfig.root-WIN32.cmake.in
index b0f254ebe8..62e36272f3 100644
--- a/cmake/templates/OpenCVConfig.root-WIN32.cmake.in
+++ b/cmake/templates/OpenCVConfig.root-WIN32.cmake.in
@@ -137,7 +137,7 @@ elseif(MSVC)
set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version
endif()
endif()
- elseif(MSVC_VERSION MATCHES "^193[0-9]$")
+ elseif(MSVC_VERSION MATCHES "^19[34][0-9]$")
set(OpenCV_RUNTIME vc17)
check_one_config(has_VS2022)
if(NOT has_VS2022)
--
2.45.2.windows.1

From f85818ba6f9031c450475a7453dee0acce31a881 Mon Sep 17 00:00:00 2001
From: Benjamin Buch <[email protected]>
Date: Fri, 24 May 2024 11:10:09 +0200
Subject: [PATCH] Support VS 2022 17.1x.y in OpenCVDetectCXXCompiler.cmake

With 17.10.0 the MSVC toolset was set to 19.40.x which breaks the compatibility test in the OpenCV's CMake Config files.
---
cmake/OpenCVDetectCXXCompiler.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake
index 1743aca11f..448afd46ea 100644
--- a/cmake/OpenCVDetectCXXCompiler.cmake
+++ b/cmake/OpenCVDetectCXXCompiler.cmake
@@ -176,7 +176,7 @@ elseif(MSVC)
set(OpenCV_RUNTIME vc15)
elseif(MSVC_VERSION MATCHES "^192[0-9]$")
set(OpenCV_RUNTIME vc16)
- elseif(MSVC_VERSION MATCHES "^193[0-9]$")
+ elseif(MSVC_VERSION MATCHES "^19[34][0-9]$")
set(OpenCV_RUNTIME vc17)
else()
message(WARNING "OpenCV does not recognize MSVC_VERSION \"${MSVC_VERSION}\". Cannot set OpenCV_RUNTIME")
--
2.45.2.windows.1

1 change: 1 addition & 0 deletions deps/OpenCV/OpenCV.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ endif ()
bambustudio_add_cmake_project(OpenCV
URL https://github.com/opencv/opencv/archive/refs/tags/4.6.0.tar.gz
URL_HASH SHA256=1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277
PATCH_COMMAND git apply --directory deps/build/dep_OpenCV-prefix/src/dep_OpenCV --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-OpenCV-fix.patch
CMAKE_ARGS
-DBUILD_SHARED_LIBS=0
-DBUILD_PERE_TESTS=OFF
Expand Down
16 changes: 9 additions & 7 deletions deps/OpenSSL/OpenSSL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ else()
endif ()
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(url_str "https://github.com/openssl/openssl/archive/OpenSSL_1_1_1k.tar.gz")
set(url_hash "SHA256=b92f9d3d12043c02860e5e602e50a73ed21a69947bcc74d391f41148e9f6aa95")
else()
set(url_str "https://github.com/openssl/openssl/archive/refs/tags/openssl-3.1.2.tar.gz")
set(url_hash "SHA256=8c776993154652d0bb393f506d850b811517c8bd8d24b1008aef57fbe55d3f31")
endif()
# if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# set(url_str "https://github.com/openssl/openssl/archive/OpenSSL_1_1_1k.tar.gz")
# set(url_hash "SHA256=b92f9d3d12043c02860e5e602e50a73ed21a69947bcc74d391f41148e9f6aa95")
# else()
# set(url_str "https://github.com/openssl/openssl/archive/refs/tags/openssl-3.1.2.tar.gz")
# set(url_hash "SHA256=8c776993154652d0bb393f506d850b811517c8bd8d24b1008aef57fbe55d3f31")
# endif()
set(url_str "https://github.com/openssl/openssl/archive/OpenSSL_1_1_1w.tar.gz")
set(url_hash "SHA256=2130E8C2FB3B79D1086186F78E59E8BC8D1A6AEDF17AB3907F4CB9AE20918C41")
ExternalProject_Add(dep_OpenSSL
#EXCLUDE_FROM_ALL ON
URL ${url_str}
Expand Down
5 changes: 3 additions & 2 deletions deps/deps-windows.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
message(STATUS "MSVC_VERSION: ${MSVC_VERSION}")
if (MSVC_VERSION EQUAL 1800)
# 1800 = VS 12.0 (v120 toolset)
set(DEP_VS_VER "12")
Expand All @@ -15,8 +16,8 @@ elseif (MSVC_VERSION LESS 1930)
# 1920-1929 = VS 16.0 (v142 toolset)
set(DEP_VS_VER "16")
set(DEP_BOOST_TOOLSET "msvc-14.2")
elseif (MSVC_VERSION LESS 1940)
# 1930-1939 = VS 17.0 (v143 toolset)
elseif (MSVC_VERSION LESS 1950)
# 1930-1949 = VS 17.0 (v143 toolset)
set(DEP_VS_VER "17")
set(DEP_BOOST_TOOLSET "msvc-14.3")
else ()
Expand Down

0 comments on commit 57e7714

Please sign in to comment.