From ec915f8e482c39416df669eebe4df6f0c7a2afef Mon Sep 17 00:00:00 2001 From: pbalcer Date: Mon, 2 Oct 2023 15:57:54 +0200 Subject: [PATCH] [L0] fix windows cmake scripts --- .github/workflows/cmake.yml | 12 ++++++++++ source/adapters/level_zero/CMakeLists.txt | 29 ++++++++--------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index db24b9fd3b..9edbd459d7 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -266,7 +266,16 @@ jobs: strategy: matrix: os: ['windows-2019', 'windows-2022'] + adapter: [ + {name: None, var: ''}, {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} + ] + + # TODO: building level zero loader on windows-2019 is currently broken + exclude: + - os: 'windows-2019' + adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} build_type: [Debug, Release] + compiler: [{c: cl.exe, cxx: cl.exe}, {c: clang-cl.exe, cxx: clang-cl.exe}] runs-on: ${{matrix.os}} steps: @@ -283,11 +292,14 @@ jobs: run: > cmake -B${{github.workspace}}/build + -DCMAKE_C_COMPILER=${{matrix.compiler.c}} + -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} -DCMAKE_POLICY_DEFAULT_CMP0094=NEW -DUR_ENABLE_TRACING=ON -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_FORMAT_CPP_STYLE=ON + ${{matrix.adapter.var}} # TODO: re-enable when check-generated is fixed for windows runners see #888 # - name: Generate source from spec, check for uncommitted diff diff --git a/source/adapters/level_zero/CMakeLists.txt b/source/adapters/level_zero/CMakeLists.txt index d802059089..117bf2affa 100644 --- a/source/adapters/level_zero/CMakeLists.txt +++ b/source/adapters/level_zero/CMakeLists.txt @@ -23,20 +23,16 @@ if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR) GIT_REPOSITORY ${LEVEL_ZERO_LOADER_REPO} GIT_TAG ${LEVEL_ZERO_LOADER_TAG} ) - set(CMAKE_CXX_FLAGS_BAK "${CMAKE_CXX_FLAGS}") if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX-") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX-") - # FIXME: Unified runtime build fails with /DUNICODE - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /UUNICODE") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /UUNICODE") - # USE_Z7 forces use of /Z7 instead of /Zi which is broken with sccache - set(USE_Z7 ON) + set(USE_Z7 ON) endif() FetchContent_MakeAvailable(level-zero-loader) FetchContent_GetProperties(level-zero-loader) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_BAK}") + target_compile_options(ze_loader PRIVATE + $<$,GNU;Clang;Intel;IntelLLVM>:-Wno-error> + $<$:/WX- /UUNICODE> + ) set(LEVEL_ZERO_LIBRARY ze_loader) set(LEVEL_ZERO_INCLUDE_DIR @@ -56,16 +52,6 @@ target_link_libraries(LevelZeroLoader INTERFACE "${LEVEL_ZERO_LIB_NAME}" ) -# Windows build might have warnings (both MSVC and ICX), disable Werror etc. -if (NOT WIN32) - target_compile_options(${LEVEL_ZERO_LIB_NAME} PUBLIC - -Wno-unused-but-set-variable - -Wno-pedantic - -Wno-unused-parameter - -Wno-error - ) -endif() - add_library (LevelZeroLoader-Headers INTERFACE) target_include_directories(LevelZeroLoader-Headers INTERFACE "${LEVEL_ZERO_INCLUDE_DIR}" @@ -106,6 +92,11 @@ add_ur_adapter(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.cpp ) +# TODO: fix level_zero adapter conversion warnings +target_compile_options(${TARGET_NAME} PRIVATE + $<$:/wd4267 /wd4805 /wd4244 /D_CRT_SECURE_NO_WARNINGS> +) + set_target_properties(${TARGET_NAME} PROPERTIES VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" SOVERSION "${PROJECT_VERSION_MAJOR}"