build-macos: fix cmake config for arm64

This commit is contained in:
sguo35 2022-04-04 12:36:13 -07:00 committed by Ivan
parent afae58b231
commit 219ddf3e11
2 changed files with 16 additions and 5 deletions

2
3rdparty/llvm.cmake vendored
View File

@ -70,7 +70,7 @@ if(WITH_LLVM)
endif()
if(COMPILER_ARM)
set(LLVM_LIBS ${LLVM_LIBS} LLVMX86CodeGen LLVMX86AsmParser LLVMARMCodeGen LLVMARMAsmParser)
set(LLVM_LIBS ${LLVM_LIBS} LLVMX86CodeGen LLVMX86AsmParser LLVMARMCodeGen LLVMARMAsmParser LLVMAArch64CodeGen LLVMAArch64AsmParser)
endif()
if(WIN32 OR CMAKE_SYSTEM MATCHES "Linux")

View File

@ -21,7 +21,11 @@ else()
CHECK_CXX_COMPILER_FLAG("-no-pie" HAS_NO_PIE)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
CHECK_CXX_COMPILER_FLAG("-msse -msse2 -mcx16" COMPILER_X86)
CHECK_CXX_COMPILER_FLAG("-march=armv8.1-a" COMPILER_ARM)
if (APPLE)
CHECK_CXX_COMPILER_FLAG("-march=armv8.4-a" COMPILER_ARM)
else()
CHECK_CXX_COMPILER_FLAG("-march=armv8.1-a" COMPILER_ARM)
endif()
add_compile_options(-Wall)
add_compile_options(-fno-exceptions)
@ -32,7 +36,11 @@ else()
endif()
if (COMPILER_ARM)
add_compile_options(-march=armv8.1-a)
if (APPLE)
add_compile_options(-march=armv8.4-a)
else()
add_compile_options(-march=armv8.1-a)
endif()
endif()
add_compile_options(-Werror=old-style-cast)
@ -93,8 +101,11 @@ else()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-stdlib=libc++)
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-image_base,0x10000 -Wl,-pagezero_size,0x10000")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie")
if (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-image_base,0x10000 -Wl,-pagezero_size,0x10000")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie")
endif()
elseif(WIN32)
set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC)