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

Move the enclaves into the same build directory #3775

Merged
merged 1 commit into from
Dec 12, 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
3 changes: 2 additions & 1 deletion consensus/enclave/measurement/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const CONSENSUS_ENCLAVE_PRODUCT_ID: u16 = 1;
const CONSENSUS_ENCLAVE_SECURITY_VERSION: u16 = 8;
const CONSENSUS_ENCLAVE_NAME: &str = "consensus-enclave";
const CONSENSUS_ENCLAVE_DIR: &str = "../trusted";
const CONSENSUS_ENCLAVE_BUILD_DIR: &str = "enclave";

fn main() {
let env = Environment::default();
Expand Down Expand Up @@ -71,7 +72,7 @@ fn main() {
}

builder
.target_dir(env.target_dir().join(CONSENSUS_ENCLAVE_NAME).as_path())
.target_dir(env.target_dir().join(CONSENSUS_ENCLAVE_BUILD_DIR).as_path())
.config_builder
.debug(sgx.sgx_mode() == SgxMode::Simulation || env.profile() != "release")
.prod_id(CONSENSUS_ENCLAVE_PRODUCT_ID)
Expand Down
3 changes: 2 additions & 1 deletion fog/ingest/enclave/measurement/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const INGEST_ENCLAVE_PRODUCT_ID: u16 = 4;
const INGEST_ENCLAVE_SECURITY_VERSION: u16 = 7;
const INGEST_ENCLAVE_NAME: &str = "ingest-enclave";
const INGEST_ENCLAVE_DIR: &str = "../trusted";
const INGEST_ENCLAVE_BUILD_DIR: &str = "enclave";

fn main() {
let env = Environment::default();
Expand Down Expand Up @@ -71,7 +72,7 @@ fn main() {
}

builder
.target_dir(env.target_dir().join(INGEST_ENCLAVE_NAME).as_path())
.target_dir(env.target_dir().join(INGEST_ENCLAVE_BUILD_DIR).as_path())
.config_builder
.debug(sgx.sgx_mode() == SgxMode::Simulation || env.profile() != "release")
.prod_id(INGEST_ENCLAVE_PRODUCT_ID)
Expand Down
3 changes: 2 additions & 1 deletion fog/ledger/enclave/measurement/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const LEDGER_ENCLAVE_PRODUCT_ID: u16 = 2;
const LEDGER_ENCLAVE_SECURITY_VERSION: u16 = 7;
const LEDGER_ENCLAVE_NAME: &str = "ledger-enclave";
const LEDGER_ENCLAVE_DIR: &str = "../trusted";
const LEDGER_ENCLAVE_BUILD_DIR: &str = "enclave";

fn main() {
let env = Environment::default();
Expand Down Expand Up @@ -71,7 +72,7 @@ fn main() {
}

builder
.target_dir(env.target_dir().join(LEDGER_ENCLAVE_NAME).as_path())
.target_dir(env.target_dir().join(LEDGER_ENCLAVE_BUILD_DIR).as_path())
.config_builder
.debug(sgx.sgx_mode() == SgxMode::Simulation || env.profile() != "release")
.prod_id(LEDGER_ENCLAVE_PRODUCT_ID)
Expand Down
3 changes: 2 additions & 1 deletion fog/view/enclave/measurement/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const VIEW_ENCLAVE_PRODUCT_ID: u16 = 3;
const VIEW_ENCLAVE_SECURITY_VERSION: u16 = 7;
const VIEW_ENCLAVE_NAME: &str = "view-enclave";
const VIEW_ENCLAVE_DIR: &str = "../trusted";
const VIEW_ENCLAVE_BUILD_DIR: &str = "enclave";

fn main() {
let env = Environment::default();
Expand Down Expand Up @@ -71,7 +72,7 @@ fn main() {
}

builder
.target_dir(env.target_dir().join(VIEW_ENCLAVE_NAME).as_path())
.target_dir(env.target_dir().join(VIEW_ENCLAVE_BUILD_DIR).as_path())
.config_builder
.debug(sgx.sgx_mode() == SgxMode::Simulation || env.profile() != "release")
.prod_id(VIEW_ENCLAVE_PRODUCT_ID)
Expand Down
8 changes: 4 additions & 4 deletions util/build/enclave/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub struct Builder {
/// The target architecture
target_arch: String,

/// The CARGO_TARGET_DIR path
/// The CARGO_TARGET_DIR path for the enclave
target_dir: PathBuf,

/// The CARGO_TARGET_DIR/profile path
Expand Down Expand Up @@ -258,7 +258,7 @@ impl Builder {
staticlib,
target_arch: env.target_arch().to_owned(),
out_dir: env.out_dir().to_owned(),
target_dir: env.target_dir().to_owned(),
target_dir: env.target_dir().join(enclave_name),
profile_target_dir: env.profile_target_dir().to_owned(),
profile: env.profile().to_owned(),
sgx_version: sgx_version.to_owned(),
Expand All @@ -279,6 +279,7 @@ impl Builder {

/// Set a new "base" target dir to use when building an enclave
pub fn target_dir(&mut self, target_dir: &Path) -> &mut Self {
self.target_dir = target_dir.to_owned();
self.cargo_builder.target_dir(target_dir);
self
}
Expand Down Expand Up @@ -650,8 +651,7 @@ impl Builder {
SgxMode::Simulation => "_sim",
};

// "target/mc_foo_enclave"
let staticlib_target_dir = self.target_dir.join(&self.name);
let staticlib_target_dir = &self.target_dir;

// e.g. "mc_foo_enclave_trusted"
let staticlib_crate_name = self.staticlib.workspace_members[0]
Expand Down
Loading