diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4b454a..40207d1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 \ No newline at end of file + 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 \ No newline at end of file diff --git a/mingw-w64-x86_64.cmake b/mingw-w64-x86_64.cmake new file mode 100644 index 0000000..b69aa6d --- /dev/null +++ b/mingw-w64-x86_64.cmake @@ -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) \ No newline at end of file