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

macOS dylib #34

Merged
merged 1 commit into from
Aug 9, 2023
Merged
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
10 changes: 6 additions & 4 deletions Makefile.darwin
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@ DARWIN_TARGET?=10.11
DARWIN_SDKROOT?=$(shell xcrun --sdk macosx --show-sdk-path)

binding_darwin: binding_darwin_x86_64 binding_darwin_arm64
lipo $(DARWIN_BINDING_OUTPUT)/x86_64.dylib $(DARWIN_BINDING_OUTPUT)/arm64.dylib -create -output $(DARWIN_BINDING_OUTPUT)/$(BINDING_NAME).dylib
rm $(DARWIN_BINDING_OUTPUT)/x86_64.dylib $(DARWIN_BINDING_OUTPUT)/arm64.dylib $(DARWIN_BINDING_OUTPUT)/*.h
lipo $(DARWIN_BINDING_OUTPUT)/x86_64/$(BINDING_NAME).dylib $(DARWIN_BINDING_OUTPUT)/arm64/$(BINDING_NAME).dylib -create -output $(DARWIN_BINDING_OUTPUT)/$(BINDING_NAME).dylib
rm -rf $(DARWIN_BINDING_OUTPUT)/x86_64/$(BINDING_NAME).dylib $(DARWIN_BINDING_OUTPUT)/arm64/$(BINDING_NAME).dylib $(DARWIN_BINDING_OUTPUT)/arm64 $(DARWIN_BINDING_OUTPUT)/x86_64

binding_darwin_x86_64:
BINDING_FILE=$(DARWIN_OUTPUT)/x86_64.dylib \
BINDING_FILE=$(DARWIN_OUTPUT)/x86_64/$(BINDING_NAME).dylib \
BUILD_MODE="c-shared" \
CGO_CFLAGS=-mmacosx-version-min=$(DARWIN_TARGET) \
MACOSX_DEPLOYMENT_TARGET=$(DARWIN_TARGET) \
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 \
make binding
install_name_tool -id @rpath/$(BINDING_NAME).dylib $(DARWIN_BINDING_OUTPUT)/x86_64/$(BINDING_NAME).dylib

binding_darwin_arm64:
BINDING_FILE=$(DARWIN_OUTPUT)/arm64.dylib \
BINDING_FILE=$(DARWIN_OUTPUT)/arm64/$(BINDING_NAME).dylib \
BUILD_MODE="c-shared" \
CGO_CFLAGS=-mmacosx-version-min=$(DARWIN_TARGET) \
MACOSX_DEPLOYMENT_TARGET=$(DARWIN_TARGET) \
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 \
SDKROOT=$(DARWIN_SDKROOT) \
make binding
install_name_tool -id @rpath/$(BINDING_NAME).dylib $(DARWIN_BINDING_OUTPUT)/arm64/$(BINDING_NAME).dylib

binding_darwin_archive_x86_64:
BINDING_FILE=$(DARWIN_OUTPUT)/x86_64.a \
Expand Down
Loading