Skip to content

Commit ec2407d

Browse files
barracuda156ilyajob05
authored andcommitted
CMakeLists: fix GCC flags
Fixes: #547
1 parent 2fba7fb commit ec2407d

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,17 @@ if(HNSWLIB_EXAMPLES)
162162
endif()
163163
endif()
164164
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
165-
# We enable optimizations in all build types, even in Debug.
166-
add_cxx_flags(
167-
-Ofast -lrt -march=native -w -fopenmp -ftree-vectorize
168-
-ftree-vectorizer-verbose=0)
165+
add_cxx_flags(-Ofast -std=c++11 -DHAVE_CXX0X -fpic -w -fopenmp -ftree-vectorize -ftree-vectorizer-verbose=0)
166+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc|powerpc")
167+
add_cxx_flags(-mtune=native)
168+
message("set -mtune=native flag")
169+
else()
170+
add_cxx_flags(-march=native)
171+
message("set -march=native flag")
172+
endif()
173+
if(NOT APPLE)
174+
add_cxx_flags(-lrt)
175+
endif()
169176
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
170177
if (NOT HNSWLIB_ENABLE_EXCEPTIONS)
171178
# Do not enable exceptions by default. We will enable them on a

0 commit comments

Comments
 (0)