Skip to content

Commit b6f4e59

Browse files
committed
Set up MSVC environment in Windows CI
1 parent cc449e4 commit b6f4e59

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ jobs:
4444
with:
4545
target: ${{ matrix.target }}
4646

47+
- name: Setup MSVC developer command prompt
48+
if: matrix.target == 'x86_64-pc-windows-msvc'
49+
uses: ilammy/msvc-dev-cmd@v1
50+
with:
51+
arch: x64
52+
4753
- name: Build workspace
4854
run: cargo build --release --target ${{ matrix.target }}
4955

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ jobs:
4444
with:
4545
target: ${{ matrix.target }}
4646

47+
- name: Setup MSVC developer command prompt
48+
if: matrix.target == 'x86_64-pc-windows-msvc'
49+
uses: ilammy/msvc-dev-cmd@v1
50+
with:
51+
arch: x64
52+
4753
- name: Extract version from tag
4854
id: version
4955
shell: bash

crates/dsview-sys/build.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,9 @@ fn build_static_object_archive(
373373
target: &TargetInfo,
374374
) {
375375
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR is set by Cargo"));
376-
let object_path = out_dir.join(format!("{archive_stem}.o"));
377-
let archive_path = out_dir.join(format!("libdsview_sys_{archive_stem}.a"));
378376
if target.is_windows_msvc() {
377+
let object_path = out_dir.join(format!("{archive_stem}.obj"));
378+
let archive_path = out_dir.join(format!("dsview_sys_{archive_stem}.lib"));
379379
let mut compile = Command::new("cl");
380380
compile
381381
.arg("/nologo")
@@ -422,6 +422,8 @@ fn build_static_object_archive(
422422
return;
423423
}
424424

425+
let object_path = out_dir.join(format!("{archive_stem}.o"));
426+
let archive_path = out_dir.join(format!("libdsview_sys_{archive_stem}.a"));
425427
let mut compile = Command::new("cc");
426428
compile.arg("-c").arg(source).arg("-o").arg(&object_path);
427429
for include in include_flags {

0 commit comments

Comments
 (0)