Skip to content

Commit 5425d2e

Browse files
committed
chore(fix): add riscv64 cross-compile build option
1 parent 38d0cc1 commit 5425d2e

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
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.
44

5+
## [1.3.1](https://github.com/tari-project/randomx-rs/compare/v1.3.1...v1.3.0) (2024-10-07)
6+
### Feature
7+
8+
* add cross-compile target ```make``` arguments for riscv64 (riscv64gc-unknown-linux-gnu)
9+
510
## [1.3.0](https://github.com/tari-project/randomx-rs/compare/v1.3.0...v1.2.1) (2023-11-01)
611
### Feature
712

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repository = "https://github.com/tari-project/randomx-rs"
66
homepage = "https://tari.com"
77
readme = "README.md"
88
license = "BSD-3-Clause"
9-
version = "1.3.0"
9+
version = "1.3.1"
1010
edition = "2018"
1111
build = "build.rs"
1212

build.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2020
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
2121
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22+
2223
use std::{
2324
env,
2425
fs,
@@ -95,6 +96,39 @@ fn main() {
9596
std::io::stderr().write_all(&c.stderr).unwrap();
9697
assert!(c.status.success());
9798

99+
let m = Command::new("cmake")
100+
.arg("--build")
101+
.arg(".")
102+
.arg("--config")
103+
.arg("Release")
104+
.output()
105+
.expect("failed to execute Make");
106+
println!("status: {}", m.status);
107+
std::io::stdout().write_all(&m.stdout).unwrap();
108+
std::io::stderr().write_all(&m.stderr).unwrap();
109+
assert!(m.status.success());
110+
} else if target.contains("riscv64gc-unknown-linux-gnu") {
111+
let c = Command::new("cmake")
112+
.arg("-D")
113+
.arg("ARCH=rv64gc")
114+
.arg("-D")
115+
.arg("ARCH_ID=riscv64")
116+
.arg("-D")
117+
.arg("CMAKE_CROSSCOMPILING=true")
118+
.arg("-D")
119+
.arg("CMAKE_SYSTEM_PROCESSOR=riscv64")
120+
.arg("-D")
121+
.arg("CMAKE_C_COMPILER=/usr/bin/riscv64-linux-gnu-gcc")
122+
.arg("-D")
123+
.arg("CMAKE_CXX_COMPILER=/usr/bin/riscv64-linux-gnu-g++")
124+
.arg(repo_dir.to_str().unwrap())
125+
.output()
126+
.expect("failed to execute CMake");
127+
println!("status: {}", c.status);
128+
std::io::stdout().write_all(&c.stdout).unwrap();
129+
std::io::stderr().write_all(&c.stderr).unwrap();
130+
assert!(c.status.success());
131+
98132
let m = Command::new("cmake")
99133
.arg("--build")
100134
.arg(".")

0 commit comments

Comments
 (0)