This is an automated email from the ASF dual-hosted git repository.
yongwww pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 25c29a5bda [FFI] Misc fixup for windows (#18234)
25c29a5bda is described below
commit 25c29a5bda6fcc7a3c29e5bf3d6b84aa2959e3b0
Author: Tianqi Chen <[email protected]>
AuthorDate: Tue Aug 26 01:32:14 2025 -0400
[FFI] Misc fixup for windows (#18234)
This PR cleans up the ffi module to make it compatible for windows.
---
ffi/cmake/Utils/AddGoogleTest.cmake | 5 +----
ffi/include/tvm/ffi/container/tuple.h | 9 ++++-----
ffi/src/ffi/extra/json_parser.cc | 6 +++---
ffi/tests/cpp/CMakeLists.txt | 5 +++--
4 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/ffi/cmake/Utils/AddGoogleTest.cmake
b/ffi/cmake/Utils/AddGoogleTest.cmake
index 85e21ced1b..af841752c6 100644
--- a/ffi/cmake/Utils/AddGoogleTest.cmake
+++ b/ffi/cmake/Utils/AddGoogleTest.cmake
@@ -26,10 +26,7 @@ FetchContent_Declare(
)
FetchContent_GetProperties(googletest)
if (NOT googletest_POPULATED)
- FetchContent_Populate(googletest)
- message(STATUS "Found googletest_SOURCE_DIR - ${googletest_SOURCE_DIR}")
- message(STATUS "Found googletest_BINARY_DIR - ${googletest_BINARY_DIR}")
- add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
+ FetchContent_MakeAvailable(googletest)
include(GoogleTest)
set_target_properties(gtest PROPERTIES EXPORT_COMPILE_COMMANDS OFF
EXCLUDE_FROM_ALL ON FOLDER 3rdparty)
set_target_properties(gtest_main PROPERTIES EXPORT_COMPILE_COMMANDS OFF
EXCLUDE_FROM_ALL ON FOLDER 3rdparty)
diff --git a/ffi/include/tvm/ffi/container/tuple.h
b/ffi/include/tvm/ffi/container/tuple.h
index 332f78a2fe..be7e63fd94 100644
--- a/ffi/include/tvm/ffi/container/tuple.h
+++ b/ffi/include/tvm/ffi/container/tuple.h
@@ -56,11 +56,10 @@ class Tuple : public ObjectRef {
typename = std::enable_if_t<(details::type_contains_v<Types,
UTypes> && ...), int>>
Tuple(Tuple<UTypes...>&& other) : ObjectRef(std::move(other)) {}
- template <typename... UTypes,
- typename = std::enable_if_t<sizeof...(Types) == sizeof...(UTypes)
&&
- !(sizeof...(Types) == 1 &&
-
(std::is_same_v<std::remove_cv_t<UTypes>, Tuple<Types>> &&
- ...))>>
+ template <typename... UTypes, typename = std::enable_if_t<
+ sizeof...(Types) == sizeof...(UTypes) &&
+ !(sizeof...(Types) == 1 &&
+ (std::is_same_v<std::decay_t<UTypes>,
Tuple<Types>> && ...))>>
explicit Tuple(UTypes&&... args) :
ObjectRef(MakeTupleNode(std::forward<UTypes>(args)...)) {}
TVM_FFI_INLINE Tuple& operator=(const Tuple<Types...>& other) {
diff --git a/ffi/src/ffi/extra/json_parser.cc b/ffi/src/ffi/extra/json_parser.cc
index 8bd372699d..c346e0d4a1 100644
--- a/ffi/src/ffi/extra/json_parser.cc
+++ b/ffi/src/ffi/extra/json_parser.cc
@@ -385,9 +385,9 @@ class JSONParserContext {
// W2 = 110111xxxxxxxxxx // 0xDC00 + xxxxxxxxxx
//
// Range of W1 and W2:
- // 0xD800–0xDBFF for W1
- // 0xDC00–0xDFFF for W2
- // both W1 and W2 fit into 0xD800–0xDFFF
+ // 0xD800 - 0xDBFF for W1
+ // 0xDC00 - 0xDFFF for W2
+ // both W1 and W2 fit into 0xD800 - 0xDFFF
// Detect if the first i16 fit into range of W1/W2
if (first_i16 >= 0xD800 && first_i16 <= 0xDFFF) {
// we are in the surrogate pair range
diff --git a/ffi/tests/cpp/CMakeLists.txt b/ffi/tests/cpp/CMakeLists.txt
index 37bfc6775f..c807fad216 100644
--- a/ffi/tests/cpp/CMakeLists.txt
+++ b/ffi/tests/cpp/CMakeLists.txt
@@ -10,16 +10,17 @@ add_executable(
EXCLUDE_FROM_ALL
${_test_sources}
)
+
set_target_properties(
tvm_ffi_tests PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
- MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)
+
tvm_ffi_add_cxx_warning(tvm_ffi_tests)
add_sanitizer_address(tvm_ffi_tests)
tvm_ffi_add_apple_dsymutil(tvm_ffi_tests)