microsoft / windows-drivers-rs

Platform that enables Windows driver development in Rust. Developed by Surface.
Apache License 2.0
1.49k stars 65 forks source link

Unable to make fresh project #104

Closed thebluefish closed 8 months ago

thebluefish commented 8 months ago

I am attempting to work off git main with a fresh project. I have followed the steps outlined in the readme and I am receiving an error:

  |                                                                                                                                                                                                                          
7 | wdk_build::cargo_make::load_rust_driver_makefile()?                                                                                                                                                                      
  |                                                 ^ expected one of `!` or `::`      

I have since updated my Cargo.toml:

[dependencies]
wdk = { git = "https://github.com/microsoft/windows-drivers-rs", branch = "main" }
wdk-alloc = { git = "https://github.com/microsoft/windows-drivers-rs", branch = "main" }
wdk-panic = { git = "https://github.com/microsoft/windows-drivers-rs", branch = "main" }
wdk-sys = { git = "https://github.com/microsoft/windows-drivers-rs", branch = "main" }

[build-dependencies]
wdk-build = { git = "https://github.com/microsoft/windows-drivers-rs", branch = "main" }

And Makefile.toml:

extend = "target/rust-driver-makefile.toml"

[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true

[config]
load_script = '''
#!@rust
//! ```cargo
//! [dependencies]
//! wdk-build = { git = "https://github.com/microsoft/windows-drivers-rs", branch = "main" } # "0.1.0" gives same output
//! ```
#![allow(unused_doc_comments)]

wdk_build::cargo_make::load_rust_driver_makefile()?
'''
thebluefish commented 8 months ago

I finally got some different errors that led me to this working script:

load_script = '''
#!@rust
//! ```cargo
//! [dependencies]
//! wdk-build = { git = "https://github.com/microsoft/windows-drivers-rs", branch = "main" }
//! ```
fn main() -> Result<(), wdk_build::ConfigError> {
    wdk_build::cargo_make::load_rust_driver_makefile()
}
'''