Skip to content

Commit 89d2fdd

Browse files
author
Aliaksandr Adziareika
committed
Add openDAQ icx compilation for Windows
1 parent 452d561 commit 89d2fdd

2 files changed

Lines changed: 267 additions & 38 deletions

File tree

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
name: Build openDAQ SDK
2+
description: Configure, build and test openDAQ SDK
3+
4+
inputs:
5+
additional-dependencies:
6+
description: 'Additional packages to install (apt on Linux, choco on Windows)'
7+
required: false
8+
default: ''
9+
cmake-generator:
10+
description: 'CMake generator (e.g., "Ninja", "Visual Studio 17 2022")'
11+
required: false
12+
default: ''
13+
cmake-config-preset:
14+
description: 'CMake configure preset name'
15+
required: false
16+
default: ''
17+
cmake-config-args:
18+
description: 'Additional CMake configure arguments (e.g., -D flags)'
19+
required: false
20+
default: ''
21+
cmake-build-type:
22+
description: 'Build configuration (Release, Debug). Required for multi-config generators (Visual Studio)'
23+
required: false
24+
default: ''
25+
enable-32bit:
26+
description: 'Build for 32-bit architecture'
27+
required: false
28+
default: 'false'
29+
enable-tests:
30+
description: 'Run tests after build'
31+
required: false
32+
default: 'false'
33+
ctest-preset:
34+
description: 'CTest preset name'
35+
required: false
36+
default: ''
37+
38+
outputs:
39+
gtest-xml-path:
40+
description: 'Path to GTest XML reports directory'
41+
value: ${{ steps.test.outputs.gtest-xml-path }}
42+
43+
runs:
44+
using: composite
45+
steps:
46+
- name: Check inputs
47+
shell: bash
48+
env:
49+
CMAKE_GENERATOR: ${{ inputs.cmake-generator }}
50+
run: |
51+
if [ -z "$CMAKE_GENERATOR" ]; then
52+
echo "::error::✗ The cmake-generator input is not set."
53+
exit 1
54+
fi
55+
56+
- name: Set up Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.14'
60+
architecture: ${{ inputs.enable-32bit == 'true' && 'x86' || 'x64' }}
61+
62+
- name: Setup cmake
63+
uses: jwlawson/actions-setup-cmake@v2
64+
65+
- name: Install Windows dependencies
66+
if: runner.os == 'Windows' && inputs.additional-dependencies != ''
67+
shell: pwsh
68+
run: choco install ${{ inputs.additional-dependencies }} -y --no-progress
69+
70+
- name: Install Linux dependencies
71+
if: runner.os == 'Linux'
72+
shell: bash
73+
run: |
74+
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
75+
${{ inputs.additional-dependencies || '' }} \
76+
lld mono-runtime libmono-system-json-microsoft4.0-cil libmono-system-data4.0-cil \
77+
libx11-dev libxi-dev libxcursor-dev libxrandr-dev libgl-dev libudev-dev libfreetype6-dev
78+
79+
- name: Install macOS dependencies
80+
if: runner.os == 'macOS'
81+
shell: bash
82+
run: |
83+
HOMEBREW_NO_AUTO_UPDATE=1 brew install mono ${{ inputs.additional-dependencies }}
84+
85+
- name: Install ninja-build
86+
if: inputs.cmake-generator == 'Ninja'
87+
uses: seanmiddleditch/gha-setup-ninja@v5
88+
89+
- name: Setup MSYS2 MINGW64
90+
if: runner.os == 'Windows'
91+
id: msys2
92+
uses: msys2/setup-msys2@v2
93+
with:
94+
msystem: MINGW64
95+
update: false
96+
install: mingw-w64-x86_64-crt-git mingw-w64-x86_64-gcc
97+
98+
- name: Add MSYS2 MINGW64 to PATH
99+
if: runner.os == 'Windows'
100+
shell: bash
101+
run: |
102+
echo "${{ steps.msys2.outputs.msys2-location }}/mingw64/bin" >> $GITHUB_PATH
103+
echo "Added MSYS2 MINGW64 to PATH: ${{ steps.msys2.outputs.msys2-location }}/mingw64/bin"
104+
105+
# https://github.com/actions/runner-images/issues/10001
106+
- name: Setup MSVC toolchain
107+
if: runner.os == 'Windows'
108+
uses: ilammy/msvc-dev-cmd@v1
109+
110+
- name: Install Python dependencies
111+
shell: bash
112+
run: |
113+
echo "Installing numpy for Python versions: $(python --version)"
114+
python -m pip install numpy
115+
echo "Done installing Python dependencies"
116+
117+
- name: Configure
118+
id: cmake-config
119+
shell: bash
120+
env:
121+
CMAKE_BUILD_TYPE: ${{ inputs.cmake-build-type }}
122+
CMAKE_GENERATOR: ${{ inputs.cmake-generator }}
123+
CI_GIT_BRANCH: ${{ github.head_ref }}
124+
run: |
125+
CMAKE_BUILD_PATH="build"
126+
mkdir -p "$CMAKE_BUILD_PATH"
127+
CMAKE_BUILD_PATH=$(cd "$CMAKE_BUILD_PATH" && pwd)
128+
echo "build-path=$CMAKE_BUILD_PATH" >> "$GITHUB_OUTPUT"
129+
130+
CMAKE_ARGS=""
131+
if [ -n "${{ inputs.cmake-config-preset }}" ]; then
132+
CMAKE_ARGS="--preset ${{ inputs.cmake-config-preset }}"
133+
fi
134+
135+
# Visual Studio specific options
136+
if [[ "$CMAKE_GENERATOR" == "Visual Studio"* ]]; then
137+
CMAKE_ARGS="$CMAKE_ARGS -DOPENDAQ_MSVC_SINGLE_PROCESS_BUILD=ON"
138+
fi
139+
140+
if [ -n "$CMAKE_BUILD_TYPE" ]; then
141+
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE"
142+
fi
143+
144+
CMAKE_ARGS="$CMAKE_ARGS -DCI_GIT_BRANCH=$CI_GIT_BRANCH"
145+
146+
echo "::group::CMake Configure"
147+
cmake -B "$CMAKE_BUILD_PATH" -G "$CMAKE_GENERATOR" $CMAKE_ARGS ${{ inputs.cmake-config-args }}
148+
echo "::endgroup::"
149+
150+
- name: Build
151+
shell: bash
152+
env:
153+
SHORT_SHA: ci # .NET bindings version suffix (e.g., 1.0.0-beta-ci)
154+
CMAKE_BUILD_TYPE: ${{ inputs.cmake-build-type }}
155+
CMAKE_BUILD_PATH: ${{ steps.cmake-config.outputs.build-path }}
156+
run: |
157+
CMAKE_BUILD_ARGS=""
158+
if [ -n "$CMAKE_BUILD_TYPE" ]; then
159+
CMAKE_BUILD_ARGS="--config $CMAKE_BUILD_TYPE"
160+
fi
161+
162+
echo "::group::CMake Build"
163+
cmake --build "$CMAKE_BUILD_PATH" $CMAKE_BUILD_ARGS
164+
echo "::endgroup::"
165+
166+
- name: Test
167+
id: test
168+
if: inputs.enable-tests == 'true'
169+
shell: bash
170+
env:
171+
CMAKE_BUILD_TYPE: ${{ inputs.cmake-build-type }}
172+
CMAKE_BUILD_PATH: ${{ steps.cmake-config.outputs.build-path }}
173+
run: |
174+
GTEST_XML_PATH="$CMAKE_BUILD_PATH/test_results"
175+
mkdir -p "$GTEST_XML_PATH"
176+
177+
if command -v cygpath &> /dev/null; then
178+
GTEST_XML_PATH=$(cygpath -w "$GTEST_XML_PATH")
179+
fi
180+
181+
export GTEST_OUTPUT="xml:$GTEST_XML_PATH/"
182+
echo "gtest-xml-path=$GTEST_XML_PATH" >> "$GITHUB_OUTPUT"
183+
184+
CTEST_ARGS=""
185+
if [ -n "${{ inputs.ctest-preset }}" ]; then
186+
CTEST_ARGS="--preset ${{ inputs.ctest-preset }}"
187+
fi
188+
189+
if [ -n "$CMAKE_BUILD_TYPE" ]; then
190+
CTEST_ARGS="$CTEST_ARGS --build-config $CMAKE_BUILD_TYPE"
191+
fi
192+
193+
SUDO_CMD=""
194+
if command -v sudo &> /dev/null; then
195+
SUDO_CMD="sudo -E"
196+
fi
197+
198+
echo "::group::CTest"
199+
$SUDO_CMD ctest --test-dir "$CMAKE_BUILD_PATH" --output-on-failure $CTEST_ARGS
200+
echo "::endgroup::"

