dev: allow option to force compiling for apple silicon

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
This commit is contained in:
Stefan 2022-05-16 13:22:02 +03:00 committed by Stefan Dunca
parent 05073a9640
commit 23d745fe0a
2 changed files with 4 additions and 3 deletions

View File

@ -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})

View File

@ -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=""