4040 # Note the mixed spaces and tabs in the heredocs, see the bash man page
4141 # entry for <<- in the Here Documents section. This allows generated code to
4242 # be indented for readability in the workflow output.
43- if : github.repository_owner == 'oneapi-src'
43+ if : github.repository_owner == 'oneapi-src' && (matrix.os.name != 'windows' || runner.os == 'Windows')
4444 needs : [config]
4545 runs-on : ${{ matrix.os.name == 'windows' && 'windows-latest' || 'ubuntu-latest' }}
4646 strategy :
@@ -111,6 +111,7 @@ jobs:
111111 docker version
112112 docker info
113113 - name : Build image
114+ if : matrix.os.name != 'windows'
114115 run : |
115116 docker info
116117 # Force Docker to use the correct container type
@@ -131,30 +132,46 @@ jobs:
131132 --pull \
132133 --tag ${DOCKER_IMAGE}:${{ needs.config.outputs.ref-slug }} \
133134 - < .github/docker/${{ matrix.os.name }}.Dockerfile
135+ - name : Setup Windows build environment
136+ if : matrix.os.name == 'windows'
137+ run : |
138+ # Install dependencies for Windows native build
139+ choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
140+ choco install ninja -y
141+ # Setup Visual Studio environment
142+ call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
143+ shell : cmd
134144 - name : Build
135145 id : build
136146 run : |
137147 mkdir build
138- docker run \
139- --rm \
140- --interactive \
141- ${{ matrix.os.name == 'windows' && ' \
142- --platform windows/amd64 \
143- --isolation process ' || ' \
144- --platform linux/amd64 '
145- }}\
146- -v '${{ github.workspace }}':${MOUNT_TARGET} \
147- -w ${MOUNT_TARGET}/build \
148- -e CCACHE_BASEDIR=${MOUNT_TARGET} \
149- -e CCACHE_DIR=${MOUNT_TARGET}/ccache \
150- -v '${{ steps.const.outputs.ccache-dir }}':${MOUNT_TARGET}/ccache \
151- ${DOCKER_IMAGE}:${{ needs.config.outputs.ref-slug }} \
152- bash -e -x <<-EOF
148+ if [[ "${{ matrix.os.name }}" == "windows" ]]; then
149+ # Native Windows build without containers
150+ cd build
151+ cmake \
152+ -G "Visual Studio 17 2022" \
153+ -A x64 \
154+ -D CMAKE_BUILD_TYPE=Release \
155+ -D CMAKE_INSTALL_PREFIX="${{ matrix.target == 'install' && '../level-zero-install' || matrix.target == 'package' && 'C:/Program Files' || '' }}" \
156+ -D CPACK_OUTPUT_FILE_PREFIX="${{ github.workspace }}/level-zero-package" \
157+ ..
158+ cmake --build . --config Release --target ${{ matrix.target }}
159+ else
160+ # Container-based build for Linux
161+ docker run \
162+ --rm \
163+ --interactive \
164+ --platform linux/amd64 \
165+ -v '${{ github.workspace }}':${MOUNT_TARGET} \
166+ -w ${MOUNT_TARGET}/build \
167+ -e CCACHE_BASEDIR=${MOUNT_TARGET} \
168+ -e CCACHE_DIR=${MOUNT_TARGET}/ccache \
169+ -v '${{ steps.const.outputs.ccache-dir }}':${MOUNT_TARGET}/ccache \
170+ ${DOCKER_IMAGE}:${{ needs.config.outputs.ref-slug }} \
171+ bash -e -x <<-EOF
153172
154173 cmake \
155- ${{ matrix.os.name != 'windows' && ' \
156- -G Ninja ' || ' '
157- }}\
174+ -G Ninja \
158175 ${{ matrix.arch == 'arm64' && ' \
159176 -D CMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
160177 -D CMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
@@ -167,8 +184,9 @@ jobs:
167184 -D CPACK_OUTPUT_FILE_PREFIX=${MOUNT_TARGET}/level-zero-package \
168185 ..
169186
170- cmake --build . ${PARALLEL} --target ${{ matrix.target }} ${{ matrix.os.name == 'windows' && '--config Release' || '' }}
187+ cmake --build . ${PARALLEL} --target ${{ matrix.target }}
171188
172189 ccache --show-stats
173190
174191 EOF
192+ fi
0 commit comments