Skip to content

Commit

Permalink
dev: allow option to force compiling for apple silicon
Browse files Browse the repository at this point in the history
Adding the optional switch to satisfy the following requirements

- Desktop nim app requires to build for x86_64
- Desktop C++ app requires native support with Qt6.3+

The default is still forcing x86_64 builds on apple silicon
  • Loading branch information
stefandunca committed Jun 30, 2022
1 parent 05073a9 commit 23d745f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SET(LIB_SHARED_FILE ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/libstatus${CMAKE_SHARE
SET(LIB_HEADER_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/)

add_custom_command(OUTPUT ${LIB_SHARED_FILE}
COMMAND make statusgo-shared-library
COMMAND make FORCE_ARCH=${STATUSGO_FORCE_ARCH} statusgo-shared-library
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

add_custom_target(statusgo_shared_target DEPENDS ${LIB_SHARED_FILE} ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ endif

ifeq ($(detected_OS),Darwin)
GOBIN_SHARED_LIB_EXT := dylib
# Building on M1 is still not supported, so in the meantime we crosscompile by default to amd64
ifeq ("$(shell sysctl -nq hw.optional.arm64)","1")
# Building on M1 is still not supported, so in the meantime we crosscompile to amd64
GOBIN_SHARED_LIB_CFLAGS=CGO_ENABLED=1 GOOS=darwin GOARCH=amd64
FORCE_ARCH ?= amd64
GOBIN_SHARED_LIB_CFLAGS=CGO_ENABLED=1 GOOS=darwin GOARCH=$(FORCE_ARCH)
endif
else ifeq ($(detected_OS),Windows)
GOBIN_SHARED_LIB_CGO_LDFLAGS := CGO_LDFLAGS=""
Expand Down

0 comments on commit 23d745f

Please sign in to comment.