.github/workflows/ci-sandbox.yml

Lines changed: 67 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
runs-on: windows-latest
2525
name: Test Intel oneAPI Setup
2626
timeout-minutes: 30
27+
if: false
2728
steps:
2829
- name: Checkout
2930
uses: actions/checkout@v4
@@ -49,7 +50,6 @@ jobs:
4950
runs-on: windows-latest
5051
name: ${{ matrix.name }}
5152
# if: ${{ ! github.event.pull_request.draft }}
52-
if: false
5353

5454
concurrency:
5555
group: ${{ github.workflow }}-${{ github.head_ref }}-${{ matrix.name }}
@@ -59,47 +59,72 @@ jobs:
5959
fail-fast: false
6060
matrix:
6161
include:
62-
- name: Windows VS 2022 x64 Release
63-
cmake-build-type: Release
64-
cmake-defines:
65-
cmake-generator: "Visual Studio 17 2022"
66-
enable-tests: true
67-
- name: Windows VS 2022 x64 Debug
68-
cmake-build-type: Debug
69-
cmake-defines:
70-
cmake-generator: "Visual Studio 17 2022"
71-
enable-tests: true
72-
disable-ccache : true
73-
- name: Windows VS 2022 Win32 Release
74-
cmake-build-type: Release
75-
cmake-defines: -A Win32
76-
cmake-generator: "Visual Studio 17 2022"
77-
enable-32bit: true
78-
enable-tests: true
79-
disable-ccache : true
80-
81-
- name: Windows Clang Release
82-
cmake-build-type: Release
83-
cmake-defines: >-
84-
-DCMAKE_C_COMPILER=clang
85-
-DCMAKE_CXX_COMPILER=clang++
86-
cmake-generator: Ninja
87-
enable-tests: true
88-
disable-ccache : true
62+
# - name: Windows VS 2022 x64 Release
63+
# cmake-build-type: Release
64+
# cmake-defines:
65+
# cmake-generator: "Visual Studio 17 2022"
66+
# enable-tests: true
67+
# - name: Windows VS 2022 x64 Debug
68+
# cmake-build-type: Debug
69+
# cmake-defines:
70+
# cmake-generator: "Visual Studio 17 2022"
71+
# enable-tests: true
72+
# disable-ccache : true
73+
# - name: Windows VS 2022 Win32 Release
74+
# cmake-build-type: Release
75+
# cmake-defines: -A Win32
76+
# cmake-generator: "Visual Studio 17 2022"
77+
# enable-32bit: true
78+
# enable-tests: true
79+
# disable-ccache : true
80+
81+
# - name: Windows Clang Release
82+
# cmake-build-type: Release
83+
# cmake-defines: >-
84+
# -DCMAKE_C_COMPILER=clang
85+
# -DCMAKE_CXX_COMPILER=clang++
86+
# cmake-generator: Ninja
87+
# enable-tests: true
88+
# disable-ccache : true
89+
90+
# - name: Windows GCC Release
91+
# cmake-build-type: Release
92+
# cmake-defines: >-
93+
# -DCMAKE_C_COMPILER=gcc
94+
# -DCMAKE_CXX_COMPILER=g++
95+
# "-DCMAKE_CXX_FLAGS=-Wa,-mbig-obj -Wno-deprecated-declarations -Wno-error=conversion-null"
96+
# "-DCMAKE_C_FLAGS=-Wa,-mbig-obj"
97+
# cmake-generator: Ninja
98+
# # Tests are disabled due to:
99+
# # - test_device_modules memory corruption
100+
# # - Python tests module resolution issues
101+
# enable-tests: false
102+
# disable-ccache: true
89103

