mirror of
https://github.com/pikami/cosmium.git
synced 2025-02-01 21:47:07 +00:00
Cross-Compile Shared Libraries
This commit is contained in:
parent
83f086a2dc
commit
be7a615931
30
.github/workflows/compile-shared-libraries.yml
vendored
Normal file
30
.github/workflows/compile-shared-libraries.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
name: Cross-Compile Shared Libraries
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cross-Compile with xgo
|
||||
uses: crazy-max/ghaction-xgo@v3.1.0
|
||||
with:
|
||||
xgo_version: latest
|
||||
go_version: 1.22.0
|
||||
dest: dist
|
||||
pkg: sharedlibrary
|
||||
prefix: cosmium
|
||||
targets: linux/amd64,linux/arm64,windows/amd64,windows/arm64,darwin/amd64,darwin/arm64
|
||||
v: true
|
||||
buildmode: c-shared
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: shared-libraries
|
||||
path: dist/*
|
7
Makefile
7
Makefile
@ -8,6 +8,8 @@ SERVER_LOCATION=./cmd/server
|
||||
|
||||
SHARED_LIB_LOCATION=./sharedlibrary
|
||||
SHARED_LIB_OPT=-buildmode=c-shared
|
||||
XGO_TARGETS=linux/amd64,linux/arm64,windows/amd64,windows/arm64,darwin/amd64,darwin/arm64
|
||||
GOVERSION=1.22.0
|
||||
|
||||
DIST_DIR=dist
|
||||
|
||||
@ -43,6 +45,11 @@ build-sharedlib-linux-amd64:
|
||||
@echo "Building shared library for Linux x64..."
|
||||
@GOOS=linux GOARCH=amd64 $(GOBUILD) $(SHARED_LIB_OPT) -o $(DIST_DIR)/$(BINARY_NAME)-linux-amd64.so $(SHARED_LIB_LOCATION)
|
||||
|
||||
xgo-compile-sharedlib:
|
||||
@echo "Building shared libraries using xgo..."
|
||||
@mkdir -p $(DIST_DIR)
|
||||
@xgo -targets=$(XGO_TARGETS) -go $(GOVERSION) -buildmode=c-shared -dest=$(DIST_DIR) -out=$(BINARY_NAME) -pkg=$(SHARED_LIB_LOCATION) .
|
||||
|
||||
generate-parser-nosql:
|
||||
pigeon -o ./parsers/nosql/nosql.go ./parsers/nosql/nosql.peg
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user