From ee53ae0e871b625e9a3f76cc9042e6c7acf97883 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 00:47:41 +0800 Subject: [PATCH 01/12] test pkg-config --- CMakeLists.txt | 34 ++++++++++++++++++++++++---------- cpp-pinyin.pc.in | 15 +++++++++++++++ 2 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 cpp-pinyin.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ea489c..26f9352 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,5 @@ -# ---------------------------------- -# Project -# ---------------------------------- cmake_minimum_required(VERSION 3.17) -project(cpp-pinyin VERSION 1.0.0.0 LANGUAGES CXX) +project(cpp-pinyin VERSION 1.0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) @@ -44,7 +41,7 @@ if (CPP_PINYIN_INSTALL) include(CMakePackageConfigHelpers) endif () # ---------------------------------- -# Main Project +# Project sources and targets # ---------------------------------- file(GLOB_RECURSE _src include/*.h src/*.h src/*.cpp src/*/*.h src/*/*.cpp) @@ -75,7 +72,7 @@ if (CPP_PINYIN_BUILD_TESTS) endif () # ---------------------------------- -# Add platform specific +# Add platform-specific settings # ---------------------------------- if (WIN32) set(RC_DESCRIPTION "A lightweight Chinese/Cantonese to Pinyin library.") @@ -84,7 +81,7 @@ if (WIN32) endif () # ---------------------------------- -# link libraries +# Link libraries # ---------------------------------- target_include_directories(${PROJECT_NAME} PRIVATE include src src/toneUtil) target_include_directories(${PROJECT_NAME} PUBLIC @@ -92,7 +89,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC ) # ---------------------------------- -# copy dictionary +# Copy dictionary files # ---------------------------------- add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND @@ -102,7 +99,7 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD ) # ---------------------------------- -# install +# Install settings # ---------------------------------- if (CPP_PINYIN_INSTALL) target_include_directories(${PROJECT_NAME} PUBLIC @@ -157,4 +154,21 @@ if (CPP_PINYIN_INSTALL) DESTINATION ${VCPKG_DICT_DIR} ) endif () -endif () \ No newline at end of file +endif () + +# ---------------------------------- +# Package config (.pc file) generation +# ---------------------------------- + +# Configure the .pc file +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/cpp-pinyin.pc.in + ${CMAKE_BINARY_DIR}/cpp-pinyin.pc + @ONLY +) + +# Install the .pc file +install( + FILES ${CMAKE_BINARY_DIR}/cpp-pinyin.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) diff --git a/cpp-pinyin.pc.in b/cpp-pinyin.pc.in new file mode 100644 index 0000000..07ec9a2 --- /dev/null +++ b/cpp-pinyin.pc.in @@ -0,0 +1,15 @@ +prefix=${CMAKE_INSTALL_PREFIX} +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include +dictdir=${prefix}/share/cpp-pinyin/dict + +Name: cpp-pinyin +Description: Chinese to Pinyin conversion library +Version: ${PROJECT_VERSION} + +Cflags: -I${includedir} + +Libs: -L${libdir} -lcpp-pinyin + +Libs.private: @PC_LIBS_PRIVATE@ From fe6aa076fd3ee561d09a55a953194c9b2d954a8b Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 01:22:28 +0800 Subject: [PATCH 02/12] fix pkg-config --- CMakeLists.txt | 1 - cpp-pinyin.pc.in | 14 +++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26f9352..619ee55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,7 +164,6 @@ endif () configure_file( ${CMAKE_CURRENT_LIST_DIR}/cpp-pinyin.pc.in ${CMAKE_BINARY_DIR}/cpp-pinyin.pc - @ONLY ) # Install the .pc file diff --git a/cpp-pinyin.pc.in b/cpp-pinyin.pc.in index 07ec9a2..2f3d0b7 100644 --- a/cpp-pinyin.pc.in +++ b/cpp-pinyin.pc.in @@ -1,15 +1,19 @@ -prefix=${CMAKE_INSTALL_PREFIX} -exec_prefix=${prefix} +prefix=${pcfiledir}/../.. + +# cpp-pinyin pkg-config file + +exec_prefix=${prefix}/bin libdir=${exec_prefix}/lib includedir=${prefix}/include + dictdir=${prefix}/share/cpp-pinyin/dict Name: cpp-pinyin -Description: Chinese to Pinyin conversion library +Description: A lightweight Chinese/Cantonese to Pinyin library. Version: ${PROJECT_VERSION} +Requires: +Conflicts: Cflags: -I${includedir} - Libs: -L${libdir} -lcpp-pinyin -Libs.private: @PC_LIBS_PRIVATE@ From 6991f00e84efb423f56d587eb6f72ae36a8ef2fc Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 01:44:50 +0800 Subject: [PATCH 03/12] fix pkg-config --- CMakeLists.txt | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 619ee55..9adb099 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,11 +62,11 @@ if (CPP_PINYIN_BUILD_TESTS) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/res/${dict} - ${CMAKE_BINARY_DIR}/tests/${dict} + ${CMAKE_CURRENT_SOURCE_DIR}/res/dict + ${CMAKE_BINARY_DIR}/tests/dict ) install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/${dict} + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/dict DESTINATION . ) endif () @@ -94,8 +94,8 @@ target_include_directories(${PROJECT_NAME} PUBLIC add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/res/${dict} - ${CMAKE_BINARY_DIR}/bin/${dict} + ${CMAKE_CURRENT_SOURCE_DIR}/res/dict + ${CMAKE_BINARY_DIR}/bin/dict ) # ---------------------------------- @@ -143,15 +143,17 @@ if (CPP_PINYIN_INSTALL) DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" ) - if (NOT DEFINED VCPKG_DICT_DIR) + if (NOT DEFINED CPP_PINYIN_VCPKG_DICT_DIR) + set(dictdir ${CMAKE_INSTALL_LIBDIR}/dict) install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/${dict} + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/dict DESTINATION ${CMAKE_INSTALL_LIBDIR} ) else () + set(dictdir ${CPP_PINYIN_VCPKG_DICT_DIR}/dict) install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/${dict} - DESTINATION ${VCPKG_DICT_DIR} + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/dict + DESTINATION ${CPP_PINYIN_VCPKG_DICT_DIR} ) endif () endif () @@ -160,10 +162,16 @@ endif () # Package config (.pc file) generation # ---------------------------------- +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) +set(libdir ${CMAKE_INSTALL_LIBDIR}) +set(includedir ${CMAKE_INSTALL_INCLUDEDIR}) + # Configure the .pc file configure_file( ${CMAKE_CURRENT_LIST_DIR}/cpp-pinyin.pc.in ${CMAKE_BINARY_DIR}/cpp-pinyin.pc + @ONLY ) # Install the .pc file From 46bd6d0a6c9e09340d45add16d3d468010049f61 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 02:00:48 +0800 Subject: [PATCH 04/12] fix pkg-config --- CMakeLists.txt | 5 ++--- cmake/winrc.cmake | 4 ++-- cpp-pinyin.pc.in | 12 ++++++------ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9adb099..a06b15b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.17) -project(cpp-pinyin VERSION 1.0.1.0 LANGUAGES CXX) +project(cpp-pinyin VERSION 1.0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) @@ -163,9 +163,8 @@ endif () # ---------------------------------- set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) set(libdir ${CMAKE_INSTALL_LIBDIR}) -set(includedir ${CMAKE_INSTALL_INCLUDEDIR}) +set(version ${PROJECT_VERSION}) # Configure the .pc file configure_file( diff --git a/cmake/winrc.cmake b/cmake/winrc.cmake index 5886ba6..d114f53 100644 --- a/cmake/winrc.cmake +++ b/cmake/winrc.cmake @@ -8,8 +8,8 @@ set(_rc_content "#include #define STRINGIFY(x) _STRINGIFY(x) VS_VERSION_INFO VERSIONINFO - FILEVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},${PROJECT_VERSION_TWEAK} - PRODUCTVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},${PROJECT_VERSION_TWEAK} + FILEVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH} + PRODUCTVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH} { BLOCK \"StringFileInfo\" { diff --git a/cpp-pinyin.pc.in b/cpp-pinyin.pc.in index 2f3d0b7..a1ca189 100644 --- a/cpp-pinyin.pc.in +++ b/cpp-pinyin.pc.in @@ -1,16 +1,16 @@ -prefix=${pcfiledir}/../.. +prefix=@prefix@ # cpp-pinyin pkg-config file -exec_prefix=${prefix}/bin -libdir=${exec_prefix}/lib -includedir=${prefix}/include +exec_prefix=@prefix@/bin +libdir=@prefix@/lib +includedir=@prefix@/include -dictdir=${prefix}/share/cpp-pinyin/dict +dictdir=@prefix@/share/cpp-pinyin/dict Name: cpp-pinyin Description: A lightweight Chinese/Cantonese to Pinyin library. -Version: ${PROJECT_VERSION} +Version: @version@ Requires: Conflicts: From 61e1cbceadb3e5312dc60342ecf370f3dbf853f9 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 02:11:09 +0800 Subject: [PATCH 05/12] fix pkg-config --- CMakeLists.txt | 3 --- cpp-pinyin.pc.in | 10 +++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a06b15b..7f05de0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,9 +161,6 @@ endif () # ---------------------------------- # Package config (.pc file) generation # ---------------------------------- - -set(prefix ${CMAKE_INSTALL_PREFIX}) -set(libdir ${CMAKE_INSTALL_LIBDIR}) set(version ${PROJECT_VERSION}) # Configure the .pc file diff --git a/cpp-pinyin.pc.in b/cpp-pinyin.pc.in index a1ca189..1973df5 100644 --- a/cpp-pinyin.pc.in +++ b/cpp-pinyin.pc.in @@ -1,12 +1,12 @@ -prefix=@prefix@ +prefix=${pcfiledir}/../.. # cpp-pinyin pkg-config file -exec_prefix=@prefix@/bin -libdir=@prefix@/lib -includedir=@prefix@/include +exec_prefix=${prefix}/bin +libdir=${prefix}/lib +includedir=${prefix}/include -dictdir=@prefix@/share/cpp-pinyin/dict +dictdir=${prefix}/share/cpp-pinyin/dict Name: cpp-pinyin Description: A lightweight Chinese/Cantonese to Pinyin library. From 4e8451af45d99e0ff9bbf6780bcbb75b42b706dd Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 08:29:11 +0800 Subject: [PATCH 06/12] test ci --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f00d106 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: Build and Test + +on: + push: + branches: + - main + - dev + + pull_request: + branches: + - main + - dev + +env: + BUILD_TYPE: Release + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ ubuntu-20.04, macos-latest, windows-latest ] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up CMake + uses: actions/setup-cmake@v1 + with: + cmake-version: '3.20.0' + + - name: Set up build environment + run: | + if [[ "${{ matrix.os }}" == "ubuntu-20.04" ]]; then + sudo apt-get update && sudo apt-get install -y build-essential + elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then + brew install cmake + elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then + choco install cmake + fi + + - name: Configure CMake + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build project + run: cmake --build build --config ${{env.BUILD_TYPE}} From 7fc0cc1e0c2fb5f9c3f25367a3366ea30da3e6c5 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 08:31:28 +0800 Subject: [PATCH 07/12] test ci --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f00d106..a31c976 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,11 +26,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up CMake - uses: actions/setup-cmake@v1 - with: - cmake-version: '3.20.0' - - name: Set up build environment run: | if [[ "${{ matrix.os }}" == "ubuntu-20.04" ]]; then From 78a82b19454674bf36da8397a9202a202622f4ee Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 08:40:46 +0800 Subject: [PATCH 08/12] test ci --- .github/workflows/ci.yml | 105 +++++++++++++++++++++++++++++---------- 1 file changed, 80 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a31c976..53043cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,43 +1,98 @@ -name: Build and Test +name: C/C++ CI on: push: branches: - main - dev - pull_request: branches: - main - dev -env: - BUILD_TYPE: Release - jobs: - build: - runs-on: ${{ matrix.os }} - + # Linux Job + linux: + runs-on: ubuntu-latest strategy: matrix: - os: [ ubuntu-20.04, macos-latest, windows-latest ] - + include: + - api: jack + APIcmake: JACK + deps: libjack-dev + - api: alsa + APIcmake: ALSA + deps: libasound-dev steps: - - name: Checkout repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake autoconf-archive ${{ matrix.deps }} + - name: Build with CMake (Linux) + run: | + mkdir -p build + cd build + cmake .. -DCMAKE_BUILD_TYPE=Release -DRTMIDI_API_JACK=OFF -DRTMIDI_API_ALSA=OFF -DRTMIDI_API_${{ matrix.APIcmake }}=ON + cmake --build . --config Release - - name: Set up build environment - run: | - if [[ "${{ matrix.os }}" == "ubuntu-20.04" ]]; then - sudo apt-get update && sudo apt-get install -y build-essential - elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then - brew install cmake - elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then - choco install cmake - fi + # macOS Job + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install dependencies (macOS) + run: | + brew install cmake autoconf-archive automake + - name: Build with CMake (macOS) + run: | + mkdir -p build + cd build + cmake .. -DCMAKE_BUILD_TYPE=Release + cmake --build . --config Release - - name: Configure CMake - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + # Windows Job (MinGW) + windows-mingw: + runs-on: windows-latest + strategy: + matrix: + include: + - host: x86_64-w64-mingw32 + api: winmm + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install dependencies (Windows MinGW) + run: | + choco install cmake mingw --version 8.1 + refreshenv + - name: Build with CMake (Windows MinGW) + run: | + mkdir -p build + cd build + cmake .. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" + cmake --build . --config Release - - name: Build project - run: cmake --build build --config ${{env.BUILD_TYPE}} + # Windows Job (MSVC) + windows-msvc: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up MSVC + run: | + # Install Visual Studio build tools + choco install visualstudio2019-workload-vctools + refreshenv + - name: Build with MSVC (Windows) + run: | + mkdir -p build + cd build + cmake .. -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 16 2019" + cmake --build . --config Release From b41517fd76c86249a86b3f949637ced42f5f592f Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 08:53:12 +0800 Subject: [PATCH 09/12] test ci --- .github/workflows/ci.yml | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53043cf..523f3f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,18 @@ jobs: fetch-depth: 0 - name: Install dependencies (Windows MinGW) run: | - choco install cmake mingw --version 8.1 + # Install MinGW and CMake + choco install mingw --version 8.1 + + # Install CMake directly from the official source if choco fails + if (-Not (Test-Path "C:\Program Files\CMake\bin\cmake.exe")) { + Write-Host "CMake not found, downloading and installing..." + Invoke-WebRequest -Uri https://cmake.org/files/v3.22/cmake-3.22.2-windows-x86_64.msi -OutFile cmake_installer.msi + Start-Process msiexec.exe -ArgumentList '/i', 'cmake_installer.msi', '/quiet', '/norestart' -NoNewWindow -Wait + Remove-Item -Force cmake_installer.msi + } else { + Write-Host "CMake already installed" + } refreshenv - name: Build with CMake (Windows MinGW) run: | @@ -77,22 +88,3 @@ jobs: cd build cmake .. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" cmake --build . --config Release - - # Windows Job (MSVC) - windows-msvc: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up MSVC - run: | - # Install Visual Studio build tools - choco install visualstudio2019-workload-vctools - refreshenv - - name: Build with MSVC (Windows) - run: | - mkdir -p build - cd build - cmake .. -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 16 2019" - cmake --build . --config Release From 29ae879311b6b357a5b8e83eddba525236acbd1d Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 08:58:15 +0800 Subject: [PATCH 10/12] test ci --- .github/workflows/ci.yml | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 523f3f3..b6f07cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,36 +55,26 @@ jobs: cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . --config Release - # Windows Job (MinGW) - windows-mingw: - runs-on: windows-latest + MinGW: + runs-on: ubuntu-latest strategy: matrix: include: + - host: i686-w64-mingw32 + api: winmm - host: x86_64-w64-mingw32 api: winmm steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install dependencies (Windows MinGW) + - name: Install dependencies (MinGW) run: | - # Install MinGW and CMake - choco install mingw --version 8.1 - - # Install CMake directly from the official source if choco fails - if (-Not (Test-Path "C:\Program Files\CMake\bin\cmake.exe")) { - Write-Host "CMake not found, downloading and installing..." - Invoke-WebRequest -Uri https://cmake.org/files/v3.22/cmake-3.22.2-windows-x86_64.msi -OutFile cmake_installer.msi - Start-Process msiexec.exe -ArgumentList '/i', 'cmake_installer.msi', '/quiet', '/norestart' -NoNewWindow -Wait - Remove-Item -Force cmake_installer.msi - } else { - Write-Host "CMake already installed" - } - refreshenv - - name: Build with CMake (Windows MinGW) + sudo apt-get update + sudo apt-get install -y mingw-w64 cmake autoconf-archive + - name: Build with CMake (MinGW) run: | mkdir -p build cd build - cmake .. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" + cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../mingw-toolchain.cmake -DRTMIDI_API_${{ matrix.api }}=ON cmake --build . --config Release From 60264c6ffb394d9429a208b26e3b54e3c552acb2 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 09:01:22 +0800 Subject: [PATCH 11/12] test ci --- .github/workflows/ci.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6f07cc..ba893b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,10 +71,17 @@ jobs: - name: Install dependencies (MinGW) run: | sudo apt-get update - sudo apt-get install -y mingw-w64 cmake autoconf-archive - - name: Build with CMake (MinGW) + sudo apt-get install -y mingw-w64 cmake autoconf-archive build-essential + - name: Create build directory run: | mkdir -p build + - name: Build with CMake (MinGW) + run: | cd build - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../mingw-toolchain.cmake -DRTMIDI_API_${{ matrix.api }}=ON + cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_TOOLCHAIN_FILE=../mingw-toolchain.cmake \ + -DRTMIDI_API_${{ matrix.api }}=ON \ + -G "MinGW Makefiles" # Use MinGW-specific makefiles cmake --build . --config Release + From bbfda4207eaaaf62c7efca29b303eb91a5707d04 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 23 Nov 2024 09:05:31 +0800 Subject: [PATCH 12/12] remove mingw test --- .github/workflows/ci.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba893b7..ea134df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,34 +54,3 @@ jobs: cd build cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . --config Release - - MinGW: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - host: i686-w64-mingw32 - api: winmm - - host: x86_64-w64-mingw32 - api: winmm - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Install dependencies (MinGW) - run: | - sudo apt-get update - sudo apt-get install -y mingw-w64 cmake autoconf-archive build-essential - - name: Create build directory - run: | - mkdir -p build - - name: Build with CMake (MinGW) - run: | - cd build - cmake .. \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_TOOLCHAIN_FILE=../mingw-toolchain.cmake \ - -DRTMIDI_API_${{ matrix.api }}=ON \ - -G "MinGW Makefiles" # Use MinGW-specific makefiles - cmake --build . --config Release -