chore: add support for building on jetson device (#620)

* add support for building on jetson devices

* fix wrong file to check

* refactor the environment check of CTranslate2 building

* chore: remove unused code

* chore: format code
r0.4
Siwen Yu 2023-10-24 15:31:14 +08:00 committed by GitHub
parent d3331c591e
commit 44cac0b1c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 4 deletions

View File

@ -22,3 +22,4 @@ rust-cxx-cmake-bridge = { path = "../rust-cxx-cmake-bridge", optional = true }
[features]
default = ["dep:cmake", "dep:rust-cxx-cmake-bridge"]
link_shared = []
link_static_cuda = []

View File

@ -37,16 +37,28 @@ fn link_static() -> PathBuf {
if cfg!(target_os = "linux") {
config
.define("WITH_MKL", "OFF")
.define("OPENMP_RUNTIME", "NONE")
.define("WITH_OPENBLAS", "ON")
.cxxflag("-msse4.1")
.define("OPENMP_RUNTIME", "NONE");
if cfg!(target_feature = "sse4.1") {
config.cxxflag("-msse4.1");
}
if cfg!(feature = "link_static_cuda") {
config.define("WITH_CUDA", "ON").define("WITH_CUDNN", "ON");
if cfg!(target_arch = "aarch64") {
config.cxxflag("-mcpu=native");
}
} else {
config.define("WITH_OPENBLAS", "ON");
}
} else if cfg!(target_os = "macos") {
config
.define("CMAKE_OSX_ARCHITECTURES", "arm64")
.define("WITH_ACCELERATE", "ON")
.define("WITH_MKL", "OFF")
.define("OPENMP_RUNTIME", "NONE")
.define("WITH_RUY", "ON")
.define("WITH_RUY", "ON");
} else {
panic!("Invalid target")
};