@@ -11,7 +11,7 @@ find_package(Protobuf REQUIRED)
1111
1212# Check protobuf library version.
1313execute_process (COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --version
14- OUTPUT_VARIABLE PROTOBUF_VERSION)
14+ OUTPUT_VARIABLE PROTOBUF_VERSION)
1515string (REPLACE "libprotoc " "" PROTOBUF_VERSION ${PROTOBUF_VERSION} )
1616
1717set (PROTOBUF_3 OFF )
@@ -25,8 +25,8 @@ find_package(ZLIB REQUIRED)
2525find_package (NumPy REQUIRED)
2626find_package (Threads REQUIRED)
2727find_package (AVX QUIET )
28- find_package (Glog)
29- find_package (Gflags QUIET )
28+ find_package (Glog REQUIRED )
29+ find_package (Gflags REQUIRED )
3030find_package (GTest)
3131find_package (Sphinx)
3232find_package (Doxygen)
@@ -40,8 +40,6 @@ option(WITH_AVX "Compile PaddlePaddle with avx intrinsics" ${AVX_FOUND})
4040option (WITH_PYTHON "Compile PaddlePaddle with python interpreter" ON )
4141option (WITH_STYLE_CHECK "Style Check for PaddlePaddle" ${PYTHONINTERP_FOUND} )
4242option (WITH_RDMA "Compile PaddlePaddle with rdma support" OFF )
43- option (WITH_GLOG "Compile PaddlePaddle use glog, otherwise use a log implement internally" ${LIBGLOG_FOUND} )
44- option (WITH_GFLAGS "Compile PaddlePaddle use gflags, otherwise use a flag implement internally" ${GFLAGS_FOUND} )
4543option (WITH_TIMER "Compile PaddlePaddle use timer" OFF )
4644option (WITH_PROFILER "Compile PaddlePaddle use gpu profiler" OFF )
4745option (WITH_TESTING "Compile and run unittest for PaddlePaddle" ${GTEST_FOUND} )
@@ -51,13 +49,7 @@ option(ON_TRAVIS "Running test on travis-ci or not." OFF)
5149option (ON_COVERALLS "Generating code coverage data on coveralls or not." OFF )
5250option (COVERALLS_UPLOAD "Uploading the generated coveralls json." ON )
5351
54- if (NOT CMAKE_BUILD_TYPE )
55- set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
56- "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel"
57- FORCE)
58- endif ()
5952
60- include (enableCXX11)
6153include (cpplint)
6254include (ccache)
6355if (WITH_RDMA)
@@ -75,42 +67,37 @@ include(coveralls)
7567find_package (Git REQUIRED)
7668# version.cmake will get the current PADDLE_VERSION
7769include (version )
78- add_definitions (-DPADDLE_VERSION=\"${PADDLE_VERSION} \")
79-
70+ add_definitions (-DPADDLE_VERSION=${PADDLE_VERSION} )
8071
8172if (NOT WITH_GPU)
8273 add_definitions (-DPADDLE_ONLY_CPU)
8374 add_definitions (-DHPPL_STUB_FUNC)
75+
8476 list (APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu)
8577else ()
86- if (${CUDA_VERSION_MAJOR} GREATER 6)
87- if (COMPILER_SUPPORT_CXX11)
88- LIST (APPEND CUDA_NVCC_FLAGS -std=c++11)
89- endif ()
78+ if (${CUDA_VERSION_MAJOR} VERSION_LESS 7)
79+ message (FATAL_ERROR "Paddle need CUDA >= 7.0 to compile" )
9080 endif ()
9181
92- # TODO(yuyang18): Change it to remove std=c++11 in cuda compile.
93- set (CUDA_PROPAGATE_HOST_FLAGS OFF )
9482 if (NOT CUDNN_FOUND)
9583 message (FATAL_ERROR "Paddle need cudnn to compile" )
9684 endif ()
97- set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-g -O3 --use_fast_math" )
9885
9986 if (WITH_AVX)
10087 set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler ${AVX_FLAG} " )
10188 else (WITH_AVX)
10289 set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler ${SSE3_FLAG} " )
10390 endif (WITH_AVX)
10491
105- if (WITH_DSO)
106- add_definitions (-DPADDLE_USE_DSO)
107- endif (WITH_DSO)
108-
10992 # Include cuda and cudnn
11093 include_directories (${CUDNN_INCLUDE_DIR} )
11194 include_directories (${CUDA_TOOLKIT_INCLUDE} )
11295endif (NOT WITH_GPU)
11396
97+ if (WITH_DSO)
98+ add_definitions (-DPADDLE_USE_DSO)
99+ endif (WITH_DSO)
100+
114101if (WITH_DOUBLE)
115102 add_definitions (-DPADDLE_TYPE_DOUBLE)
116103 set (ACCURACY double)
@@ -147,16 +134,12 @@ else(WITH_RDMA)
147134 add_definitions (-DPADDLE_DISABLE_RDMA)
148135endif (WITH_RDMA)
149136
150- if (WITH_GLOG)
151- add_definitions (-DPADDLE_USE_GLOG)
152- include_directories (${LIBGLOG_INCLUDE_DIR} )
153- endif ()
137+ # glog
138+ include_directories (${LIBGLOG_INCLUDE_DIR} )
154139
155- if (WITH_GFLAGS)
156- add_definitions (-DPADDLE_USE_GFLAGS)
157- add_definitions (-DGFLAGS_NS=${GFLAGS_NAMESPACE} )
158- include_directories (${GFLAGS_INCLUDE_DIRS} )
159- endif ()
140+ #gflags
141+ add_definitions (-DGFLAGS_NS=${GFLAGS_NAMESPACE} )
142+ include_directories (${GFLAGS_INCLUDE_DIRS} )
160143
161144if (WITH_TESTING)
162145 enable_testing ()
@@ -180,5 +163,4 @@ add_subdirectory(paddle)
180163add_subdirectory (python)
181164if (WITH_DOC)
182165 add_subdirectory (doc )
183- add_subdirectory (doc_cn)
184166endif ()
0 commit comments