mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-11 08:36:16 +00:00
Build and test MinGW in CI
This commit is contained in:
18
.github/workflows/build.yml
vendored
18
.github/workflows/build.yml
vendored
@@ -166,6 +166,7 @@ jobs:
|
||||
platform:
|
||||
- Windows x86
|
||||
- Windows x86_64
|
||||
- MinGW x86_64
|
||||
- Linux x86_64 GCC
|
||||
- Linux x86_64 GCC Sanitizer
|
||||
- Linux x86_64 Clang
|
||||
@@ -190,6 +191,10 @@ jobs:
|
||||
- platform: Windows x86_64
|
||||
runner: windows-latest
|
||||
devcmd_arch: x64
|
||||
- platform: MinGW x86_64
|
||||
runner: ubuntu-24.04
|
||||
rust-target: x86_64-pc-windows-gnu
|
||||
cmake-options: "-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/cmake/toolchain/mingw-w64.cmake"
|
||||
- platform: Linux x86_64 GCC Sanitizer
|
||||
runner: ubuntu-24.04
|
||||
cmake-options: "-DMOMO_ENABLE_SANITIZER=On"
|
||||
@@ -251,6 +256,12 @@ jobs:
|
||||
sudo update-alternatives --set cc /usr/bin/clang-${{ matrix.clang-version }}
|
||||
sudo update-alternatives --set c++ /usr/bin/clang++-${{ matrix.clang-version }}
|
||||
|
||||
- name: Set up MinGW
|
||||
uses: egor-tensin/setup-mingw@v2
|
||||
if: "${{ startsWith(matrix.platform, 'MinGW') }}"
|
||||
with:
|
||||
platform: x64
|
||||
|
||||
- name: Enable Developer Command Prompt
|
||||
uses: ilammy/msvc-dev-cmd@v1.13.0
|
||||
if: ${{ startsWith(matrix.platform, 'Windows') }}
|
||||
@@ -329,6 +340,7 @@ jobs:
|
||||
platform:
|
||||
- Windows x86
|
||||
- Windows x86_64
|
||||
- MinGW x86_64
|
||||
- Linux x86_64 GCC
|
||||
- Linux x86_64 GCC Sanitizer
|
||||
- Linux x86_64 Clang
|
||||
@@ -353,6 +365,8 @@ jobs:
|
||||
runner: windows-latest
|
||||
- platform: Windows x86_64
|
||||
runner: windows-latest
|
||||
- platform: MinGW x86_64
|
||||
runner: windows-latest
|
||||
- platform: Linux x86_64 GCC
|
||||
runner: ubuntu-24.04
|
||||
- platform: Linux x86_64 GCC Sanitizer
|
||||
@@ -390,7 +404,7 @@ jobs:
|
||||
|
||||
- name: Download Windows Artifacts
|
||||
uses: pyTooling/download-artifact@v4
|
||||
if: "${{ matrix.platform != 'Windows x86_64' }}"
|
||||
if: "${{ matrix.platform != 'Windows x86_64' && matrix.platform != 'MinGW x86_64' }}"
|
||||
with:
|
||||
name: Windows x86_64 Release Artifacts
|
||||
path: build/${{matrix.preset}}/artifacts
|
||||
@@ -405,7 +419,7 @@ jobs:
|
||||
run: cp build/${{matrix.preset}}/artifacts/test-sample.exe build/${{matrix.preset}}/artifacts/root/filesys/c/
|
||||
|
||||
- name: CMake Test
|
||||
if: ${{ matrix.emulator != 'Icicle' || matrix.platform != 'Windows x86' }}
|
||||
if: ${{ matrix.emulator != 'Icicle' || (matrix.platform != 'Windows x86' && matrix.platform != 'MinGW x86_64') }}
|
||||
run: cd build/${{matrix.preset}} && ctest --verbose -j
|
||||
env:
|
||||
EMULATOR_ROOT: ${{github.workspace}}/build/${{matrix.preset}}/artifacts/root
|
||||
|
||||
@@ -25,21 +25,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
##########################################
|
||||
|
||||
if(MINGW)
|
||||
# Minimum version check for MinGW compiler
|
||||
set(MINGW_C_COMPILER_MIN_VERSION "14.0.0")
|
||||
set(MINGW_CXX_COMPILER_MIN_VERSION "14.0.0")
|
||||
|
||||
if (${CMAKE_C_COMPILER_VERSION} VERSION_LESS_EQUAL ${MINGW_C_COMPILER_MIN_VERSION})
|
||||
message(FATAL_ERROR "${CMAKE_C_COMPILER} version should >= ${MINGW_C_COMPILER_MIN_VERSION}")
|
||||
endif()
|
||||
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS_EQUAL ${MINGW_CXX_COMPILER_MIN_VERSION})
|
||||
message(FATAL_ERROR "${CMAKE_C_COMPILER} version should >= ${MINGW_CXX_COMPILER_MIN_VERSION}")
|
||||
endif()
|
||||
|
||||
# MinGW LTO will cause errors in compile stage, We just disable it
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
|
||||
elseif(NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if(NOT MINGW AND NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
||||
endif()
|
||||
|
||||
@@ -53,7 +39,14 @@ endif()
|
||||
|
||||
##########################################
|
||||
|
||||
if(MOMO_ENABLE_RUST_CODE)
|
||||
set(MOMO_ENABLE_RUST OFF)
|
||||
if(MOMO_ENABLE_RUST_CODE AND NOT MINGW AND NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
set(MOMO_ENABLE_RUST ON)
|
||||
endif()
|
||||
|
||||
##########################################
|
||||
|
||||
if(MOMO_ENABLE_RUST)
|
||||
add_compile_definitions(MOMO_ENABLE_RUST_CODE=1)
|
||||
else()
|
||||
add_compile_definitions(MOMO_ENABLE_RUST_CODE=0)
|
||||
|
||||
@@ -16,7 +16,7 @@ target_link_libraries(backend-selection PRIVATE
|
||||
unicorn-emulator
|
||||
)
|
||||
|
||||
if (MOMO_ENABLE_RUST_CODE)
|
||||
if (MOMO_ENABLE_RUST)
|
||||
target_link_libraries(backend-selection PRIVATE
|
||||
icicle-emulator
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
add_subdirectory(unicorn-emulator)
|
||||
|
||||
if (MOMO_ENABLE_RUST_CODE)
|
||||
if (MOMO_ENABLE_RUST)
|
||||
add_subdirectory(icicle-emulator)
|
||||
endif()
|
||||
|
||||
@@ -13,7 +13,9 @@ endif()
|
||||
set(CARGO_TRIPLE)
|
||||
set(CARGO_OPTIONS)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
||||
if (MINGW)
|
||||
set(CARGO_TRIPLE "x86_64-pc-windows-gnu")
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
||||
set(CARGO_TRIPLE "wasm32-unknown-emscripten")
|
||||
elseif(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CARGO_TRIPLE "i686-pc-windows-msvc")
|
||||
|
||||
@@ -17,7 +17,7 @@ target_link_libraries(emulator-common PUBLIC
|
||||
zlibstatic
|
||||
)
|
||||
|
||||
if(MINGW)
|
||||
if(WIN)
|
||||
target_link_libraries(emulator-common PUBLIC
|
||||
ws2_32
|
||||
)
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
using socklen_t = int;
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#endif
|
||||
|
||||
namespace network
|
||||
|
||||
@@ -19,7 +19,7 @@ target_link_libraries(fuzzer PRIVATE
|
||||
windows-emulator
|
||||
)
|
||||
|
||||
if (MOMO_ENABLE_RUST_CODE)
|
||||
if (MOMO_ENABLE_RUST)
|
||||
target_link_libraries(fuzzer PRIVATE
|
||||
icicle-emulator
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user