@@ -5,7 +5,7 @@ to generate a header file during the build. To generate both:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
```shell
 | 
					```shell
 | 
				
			||||||
$ cd <path/to/solana/repo>/sdk-c
 | 
					$ cd <path/to/solana/repo>/sdk-c
 | 
				
			||||||
$ cargo build
 | 
					$ SOLANA_H_OUT_DIR="$(pwd)/include" cargo build
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This will generate the static library in `<path/to/solana/repo>/target/deps` and the header file in
 | 
					This will generate the static library in `<path/to/solana/repo>/target/deps` and the header file in
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,17 @@
 | 
				
			|||||||
use std::env;
 | 
					use std::env;
 | 
				
			||||||
use std::fs;
 | 
					use std::fs;
 | 
				
			||||||
use std::path::Path;
 | 
					use std::path::{Path, PathBuf};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
    let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
 | 
					    let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let out_path = Path::new(&crate_dir);
 | 
					    let out_path = if let Ok(path) = env::var("SOLANA_H_OUT_DIR") {
 | 
				
			||||||
    let out_path = out_path.join(Path::new("include"));
 | 
					        PathBuf::from(path)
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        let out_dir = env::var("OUT_DIR").unwrap();
 | 
				
			||||||
 | 
					        let out_dir = Path::new(&out_dir);
 | 
				
			||||||
 | 
					        out_dir.join(Path::new("include"))
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Ensure `out_path` exists
 | 
					    // Ensure `out_path` exists
 | 
				
			||||||
    fs::create_dir_all(&out_path).unwrap_or_else(|err| {
 | 
					    fs::create_dir_all(&out_path).unwrap_or_else(|err| {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user