CMake changes for CRC32 Optimization on PowerPC
Summary: Closes https://github.com/facebook/rocksdb/pull/2869 Differential Revision: D6791359 Pulled By: ajkr fbshipit-source-id: fdd38df603d84bbcce8d85dd1729d5caa256e6be
This commit is contained in:
parent
35d8e65a04
commit
d6fdd59c63
@ -34,6 +34,9 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8.12)
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
project(rocksdb)
|
project(rocksdb)
|
||||||
|
enable_language(CXX)
|
||||||
|
enable_language(C)
|
||||||
|
enable_language(ASM)
|
||||||
|
|
||||||
if(POLICY CMP0042)
|
if(POLICY CMP0042)
|
||||||
cmake_policy(SET CMP0042 NEW)
|
cmake_policy(SET CMP0042 NEW)
|
||||||
@ -177,6 +180,18 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
|
||||||
|
CHECK_C_COMPILER_FLAG("-maltivec" HAS_ALTIVEC)
|
||||||
|
if(HAS_ALTIVEC)
|
||||||
|
message(STATUS " HAS_ALTIVEC yes")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maltivec")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=power8")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=power8")
|
||||||
|
endif(HAS_ALTIVEC)
|
||||||
|
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
|
||||||
|
|
||||||
option(PORTABLE "build a portable binary" OFF)
|
option(PORTABLE "build a portable binary" OFF)
|
||||||
option(FORCE_SSE42 "force building with SSE4.2, even when PORTABLE=ON" OFF)
|
option(FORCE_SSE42 "force building with SSE4.2, even when PORTABLE=ON" OFF)
|
||||||
if(PORTABLE)
|
if(PORTABLE)
|
||||||
@ -189,9 +204,11 @@ else()
|
|||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2")
|
||||||
else()
|
else()
|
||||||
|
if(NOT HAVE_POWER8)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
@ -625,6 +642,12 @@ set_source_files_properties(
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_POWER8)
|
||||||
|
list(APPEND SOURCES
|
||||||
|
util/crc32c_ppc.c
|
||||||
|
util/crc32c_ppc_asm.S)
|
||||||
|
endif(HAVE_POWER8)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
list(APPEND SOURCES
|
list(APPEND SOURCES
|
||||||
port/win/io_win.cc
|
port/win/io_win.cc
|
||||||
|
Loading…
Reference in New Issue
Block a user