Skip to content

Commit

Permalink
Add Windows builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Theldus committed Apr 6, 2024
1 parent 1c3fde6 commit 7cda5d3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,29 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build & Tests
run: >
mkdir build &&
cd build &&
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_WSSERVER_TEST=On &&
make -j$(nproc) &&
CTEST_OUTPUT_ON_FAILURE=1 ctest --verbose
windows:
name: Windows (via Wine) (AMD64) Build & Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install toolchain
run: sudo apt-get install mingw-w64 wine64 -y
- name: Build & Tests
run: >
wget https://raw.githubusercontent.com/Theldus/wsServer/master/.github/workflows/mingw-w64-x86_64.cmake &&
mkdir build &&
cd build &&
cmake .. -DCMAKE_TOOLCHAIN_FILE=../mingw-w64-x86_64.cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_WSSERVER_TEST=On &&
make -j$(nproc) &&
CTEST_OUTPUT_ON_FAILURE=1 ctest --verbose
23 changes: 23 additions & 0 deletions .github/workflows/mingw-w64-x86_64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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 ..

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 7cda5d3

Please sign in to comment.