Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake (Windows): Added support for ninja build and some fixes/changes #16763

Merged
merged 2 commits into from
Feb 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion tensorflow/contrib/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,21 @@ if (tensorflow_ENABLE_GPU)
list(APPEND CMAKE_LIBRARY_PATH "${tensorflow_CUDA_LIBRARY_PATH}/stubs")
endif (NOT WIN32)

find_package(CUDA ${tensorflow_CUDA_VERSION} REQUIRED)
# later command will make use of the value in tensorflow_CUDA_VERSION
find_package(CUDA ${tensorflow_CUDA_VERSION} REQUIRED EXACT)

# Test compatibility of compiler on CUDA
try_compile(CUDA_TEST_COMPILE_C
${CMAKE_CURRENT_BINARY_DIR}/tests/cuda
${CMAKE_CURRENT_SOURCE_DIR}/tests/cuda/compatibility_test.c
CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${CUDA_INCLUDE_DIRS})
try_compile(CUDA_TEST_COMPILE_CXX
${CMAKE_CURRENT_BINARY_DIR}/tests/cuda
${CMAKE_CURRENT_SOURCE_DIR}/tests/cuda/compatibility_test.cc
CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${CUDA_INCLUDE_DIRS})
if(NOT (CUDA_TEST_COMPILE_C AND CUDA_TEST_COMPILE_CXX))
message(FATAL_ERROR "Selected compiler (or version) is not supported for CUDA")
endif()

