Skip to content

Commit 25c29a5

Browse files
authored
[FFI] Misc fixup for windows (#18234)
This PR cleans up the ffi module to make it compatible for windows.
1 parent ad9a201 commit 25c29a5

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

ffi/cmake/Utils/AddGoogleTest.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ FetchContent_Declare(
2626
)
2727
FetchContent_GetProperties(googletest)
2828
if (NOT googletest_POPULATED)
29-
FetchContent_Populate(googletest)
30-
message(STATUS "Found googletest_SOURCE_DIR - ${googletest_SOURCE_DIR}")
31-
message(STATUS "Found googletest_BINARY_DIR - ${googletest_BINARY_DIR}")
32-
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
29+
FetchContent_MakeAvailable(googletest)
3330
include(GoogleTest)
3431
set_target_properties(gtest PROPERTIES EXPORT_COMPILE_COMMANDS OFF EXCLUDE_FROM_ALL ON FOLDER 3rdparty)
3532
set_target_properties(gtest_main PROPERTIES EXPORT_COMPILE_COMMANDS OFF EXCLUDE_FROM_ALL ON FOLDER 3rdparty)

ffi/include/tvm/ffi/container/tuple.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ class Tuple : public ObjectRef {
5656
typename = std::enable_if_t<(details::type_contains_v<Types, UTypes> && ...), int>>
5757
Tuple(Tuple<UTypes...>&& other) : ObjectRef(std::move(other)) {}
5858

59-
template <typename... UTypes,
60-
typename = std::enable_if_t<sizeof...(Types) == sizeof...(UTypes) &&
61-
!(sizeof...(Types) == 1 &&
62-
(std::is_same_v<std::remove_cv_t<UTypes>, Tuple<Types>> &&
63-
...))>>
59+
template <typename... UTypes, typename = std::enable_if_t<
60+
sizeof...(Types) == sizeof...(UTypes) &&
61+
!(sizeof...(Types) == 1 &&
62+
(std::is_same_v<std::decay_t<UTypes>, Tuple<Types>> && ...))>>
6463
explicit Tuple(UTypes&&... args) : ObjectRef(MakeTupleNode(std::forward<UTypes>(args)...)) {}
6564

6665
TVM_FFI_INLINE Tuple& operator=(const Tuple<Types...>& other) {

ffi/src/ffi/extra/json_parser.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@ class JSONParserContext {
385385
// W2 = 110111xxxxxxxxxx // 0xDC00 + xxxxxxxxxx
386386
//
387387
// Range of W1 and W2:
388-
// 0xD8000xDBFF for W1
389-
// 0xDC000xDFFF for W2
390-
// both W1 and W2 fit into 0xD8000xDFFF
388+
// 0xD800 - 0xDBFF for W1
389+
// 0xDC00 - 0xDFFF for W2
390+
// both W1 and W2 fit into 0xD800 - 0xDFFF
391391
// Detect if the first i16 fit into range of W1/W2
392392
if (first_i16 >= 0xD800 && first_i16 <= 0xDFFF) {
393393
// we are in the surrogate pair range

ffi/tests/cpp/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ add_executable(
1010
EXCLUDE_FROM_ALL
1111
${_test_sources}
1212
)
13+
1314
set_target_properties(
1415
tvm_ffi_tests PROPERTIES
1516
CXX_STANDARD 17
1617
CXX_STANDARD_REQUIRED ON
1718
CXX_EXTENSIONS OFF
18-
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
1919
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
2020
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
21-
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
21+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
2222
)
23+
2324
tvm_ffi_add_cxx_warning(tvm_ffi_tests)
2425
add_sanitizer_address(tvm_ffi_tests)
2526
tvm_ffi_add_apple_dsymutil(tvm_ffi_tests)

0 commit comments

Comments
 (0)