Skip to content

Commit

Permalink
Use linux mingw instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Werni2A committed Jul 17, 2024
1 parent 81a78d9 commit 33714a2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 15 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,32 +101,37 @@ jobs:
cmake --build --preset release
build-mingw:
runs-on: windows-2022
container: amitie10g/msys2-mingw-w64-toolchain
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up vcpkg
run: |
# Workaround for failing grub-efi installation during upgrade
echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates
sudo apt update
sudo apt upgrade -y
sudo apt install -y cmake
git clone https://github.com/microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
./vcpkg/bootstrap-vcpkg.sh
- name: Download Unit Test Designs
run: |
${ENV:PYTHONUTF8}=1
git config --system core.longpaths true
python -m pip install -r test/py/requirements.txt
python test/py/testing.py --download_repos true --database_file_path repos.yaml --third_party_path test\designs
python test/py/testing.py --download_repos true --database_file_path repos.yaml --third_party_path test/designs
- name: Create Unit Tests
run: |
${ENV:PYTHONUTF8}=1
git config --system core.longpaths true
python test/py/testing.py --generate_unit_tests true --database_file_path repos.yaml --unit_test_path test\src\generated_tests --third_party_path test\designs
python test/py/testing.py --generate_unit_tests true --database_file_path repos.yaml --unit_test_path test/src/generated_tests --third_party_path test/designs
- name: Build Library and CLI Application
- name: Build Library, CLI Application and Tests
run: |
${ENV:MSYSTEM}=MINGW64
${ENV:VCPKG_ROOT}=$(Resolve-Path ./vcpkg)
${ENV:CMAKE_BUILD_PARALLEL_LEVEL}=2
cmake --preset release -DENABLE_UNIT_TESTING=ON
cmake --build --preset release
sudo apt update
sudo apt install -y g++-mingw-w64-x86-64-win32
export VCPKG_ROOT=$(realpath ./vcpkg)
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
cmake --preset release -DENABLE_UNIT_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=./mingw-w64-x86_64.cmake
cmake --build --preset release
- name: Run Tests
run: |
python3 run_tests.py
25 changes: 25 additions & 0 deletions mingw-w64-x86_64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# Sample toolchain file for building for Windows from an Ubuntu Linux system.
#
# Typical usage:
# *) install cross compiler: `sudo apt-get install mingw-w64`
# *) cd build
# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake ..
# This is free and unencumbered software released into the public domain.

set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)

# cross compilers to use for C, C++ and Fortran
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)

# target environment on the build host system
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})

# modify default behavior of FIND_XXX() commands
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

0 comments on commit 33714a2

Please sign in to comment.