Skip to content

Commit

Permalink
Support Apple Silicon CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Nov 18, 2020
1 parent 0781983 commit 7ff4803
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ endif()
# Compiler dependent flags
include (CheckCCompilerFlag)
if(UNIX)
check_c_compiler_flag(-msse2 HAS_SSE2)
if(HAS_SSE2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mfpmath=sse")
if(ARM_CRC)
# wrong answer for Apple Silicon: check_cxx_compiler_flag(-msse2 HAS_SSE2)
else()
check_c_compiler_flag(-msse2 HAS_SSE2)
if(HAS_SSE2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mfpmath=sse")
endif()
endif()
endif()

Expand Down
5 changes: 5 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ CFLAGS=-O3 -DHAVE_ZLIB
ifeq "$(OMP)" "1"
CNAME= gcc-9
CFLAGS+=-fopenmp -flto
#to get full file path:
#gcc-9 --print-file-name=libgomp.a
#LFLAGS+= /usr/local/Cellar/gcc/9.2.0_3/lib/gcc/9/gcc/x86_64-apple-darwin18/9.2.0/../../../libgomp.a
LFLAGS+= -static-libgcc -static-libstdc++ -L.

endif

all:
Expand Down

0 comments on commit 7ff4803

Please sign in to comment.