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

chore(fix): add riscv64 cross-compile build option #71

Merged
merged 1 commit into from
Oct 7, 2024
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
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
Loading