From 724760404a5130498528cd4db07c81f5a96112ca Mon Sep 17 00:00:00 2001 From: Fei Hao Date: Fri, 12 Jun 2026 13:51:36 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Ci=20build=20for=20windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/runtime.yml | 35 +++++++++++++++++++++++++++++--- runtime/CMakeLists.txt | 2 ++ runtime/cmake/openfst.cmake | 4 ++-- runtime/processor/CMakeLists.txt | 11 ++-------- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/.github/workflows/runtime.yml b/.github/workflows/runtime.yml index ca7e609a..2ebacaa0 100644 --- a/.github/workflows/runtime.yml +++ b/.github/workflows/runtime.yml @@ -4,8 +4,8 @@ on: workflow_dispatch: pull_request: paths: - - 'runtime/**' - - '.github/workflows/runtime.yml' + - "runtime/**" + - ".github/workflows/runtime.yml" jobs: build: @@ -18,5 +18,34 @@ jobs: - uses: actions/checkout@v4 - name: Build runtime run: | - cmake -B build -S runtime -DBUILD_TESTING=ON + cmake -B build -G Ninja -S runtime -DBUILD_TESTING=ON + cmake --build build --parallel + + build-windows: + name: build (windows-latest) + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v4 + + - uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: false + cache: true + install: >- + mingw-w64-x86_64-cmake + mingw-w64-x86_64-gcc + mingw-w64-x86_64-ninja + + - name: Build runtime + run: | + cmake --version + gcc --version + + cmake -S runtime -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=OFF cmake --build build --parallel diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 519f4705..90396cfd 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -28,6 +28,8 @@ endif() include(openfst) include_directories(${PROJECT_SOURCE_DIR}) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") + add_subdirectory(utils) add_subdirectory(processor) add_subdirectory(bin) diff --git a/runtime/cmake/openfst.cmake b/runtime/cmake/openfst.cmake index 0394b15f..485325c9 100644 --- a/runtime/cmake/openfst.cmake +++ b/runtime/cmake/openfst.cmake @@ -27,8 +27,8 @@ if(NOT ANDROID) # To build openfst with gflags and glog, we comment out some vars of {flags, log}.h and flags.cc. set(openfst_SOURCE_DIR ${fc_base}/openfst-src CACHE PATH "OpenFST source directory") FetchContent_Declare(openfst - URL https://github.com/csukuangfj/openfst/archive/refs/tags/v1.8.5-2026-04-11.tar.gz - URL_HASH SHA256=57fbc4b950ae81b1a0e1e298af15652da968a6723a592b7874e9b4027a80a5b4 + URL https://github.com/csukuangfj/openfst/archive/refs/tags/v1.8.5-2026-06-15.tar.gz + URL_HASH SHA256=5f9323ded5c9cf4d4e23325dd92652b18b553556ad92b59996e687ebd9688490 ) FetchContent_MakeAvailable(openfst) include_directories(${openfst_SOURCE_DIR}/src/include) diff --git a/runtime/processor/CMakeLists.txt b/runtime/processor/CMakeLists.txt index d4835f8c..d970e313 100644 --- a/runtime/processor/CMakeLists.txt +++ b/runtime/processor/CMakeLists.txt @@ -2,15 +2,8 @@ add_library(wetext_processor STATIC wetext_processor.cc wetext_token_parser.cc ) -if(ANDROID) - target_link_libraries(wetext_processor PUBLIC fst wetext_utils) -else() - if(MSVC) - target_link_libraries(wetext_processor PUBLIC fst wetext_utils) - else() - target_link_libraries(wetext_processor PUBLIC dl fst wetext_utils) - endif() -endif() + +target_link_libraries(wetext_processor PUBLIC fst wetext_utils) # ---------------------------------------------------------------------------- # C API shared library (wetext_processor_c)