Enabled SNAPPY in CMake by default, added Linux support

This commit is contained in:
Alexey Petrenko 2017-08-17 16:04:29 +03:00 committed by Martin Wicke
parent b40716f792
commit 3dd53c2c8c
2 changed files with 8 additions and 10 deletions

View File

@ -33,7 +33,7 @@ option(tensorflow_BUILD_MORE_PYTHON_TESTS "Build more python unit tests for cont
option(tensorflow_BUILD_SHARED_LIB "Build TensorFlow as a shared library" OFF)
option(tensorflow_OPTIMIZE_FOR_NATIVE_ARCH "Enable compiler optimizations for the native processor architecture (if available)" ON)
option(tensorflow_WIN_CPU_SIMD_OPTIONS "Enables CPU SIMD instructions")
option(tensorflow_ENABLE_SNAPPY_SUPPORT "Enable SNAPPY compression support" OFF)
option(tensorflow_ENABLE_SNAPPY_SUPPORT "Enable SNAPPY compression support" ON)
if (NOT WIN32)
# Threads: defines CMAKE_THREAD_LIBS_INIT and adds -pthread compile option
@ -206,14 +206,10 @@ if(tensorflow_ENABLE_JEMALLOC_SUPPORT)
include_directories(${jemalloc_INCLUDE_DIRS})
endif()
if(tensorflow_ENABLE_SNAPPY_SUPPORT)
if (WIN32)
include(snappy)
list(APPEND tensorflow_EXTERNAL_LIBRARIES ${snappy_STATIC_LIBRARIES})
list(APPEND tensorflow_EXTERNAL_DEPENDENCIES snappy)
include_directories(${snappy_INCLUDE_DIR})
else()
message(FATAL_ERROR "CMake build with SNAPPY is only supported on Windows at the moment")
endif()
include(snappy)
list(APPEND tensorflow_EXTERNAL_LIBRARIES ${snappy_LIBRARIES})
list(APPEND tensorflow_EXTERNAL_DEPENDENCIES snappy)
include_directories(${snappy_INCLUDE_DIR})
endif()
if(WIN32)
list(APPEND tensorflow_EXTERNAL_LIBRARIES wsock32 ws2_32 shlwapi)

View File

@ -20,7 +20,9 @@ set(snappy_BUILD ${CMAKE_CURRENT_BINARY_DIR}/snappy/src/snappy)
set(snappy_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/snappy/src/snappy)
if(WIN32)
set(snappy_STATIC_LIBRARIES ${snappy_BUILD}/$(Configuration)/snappy.lib)
set(snappy_LIBRARIES ${snappy_BUILD}/$(Configuration)/snappy.lib)
else()
set(snappy_LIBRARIES ${snappy_BUILD}/libsnappy.so)
endif()
set(snappy_HEADERS