diff --git a/assets/v0.1.0/libgofunc_arm64.h b/assets/v0.1.0/libgofunc_arm64.h new file mode 100644 index 0000000..cecd6e5 --- /dev/null +++ b/assets/v0.1.0/libgofunc_arm64.h @@ -0,0 +1,108 @@ +/* Code generated by cmd/cgo; DO NOT EDIT. */ + +/* package libgofunc */ + + +#line 1 "cgo-builtin-export-prolog" + +#include + +#ifndef GO_CGO_EXPORT_PROLOGUE_H +#define GO_CGO_EXPORT_PROLOGUE_H + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef struct { const char *p; ptrdiff_t n; } _GoString_; +extern size_t _GoStringLen(_GoString_ s); +extern const char *_GoStringPtr(_GoString_ s); +#endif + +#endif + +/* Start of preamble from import "C" comments. */ + + +#line 4 "img.go" + + #include + +#line 1 "cgo-generated-wrapper" + +#line 4 "main.go" + + #include + +#line 1 "cgo-generated-wrapper" + +#line 4 "printer.go" + + #include + +#line 1 "cgo-generated-wrapper" + + +/* End of preamble from import "C" comments. */ + + +/* Start of boilerplate cgo prologue. */ +#line 1 "cgo-gcc-export-header-prolog" + +#ifndef GO_CGO_PROLOGUE_H +#define GO_CGO_PROLOGUE_H + +typedef signed char GoInt8; +typedef unsigned char GoUint8; +typedef short GoInt16; +typedef unsigned short GoUint16; +typedef int GoInt32; +typedef unsigned int GoUint32; +typedef long long GoInt64; +typedef unsigned long long GoUint64; +typedef GoInt64 GoInt; +typedef GoUint64 GoUint; +typedef size_t GoUintptr; +typedef float GoFloat32; +typedef double GoFloat64; +#ifdef _MSC_VER +#if !defined(__cplusplus) || _MSVC_LANG <= 201402L +#include +typedef _Fcomplex GoComplex64; +typedef _Dcomplex GoComplex128; +#else +#include +typedef std::complex GoComplex64; +typedef std::complex GoComplex128; +#endif +#else +typedef float _Complex GoComplex64; +typedef double _Complex GoComplex128; +#endif + +/* + static assertion to make sure the file is being used on architecture + at least with matching size of GoInt. +*/ +typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef _GoString_ GoString; +#endif +typedef void *GoMap; +typedef void *GoChan; +typedef struct { void *t; void *v; } GoInterface; +typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; + +#endif + +/* End of boilerplate cgo prologue. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern char* GenPNG(char* outputPath, char* payload, char* tmpl); +extern GoInt Sum(GoInt a, GoInt b); +extern char* PrintImg(char* printer, char* imagePath); + +#ifdef __cplusplus +} +#endif diff --git a/assets/v0.1.0/libgofunc_armv7a.h b/assets/v0.1.0/libgofunc_armv7a.h new file mode 100644 index 0000000..9c7e888 --- /dev/null +++ b/assets/v0.1.0/libgofunc_armv7a.h @@ -0,0 +1,108 @@ +/* Code generated by cmd/cgo; DO NOT EDIT. */ + +/* package libgofunc */ + + +#line 1 "cgo-builtin-export-prolog" + +#include + +#ifndef GO_CGO_EXPORT_PROLOGUE_H +#define GO_CGO_EXPORT_PROLOGUE_H + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef struct { const char *p; ptrdiff_t n; } _GoString_; +extern size_t _GoStringLen(_GoString_ s); +extern const char *_GoStringPtr(_GoString_ s); +#endif + +#endif + +/* Start of preamble from import "C" comments. */ + + +#line 4 "img.go" + + #include + +#line 1 "cgo-generated-wrapper" + +#line 4 "main.go" + + #include + +#line 1 "cgo-generated-wrapper" + +#line 4 "printer.go" + + #include + +#line 1 "cgo-generated-wrapper" + + +/* End of preamble from import "C" comments. */ + + +/* Start of boilerplate cgo prologue. */ +#line 1 "cgo-gcc-export-header-prolog" + +#ifndef GO_CGO_PROLOGUE_H +#define GO_CGO_PROLOGUE_H + +typedef signed char GoInt8; +typedef unsigned char GoUint8; +typedef short GoInt16; +typedef unsigned short GoUint16; +typedef int GoInt32; +typedef unsigned int GoUint32; +typedef long long GoInt64; +typedef unsigned long long GoUint64; +typedef GoInt32 GoInt; +typedef GoUint32 GoUint; +typedef size_t GoUintptr; +typedef float GoFloat32; +typedef double GoFloat64; +#ifdef _MSC_VER +#if !defined(__cplusplus) || _MSVC_LANG <= 201402L +#include +typedef _Fcomplex GoComplex64; +typedef _Dcomplex GoComplex128; +#else +#include +typedef std::complex GoComplex64; +typedef std::complex GoComplex128; +#endif +#else +typedef float _Complex GoComplex64; +typedef double _Complex GoComplex128; +#endif + +/* + static assertion to make sure the file is being used on architecture + at least with matching size of GoInt. +*/ +typedef char _check_for_32_bit_pointer_matching_GoInt[sizeof(void*)==32/8 ? 1:-1]; + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef _GoString_ GoString; +#endif +typedef void *GoMap; +typedef void *GoChan; +typedef struct { void *t; void *v; } GoInterface; +typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; + +#endif + +/* End of boilerplate cgo prologue. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern char* GenPNG(char* outputPath, char* payload, char* tmpl); +extern GoInt Sum(GoInt a, GoInt b); +extern char* PrintImg(char* printer, char* imagePath); + +#ifdef __cplusplus +} +#endif diff --git a/assets/v0.1.0/libgofunc_x64.h b/assets/v0.1.0/libgofunc_x64.h new file mode 100644 index 0000000..cecd6e5 --- /dev/null +++ b/assets/v0.1.0/libgofunc_x64.h @@ -0,0 +1,108 @@ +/* Code generated by cmd/cgo; DO NOT EDIT. */ + +/* package libgofunc */ + + +#line 1 "cgo-builtin-export-prolog" + +#include + +#ifndef GO_CGO_EXPORT_PROLOGUE_H +#define GO_CGO_EXPORT_PROLOGUE_H + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef struct { const char *p; ptrdiff_t n; } _GoString_; +extern size_t _GoStringLen(_GoString_ s); +extern const char *_GoStringPtr(_GoString_ s); +#endif + +#endif + +/* Start of preamble from import "C" comments. */ + + +#line 4 "img.go" + + #include + +#line 1 "cgo-generated-wrapper" + +#line 4 "main.go" + + #include + +#line 1 "cgo-generated-wrapper" + +#line 4 "printer.go" + + #include + +#line 1 "cgo-generated-wrapper" + + +/* End of preamble from import "C" comments. */ + + +/* Start of boilerplate cgo prologue. */ +#line 1 "cgo-gcc-export-header-prolog" + +#ifndef GO_CGO_PROLOGUE_H +#define GO_CGO_PROLOGUE_H + +typedef signed char GoInt8; +typedef unsigned char GoUint8; +typedef short GoInt16; +typedef unsigned short GoUint16; +typedef int GoInt32; +typedef unsigned int GoUint32; +typedef long long GoInt64; +typedef unsigned long long GoUint64; +typedef GoInt64 GoInt; +typedef GoUint64 GoUint; +typedef size_t GoUintptr; +typedef float GoFloat32; +typedef double GoFloat64; +#ifdef _MSC_VER +#if !defined(__cplusplus) || _MSVC_LANG <= 201402L +#include +typedef _Fcomplex GoComplex64; +typedef _Dcomplex GoComplex128; +#else +#include +typedef std::complex GoComplex64; +typedef std::complex GoComplex128; +#endif +#else +typedef float _Complex GoComplex64; +typedef double _Complex GoComplex128; +#endif + +/* + static assertion to make sure the file is being used on architecture + at least with matching size of GoInt. +*/ +typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef _GoString_ GoString; +#endif +typedef void *GoMap; +typedef void *GoChan; +typedef struct { void *t; void *v; } GoInterface; +typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; + +#endif + +/* End of boilerplate cgo prologue. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern char* GenPNG(char* outputPath, char* payload, char* tmpl); +extern GoInt Sum(GoInt a, GoInt b); +extern char* PrintImg(char* printer, char* imagePath); + +#ifdef __cplusplus +} +#endif diff --git a/build_lib.sh b/build_lib.sh index ca66668..42df23b 100755 --- a/build_lib.sh +++ b/build_lib.sh @@ -1,7 +1,9 @@ #!/bin/bash -export PATH=$HOME/apps/go1.22.12/bin:$PATH -go version +APP_NAME="libgofunc" +VERSION="${1:-v0.1.0}" +OUTPUT_DIR="assets" +BUILD_DIR="build" # need Android NDK NDK_HOME="$HOME/Android/Sdk/ndk/28.2.13676358" # <--- CHECK YOUR VERSION @@ -45,25 +47,29 @@ elif [ "$OS" = "Linux" ]; then echo "Building for Android x86_64..." CC="$TOOLCHAIN/x86_64-linux-android$API-clang" \ CGO_ENABLED=1 GOOS=android GOARCH=amd64 \ - go build -buildmode=c-shared -o ./build/libgofunc_x64.so . + go build -buildmode=c-shared -o $OUTPUT_DIR/$VERSION/libgofunc_x64.so . echo "Building for Android ARM64..." CC="$TOOLCHAIN/aarch64-linux-android$API-clang" \ CGO_ENABLED=1 GOOS=android GOARCH=arm64 \ - go build -buildmode=c-shared -o ./build/libgofunc_arm64.so . + go build -buildmode=c-shared -o $OUTPUT_DIR/$VERSION/libgofunc_arm64.so . echo "Building for Android ARMv7..." CC="$TOOLCHAIN/armv7a-linux-androideabi$API-clang" \ CGO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 \ - go build -buildmode=c-shared -o ./build/libgofunc_armv7a.so . + go build -buildmode=c-shared -o $OUTPUT_DIR/$VERSION/libgofunc_armv7a.so . - cp ./build/libgofunc_x64.so $HOME/ws/forward_pos/native/android/x86_64/libgofunc.so - cp ./build/libgofunc_arm64.so $HOME/ws/forward_pos/native/android/arm64-v8a/libgofunc.so - cp ./build/libgofunc_armv7a.so $HOME/ws/forward_pos/native/android/armeabi-v7a/libgofunc.so - cp ./build/libgofunc_armv7a.so $HOME/ws/forward_pos/native/android/armeabi-v7a/libgofunc.so + # cp ./assets/libgofunc_x64.so $HOME/ws/forward_pos/native/android/x86_64/libgofunc.so + # cp ./assets/libgofunc_arm64.so $HOME/ws/forward_pos/native/android/arm64-v8a/libgofunc.so + # cp ./assets/libgofunc_armv7a.so $HOME/ws/forward_pos/native/android/armeabi-v7a/libgofunc.so + + # ARCHIVE_NAME="${APP_NAME}-${VERSION}.tar.gz" + # tar -czf "${OUTPUT_DIR}/${ARCHIVE_NAME}" -C "${BUILD_DIR}" . else echo "Unsupported OS: $OS" exit 1 fi -echo "Done!" \ No newline at end of file +echo "Done!" +echo "Artifacts:" +ls -lh "${OUTPUT_DIR}"