Skip to content

Commit

Permalink
chore(fix): add riscv64 cross-compile build option (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
leet4tari authored Oct 7, 2024
1 parent 38d0cc1 commit 3cb1955
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.3.1](https://github.com/tari-project/randomx-rs/compare/v1.3.1...v1.3.0) (2024-10-07)
### Feature

* add cross-compile target ```make``` arguments for riscv64 (riscv64gc-unknown-linux-gnu)

## [1.3.0](https://github.com/tari-project/randomx-rs/compare/v1.3.0...v1.2.1) (2023-11-01)
### Feature

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repository = "https://github.com/tari-project/randomx-rs"
homepage = "https://tari.com"
readme = "README.md"
license = "BSD-3-Clause"
version = "1.3.0"
version = "1.3.1"
edition = "2018"
build = "build.rs"

Expand Down
34 changes: 34 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use std::{
env,
fs,
Expand Down Expand Up @@ -95,6 +96,39 @@ fn main() {
std::io::stderr().write_all(&c.stderr).unwrap();
assert!(c.status.success());

let m = Command::new("cmake")
.arg("--build")
.arg(".")
.arg("--config")
.arg("Release")
.output()
.expect("failed to execute Make");
println!("status: {}", m.status);
std::io::stdout().write_all(&m.stdout).unwrap();
std::io::stderr().write_all(&m.stderr).unwrap();
assert!(m.status.success());
} else if target.contains("riscv64gc-unknown-linux-gnu") {
let c = Command::new("cmake")
.arg("-D")
.arg("ARCH=rv64gc")
.arg("-D")
.arg("ARCH_ID=riscv64")
.arg("-D")
.arg("CMAKE_CROSSCOMPILING=true")
.arg("-D")
.arg("CMAKE_SYSTEM_PROCESSOR=riscv64")
.arg("-D")
.arg("CMAKE_C_COMPILER=/usr/bin/riscv64-linux-gnu-gcc")
.arg("-D")
.arg("CMAKE_CXX_COMPILER=/usr/bin/riscv64-linux-gnu-g++")
.arg(repo_dir.to_str().unwrap())
.output()
.expect("failed to execute CMake");
println!("status: {}", c.status);
std::io::stdout().write_all(&c.stdout).unwrap();
std::io::stderr().write_all(&c.stderr).unwrap();
assert!(c.status.success());

let m = Command::new("cmake")
.arg("--build")
.arg(".")
Expand Down

0 comments on commit 3cb1955

Please sign in to comment.