Merge branch 'master' of https://github.com/unklnik/raylib-go
This commit is contained in:
commit
64b853abaa
59 changed files with 38468 additions and 22154 deletions
|
@ -9,19 +9,22 @@ Export path to Android NDK, point to location where you have unpacked archive:
|
|||
|
||||
Add toolchain bin directory to PATH:
|
||||
|
||||
export PATH=${ANDROID_NDK_HOME}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:${PATH}
|
||||
export PATH=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}
|
||||
|
||||
Export sysroot and libdirs:
|
||||
|
||||
export ANDROID_SYSROOT=${ANDROID_NDK_HOME}/sysroot
|
||||
export ANDROID_PLATFORM=${ANDROID_NDK_HOME}/platforms/android-16/arch-arm
|
||||
export ANDROID_SYSROOT=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot
|
||||
export ANDROID_TOOLCHAIN=${ANDROID_NDK_HOME}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
|
||||
|
||||
Export API version:
|
||||
|
||||
export ANDROID_API=16
|
||||
|
||||
And compile shared library:
|
||||
|
||||
CC="arm-linux-androideabi-gcc" \
|
||||
CGO_CFLAGS="-I${ANDROID_SYSROOT}/usr/include -I${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi --sysroot=${ANDROID_SYSROOT} -D__ANDROID_API__=16" \
|
||||
CGO_LDFLAGS="-L${ANDROID_SYSROOT}/usr/lib/arm-linux-androideabi -L${ANDROID_PLATFORM}/usr/lib -L${ANDROID_TOOLCHAIN}/arm-linux-androideabi/lib -L${ANDROID_TOOLCHAIN}/lib/gcc/arm-linux-androideabi/4.9.x --sysroot=${ANDROID_PLATFORM}" \
|
||||
CC="armv7a-linux-androideabi${ANDROID_API}-clang" \
|
||||
CGO_CFLAGS="-I${ANDROID_SYSROOT}/usr/include -I${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi --sysroot=${ANDROID_SYSROOT} -D__ANDROID_API__=${ANDROID_API}" \
|
||||
CGO_LDFLAGS="-L${ANDROID_SYSROOT}/usr/lib/arm-linux-androideabi/${ANDROID_API} -L${ANDROID_TOOLCHAIN}/arm-linux-androideabi/lib -L${ANDROID_TOOLCHAIN}/lib/gcc/arm-linux-androideabi/4.9.x --sysroot=${ANDROID_SYSROOT}" \
|
||||
CGO_ENABLED=1 GOOS=android GOARCH=arm \
|
||||
go build -buildmode=c-shared -ldflags="-s -w -extldflags=-Wl,-soname,libexample.so" \
|
||||
-o=android/libs/armeabi-v7a/libexample.so
|
||||
|
@ -40,3 +43,6 @@ Or with gradle:
|
|||
./gradlew assembleDebug
|
||||
|
||||
If everything is successfully built apk can be found in bin/ directory or in the android/build/outputs in case `gradle` is used.
|
||||
|
||||
|
||||
For aarch64/arm64 replace `arm-linux-androideabi` with `aarch64-linux-android`, set GOARCH to arm64 and use minimum `ANDROID_API=21`.
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
### Raspberry Pi example
|
||||
|
||||
To cross compile example for Raspberry Pi you will need [RPi toolchain](https://github.com/raspberrypi/tools/tree/master/arm-bcm2708) and [userspace libraries](https://github.com/raspberrypi/firmware) (opt/vc).
|
||||
|
||||
Export path to RPi toolchain:
|
||||
|
||||
export RPI_HOME=/opt/tools/arm-bcm2708/arm-linux-gnueabihf
|
||||
|
||||
Add toolchain bin directory to PATH:
|
||||
|
||||
export PATH=${RPI_HOME}/bin:${PATH}
|
||||
|
||||
And compile example:
|
||||
|
||||
CC=arm-linux-gnueabihf-gcc \
|
||||
CGO_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads --sysroot=${RPI_HOME}/arm-linux-gnueabihf/sysroot" \
|
||||
CGO_LDFLAGS="-L/opt/vc/lib -L/opt/vc/lib64 --sysroot=${RPI_HOME}/arm-linux-gnueabihf/sysroot" \
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=arm go build
|
|
@ -1,21 +0,0 @@
|
|||
package main
|
||||
|
||||
import "github.com/gen2brain/raylib-go/raylib"
|
||||
|
||||
func main() {
|
||||
rl.InitWindow(800, 450, "raylib [rpi] example - basic window")
|
||||
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
for !rl.WindowShouldClose() {
|
||||
rl.BeginDrawing()
|
||||
|
||||
rl.ClearBackground(rl.RayWhite)
|
||||
|
||||
rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LightGray)
|
||||
|
||||
rl.EndDrawing()
|
||||
}
|
||||
|
||||
rl.CloseWindow()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue