Skip to content

Commit

Permalink
Fix STL dir for v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
VonTum committed Nov 6, 2024
1 parent b6ddbe8 commit 83e1291
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
- All builtin names (bool, int, true, false) are now defined in [stl/core.sus](stl/core.sus). This is so the templating system works for all of them.
- Since link_info is now shared between Modules, Types and Constants, we now share all code for templating, typing, etc.
- Instructions are now part of LinkInfo.
## 0.1.1
- Change sus stl installation directory to $HOME/.sus/VERSION/stl
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sus_compiler"
description = "Compiler for the SUS Hardware Design Language"
version = "0.1.0"
version = "0.1.1"
authors = ["Lennart Van Hirtum <[email protected]>"]
edition = "2021"
license = "GPL-3.0-or-later"
Expand All @@ -12,6 +12,8 @@ keywords = ["sus", "fpga", "vlsi", "hdl", "verilog"]
categories = ["compilers", "text-processing"]
rust-version = "1.78"

include = ["/src", "/stl/*", "/README.md", "/LICENSE", "/CHANGELOG.md", "/build.rs", "/rustfmt.toml"]

[workspace]
members = [
"sus-proc-macro",
Expand Down Expand Up @@ -49,6 +51,9 @@ serde_json = {version = "1.0.97", optional = true}
serde = {version = "1.0.156", optional = true}


[build-dependencies]
dirs-next = "2.0.0"

[features]
default = ["lsp"]

Expand Down
25 changes: 16 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
use std::env;
use std::fs;
use std::path::PathBuf;
use std::{fs, path::PathBuf};

fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let install_dir = PathBuf::from(out_dir)
.join("../../..")
.join("share")
.join("sus_compiler")
.join("std");
let mut install_dir = get_sus_dir();
install_dir.push(env!("CARGO_PKG_VERSION"));
install_dir.push("stl");

fs::create_dir_all(&install_dir).expect("Failed to create std_lib directory");

Expand All @@ -18,6 +13,18 @@ fn main() {
println!("cargo:rustc-env=SUS_COMPILER_STD_LIB_PATH={}", install_dir.display());
}

fn get_sus_dir() -> PathBuf {
let mut sus_dir = dirs_next::home_dir().expect("Could not determine home directory");
sus_dir.push(".sus");

// Create the .sus directory if it doesn't exist
if !sus_dir.exists() {
fs::create_dir(&sus_dir).expect("Failed to create .sus directory");
}

sus_dir
}

// Helper function to copy a directory and its contents recursively
fn copy_dir(src: &str, dst: &PathBuf) -> std::io::Result<()> {
for entry in fs::read_dir(src)? {
Expand Down

0 comments on commit 83e1291

Please sign in to comment.