Skip to content

Commit e6343f4

Browse files
authored
Merge pull request #923 from pbalcer/l0-win-fix-build
[L0] fix windows cmake scripts
2 parents f1c17dc + ec915f8 commit e6343f4

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

.github/workflows/cmake.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,16 @@ jobs:
266266
strategy:
267267
matrix:
268268
os: ['windows-2019', 'windows-2022']
269+
adapter: [
270+
{name: None, var: ''}, {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
271+
]
272+
273+
# TODO: building level zero loader on windows-2019 is currently broken
274+
exclude:
275+
- os: 'windows-2019'
276+
adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
269277
build_type: [Debug, Release]
278+
compiler: [{c: cl.exe, cxx: cl.exe}, {c: clang-cl.exe, cxx: clang-cl.exe}]
270279
runs-on: ${{matrix.os}}
271280

272281
steps:
@@ -283,11 +292,14 @@ jobs:
283292
run: >
284293
cmake
285294
-B${{github.workspace}}/build
295+
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
296+
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
286297
-DCMAKE_POLICY_DEFAULT_CMP0094=NEW
287298
-DUR_ENABLE_TRACING=ON
288299
-DUR_DEVELOPER_MODE=ON
289300
-DUR_BUILD_TESTS=ON
290301
-DUR_FORMAT_CPP_STYLE=ON
302+
${{matrix.adapter.var}}
291303
292304
# TODO: re-enable when check-generated is fixed for windows runners see #888
293305
# - name: Generate source from spec, check for uncommitted diff

source/adapters/level_zero/CMakeLists.txt

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,16 @@ if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR)
2323
GIT_REPOSITORY ${LEVEL_ZERO_LOADER_REPO}
2424
GIT_TAG ${LEVEL_ZERO_LOADER_TAG}
2525
)
26-
set(CMAKE_CXX_FLAGS_BAK "${CMAKE_CXX_FLAGS}")
2726
if(MSVC)
28-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX-")
29-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX-")
30-
# FIXME: Unified runtime build fails with /DUNICODE
31-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /UUNICODE")
32-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /UUNICODE")
33-
# USE_Z7 forces use of /Z7 instead of /Zi which is broken with sccache
34-
set(USE_Z7 ON)
27+
set(USE_Z7 ON)
3528
endif()
3629
FetchContent_MakeAvailable(level-zero-loader)
3730
FetchContent_GetProperties(level-zero-loader)
3831

39-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_BAK}")
32+
target_compile_options(ze_loader PRIVATE
33+
$<$<IN_LIST:$<CXX_COMPILER_ID>,GNU;Clang;Intel;IntelLLVM>:-Wno-error>
34+
$<$<CXX_COMPILER_ID:MSVC>:/WX- /UUNICODE>
35+
)
4036

4137
set(LEVEL_ZERO_LIBRARY ze_loader)
4238
set(LEVEL_ZERO_INCLUDE_DIR
@@ -56,16 +52,6 @@ target_link_libraries(LevelZeroLoader
5652
INTERFACE "${LEVEL_ZERO_LIB_NAME}"
5753
)
5854

59-
# Windows build might have warnings (both MSVC and ICX), disable Werror etc.
60-
if (NOT WIN32)
61-
target_compile_options(${LEVEL_ZERO_LIB_NAME} PUBLIC
62-
-Wno-unused-but-set-variable
63-
-Wno-pedantic
64-
-Wno-unused-parameter
65-
-Wno-error
66-
)
67-
endif()
68-
6955
add_library (LevelZeroLoader-Headers INTERFACE)
7056
target_include_directories(LevelZeroLoader-Headers
7157
INTERFACE "${LEVEL_ZERO_INCLUDE_DIR}"
@@ -106,6 +92,11 @@ add_ur_adapter(${TARGET_NAME}
10692
${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.cpp
10793
)
10894

95+
# TODO: fix level_zero adapter conversion warnings
96+
target_compile_options(${TARGET_NAME} PRIVATE
97+
$<$<CXX_COMPILER_ID:MSVC>:/wd4267 /wd4805 /wd4244 /D_CRT_SECURE_NO_WARNINGS>
98+
)
99+
109100
set_target_properties(${TARGET_NAME} PROPERTIES
110101
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
111102
SOVERSION "${PROJECT_VERSION_MAJOR}"

0 commit comments

Comments
 (0)