Merge pull request #1017 from gangliao/external
Download, build, install External dependencies via cmakeavx_docs
commit
d41ac09090
@ -1,3 +0,0 @@
|
||||
[submodule "warp-ctc"]
|
||||
path = warp-ctc
|
||||
url = https://github.com/baidu-research/warp-ctc.git
|
@ -1,166 +1,89 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(paddle CXX C)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
set(PROJ_ROOT ${CMAKE_SOURCE_DIR})
|
||||
include(package)
|
||||
find_package(SWIG 2.0)
|
||||
find_package(CUDA QUIET)
|
||||
find_package(Protobuf REQUIRED)
|
||||
|
||||
# Check protobuf library version.
|
||||
execute_process(COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE PROTOBUF_VERSION)
|
||||
string(REPLACE "libprotoc " "" PROTOBUF_VERSION ${PROTOBUF_VERSION})
|
||||
find_package(Sphinx)
|
||||
find_package(CUDA QUIET)
|
||||
find_package(Git REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
set(PROTOBUF_3 OFF)
|
||||
if (${PROTOBUF_VERSION} VERSION_GREATER "3.0.0" OR ${PROTOBUF_VERSION} VERSION_EQUAL "3.0.0")
|
||||
set(PROTOBUF_3 ON)
|
||||
endif()
|
||||
include(system)
|
||||
include(simd)
|
||||
|
||||
find_package(PythonLibs 2.7 REQUIRED)
|
||||
find_package(PythonInterp 2.7 REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(NumPy REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(AVX QUIET)
|
||||
find_package(Glog REQUIRED)
|
||||
find_package(Gflags REQUIRED)
|
||||
find_package(GTest)
|
||||
find_package(Sphinx)
|
||||
find_package(Doxygen)
|
||||
include(cblas)
|
||||
find_program(M4_EXECUTABLE m4)
|
||||
###################### Configurations ###########################
|
||||
###################### Configurations ############################
|
||||
option(WITH_DSO "Compile PaddlePaddle with dynamic linked libraries" ON)
|
||||
option(WITH_GPU "Compile PaddlePaddle with gpu" ${CUDA_FOUND})
|
||||
option(WITH_DOUBLE "Compile PaddlePaddle with double precision, otherwise use single precision" OFF)
|
||||
option(WITH_AVX "Compile PaddlePaddle with avx intrinsics" ${AVX_FOUND})
|
||||
option(WITH_PYTHON "Compile PaddlePaddle with python interpreter" ON)
|
||||
option(WITH_STYLE_CHECK "Style Check for PaddlePaddle" ${PYTHONINTERP_FOUND})
|
||||
option(WITH_STYLE_CHECK "Style Check for PaddlePaddle" ON)
|
||||
option(WITH_RDMA "Compile PaddlePaddle with rdma support" OFF)
|
||||
option(WITH_TIMER "Compile PaddlePaddle use timer" OFF)
|
||||
option(WITH_PROFILER "Compile PaddlePaddle use gpu profiler" OFF)
|
||||
option(WITH_TESTING "Compile and run unittest for PaddlePaddle" ${GTEST_FOUND})
|
||||
option(WITH_TESTING "Compile and run unittest for PaddlePaddle" ON)
|
||||
option(WITH_DOC "Compile PaddlePaddle with documentation" OFF)
|
||||
option(WITH_SWIG_PY "Compile PaddlePaddle with py PaddlePaddle prediction api" ${SWIG_FOUND})
|
||||
option(WITH_SWIG_PY "Compile PaddlePaddle with py PaddlePaddle prediction api" ON)
|
||||
option(ON_TRAVIS "Running test on travis-ci or not." OFF)
|
||||
option(ON_COVERALLS "Generating code coverage data on coveralls or not." OFF)
|
||||
option(COVERALLS_UPLOAD "Uploading the generated coveralls json." ON)
|
||||
|
||||
include(external/zlib) # download, build, install zlib
|
||||
include(external/gflags) # download, build, install gflags
|
||||
include(external/glog) # download, build, install glog
|
||||
include(external/gtest) # download, build, install gtest
|
||||
include(external/protobuf) # download, build, install protobuf
|
||||
include(external/python) # download, build, install python
|
||||
include(external/openblas) # download, build, install openblas
|
||||
include(external/swig) # download, build, install swig
|
||||
include(external/warpctc) # download, build, install warpctc
|
||||
|
||||
include(package) # set paddle packages
|
||||
include(cpplint) # set paddle c++ style
|
||||
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(cudnn) # set cudnn libraries
|
||||
include(version) # set PADDLE_VERSION
|
||||
include(coveralls) # set code coverage
|
||||
include(python_module) # set python module
|
||||
|
||||
include(configure) # add paddle env configuration
|
||||
|
||||
include(cpplint)
|
||||
include(ccache)
|
||||
if(WITH_RDMA)
|
||||
include(rdma)
|
||||
endif()
|
||||
include(util)
|
||||
include(flags)
|
||||
include(cudnn)
|
||||
include(FindPythonModule)
|
||||
include(check_packages)
|
||||
include(swig)
|
||||
include(coveralls)
|
||||
|
||||
# Set PaddlePaddle version to Git tag name or Git commit ID.
|
||||
find_package(Git REQUIRED)
|
||||
# version.cmake will get the current PADDLE_VERSION
|
||||
include(version)
|
||||
add_definitions(-DPADDLE_VERSION=${PADDLE_VERSION})
|
||||
|
||||
if(NOT WITH_GPU)
|
||||
add_definitions(-DPADDLE_ONLY_CPU)
|
||||
add_definitions(-DHPPL_STUB_FUNC)
|
||||
|
||||
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu)
|
||||
else()
|
||||
if(${CUDA_VERSION_MAJOR} VERSION_LESS 7)
|
||||
message(FATAL_ERROR "Paddle need CUDA >= 7.0 to compile")
|
||||
endif()
|
||||
|
||||
if(NOT CUDNN_FOUND)
|
||||
message(FATAL_ERROR "Paddle need cudnn to compile")
|
||||
endif()
|
||||
|
||||
if(WITH_AVX)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler ${AVX_FLAG}")
|
||||
else(WITH_AVX)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler ${SSE3_FLAG}")
|
||||
endif(WITH_AVX)
|
||||
|
||||
# Include cuda and cudnn
|
||||
include_directories(${CUDNN_INCLUDE_DIR})
|
||||
include_directories(${CUDA_TOOLKIT_INCLUDE})
|
||||
endif(NOT WITH_GPU)
|
||||
|
||||
if(WITH_DSO)
|
||||
add_definitions(-DPADDLE_USE_DSO)
|
||||
endif(WITH_DSO)
|
||||
|
||||
if(WITH_DOUBLE)
|
||||
add_definitions(-DPADDLE_TYPE_DOUBLE)
|
||||
set(ACCURACY double)
|
||||
else(WITH_DOUBLE)
|
||||
set(ACCURACY float)
|
||||
endif(WITH_DOUBLE)
|
||||
|
||||
if(NOT WITH_TIMER)
|
||||
add_definitions(-DPADDLE_DISABLE_TIMER)
|
||||
endif(NOT WITH_TIMER)
|
||||
|
||||
if(NOT WITH_PROFILER)
|
||||
add_definitions(-DPADDLE_DISABLE_PROFILER)
|
||||
endif(NOT WITH_PROFILER)
|
||||
|
||||
if(WITH_AVX)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${AVX_FLAG}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${AVX_FLAG}")
|
||||
else(WITH_AVX)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SSE3_FLAG}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SSE3_FLAG}")
|
||||
endif(WITH_AVX)
|
||||
|
||||
if(WITH_PYTHON)
|
||||
include_directories(${PYTHON_INCLUDE_DIR})
|
||||
include_directories(${PYTHON_NUMPY_INCLUDE_DIR})
|
||||
else(WITH_PYTHON)
|
||||
add_definitions(-DPADDLE_NO_PYTHON)
|
||||
endif(WITH_PYTHON)
|
||||
|
||||
if(WITH_RDMA)
|
||||
include_directories("${RDMA_INC_DIR}")
|
||||
else(WITH_RDMA)
|
||||
add_definitions(-DPADDLE_DISABLE_RDMA)
|
||||
endif(WITH_RDMA)
|
||||
|
||||
# glog
|
||||
include_directories(${LIBGLOG_INCLUDE_DIR})
|
||||
|
||||
#gflags
|
||||
add_definitions(-DGFLAGS_NS=${GFLAGS_NAMESPACE})
|
||||
include_directories(${GFLAGS_INCLUDE_DIRS})
|
||||
|
||||
if(WITH_TESTING)
|
||||
enable_testing()
|
||||
include_directories(${GTEST_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
include_directories("${CBLAS_INC_DIR}")
|
||||
include_directories("${PROJ_ROOT}")
|
||||
include_directories("${PROJ_ROOT}/paddle/cuda/include")
|
||||
include_directories(${PROTOBUF_INCLUDE_DIRS})
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}/proto")
|
||||
if(EXISTS "${PROJ_ROOT}/paddle/internals/CMakeLists.txt")
|
||||
set(PADDLE_WITH_INTERNAL ON)
|
||||
include(paddle/internals/CMakeLists.txt)
|
||||
else()
|
||||
set(PADDLE_WITH_INTERNAL OFF)
|
||||
set(INTERNAL_PROTO_PATH "")
|
||||
endif()
|
||||
|
||||
set(EXTERNAL_LIBS
|
||||
# have not include gtest here.
|
||||
${GFLAGS_LIBRARIES}
|
||||
${GLOG_LIBRARIES}
|
||||
${CBLAS_LIBRARIES}
|
||||
${PROTOBUF_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
)
|
||||
|
||||
add_subdirectory(proto)
|
||||
add_subdirectory(paddle)
|
||||
add_subdirectory(python)
|
||||
|
||||
if(WITH_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
|
@ -1,39 +0,0 @@
|
||||
# Check package for each cmake option
|
||||
|
||||
if(WITH_GPU)
|
||||
find_package(CUDA REQUIRED) # CUDA is required when use gpu
|
||||
endif()
|
||||
|
||||
if(WITH_PYTHON)
|
||||
find_package(PythonLibs 2.6 REQUIRED)
|
||||
find_package(PythonInterp REQUIRED)
|
||||
find_package(NumPy REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_STYLE_CHECK)
|
||||
find_package(PythonInterp REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Glog REQUIRED)
|
||||
|
||||
find_package(Gflags REQUIRED)
|
||||
|
||||
if(WITH_TESTING)
|
||||
find_package(GTest REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_DOC)
|
||||
find_package(Sphinx REQUIRED)
|
||||
find_python_module(recommonmark REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_SWIG_PY)
|
||||
if(NOT SWIG_FOUND)
|
||||
message(FATAL_ERROR "SWIG is not found. Please install swig or disable WITH_SWIG_PY")
|
||||
endif()
|
||||
find_python_module(wheel REQUIRED) # package wheel
|
||||
endif()
|
||||
|
||||
if(NOT M4_EXECUTABLE)
|
||||
message(FATAL_ERROR "Paddle need m4 to generate proto file.")
|
||||
endif()
|
@ -0,0 +1,64 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
if(WITH_DSO)
|
||||
add_definitions(-DPADDLE_USE_DSO)
|
||||
endif(WITH_DSO)
|
||||
|
||||
if(WITH_DOUBLE)
|
||||
add_definitions(-DPADDLE_TYPE_DOUBLE)
|
||||
endif(WITH_DOUBLE)
|
||||
|
||||
if(NOT WITH_TIMER)
|
||||
add_definitions(-DPADDLE_DISABLE_TIMER)
|
||||
endif(NOT WITH_TIMER)
|
||||
|
||||
if(NOT WITH_PROFILER)
|
||||
add_definitions(-DPADDLE_DISABLE_PROFILER)
|
||||
endif(NOT WITH_PROFILER)
|
||||
|
||||
if(NOT WITH_GPU)
|
||||
add_definitions(-DPADDLE_ONLY_CPU)
|
||||
add_definitions(-DHPPL_STUB_FUNC)
|
||||
|
||||
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu)
|
||||
else()
|
||||
FIND_PACKAGE(CUDA REQUIRED)
|
||||
|
||||
if(${CUDA_VERSION_MAJOR} VERSION_LESS 7)
|
||||
message(FATAL_ERROR "Paddle need CUDA >= 7.0 to compile")
|
||||
endif()
|
||||
|
||||
if(NOT CUDNN_FOUND)
|
||||
message(FATAL_ERROR "Paddle need cudnn to compile")
|
||||
endif()
|
||||
|
||||
if(WITH_AVX)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler ${AVX_FLAG}")
|
||||
else(WITH_AVX)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler ${SSE3_FLAG}")
|
||||
endif(WITH_AVX)
|
||||
|
||||
# Include cuda and cudnn
|
||||
include_directories(${CUDNN_INCLUDE_DIR})
|
||||
include_directories(${CUDA_TOOLKIT_INCLUDE})
|
||||
endif(NOT WITH_GPU)
|
||||
|
||||
if(WITH_AVX)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${AVX_FLAG}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${AVX_FLAG}")
|
||||
else(WITH_AVX)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SSE3_FLAG}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SSE3_FLAG}")
|
||||
endif(WITH_AVX)
|
@ -0,0 +1,39 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
SET(GFLAGS_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gflags)
|
||||
SET(GFLAGS_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/install/gflags)
|
||||
SET(GFLAGS_INCLUDE_DIR "${GFLAGS_INSTALL_DIR}/include" CACHE PATH "gflags include directory." FORCE)
|
||||
IF(WIN32)
|
||||
set(GFLAGS_LIBRARIES "${GFLAGS_INSTALL_DIR}/lib/gflags.lib" CACHE FILEPATH "GFLAGS_LIBRARIES" FORCE)
|
||||
ELSE(WIN32)
|
||||
set(GFLAGS_LIBRARIES "${GFLAGS_INSTALL_DIR}/lib/libgflags.a" CACHE FILEPATH "GFLAGS_LIBRARIES" FORCE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
INCLUDE_DIRECTORIES(${GFLAGS_INCLUDE_DIR})
|
||||
|
||||
ExternalProject_Add(
|
||||
gflags
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
GIT_REPOSITORY "https://github.com/gflags/gflags.git"
|
||||
PREFIX ${GFLAGS_SOURCES_DIR}
|
||||
UPDATE_COMMAND ""
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GFLAGS_INSTALL_DIR}
|
||||
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
CMAKE_ARGS -DBUILD_TESTING=OFF
|
||||
)
|
||||
|
||||
LIST(APPEND external_project_dependencies gflags)
|
@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
SET(GLOG_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/glog)
|
||||
SET(GLOG_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/install/glog)
|
||||
SET(GLOG_INCLUDE_DIR "${GLOG_INSTALL_DIR}/include" CACHE PATH "glog include directory." FORCE)
|
||||
|
||||
IF(WIN32)
|
||||
SET(GLOG_LIBRARIES "${GLOG_INSTALL_DIR}/lib/libglog.lib" CACHE FILEPATH "glog library." FORCE)
|
||||
ELSE(WIN32)
|
||||
SET(GLOG_LIBRARIES "${GLOG_INSTALL_DIR}/lib/libglog.a" CACHE FILEPATH "glog library." FORCE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
INCLUDE_DIRECTORIES(${GLOG_INCLUDE_DIR})
|
||||
|
||||
ExternalProject_Add(
|
||||
glog
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
GIT_REPOSITORY "https://github.com/google/glog.git"
|
||||
PREFIX ${GLOG_SOURCES_DIR}
|
||||
UPDATE_COMMAND ""
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GLOG_INSTALL_DIR}
|
||||
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
CMAKE_ARGS -DWITH_GFLAGS=OFF
|
||||
CMAKE_ARGS -DBUILD_TESTING=OFF
|
||||
)
|
||||
|
||||
LIST(APPEND external_project_dependencies glog)
|
@ -0,0 +1,51 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
IF(WITH_TESTING)
|
||||
ENABLE_TESTING()
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
SET(GTEST_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gtest)
|
||||
SET(GTEST_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/install/gtest)
|
||||
SET(GTEST_INCLUDE_DIR "${GTEST_INSTALL_DIR}/include" CACHE PATH "gtest include directory." FORCE)
|
||||
|
||||
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIR})
|
||||
|
||||
IF(WIN32)
|
||||
set(GTEST_LIBRARIES
|
||||
"${GTEST_INSTALL_DIR}/lib/gtest.lib" CACHE FILEPATH "gtest libraries." FORCE)
|
||||
set(GTEST_MAIN_LIBRARIES
|
||||
"${GTEST_INSTALL_DIR}/lib/gtest_main.lib" CACHE FILEPATH "gtest main libraries." FORCE)
|
||||
ELSE(WIN32)
|
||||
set(GTEST_LIBRARIES
|
||||
"${GTEST_INSTALL_DIR}/lib/libgtest.a" CACHE FILEPATH "gtest libraries." FORCE)
|
||||
set(GTEST_MAIN_LIBRARIES
|
||||
"${GTEST_INSTALL_DIR}/lib/libgtest_main.a" CACHE FILEPATH "gtest main libraries." FORCE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
ExternalProject_Add(
|
||||
gtest
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
GIT_REPOSITORY "https://github.com/google/googletest.git"
|
||||
GIT_TAG "release-1.8.0"
|
||||
PREFIX ${GTEST_SOURCES_DIR}
|
||||
UPDATE_COMMAND ""
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${GTEST_INSTALL_DIR}
|
||||
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
CMAKE_ARGS -DBUILD_GMOCK=ON
|
||||
CMAKE_ARGS -Dgtest_disable_pthreads=ON
|
||||
CMAKE_ARGS -Dgtest_force_shared_crt=ON
|
||||
)
|
||||
LIST(APPEND external_project_dependencies gtest)
|
||||
ENDIF(WITH_TESTING)
|
@ -0,0 +1,46 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDE(cblas)
|
||||
|
||||
IF(NOT ${CBLAS_FOUND})
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
SET(CBLAS_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/openblas)
|
||||
SET(CBLAS_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/install/openblas)
|
||||
SET(CBLAS_INC_DIR "${CBLAS_INSTALL_DIR}/include" CACHE PATH "openblas include directory." FORCE)
|
||||
|
||||
IF(WIN32)
|
||||
SET(CBLAS_LIBRARIES "${CBLAS_INSTALL_DIR}/lib/openblas.lib" CACHE FILEPATH "openblas library." FORCE)
|
||||
ELSE(WIN32)
|
||||
SET(CBLAS_LIBRARIES "${CBLAS_INSTALL_DIR}/lib/libopenblas.a" CACHE FILEPATH "openblas library" FORCE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
ExternalProject_Add(
|
||||
openblas
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
URL "https://github.com/xianyi/OpenBLAS/archive/v0.2.19.tar.gz"
|
||||
PREFIX ${CBLAS_SOURCES_DIR}
|
||||
INSTALL_DIR ${CBLAS_INSTALL_DIR}
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND make CC=${CMAKE_C_COMPILER} FC=${CMAKE_Fortran_COMPILER}
|
||||
INSTALL_COMMAND make install PREFIX=<INSTALL_DIR>
|
||||
UPDATE_COMMAND ""
|
||||
)
|
||||
|
||||
LIST(APPEND external_project_dependencies openblas)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES(${CBLAS_INC_DIR})
|
@ -0,0 +1,62 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
SET(PROTOBUF_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf)
|
||||
SET(PROTOBUF_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/install/protobuf)
|
||||
SET(PROTOBUF_INCLUDE_DIR "${PROTOBUF_INSTALL_DIR}/include" CACHE PATH "protobuf include directory." FORCE)
|
||||
|
||||
INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR})
|
||||
|
||||
IF(WIN32)
|
||||
SET(PROTOBUF_LITE_LIBRARY
|
||||
"${PROTOBUF_INSTALL_DIR}/lib/libprotobuf-lite.lib" CACHE FILEPATH "protobuf lite library." FORCE)
|
||||
SET(PROTOBUF_LIBRARY
|
||||
"${PROTOBUF_INSTALL_DIR}/lib/libprotobuf.lib" CACHE FILEPATH "protobuf library." FORCE)
|
||||
SET(PROTOBUF_PROTOC_LIBRARY
|
||||
"${PROTOBUF_INSTALL_DIR}/lib/libprotoc.lib" CACHE FILEPATH "protoc library." FORCE)
|
||||
SET(PROTOBUF_PROTOC_EXECUTABLE "${PROTOBUF_INSTALL_DIR}/bin/protoc.exe" CACHE FILEPATH "protobuf executable." FORCE)
|
||||
ELSE(WIN32)
|
||||
IF(${HOST_SYSTEM} STREQUAL "centos")
|
||||
SET(LIB "lib64")
|
||||
ELSE()
|
||||
SET(LIB "lib")
|
||||
ENDIF()
|
||||
SET(PROTOBUF_LITE_LIBRARY
|
||||
"${PROTOBUF_INSTALL_DIR}/${LIB}/libprotobuf-lite.a" CACHE FILEPATH "protobuf lite library." FORCE)
|
||||
SET(PROTOBUF_LIBRARY
|
||||
"${PROTOBUF_INSTALL_DIR}/${LIB}/libprotobuf.a" CACHE FILEPATH "protobuf library." FORCE)
|
||||
SET(PROTOBUF_PROTOC_LIBRARY
|
||||
"${PROTOBUF_INSTALL_DIR}/${LIB}/libprotoc.a" CACHE FILEPATH "protoc library." FORCE)
|
||||
SET(PROTOBUF_PROTOC_EXECUTABLE "${PROTOBUF_INSTALL_DIR}/bin/protoc" CACHE FILEPATH "protobuf executable." FORCE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
ExternalProject_Add(
|
||||
protobuf
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
PREFIX ${PROTOBUF_SOURCES_DIR}
|
||||
UPDATE_COMMAND ""
|
||||
DEPENDS zlib
|
||||
GIT_REPOSITORY "https://github.com/google/protobuf.git"
|
||||
GIT_TAG "9f75c5aa851cd877fb0d93ccc31b8567a6706546"
|
||||
CONFIGURE_COMMAND
|
||||
${CMAKE_COMMAND} ${PROTOBUF_SOURCES_DIR}/src/protobuf/cmake
|
||||
-Dprotobuf_BUILD_TESTS=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_INSTALL_PREFIX=${PROTOBUF_INSTALL_DIR}
|
||||
)
|
||||
|
||||
LIST(APPEND external_project_dependencies protobuf)
|
@ -0,0 +1,204 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
|
||||
##################################### PYTHON ########################################
|
||||
SET(PYTHON_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/python)
|
||||
SET(PYTHON_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/install/python)
|
||||
SET(_python_DIR ${PYTHON_INSTALL_DIR})
|
||||
|
||||
IF(UNIX)
|
||||
SET(PYTHON_FOUND ON)
|
||||
SET(PYTHON_INCLUDE_DIR "${PYTHON_INSTALL_DIR}/include/python2.7" CACHE PATH "Python include dir" FORCE)
|
||||
SET(PYTHON_LIBRARIES "${PYTHON_INSTALL_DIR}/lib/libpython2.7.a" CACHE FILEPATH "Python library" FORCE)
|
||||
SET(PYTHON_EXECUTABLE ${PYTHON_INSTALL_DIR}/bin/python CACHE FILEPATH "Python executable" FORCE)
|
||||
SET(PY_SITE_PACKAGES_PATH "${PYTHON_INSTALL_DIR}/lib/python2.7/site-packages" CACHE PATH "Python site-packages path" FORCE)
|
||||
ELSEIF(WIN32)
|
||||
SET(PYTHON_FOUND ON)
|
||||
SET(PYTHON_INCLUDE_DIR "${PYTHON_INSTALL_DIR}/include" CACHE PATH "Python include dir" FORCE)
|
||||
SET(PYTHON_LIBRARIES "${PYTHON_INSTALL_DIR}/libs/python27.lib" CACHE FILEPATH "Python library" FORCE)
|
||||
SET(PYTHON_EXECUTABLE "${PYTHON_INSTALL_DIR}/bin/python.exe" CACHE FILEPATH "Python executable" FORCE)
|
||||
SET(PY_SITE_PACKAGES_PATH "${PYTHON_INSTALL_DIR}/Lib/site-packages" CACHE PATH "Python site-packages path" FORCE)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unknown system !")
|
||||
ENDIF()
|
||||
|
||||
SET(py_env
|
||||
PATH=${PYTHON_INSTALL_DIR}/bin/:$ENV{PATH}
|
||||
PYTHONHOME=${PYTHON_INSTALL_DIR}
|
||||
PYTHONPATH=${PYTHON_INSTALL_DIR}/lib:${PYTHON_INSTALL_DIR}/lib/python2.7:${PY_SITE_PACKAGES_PATH})
|
||||
|
||||
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR})
|
||||
|
||||
IF(APPLE)
|
||||
LIST(APPEND EXTERNAL_PROJECT_OPTIONAL_CMAKE_ARGS
|
||||
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
SET(EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS)
|
||||
|
||||
# Force Python build to "Release".
|
||||
IF(CMAKE_CONFIGURATION_TYPES)
|
||||
SET(SAVED_CMAKE_CFG_INTDIR ${CMAKE_CFG_INTDIR})
|
||||
SET(CMAKE_CFG_INTDIR "Release")
|
||||
ELSE()
|
||||
LIST(APPEND EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS
|
||||
-DCMAKE_BUILD_TYPE:STRING=Release
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
ExternalProject_Add(python
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
GIT_REPOSITORY "https://github.com/python-cmake-buildsystem/python-cmake-buildsystem.git"
|
||||
PREFIX ${PYTHON_SOURCES_DIR}
|
||||
UPDATE_COMMAND ""
|
||||
CMAKE_ARGS -DPYTHON_VERSION=2.7.12
|
||||
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
CMAKE_CACHE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=${PYTHON_INSTALL_DIR}
|
||||
-DBUILD_LIBPYTHON_SHARED:BOOL=OFF
|
||||
-DUSE_SYSTEM_LIBRARIES:BOOL=OFF
|
||||
-DZLIB_ROOT:FILEPATH=${ZLIB_ROOT}
|
||||
-DZLIB_INCLUDE_DIR:PATH=${ZLIB_INCLUDE_DIR}
|
||||
-DZLIB_LIBRARY:FILEPATH=${ZLIB_LIBRARIES}
|
||||
-DDOWNLOAD_SOURCES:BOOL=ON
|
||||
-DINSTALL_WINDOWS_TRADITIONAL:BOOL=OFF
|
||||
${EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS}
|
||||
${EXTERNAL_PROJECT_OPTIONAL_CMAKE_ARGS}
|
||||
DEPENDS zlib
|
||||
)
|
||||
####################################################################################
|
||||
|
||||
##################################### SETUPTOOLS ###################################
|
||||
SET(SETUPTOOLS_SOURCES_DIR ${PYTHON_SOURCES_DIR}/setuptools)
|
||||
ExternalProject_Add(setuptools
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
PREFIX ${SETUPTOOLS_SOURCES_DIR}
|
||||
URL "https://pypi.python.org/packages/source/s/setuptools/setuptools-18.3.2.tar.gz"
|
||||
BUILD_IN_SOURCE 1
|
||||
PATCH_COMMAND ""
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py install
|
||||
DEPENDS python zlib
|
||||
)
|
||||
#####################################################################################
|
||||
|
||||
##################################### SIX ###########################################
|
||||
SET(SIX_SOURCES_DIR ${PYTHON_SOURCES_DIR}/six)
|
||||
ExternalProject_Add(six
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
PREFIX ${SIX_SOURCES_DIR}
|
||||
URL https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz
|
||||
BUILD_IN_SOURCE 1
|
||||
PATCH_COMMAND ""
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py install
|
||||
DEPENDS python setuptools
|
||||
)
|
||||
#####################################################################################
|
||||
|
||||
##################################### CYTHON ########################################
|
||||
SET(CYTHON_SOURCES_DIR ${PYTHON_SOURCES_DIR}/cython)
|
||||
ExternalProject_Add(cython
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
PREFIX ${CYTHON_SOURCES_DIR}
|
||||
URL https://github.com/cython/cython/archive/0.25.2.tar.gz
|
||||
GIT_TAG 0.25.2
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ""
|
||||
PATCH_COMMAND ""
|
||||
UPDATE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py install
|
||||
DEPENDS python
|
||||
)
|
||||
####################################################################################
|
||||
|
||||
##################################### NUMPY ########################################
|
||||
SET(NUMPY_SOURCES_DIR ${PYTHON_SOURCES_DIR}/numpy)
|
||||
SET(NUMPY_TAG_VERSION "v1.11.3")
|
||||
SET(NUMPY_VERSION "1.11.3")
|
||||
|
||||
SET(EGG_NAME "")
|
||||
SET(PYTHON_NUMPY_INCLUDE_DIR "")
|
||||
IF(WIN32)
|
||||
SET(EGG_NAME "numpy-${NUMPY_VERSION}-py2.7-${HOST_SYSTEM}.egg")
|
||||
ELSE(WIN32)
|
||||
IF(APPLE)
|
||||
SET(EGG_NAME "numpy-${NUMPY_VERSION}-py2.7-${HOST_SYSTEM}-${MACOS_VERSION}")
|
||||
ELSE(APPLE)
|
||||
SET(EGG_NAME "numpy-${NUMPY_VERSION}-py2.7-linux")
|
||||
SET(EGG_NAME "numpy-${NUMPY_VERSION}-py2.7-linux")
|
||||
ENDIF(APPLE)
|
||||
|
||||
FOREACH(suffix x86_64 intel fat64 fat32 universal)
|
||||
LIST(APPEND PYTHON_NUMPY_INCLUDE_DIR ${PY_SITE_PACKAGES_PATH}/${EGG_NAME}-${suffix}.egg/numpy/core/include)
|
||||
ENDFOREACH()
|
||||
ENDIF(WIN32)
|
||||
|
||||
INCLUDE_DIRECTORIES(${PYTHON_NUMPY_INCLUDE_DIR})
|
||||
|
||||
ExternalProject_Add(numpy
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
GIT_REPOSITORY https://github.com/numpy/numpy.git
|
||||
GIT_TAG ${NUMPY_TAG_VERSION}
|
||||
CONFIGURE_COMMAND ""
|
||||
UPDATE_COMMAND ""
|
||||
PREFIX ${NUMPY_SOURCES_DIR}
|
||||
BUILD_COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py build
|
||||
INSTALL_COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py install
|
||||
BUILD_IN_SOURCE 1
|
||||
DEPENDS python setuptools cython
|
||||
)
|
||||
####################################################################################
|
||||
|
||||
##################################### WHEEL ########################################
|
||||
SET(WHEEL_SOURCES_DIR ${PYTHON_SOURCES_DIR}/wheel)
|
||||
ExternalProject_Add(wheel
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
URL https://pypi.python.org/packages/source/w/wheel/wheel-0.29.0.tar.gz
|
||||
PREFIX ${WHEEL_SOURCES_DIR}
|
||||
CONFIGURE_COMMAND ""
|
||||
UPDATE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py install
|
||||
BUILD_IN_SOURCE 1
|
||||
DEPENDS python setuptools
|
||||
)
|
||||
####################################################################################
|
||||
|
||||
################################### PROTOBUF #######################################
|
||||
SET(PY_PROTOBUF_SOURCES_DIR ${PYTHON_SOURCES_DIR}/protobuf)
|
||||
ExternalProject_Add(python-protobuf
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
URL https://pypi.python.org/packages/e0/b0/0a1b364fe8a7d177b4b7d4dca5b798500dc57a7273b93cca73931b305a6a/protobuf-3.1.0.post1.tar.gz
|
||||
URL_MD5 38b5fb160c768d2f8444d0c6d637ff91
|
||||
PREFIX ${PY_PROTOBUF_SOURCES_DIR}
|
||||
BUILD_IN_SOURCE 1
|
||||
PATCH_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND env PATH=${PROTOBUF_INSTALL_DIR}/bin:$ENV{PATH} ${py_env} ${PYTHON_EXECUTABLE} setup.py build
|
||||
INSTALL_COMMAND env PATH=${PROTOBUF_INSTALL_DIR}/bin:$ENV{PATH} ${py_env} ${PYTHON_EXECUTABLE} setup.py install
|
||||
DEPENDS python setuptools six
|
||||
)
|
||||
|
||||
LIST(APPEND external_project_dependencies python setuptools six cython numpy wheel python-protobuf)
|
@ -0,0 +1,70 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# build swig as an external project
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
SET(SWIG_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/swig)
|
||||
SET(SWIG_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/install/swig)
|
||||
SET(SWIG_TARGET_VERSION "3.0.2")
|
||||
SET(SWIG_DOWNLOAD_SRC_MD5 "62f9b0d010cef36a13a010dc530d0d41")
|
||||
SET(SWIG_DOWNLOAD_WIN_MD5 "3f18de4fc09ab9abb0d3be37c11fbc8f")
|
||||
|
||||
IF(WIN32)
|
||||
# swig.exe available as pre-built binary on Windows:
|
||||
ExternalProject_Add(swig
|
||||
URL http://prdownloads.sourceforge.net/swig/swigwin-${SWIG_TARGET_VERSION}.zip
|
||||
URL_MD5 ${SWIG_DOWNLOAD_WIN_MD5}
|
||||
SOURCE_DIR ${SWIG_SOURCES_DIR}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
UPDATE_COMMAND ""
|
||||
)
|
||||
SET(SWIG_DIR ${SWIG_SOURCES_DIR} CACHE FILEPATH "SWIG Directory" FORCE)
|
||||
SET(SWIG_EXECUTABLE ${SWIG_SOURCES_DIR}/swig.exe CACHE FILEPATH "SWIG Executable" FORCE)
|
||||
ELSE(WIN32)
|
||||
# From PCRE configure
|
||||
ExternalProject_Add(pcre
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
GIT_REPOSITORY https://github.com/svn2github/pcre.git
|
||||
PREFIX ${SWIG_SOURCES_DIR}/pcre
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SWIG_INSTALL_DIR}/pcre
|
||||
)
|
||||
|
||||
# swig uses bison find it by cmake and pass it down
|
||||
FIND_PACKAGE(BISON)
|
||||
|
||||
# From SWIG configure
|
||||
ExternalProject_Add(swig
|
||||
GIT_REPOSITORY https://github.com/swig/swig.git
|
||||
GIT_TAG rel-3.0.10
|
||||
PREFIX ${SWIG_SOURCES_DIR}
|
||||
CONFIGURE_COMMAND cd ${SWIG_SOURCES_DIR}/src/swig && ./autogen.sh
|
||||
CONFIGURE_COMMAND cd ${SWIG_SOURCES_DIR}/src/swig &&
|
||||
env "PCRE_LIBS=${SWIG_INSTALL_DIR}/pcre/lib/libpcre.a ${SWIG_INSTALL_DIR}/pcre/lib/libpcrecpp.a ${SWIG_INSTALL_DIR}/pcre/lib/libpcreposix.a"
|
||||
./configure
|
||||
--prefix=${SWIG_INSTALL_DIR}
|
||||
--with-pcre-prefix=${SWIG_INSTALL_DIR}/pcre
|
||||
BUILD_COMMAND cd ${SWIG_SOURCES_DIR}/src/swig && make
|
||||
INSTALL_COMMAND cd ${SWIG_SOURCES_DIR}/src/swig && make install
|
||||
UPDATE_COMMAND ""
|
||||
DEPENDS pcre
|
||||
)
|
||||
|
||||
SET(SWIG_DIR ${SWIG_INSTALL_DIR}/share/swig/${SWIG_TARGET_VERSION})
|
||||
SET(SWIG_EXECUTABLE ${SWIG_INSTALL_DIR}/bin/swig)
|
||||
ENDIF(WIN32)
|
||||
|
||||
LIST(APPEND external_project_dependencies swig)
|
@ -0,0 +1,58 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
SET(WARPCTC_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/warpctc)
|
||||
SET(WARPCTC_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/install/warpctc)
|
||||
SET(WARPCTC_INCLUDE_DIR "${WARPCTC_INSTALL_DIR}/include" CACHE PATH "Warp-ctc Directory" FORCE)
|
||||
|
||||
INCLUDE_DIRECTORIES(${WARPCTC_INCLUDE_DIR})
|
||||
|
||||
SET(WARPCTC_LIB_DIR "${WARPCTC_INSTALL_DIR}/lib" CACHE PATH "Warp-ctc Library Directory" FORCE)
|
||||
|
||||
IF(WIN32)
|
||||
SET(WARPCTC_LIBRARIES
|
||||
"${WARPCTC_INSTALL_DIR}/lib/warpctc.dll" CACHE FILEPATH "Warp-ctc Library" FORCE)
|
||||
ELSE(WIN32)
|
||||
IF(APPLE)
|
||||
SET(_warpctc_SHARED_SUFFIX dylib)
|
||||
ELSE(APPLE)
|
||||
SET(_warpctc_SHARED_SUFFIX so)
|
||||
ENDIF(APPLE)
|
||||
|
||||
SET(WARPCTC_LIBRARIES
|
||||
"${WARPCTC_INSTALL_DIR}/lib/libwarpctc.${_warpctc_SHARED_SUFFIX}" CACHE FILEPATH "Warp-ctc Library" FORCE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
|
||||
SET(USE_OMP OFF)
|
||||
ELSE()
|
||||
SET(USE_OMP ON)
|
||||
ENDIF()
|
||||
|
||||
ExternalProject_Add(
|
||||
warpctc
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
GIT_REPOSITORY "https://github.com/gangliao/warp-ctc.git"
|
||||
PREFIX ${WARPCTC_SOURCES_DIR}
|
||||
UPDATE_COMMAND ""
|
||||
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${WARPCTC_INSTALL_DIR}
|
||||
CMAKE_ARGS -DWITH_GPU=${WITH_GPU}
|
||||
CMAKE_ARGS -DWITH_OMP=${USE_OMP}
|
||||
)
|
||||
|
||||
LIST(APPEND external_project_dependencies warpctc)
|
@ -0,0 +1,43 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
SET(ZLIB_SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/zlib)
|
||||
SET(ZLIB_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/install/zlib)
|
||||
SET(ZLIB_ROOT ${ZLIB_INSTALL_DIR} CACHE FILEPATH "zlib root directory." FORCE)
|
||||
SET(ZLIB_INCLUDE_DIR "${ZLIB_INSTALL_DIR}/include" CACHE PATH "zlib include directory." FORCE)
|
||||
|
||||
IF(WIN32)
|
||||
SET(ZLIB_LIBRARIES "${ZLIB_INSTALL_DIR}/lib/zlibstatic.lib" CACHE FILEPATH "zlib library." FORCE)
|
||||
ELSE(WIN32)
|
||||
set(ZLIB_LIBRARIES "${ZLIB_INSTALL_DIR}/lib/libz.a" CACHE FILEPATH "zlib library." FORCE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
||||
|
||||
ExternalProject_Add(
|
||||
zlib
|
||||
${EXTERNAL_PROJECT_LOG_ARGS}
|
||||
GIT_REPOSITORY "https://github.com/madler/zlib.git"
|
||||
GIT_TAG "v1.2.8"
|
||||
PREFIX ${ZLIB_SOURCES_DIR}
|
||||
UPDATE_COMMAND ""
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${ZLIB_INSTALL_DIR}
|
||||
CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF
|
||||
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
CMAKE_ARGS -DCMAKE_MACOSX_RPATH=ON
|
||||
)
|
||||
|
||||
LIST(APPEND external_project_dependencies zlib)
|
@ -1,15 +0,0 @@
|
||||
function(generate_python_api target_name)
|
||||
add_custom_command(OUTPUT ${PROJ_ROOT}/paddle/py_paddle/swig_paddle.py
|
||||
${PROJ_ROOT}/paddle/Paddle_wrap.cxx
|
||||
${PROJ_ROOT}/paddle/Paddle_wrap.h
|
||||
COMMAND swig -python -c++ -outcurrentdir -I../ api/Paddle.swig
|
||||
&& mv ${PROJ_ROOT}/paddle/swig_paddle.py ${PROJ_ROOT}/paddle/py_paddle/swig_paddle.py
|
||||
DEPENDS ${PROJ_ROOT}/paddle/api/Paddle.swig
|
||||
${PROJ_ROOT}/paddle/api/PaddleAPI.h
|
||||
WORKING_DIRECTORY ${PROJ_ROOT}/paddle
|
||||
COMMENT "Generate Python API from swig")
|
||||
add_custom_target(${target_name} ALL DEPENDS
|
||||
${PROJ_ROOT}/paddle/Paddle_wrap.cxx
|
||||
${PROJ_ROOT}/paddle/Paddle_wrap.h
|
||||
${PROJ_ROOT}/paddle/py_paddle/swig_paddle.py)
|
||||
endfunction(generate_python_api)
|
@ -0,0 +1,53 @@
|
||||
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
IF(WIN32)
|
||||
SET(HOST_SYSTEM "win32")
|
||||
ELSE(WIN32)
|
||||
IF(APPLE)
|
||||
EXEC_PROGRAM (sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION)
|
||||
STRING(REGEX MATCH "[0-9]+.[0-9]+" VERSION "${MACOSX_VERSION}")
|
||||
SET(MACOS_VERSION ${VERSION})
|
||||
SET(HOST_SYSTEM "macosx")
|
||||
ELSE(APPLE)
|
||||
IF(EXISTS "/etc/issue")
|
||||
FILE(READ "/etc/issue" LINUX_ISSUE)
|
||||
IF(LINUX_ISSUE MATCHES "CentOS")
|
||||
SET(HOST_SYSTEM "centos")
|
||||
ELSEIF(LINUX_ISSUE MATCHES "Debian")
|
||||
SET(HOST_SYSTEM "debian")
|
||||
ELSEIF(LINUX_ISSUE MATCHES "Ubuntu")
|
||||
SET(HOST_SYSTEM "ubuntu")
|
||||
ENDIF()
|
||||
ENDIF(EXISTS "/etc/issue")
|
||||
ENDIF(APPLE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
# query number of logical cores
|
||||
CMAKE_HOST_SYSTEM_INFORMATION(RESULT CPU_CORES QUERY NUMBER_OF_LOGICAL_CORES)
|
||||
|
||||
MARK_AS_ADVANCED(HOST_SYSTEM CPU_CORES)
|
||||
|
||||
MESSAGE(STATUS "Found Paddle host system: ${HOST_SYSTEM}")
|
||||
MESSAGE(STATUS "Found Paddle host system's CPU: ${CPU_CORES} cores")
|
||||
|
||||
# external dependencies log output
|
||||
SET(EXTERNAL_PROJECT_LOG_ARGS
|
||||
LOG_DOWNLOAD 0 # Wrap download in script to log output
|
||||
LOG_UPDATE 1 # Wrap update in script to log output
|
||||
LOG_CONFIGURE 1 # Wrap configure in script to log output
|
||||
LOG_BUILD 1 # Wrap build in script to log output
|
||||
LOG_TEST 1 # Wrap test in script to log output
|
||||
LOG_INSTALL 1 # Wrap install in script to log output
|
||||
)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue