From f1a7ae3d123890de5a32a5f235725ad1b653b97f Mon Sep 17 00:00:00 2001 From: dzhwinter Date: Sun, 19 Aug 2018 19:10:02 -0700 Subject: [PATCH] "fix cmake error" --- CMakeLists.txt | 2 +- cmake/configure.cmake | 4 ---- cmake/cudnn.cmake | 2 ++ cmake/flags.cmake | 5 +++++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 684477271..ba9af2cc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,6 +212,7 @@ elseif() set(WITH_ANAKIN OFF CACHE STRING "Anakin is used in GPU only now." FORCE) endif() +include(flags) # set paddle compile flags include(cudnn) # set cudnn libraries, must before configure include(cupti) include(configure) # add paddle env configuration @@ -220,7 +221,6 @@ include(package) # set paddle packages include(ccache) # set ccache for compilation include(util) # set unittest and link libs include(rdma) # set rdma libraries -include(flags) # set paddle compile flags include(version) # set PADDLE_VERSION include(coveralls) # set code coverage include(inference_lib) # add paddle fluid inference libraries diff --git a/cmake/configure.cmake b/cmake/configure.cmake index d14162e0a..ae90a529b 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -56,10 +56,6 @@ if(NOT CMAKE_CROSSCOMPILING) set(SIMD_FLAG ${SSE3_FLAG}) endif() endif() -if(UNIX AND NOT APPLE) - # except apple from nix*Os family - set(LINUX TRUE) -endif(UNIX AND NOT APPLE) if(NOT WITH_GOLANG) add_definitions(-DPADDLE_WITHOUT_GOLANG) diff --git a/cmake/cudnn.cmake b/cmake/cudnn.cmake index 84b1b44be..cd5153392 100644 --- a/cmake/cudnn.cmake +++ b/cmake/cudnn.cmake @@ -42,11 +42,13 @@ endif(WIN32) if(Apple) set(CUDNN_LIB_NAME "libcudnn.dylib" "libcudnn.so") endif(Apple) + find_library(CUDNN_LIBRARY NAMES ${CUDNN_LIB_NAME} # libcudnn_static.a PATHS ${CUDNN_CHECK_LIBRARY_DIRS} ${CUDNN_INCLUDE_DIR} ${__libpath_hist} NO_DEFAULT_PATH DOC "Path to cuDNN library.") + if(CUDNN_INCLUDE_DIR AND CUDNN_LIBRARY) set(CUDNN_FOUND ON) else() diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 1120677a3..8ac157c4d 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -142,6 +142,11 @@ else() ${GPU_COMMON_FLAGS}) endif() +if(UNIX AND NOT APPLE) + # except apple from nix*Os family + set(LINUX TRUE) +endif(UNIX AND NOT APPLE) + foreach(flag ${COMMON_FLAGS}) safe_set_cflag(CMAKE_C_FLAGS ${flag}) -- GitLab