Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support x86 PerformanceAPI #19

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,25 @@ jobs:
with:
toolchain: stable
override: true
# When under Windows, add the x86 target as well.
- if: runner.os == 'Windows'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: i686-pc-windows-msvc
override: true

- name: cargo build
- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
# When under Windows, run with the x86 target as well.
- if: runner.os == 'Windows'
name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --target i686-pc-windows-msvc

example:
name: Example
Expand All @@ -64,15 +78,36 @@ jobs:
with:
toolchain: stable
override: true
# When under Windows, add the x86 target as well.
- if: runner.os == 'Windows'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: i686-pc-windows-msvc
override: true

- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
# When under Windows, build with the x86 target as well.
- if: runner.os == 'Windows'
name: cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --target i686-pc-windows-msvc --release

- name: run example
uses: actions-rs/cargo@v1
with:
command: run
args: --release --example basic
# When under Windows, run with the x86 target as well.
- if: runner.os == 'Windows'
name: run example
uses: actions-rs/cargo@v1
with:
command: run
args: --target i686-pc-windows-msvc --release --example basic
17 changes: 14 additions & 3 deletions sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::env;

fn runtime() -> &'static str {
if std::env::var("CARGO_CFG_TARGET_FEATURE")
if env::var("CARGO_CFG_TARGET_FEATURE")
.unwrap_or_default()
.contains("crt-static")
{
Expand All @@ -9,10 +11,19 @@ fn runtime() -> &'static str {
}
}

fn arch() -> &'static str {
if env::var("CARGO_CFG_TARGET_ARCH").as_deref() == Ok("x86") {
"x86"
} else {
"x64"
}
}

fn main() {
println!(
"cargo:rustc-link-search={}/external/lib/x64/",
std::env!("CARGO_MANIFEST_DIR")
"cargo:rustc-link-search={}/external/lib/{}/",
std::env!("CARGO_MANIFEST_DIR"),
arch(),
);
println!("cargo:rustc-link-lib=PerformanceAPI_{}", runtime());
}
Binary file modified sys/external/lib/x64/PerformanceAPI_MD.lib
Binary file not shown.
Binary file modified sys/external/lib/x64/PerformanceAPI_MT.lib
Binary file not shown.
Binary file added sys/external/lib/x86/PerformanceAPI_MD.lib
Binary file not shown.
Binary file added sys/external/lib/x86/PerformanceAPI_MT.lib
Binary file not shown.
Loading