Skip to content

Commit 0112320

Browse files
authored
Merge pull request #1847 from lukaszstolarczuk/fix-generate-on-win
[CMake] Enable clang-format command on Windows
2 parents 537d545 + 8128f79 commit 0112320

File tree

4 files changed

+42
-32
lines changed

4 files changed

+42
-32
lines changed

.github/workflows/cmake.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -241,20 +241,6 @@ jobs:
241241
steps:
242242
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
243243

244-
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
245-
with:
246-
python-version: 3.9
247-
248-
- name: Install prerequisites
249-
run: python3 -m pip install -r third_party/requirements.txt
250-
251-
- name: Install doxygen
252-
run: |
253-
$WorkingDir = $PWD.Path
254-
Invoke-WebRequest -Uri https://github.com/doxygen/doxygen/releases/download/Release_1_9_8/doxygen-1.9.8.windows.x64.bin.zip -OutFile "$WorkingDir\doxygen.zip"
255-
Expand-Archive -Path "$WorkingDir\doxygen.zip"
256-
Add-Content $env:GITHUB_PATH "$WorkingDir\doxygen"
257-
258244
- name: Install hwloc
259245
run: vcpkg install hwloc:x64-windows
260246

@@ -272,7 +258,7 @@ jobs:
272258
-DUR_ENABLE_TRACING=ON
273259
-DUR_DEVELOPER_MODE=ON
274260
-DUR_BUILD_TESTS=ON
275-
-DUR_FORMAT_CPP_STYLE=ON
261+
-DUR_FORMAT_CPP_STYLE=OFF
276262
${{matrix.adapter.var}}
277263
278264
- name: Build all

.github/workflows/source-checks.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,59 @@ permissions:
1212
jobs:
1313
source-checks:
1414
name: Source Checks
15-
# TODO: Make this run on Windows (#888)
16-
runs-on: 'ubuntu-22.04'
15+
strategy:
16+
matrix:
17+
os: ['ubuntu-22.04', 'windows-2022']
18+
19+
runs-on: ${{matrix.os}}
1720

1821
steps:
1922
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2023

21-
- name: Install apt packages
24+
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
25+
with:
26+
python-version: 3.9
27+
28+
- name: Install pip packages
29+
run: pip install -r third_party/requirements.txt
30+
31+
- name: "[Lin] Install doxygen"
32+
if: matrix.os == 'ubuntu-22.04'
2233
run: |
2334
sudo apt-get update
2435
sudo apt-get install -y doxygen
2536
26-
- name: Setup PATH
27-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
28-
29-
- name: Install pip packages
30-
run: pip install -r third_party/requirements.txt
37+
- name: "[Win] Install doxygen"
38+
if: matrix.os == 'windows-2022'
39+
run: |
40+
$WorkingDir = $PWD.Path
41+
Invoke-WebRequest -Uri https://github.com/doxygen/doxygen/releases/download/Release_1_9_8/doxygen-1.9.8.windows.x64.bin.zip -OutFile "$WorkingDir\doxygen.zip"
42+
Expand-Archive -Path "$WorkingDir\doxygen.zip"
43+
Add-Content $env:GITHUB_PATH "$WorkingDir\doxygen"
3144
32-
# Required for CMake
33-
- name: Install libhwloc
45+
- name: "[Lin] Install hwloc"
46+
if: matrix.os == 'ubuntu-22.04'
3447
run: .github/scripts/install_hwloc.sh
3548

49+
- name: "[Win] Install hwloc"
50+
if: matrix.os == 'windows-2022'
51+
run: vcpkg install hwloc:x64-windows
52+
3653
- name: Configure CMake
54+
env:
55+
VCPKG_PATH: "C:/vcpkg/packages/hwloc_x64-windows"
3756
run: >
3857
cmake
3958
-B${{github.workspace}}/build
59+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
4060
-DUR_ENABLE_TRACING=OFF
4161
-DCMAKE_BUILD_TYPE=Debug
4262
-DUR_BUILD_TESTS=OFF
4363
-DUR_FORMAT_CPP_STYLE=ON
4464
65+
# Verifying license should be enough on a single OS
4566
- name: Verify that each source file contains a license
67+
if: matrix.os == 'ubuntu-22.04'
4668
run: cmake --build ${{github.workspace}}/build --target verify-licenses
4769

4870
- name: Generate source from spec, check for uncommitted diff

cmake/helpers.cmake

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2023 Intel Corporation
1+
# Copyright (C) 2023-2024 Intel Corporation
22
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
33
# See LICENSE.TXT
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -28,13 +28,14 @@ function(add_cppformat name)
2828
if(${ARGC} EQUAL 0)
2929
return()
3030
else()
31+
# Split args into 2 parts (in Windows the list is probably too long)
32+
list(SUBLIST ARGN 0 250 selected_files_1)
33+
list(SUBLIST ARGN 251 -1 selected_files_2)
3134
add_custom_target(cppformat-${name}
32-
COMMAND ${CLANG_FORMAT}
33-
--style=file
34-
--i
35-
${ARGN}
35+
COMMAND ${CLANG_FORMAT} --style=file --i ${selected_files_1}
36+
COMMAND ${CLANG_FORMAT} --style=file --i ${selected_files_2}
3637
COMMENT "Format CXX source files"
37-
)
38+
)
3839
endif()
3940

4041
add_dependencies(cppformat cppformat-${name})

scripts/templates/stype_map_helpers.hpp.mako

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<%!
2+
import os
23
import re
34
from templates import helper as th
45
%><%
@@ -7,7 +8,7 @@ from templates import helper as th
78
x=tags['$x']
89
X=x.upper()
910
%>
10-
// This file is autogenerated from the template at ${self.template.filename}
11+
// This file is autogenerated from the template at ${os.path.dirname(self.template.filename)}/${os.path.basename(self.template.filename)}
1112

1213
%for obj in th.extract_objs(specs, r"enum"):
1314
%if obj["name"] == '$x_structure_type_t':

0 commit comments

Comments
 (0)