Skip to content

Commit 40390d4

Browse files
authored
[runtime] support windows (#71)
1 parent 90efd33 commit 40390d4

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

runtime/CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@ option(BUILD_TESTING "whether to build unit test" OFF)
88

99
include(FetchContent)
1010
set(FETCHCONTENT_QUIET OFF)
11-
get_filename_component(fc_base "fc_base" REALPATH BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
11+
get_filename_component(fc_base "fc_base-${CMAKE_CXX_COMPILER_ID}" REALPATH BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
1212
set(FETCHCONTENT_BASE_DIR ${fc_base})
1313
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
1414

15-
# Keep the same with openfst, -fPIC or -fpic
16-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread -fPIC")
15+
if(NOT MSVC)
16+
# Keep the same with openfst, -fPIC or -fpic
17+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread -fPIC")
18+
else()
19+
# For windows, please use unicode(3 bytes per chinese char) instead of gbk(2 bytes per chinese char).
20+
# https://github.com/wenet-e2e/wenet/issues/882#issuecomment-1101246299
21+
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
22+
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
23+
endif()
24+
1725
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
1826
set(CMAKE_MACOSX_RPATH 1)
1927
endif()

0 commit comments

Comments
 (0)