third_party.cmake 2.1 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(cub)
W
willzhang4a58 已提交
12

W
willzhang4a58 已提交
13
find_package(CUDA REQUIRED)
W
willzhang4a58 已提交
14
find_package(CuDNN REQUIRED)
W
willzhang4a58 已提交
15

16 17
if (NOT WIN32)
  set(BLA_VENDOR "Intel10_64lp_seq")
W
Will Zhang 已提交
18 19 20 21 22
  find_package(BLAS)
  if (NOT BLAS_FOUND)
    set(BLA_VENDOR "All")
    find_package(BLAS)
  endif()
23 24 25 26
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 已提交
27
message(STATUS "Blas Lib: " ${BLAS_LIBRARIES})
W
willzhang4a58 已提交
28

W
willzhang4a58 已提交
29 30 31 32 33 34
set(oneflow_third_party_libs
    ${CMAKE_THREAD_LIBS_INIT}
    ${ZLIB_STATIC_LIBRARIES}
    ${GLOG_STATIC_LIBRARIES}
    ${GFLAGS_STATIC_LIBRARIES}
    ${GOOGLETEST_STATIC_LIBRARIES}
J
Jinhui Yuan 已提交
35
    ${GOOGLEMOCK_STATIC_LIBRARIES}
W
willzhang4a58 已提交
36 37
    ${PROTOBUF_STATIC_LIBRARIES}
    ${GRPC_STATIC_LIBRARIES}
J
jiyuan 已提交
38
    ${farmhash_STATIC_LIBRARIES}
W
willzhang4a58 已提交
39
    ${CUDA_CUBLAS_LIBRARIES}
W
willzhang4a58 已提交
40
    ${CUDNN_LIBRARIES}
W
willzhang4a58 已提交
41
    ${BLAS_LIBRARIES}
W
willzhang4a58 已提交
42 43
)

44 45 46
if(WIN32)
  # static gflags lib requires "PathMatchSpecA" defined in "ShLwApi.Lib"
  list(APPEND oneflow_third_party_libs "ShLwApi.Lib")
47
  list(APPEND oneflow_third_party_libs "Ws2_32.lib")
48 49
endif()

W
willzhang4a58 已提交
50 51 52 53 54 55 56 57 58
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 已提交
59 60
  googlemock_copy_headers_to_destination
  googlemock_copy_libs_to_destination
W
willzhang4a58 已提交
61 62 63 64 65
  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 已提交
66
  cub_copy_headers_to_destination
W
willzhang4a58 已提交
67 68 69 70 71 72 73
)

include_directories(
    ${ZLIB_INCLUDE_DIR}
    ${GFLAGS_INCLUDE_DIR}
    ${GLOG_INCLUDE_DIR}
    ${GOOGLETEST_INCLUDE_DIR}
J
Jinhui Yuan 已提交
74
    ${GOOGLEMOCK_INCLUDE_DIR}
W
willzhang4a58 已提交
75 76
    ${PROTOBUF_INCLUDE_DIR}
    ${GRPC_INCLUDE_DIR}
W
willzhang4a58 已提交
77
    ${CUDNN_INCLUDE_DIRS}
C
chengtbf 已提交
78
    ${CUB_INCLUDE_DIR}
W
willzhang4a58 已提交
79
)