Skip to content

Commit

Permalink
Add lnux arm64 build scripts for go sample
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonmojo committed Jan 17, 2025
1 parent 4ad37be commit e2d330b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Samples/Beyond.NET.Sample.Go/build_dependencies_linux_arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -e

cd "../Beyond.NET.Sample.Managed"
./publish_managed

cd "../../Generator/Beyond.NET.CodeGenerator.CLI"
./publish_linux_arm64

cd "../../Samples"
echo "Generating .NET Native Bindings"
../Generator/Beyond.NET.CodeGenerator.CLI/bin/Release/linux-arm64/publish/beyondnetgen "Beyond.NET.Sample_Config.json"

cd "Beyond.NET.Sample.Native"
./publish_linux_arm64
38 changes: 38 additions & 0 deletions Samples/Beyond.NET.Sample.Go/build_linux_arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

set -e

CGO_ENABLED=1
export CGO_ENABLED

GOOS=linux
export GOOS

CC=clang
export CC

go clean -modcache

OUTPUT_PRODUCT_NAME="gobeyond"
LIBRARY_NAME="BeyondDotNETSampleNative"
LIBRARY_FILE_NAME="lib${LIBRARY_NAME}.so"

BUILD_DIR="bin"

echo "Making directory for ${OUTPUT_PRODUCT_NAME} build"
mkdir -p "${BUILD_DIR}"

OUTPUT_FILE_PATH_ARM64="${OUTPUT_PRODUCT_NAME}"

./build_dependencies_linux_arm64

rm -f "${LIBRARY_FILE_NAME}"
ln -s "../Beyond.NET.Sample.Native/bin/Release/linux-arm64/publish/${LIBRARY_FILE_NAME}" "${LIBRARY_FILE_NAME}"

cd "${BUILD_DIR}"

echo "Copying native library"
cp "../../Beyond.NET.Sample.Native/bin/Release/linux-arm64/publish/${LIBRARY_FILE_NAME}" "${LIBRARY_FILE_NAME}"

echo "Building ${OUTPUT_PRODUCT_NAME} for ARM64"
GOARCH=arm64 go build -o "${OUTPUT_FILE_PATH_ARM64}" ../

0 comments on commit e2d330b

Please sign in to comment.