Skip to content

Commit

Permalink
target-env: prefer target_env and target_os for conditional compilation
Browse files Browse the repository at this point in the history
... over use of target_arch, as with Nitro and upcoming Linux support this is now ambiguous.
  • Loading branch information
DominicPM committed Mar 22, 2021
1 parent 60492f3 commit b5e625c
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion execution-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pinecone = "0.2"
name = "execution_engine"
path = "./src/lib.rs"

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_tstd = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }

[patch.crates-io]
Expand Down
4 changes: 2 additions & 2 deletions platform-services/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ getrandom = { version = "0.1.14", optional = true }
nsm_lib = { git = "https://github.com/aws/aws-nitro-enclaves-nsm-api.git/", branch = "main", package="nsm-lib", optional = true }
nsm_io = { git = "https://github.com/aws/aws-nitro-enclaves-nsm-api.git/", branch = "main", package = "nsm-io", optional = true }

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_trts = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }

[target.'cfg(target_arch = "aarch64")'.dependencies]
[target.'cfg(target_os = "optee")'.dependencies]
optee-utee = { git = "https://github.com/veracruz-project/rust-optee-trustzone-sdk.git", branch = "veracruz", optional = true }

[profile.release]
Expand Down
2 changes: 1 addition & 1 deletion proxy-attestation-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ serde_cbor = {version = "0.11", optional = true }
nitro-enclave-token = { git = "https://github.com/veracruz-project/nitro-enclave-token.git", branch = "main", optional = true }


[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_ucrypto = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_urts = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions runtime-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ nsm_io = { git = "https://github.com/aws/aws-nitro-enclaves-nsm-api.git/", bran
uuid = { version = "0.7", features = ["v4"] }
target_build_utils = "0.1"

[target.'cfg(target_arch = "aarch64")'.dependencies]
[target.'cfg(target_os = "optee")'.dependencies]
libc = { git = "https://github.com/veracruz-project/libc.git", branch = "veracruz", optional = true }
optee-utee-sys = { git = "https://github.com/veracruz-project/rust-optee-trustzone-sdk.git", branch = "veracruz", optional = true }
optee-utee = { git = "https://github.com/veracruz-project/rust-optee-trustzone-sdk.git", branch = "veracruz", optional = true }

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_tstd = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_tcrypto = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion runtime-manager/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use uuid::Uuid;

fn main() -> std::io::Result<()> {
let target = target_build_utils::TargetInfo::new().expect("could not get target info");
if target.target_arch() == "aarch64" {
if target.target_os() == "optee" {
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
let runtime_manager_uuid: &str = &std::fs::read_to_string("../runtime-manager-uuid.txt").unwrap();

Expand Down
2 changes: 1 addition & 1 deletion session-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ webpki = { git = "https://github.com/veracruz-project/webpki.git", branch = "ver
webpki-roots = { git = "https://github.com/veracruz-project/webpki-roots.git" , branch = "veracruz"}
err-derive = "0.2"

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_tstd = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion sgx-root-enclave/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ring = { git = "https://github.com/veracruz-project/ring.git", version = "=0.16.
veracruz-utils = { path = "../veracruz-utils", features = ["sgx"] }
psa-attestation = { path = "../psa-attestation", features = ["sgx"] }

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" }
sgx_tstd = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" }
sgx_tdh = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" }
Expand Down
2 changes: 1 addition & 1 deletion transport-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ err-derive = "0.2"
[build-dependencies]
protoc-rust = { git = "https://github.com/veracruz-project/rust-protobuf.git", branch = "veracruz" }

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_tstd = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion veracruz-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ err-derive = "0.2"
mockall = { version = "0.5.0", optional = true }
mockito = { version = "0.23.1", optional = true }

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_ucrypto = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion veracruz-server-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ lazy_static = "1.4"
regex = "1.4"
local_ipaddress = "0.1.3"

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_ucrypto = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_urts = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions veracruz-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ byteorder = { version = "1.3.2", optional = true }
nix = { version = "0.15", optional = true }
ssh2 = {version = "0.8.3", optional = true }

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_urts = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
runtime-manager-bind = { path = "../runtime-manager-bind", optional = true }
sgx-root-enclave-bind = { path = "../sgx-root-enclave-bind", optional = true }

[target.'cfg(target_arch = "aarch64")'.dependencies]
[target.'cfg(target_os = "optee")'.dependencies]
optee-teec = { git = "https://github.com/veracruz-project/rust-optee-trustzone-sdk.git", branch = "veracruz", optional = true }
# for the error handling
uuid = { version = "0.7", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion veracruz-server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn main() {
"SW" => println!("cargo:rustc-link-lib=dylib=sgx_urts_sim"),
"HW" => {
let target = target_build_utils::TargetInfo::new().unwrap();
if target.target_arch() == "x86_64" {
if target.target_env() == "sgx" {
println!("cargo:rustc-link-lib=dylib=sgx_urts");
println!("cargo:rustc-link-lib=dylib=sgx_tkey_exchange");
println!("cargo:rustc-link-lib=dylib=sgx_uae_service");
Expand Down
2 changes: 1 addition & 1 deletion veracruz-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ log = "=0.4.13"
lazy_static = "1.4"
err-derive = "0.2"

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(target_env = "sgx")'.dependencies]
sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_ucrypto = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_alloc = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
Expand Down

0 comments on commit b5e625c

Please sign in to comment.