90-
- name: Windows GCC Release
104+
- name: Windows Intel oneAPI Release
91105
cmake-build-type: Release
92106
cmake-defines: >-
93-
-DCMAKE_C_COMPILER=gcc
94-
-DCMAKE_CXX_COMPILER=g++
95-
"-DCMAKE_CXX_FLAGS=-Wa,-mbig-obj -Wno-deprecated-declarations -Wno-error=conversion-null"
96-
"-DCMAKE_C_FLAGS=-Wa,-mbig-obj"
107+
-DCMAKE_C_COMPILER=icx
108+
-DCMAKE_CXX_COMPILER=icx
109+
-DOPENDAQ_ENABLE_OPCUA=OFF
110+
-DDAQMODULES_EMPTY_MODULE=OFF
111+
-DDAQMODULES_OPENDAQ_CLIENT_MODULE=OFF
112+
-DDAQMODULES_OPENDAQ_SERVER_MODULE=OFF
113+
-DDAQMODULES_REF_DEVICE_MODULE=OFF
114+
-DDAQMODULES_REF_FB_MODULE=OFF
115+
-DDAQMODULES_AUDIO_DEVICE_MODULE=OFF
116+
-DDAQMODULES_BASIC_CSV_RECORDER_MODULE=OFF
117+
-DOPENDAQ_ENABLE_WEBSOCKET_STREAMING=OFF
118+
-DAPP_ENABLE_WEBPAGE_EXAMPLES=OFF
119+
-DOPENDAQ_DOCUMENTATION_TESTS=OFF
120+
-DOPENDAQ_ENABLE_NATIVE_STREAMING=OFF
121+
-DOPENDAQ_ENABLE_OPCUA_INTEGRATION_TESTS=OFF
97122
cmake-generator: Ninja
98-
# Tests are disabled due to:
99-
# - test_device_modules memory corruption
100-
# - Python tests module resolution issues
123+
enable-32bit: false
101124
enable-tests: false
102-
disable-ccache : true
125+
disable-ccache: true
126+
use-oneapi: true
127+
103128

104129
steps:
105130
# TODO: Remove these 3 steps before merging to openDAQ/openDAQ
@@ -135,6 +160,10 @@ jobs:
135160
cmake-config-args: ${{ matrix.cmake-defines }}
136161
cmake-build-type: ${{ matrix.cmake-build-type }}
137162
target-arch: ${{ matrix.enable-32bit == true && 'x86-32' || '' }}
163+
164+
- name: Setup Intel oneAPI
165+
if: matrix.use-oneapi == true
166+
uses: ./.github/actions/setup-compiler-oneapi
138167
# TODO: End of sandbox-only steps
139168

140169
- name: Build and Test
@@ -145,7 +174,7 @@ jobs:
145174
cmake-config-preset: ${{ env.cmake_preset }}
146175
cmake-config-args: ${{ matrix.cmake-defines }}
147176
cmake-generator: ${{ matrix.cmake-generator }}
148-
enable-tests: true
177+
enable-tests: ${{ matrix.enable-tests == true }}
149178
enable-32bit: ${{ matrix.enable-32bit == true }}
150179
ctest-preset: ${{ env.ctest_preset }}
151180

0 commit comments

Comments
 (0)