From da5c1cc5183363e97a89275a41c5d40f01593436 Mon Sep 17 00:00:00 2001 From: tolya-yanot <1449561+tolya-yanot@users.noreply.github.com> Date: Fri, 10 Jun 2022 16:48:32 +0300 Subject: [PATCH] apple m1 support --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da1945ff2..007e0218a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,12 @@ option(TON_USE_ASAN "Use \"ON\" to enable AddressSanitizer." OFF) option(TON_USE_TSAN "Use \"ON\" to enable ThreadSanitizer." OFF) option(TON_USE_UBSAN "Use \"ON\" to enable UndefinedBehaviorSanitizer." OFF) set(TON_ARCH "native" CACHE STRING "Architecture, will be passed to -march=") +EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE ) + +if (ARCHITECTURE MATCHES "arm64") + set(TON_ARCH "apple-m1") + set(CMAKE_CXX_STANDARD 14) +endif() if (TON_USE_ABSEIL) message("Add abseil-cpp") @@ -204,7 +210,7 @@ find_package(Threads REQUIRED) find_package(ZLIB REQUIRED) if (TON_ARCH AND NOT MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${TON_ARCH}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=${TON_ARCH}") endif() if (THREADS_HAVE_PTHREAD_ARG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")