From 23d745fe0a61501b847af9c54479d5fa763a51d0 Mon Sep 17 00:00:00 2001 From: Stefan Date: Mon, 16 May 2022 13:22:02 +0300 Subject: [PATCH] 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 --- CMakeLists.txt | 2 +- Makefile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27994ced3..ef207009d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/Makefile b/Makefile index 3ea85e13a..a99b65708 100644 --- a/Makefile +++ b/Makefile @@ -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=""