# by default we assume compute cabability 3.5 and 5.2. If you change this change it in
# CUDA_NVCC_FLAGS and cuda_config.h below
Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/cmake/external/boringssl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ExternalProject_Add(boringssl
GIT_TAG ${boringssl_TAG}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
# BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${boringssl_STATIC_LIBRARIES}
INSTALL_COMMAND ""
CMAKE_CACHE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=${tensorflow_ENABLE_POSITION_INDEPENDENT_CODE}
Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/cmake/external/farmhash.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if(WIN32)
URL_HASH ${farmhash_HASH}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${farmhash_STATIC_LIBRARIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/patches/farmhash/CMakeLists.txt ${farmhash_BUILD}
INSTALL_DIR ${farmhash_INSTALL}
CMAKE_CACHE_ARGS
Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/cmake/external/fft2d.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ if(WIN32)
URL_HASH ${fft2d_HASH}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${fft2d_STATIC_LIBRARIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/patches/fft2d/CMakeLists.txt ${fft2d_BUILD}/src/fft2d/CMakeLists.txt
INSTALL_DIR ${fft2d_INSTALL}
CMAKE_CACHE_ARGS
Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/cmake/external/gif.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if(WIN32)
PREFIX gif
URL ${gif_URL}
URL_HASH ${gif_HASH}
BUILD_BYPRODUCTS ${gif_STATIC_LIBRARIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/patches/gif/CMakeLists.txt ${gif_BUILD}
INSTALL_DIR ${gif_INSTALL}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
Expand Down
10 changes: 8 additions & 2 deletions tensorflow/contrib/cmake/external/googletest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ set(googletest_BUILD ${CMAKE_CURRENT_BINARY_DIR}/googletest/)
set(googletest_TAG ec44c6c1675c25b9827aacd08c02433cccde7780)

if(WIN32)
set(googletest_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/googletest/src/googletest/googletest/$(Configuration)/gtest.lib)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set(googletest_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/googletest/src/googletest/googletest/$(Configuration)/gtest.lib)
else()
set(googletest_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/googletest/src/googletest/googletest/gtest.lib)
endif()
else()
set(googletest_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/googletest/src/googletest/googletest/${CMAKE_BUILD_TYPE}/gtest.a)
Expand All @@ -33,6 +38,7 @@ ExternalProject_Add(googletest
GIT_TAG ${googletest_TAG}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${googletest_STATIC_LIBRARIES}
#PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/patches/grpc/CMakeLists.txt ${GRPC_BUILD}
INSTALL_COMMAND ""
CMAKE_CACHE_ARGS
Expand Down
16 changes: 12 additions & 4 deletions tensorflow/contrib/cmake/external/grpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ set(GRPC_BUILD ${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc)
set(GRPC_TAG 730b778632e79cc3c96ad237f282d687ee325ce7)

if(WIN32)
set(grpc_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc/Release/grpc++_unsecure.lib
${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc/Release/grpc_unsecure.lib
${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc/Release/gpr.lib)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set(grpc_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc/Release/grpc++_unsecure.lib
${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc/Release/grpc_unsecure.lib
${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc/Release/gpr.lib)
else()
set(grpc_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc/grpc++_unsecure.lib
${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc/grpc_unsecure.lib
${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc/gpr.lib)
endif()
else()
set(grpc_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/grpc/src/grpc/libgrpc++_unsecure.a
Expand All @@ -40,6 +47,7 @@ ExternalProject_Add(grpc
GIT_TAG ${GRPC_TAG}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${grpc_STATIC_LIBRARIES}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release --target grpc++_unsecure
COMMAND ${CMAKE_COMMAND} --build . --config Release --target grpc_cpp_plugin
INSTALL_COMMAND ""
Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/cmake/external/highwayhash.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ExternalProject_Add(highwayhash
GIT_TAG ${highwayhash_TAG}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${highwayhash_STATIC_LIBRARIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/patches/highwayhash/CMakeLists.txt ${highwayhash_BUILD}
INSTALL_DIR ${highwayhash_INSTALL}
CMAKE_CACHE_ARGS
Expand Down
15 changes: 9 additions & 6 deletions tensorflow/contrib/cmake/external/jemalloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ if (WIN32)
${jemalloc_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/jemalloc/src/jemalloc/include/msvc_compat
)
set(jemalloc_ADDITIONAL_CMAKE_OPTIONS -A x64)
set(jemalloc_STATIC_LIBRARIES ${jemalloc_BUILD}/Release/jemalloc.lib)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set(jemalloc_STATIC_LIBRARIES ${jemalloc_BUILD}/Release/jemalloc.lib)
else()
set(jemalloc_STATIC_LIBRARIES ${jemalloc_BUILD}/jemalloc.lib)
endif()
else()
set(jemalloc_STATIC_LIBRARIES ${jemalloc_BUILD}/Release/jemalloc.a)
endif()
Expand All @@ -36,12 +39,12 @@ ExternalProject_Add(jemalloc
URL_HASH ${jemalloc_HASH}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ${CMAKE_COMMAND}
BUILD_BYPRODUCTS ${jemalloc_STATIC_LIBRARIES}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release --target jemalloc
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step."
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
-Dwith-jemalloc-prefix:STRING=jemalloc_
-Dwithout-export:BOOL=ON
${jemalloc_ADDITIONAL_CMAKE_OPTIONS}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release --target jemalloc
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step."
)
1 change: 1 addition & 0 deletions tensorflow/contrib/cmake/external/jpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ if (WIN32)
PREFIX jpeg
URL ${jpeg_URL}
URL_HASH ${jpeg_HASH}
BUILD_BYPRODUCTS ${jpeg_STATIC_LIBRARIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/patches/jpeg/CMakeLists.txt ${jpeg_BUILD}
INSTALL_DIR ${jpeg_INSTALL}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
Expand Down
7 changes: 6 additions & 1 deletion tensorflow/contrib/cmake/external/jsoncpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ set(jsoncpp_LIBRARIES ${jsoncpp_BUILD}/obj/so/libjsoncpp.so)
set(jsoncpp_INCLUDES ${jsoncpp_BUILD})

if(WIN32)
set(jsoncpp_STATIC_LIBRARIES ${jsoncpp_BUILD}/$(Configuration)/jsoncpp.lib)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set(jsoncpp_STATIC_LIBRARIES ${jsoncpp_BUILD}/$(Configuration)/jsoncpp.lib)
else()
set(jsoncpp_STATIC_LIBRARIES ${jsoncpp_BUILD}/jsoncpp.lib)
endif()
else()
set(jsoncpp_STATIC_LIBRARIES ${jsoncpp_BUILD}/libjsoncpp.a)
endif()
Expand All @@ -40,6 +44,7 @@ ExternalProject_Add(jsoncpp
GIT_TAG ${jsoncpp_TAG}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${jsoncpp_STATIC_LIBRARIES}
INSTALL_COMMAND ""
CMAKE_CACHE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=${tensorflow_ENABLE_POSITION_INDEPENDENT_CODE}
Expand Down
13 changes: 7 additions & 6 deletions tensorflow/contrib/cmake/external/lmdb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ set(lmdb_HASH SHA256=108532fb94c6f227558d45be3f3347b52539f0f58290a7bb31ec06c462d
set(lmdb_BUILD ${CMAKE_BINARY_DIR}/lmdb/src/lmdb)
set(lmdb_INSTALL ${CMAKE_BINARY_DIR}/lmdb/install)

if(WIN32)
set(lmdb_STATIC_LIBRARIES ${lmdb_INSTALL}/lib/lmdb.lib)
else()
set(lmdb_STATIC_LIBRARIES ${lmdb_INSTALL}/lib/liblmdb.a)
endif()

ExternalProject_Add(lmdb
PREFIX lmdb
URL ${lmdb_URL}
URL_HASH ${lmdb_HASH}
BUILD_BYPRODUCTS ${lmdb_STATIC_LIBRARIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/patches/lmdb/CMakeLists.txt ${lmdb_BUILD}
INSTALL_DIR ${lmdb_INSTALL}
Expand All @@ -35,12 +42,6 @@ ExternalProject_Add(lmdb
-DCMAKE_INSTALL_PREFIX:STRING=${lmdb_INSTALL}
)

if(WIN32)
set(lmdb_STATIC_LIBRARIES ${lmdb_INSTALL}/lib/lmdb.lib)
else()
set(lmdb_STATIC_LIBRARIES ${lmdb_INSTALL}/lib/liblmdb.a)
endif()

set(lmdb_HEADERS
"${lmdb_INSTALL}/include/lmdb.h"
"${lmdb_INSTALL}/include/midl.h"
Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/cmake/external/nsync.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ExternalProject_Add(nsync
GIT_TAG ${nsync_TAG}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${nsync_STATIC_LIBRARIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/patches/nsync/CMakeLists.txt ${nsync_BUILD}
INSTALL_DIR ${nsync_INSTALL}
CMAKE_CACHE_ARGS
Expand Down
17 changes: 14 additions & 3 deletions tensorflow/contrib/cmake/external/png.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@ set(png_BUILD ${CMAKE_BINARY_DIR}/png/src/png)
set(png_INSTALL ${CMAKE_BINARY_DIR}/png/install)

if(WIN32)
set(png_STATIC_LIBRARIES
debug ${CMAKE_BINARY_DIR}/png/install/lib/libpng12_staticd.lib
optimized ${CMAKE_BINARY_DIR}/png/install/lib/libpng12_static.lib)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set(png_STATIC_LIBRARIES
debug ${CMAKE_BINARY_DIR}/png/install/lib/libpng12_staticd.lib
optimized ${CMAKE_BINARY_DIR}/png/install/lib/libpng12_static.lib)
else()
if(CMAKE_BUILD_TYPE EQUAL Debug)
set(png_STATIC_LIBRARIES
${CMAKE_BINARY_DIR}/png/install/lib/libpng12_staticd.lib)
else()
set(png_STATIC_LIBRARIES
${CMAKE_BINARY_DIR}/png/install/lib/libpng12_static.lib)
endif()
endif()
else()
set(png_STATIC_LIBRARIES ${CMAKE_BINARY_DIR}/png/install/lib/libpng12.a)
endif()
Expand All @@ -38,6 +48,7 @@ ExternalProject_Add(png
DEPENDS zlib
URL ${png_URL}
URL_HASH ${png_HASH}
BUILD_BYPRODUCTS ${png_STATIC_LIBRARIES}
INSTALL_DIR ${png_INSTALL}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
CMAKE_CACHE_ARGS
Expand Down
44 changes: 37 additions & 7 deletions tensorflow/contrib/cmake/external/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,34 @@ set(PROTOBUF_URL https://github.com/google/protobuf.git)
set(PROTOBUF_TAG 396336eb961b75f03b25824fe86cf6490fb75e3a)

if(WIN32)
set(protobuf_STATIC_LIBRARIES
debug ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/$(Configuration)/libprotobufd.lib
optimized ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/$(Configuration)/libprotobuf.lib)
set(PROTOBUF_PROTOC_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/$(Configuration)/protoc.exe)
set(PROTOBUF_ADDITIONAL_CMAKE_OPTIONS -Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF -A x64)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set(protobuf_STATIC_LIBRARIES
debug ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/$(Configuration)/libprotobufd.lib
optimized ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/$(Configuration)/libprotobuf.lib)
set(PROTOBUF_PROTOC_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/$(Configuration)/protoc.exe)
else()
if(CMAKE_BUILD_TYPE EQUAL Debug)
set(protobuf_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/libprotobufd.lib)
else()
set(protobuf_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/libprotobuf.lib)
endif()
set(PROTOBUF_PROTOC_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/protoc.exe)
endif()

# This section is to make sure CONFIGURE_COMMAND use the same generator settings
set(PROTOBUF_GENERATOR_PLATFORM)
if (CMAKE_GENERATOR_PLATFORM)
set(PROTOBUF_GENERATOR_PLATFORM -A ${CMAKE_GENERATOR_PLATFORM})
endif()
set(PROTOBUF_GENERATOR_TOOLSET)
if (CMAKE_GENERATOR_TOOLSET)
set(PROTOBUF_GENERATOR_TOOLSET -T ${CMAKE_GENERATOR_TOOLSET})
endif()
set(PROTOBUF_ADDITIONAL_CMAKE_OPTIONS -Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF
-G${CMAKE_GENERATOR} ${PROTOBUF_GENERATOR_PLATFORM} ${PROTOBUF_GENERATOR_TOOLSET})
# End of section
else()
set(protobuf_STATIC_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/libprotobuf.a)
set(PROTOBUF_PROTOC_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/protoc)
Expand All @@ -36,16 +59,23 @@ ExternalProject_Add(protobuf
GIT_TAG ${PROTOBUF_TAG}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${PROTOBUF_PROTOC_EXECUTABLE} ${protobuf_STATIC_LIBRARIES}
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf
# SOURCE_SUBDIR cmake/ # Requires CMake 3.7, this will allow removal of CONFIGURE_COMMAND
# CONFIGURE_COMMAND resets some settings made in CMAKE_CACHE_ARGS and the generator used
CONFIGURE_COMMAND ${CMAKE_COMMAND} cmake/
-Dprotobuf_BUILD_TESTS=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=${tensorflow_ENABLE_POSITION_INDEPENDENT_CODE}
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
-Dprotobuf_BUILD_TESTS:BOOL=OFF
-DZLIB_ROOT=${ZLIB_INSTALL}
${PROTOBUF_ADDITIONAL_CMAKE_OPTIONS}
INSTALL_COMMAND ""
CMAKE_CACHE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=${tensorflow_ENABLE_POSITION_INDEPENDENT_CODE}
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
-Dprotobuf_BUILD_TESTS:BOOL=OFF
-Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF
-DZLIB_ROOT:STRING=${ZLIB_INSTALL}
)
7 changes: 6 additions & 1 deletion tensorflow/contrib/cmake/external/re2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ set(re2_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/re2/install)
set(re2_TAG e7efc48)

if(WIN32)
set(re2_STATIC_LIBRARIES ${re2_BUILD}/$(Configuration)/re2.lib)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set(re2_STATIC_LIBRARIES ${re2_BUILD}/$(Configuration)/re2.lib)
else()
set(re2_STATIC_LIBRARIES ${re2_BUILD}/re2.lib)
endif()
else()
set(re2_STATIC_LIBRARIES ${re2_BUILD}/libre2.a)
endif()
Expand All @@ -36,6 +40,7 @@ ExternalProject_Add(re2
GIT_TAG ${re2_TAG}
INSTALL_DIR ${re2_INSTALL}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${re2_STATIC_LIBRARIES}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
CMAKE_CACHE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=${tensorflow_ENABLE_POSITION_INDEPENDENT_CODE}
Expand Down
7 changes: 6 additions & 1 deletion tensorflow/contrib/cmake/external/snappy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ 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)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set(snappy_STATIC_LIBRARIES ${snappy_BUILD}/$(Configuration)/snappy.lib)
else()
set(snappy_STATIC_LIBRARIES ${snappy_BUILD}/snappy.lib)
endif()
else()
set(snappy_STATIC_LIBRARIES ${snappy_BUILD}/libsnappy.a)
endif()
Expand All @@ -35,6 +39,7 @@ ExternalProject_Add(snappy
GIT_TAG ${snappy_TAG}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${snappy_STATIC_LIBRARIES}
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/cmake/external/sqlite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ if (WIN32)
PREFIX sqlite
URL ${sqlite_URL}
URL_HASH ${sqlite_HASH}
BUILD_BYPRODUCTS ${sqlite_STATIC_LIBRARIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/patches/sqlite/CMakeLists.txt ${sqlite_BUILD}
INSTALL_DIR ${sqlite_INSTALL}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
Expand Down
17 changes: 14 additions & 3 deletions tensorflow/contrib/cmake/external/zlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@ set(ZLIB_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/zlib/install)
set(ZLIB_TAG 50893291621658f355bc5b4d450a8d06a563053d)

if(WIN32)
set(zlib_STATIC_LIBRARIES
debug ${CMAKE_CURRENT_BINARY_DIR}/zlib/install/lib/zlibstaticd.lib
optimized ${CMAKE_CURRENT_BINARY_DIR}/zlib/install/lib/zlibstatic.lib)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
set(zlib_STATIC_LIBRARIES
debug ${CMAKE_CURRENT_BINARY_DIR}/zlib/install/lib/zlibstaticd.lib
optimized ${CMAKE_CURRENT_BINARY_DIR}/zlib/install/lib/zlibstatic.lib)
else()
if(CMAKE_BUILD_TYPE EQUAL Debug)
set(zlib_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/zlib/install/lib/zlibstaticd.lib)
else()
set(zlib_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/zlib/install/lib/zlibstatic.lib)
endif()
endif()
else()
set(zlib_STATIC_LIBRARIES
${CMAKE_CURRENT_BINARY_DIR}/zlib/install/lib/libz.a)
Expand All @@ -40,6 +50,7 @@ ExternalProject_Add(zlib
GIT_TAG ${ZLIB_TAG}
INSTALL_DIR ${ZLIB_INSTALL}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${zlib_STATIC_LIBRARIES}
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
CMAKE_CACHE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=${tensorflow_ENABLE_POSITION_INDEPENDENT_CODE}
Expand Down