third_party.cmake 2.4 KB
Newer Older
W
willzhang4a58 已提交
1 2 3 4 5 6 7 8
if (NOT WIN32)
  find_package(Threads)
endif()

include(zlib)
include(protobuf)
include(googletest)
include(gflags)
W
willzhang4a58 已提交
9
include(glog)
W
willzhang4a58 已提交
10
include(grpc)
J
Jinhui Yuan 已提交
11
include(eigen)
W
willzhang4a58 已提交
12 13 14
if (BUILD_CUDA)
  include(cub)
endif()
W
willzhang4a58 已提交
15

W
willzhang4a58 已提交
16 17 18 19 20 21 22 23 24 25 26 27
if (BUILD_CUDA)
  find_package(CUDA REQUIRED)
  add_definitions(-DWITH_CUDA)
endif()

if (BUILD_CUDNN)
  if (NOT BUILD_CUDA)
    message(FATAL_ERROR "BUILD_CUDNN without BUILD_CUDA")
  endif()
  find_package(CuDNN REQUIRED)
  add_definitions(-DWITH_CUDNN)
endif()
W
willzhang4a58 已提交
28

29 30
if (NOT WIN32)
  set(BLA_VENDOR "Intel10_64lp_seq")
W
Will Zhang 已提交
31 32 33 34 35
  find_package(BLAS)
  if (NOT BLAS_FOUND)
    set(BLA_VENDOR "All")
    find_package(BLAS)
  endif()
36 37 38 39
else()
  set(MKL_LIB_PATH "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2017/windows/mkl/lib/intel64_win")
  set(BLAS_LIBRARIES ${MKL_LIB_PATH}/mkl_core_dll.lib ${MKL_LIB_PATH}/mkl_sequential_dll.lib ${MKL_LIB_PATH}/mkl_intel_lp64_dll.lib)
endif()
W
willzhang4a58 已提交
40
message(STATUS "Found Blas Lib: " ${BLAS_LIBRARIES})
W
willzhang4a58 已提交
41

W
willzhang4a58 已提交
42 43 44 45 46
set(oneflow_third_party_libs
    ${CMAKE_THREAD_LIBS_INIT}
    ${GLOG_STATIC_LIBRARIES}
    ${GFLAGS_STATIC_LIBRARIES}
    ${GOOGLETEST_STATIC_LIBRARIES}
J
Jinhui Yuan 已提交
47
    ${GOOGLEMOCK_STATIC_LIBRARIES}
W
willzhang4a58 已提交
48 49
    ${PROTOBUF_STATIC_LIBRARIES}
    ${GRPC_STATIC_LIBRARIES}
W
willzhang4a58 已提交
50
    ${ZLIB_STATIC_LIBRARIES}
J
jiyuan 已提交
51
    ${farmhash_STATIC_LIBRARIES}
W
willzhang4a58 已提交
52
    ${CUDA_CUBLAS_LIBRARIES}
W
willzhang4a58 已提交
53
    ${CUDNN_LIBRARIES}
W
willzhang4a58 已提交
54
    ${BLAS_LIBRARIES}
W
willzhang4a58 已提交
55
    ${CMAKE_DL_LIBS}
W
willzhang4a58 已提交
56 57
)

58 59 60
if(WIN32)
  # static gflags lib requires "PathMatchSpecA" defined in "ShLwApi.Lib"
  list(APPEND oneflow_third_party_libs "ShLwApi.Lib")
61
  list(APPEND oneflow_third_party_libs "Ws2_32.lib")
62 63
endif()

W
willzhang4a58 已提交
64 65 66 67 68 69 70 71 72
set(oneflow_third_party_dependencies
  zlib_copy_headers_to_destination
  zlib_copy_libs_to_destination
  gflags_copy_headers_to_destination
  gflags_copy_libs_to_destination
  glog_copy_headers_to_destination
  glog_copy_libs_to_destination
  googletest_copy_headers_to_destination
  googletest_copy_libs_to_destination
J
Jinhui Yuan 已提交
73 74
  googlemock_copy_headers_to_destination
  googlemock_copy_libs_to_destination
W
willzhang4a58 已提交
75 76 77 78 79
  protobuf_copy_headers_to_destination
  protobuf_copy_libs_to_destination
  protobuf_copy_binary_to_destination
  grpc_copy_headers_to_destination
  grpc_copy_libs_to_destination
J
Jinhui Yuan 已提交
80
  cub_copy_headers_to_destination
J
Jinhui Yuan 已提交
81
  eigen
W
willzhang4a58 已提交
82 83 84 85 86 87 88
)

include_directories(
    ${ZLIB_INCLUDE_DIR}
    ${GFLAGS_INCLUDE_DIR}
    ${GLOG_INCLUDE_DIR}
    ${GOOGLETEST_INCLUDE_DIR}
J
Jinhui Yuan 已提交
89
    ${GOOGLEMOCK_INCLUDE_DIR}
W
willzhang4a58 已提交
90 91
    ${PROTOBUF_INCLUDE_DIR}
    ${GRPC_INCLUDE_DIR}
W
willzhang4a58 已提交
92
    ${CUDNN_INCLUDE_DIRS}
C
chengtbf 已提交
93
    ${CUB_INCLUDE_DIR}
J
Jinhui Yuan 已提交
94
    ${EIGEN_INCLUDE_DIR}
W
willzhang4a58 已提交
95
)