commit
15318aebac
@ -1,3 +0,0 @@
|
||||
[submodule "warp-ctc"]
|
||||
path = warp-ctc
|
||||
url = https://github.com/baidu-research/warp-ctc.git
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
./doc/howto/dev/contribute_to_paddle_en.md
|
@ -1,15 +0,0 @@
|
||||
# External dependency to Google protobuf.
|
||||
http_archive(
|
||||
name="protobuf",
|
||||
url="http://github.com/google/protobuf/archive/v3.1.0.tar.gz",
|
||||
sha256="0a0ae63cbffc274efb573bdde9a253e3f32e458c41261df51c5dbc5ad541e8f7",
|
||||
strip_prefix="protobuf-3.1.0", )
|
||||
|
||||
# External dependency to gtest 1.7.0. This method comes from
|
||||
# https://www.bazel.io/versions/master/docs/tutorial/cpp.html.
|
||||
new_http_archive(
|
||||
name="gtest",
|
||||
url="https://github.com/google/googletest/archive/release-1.7.0.zip",
|
||||
sha256="b58cb7547a28b2c718d1e38aee18a3659c9e3ff52440297e965f5edffe34b6d0",
|
||||
build_file="third_party/gtest.BUILD",
|
||||
strip_prefix="googletest-release-1.7.0", )
|
@ -1,44 +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()
|
||||
|
||||
if(WITH_GLOG)
|
||||
find_package(Glog REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_GFLAGS)
|
||||
find_package(Gflags REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_TESTING)
|
||||
find_package(GTest REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_DOC)
|
||||
find_package(Sphinx REQUIRED)
|
||||
find_package(Doxygen 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,68 @@
|
||||
# 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(NOT WITH_PYTHON)
|
||||
add_definitions(-DPADDLE_NO_PYTHON)
|
||||
endif(NOT WITH_PYTHON)
|
||||
|
||||
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 ${THIRD_PARTY_PATH}/gflags)
|
||||
SET(GFLAGS_INSTALL_DIR ${THIRD_PARTY_PATH}/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 ${THIRD_PARTY_PATH}/glog)
|
||||
SET(GLOG_INSTALL_DIR ${THIRD_PARTY_PATH}/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 ${THIRD_PARTY_PATH}/gtest)
|
||||
SET(GTEST_INSTALL_DIR ${THIRD_PARTY_PATH}/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,47 @@
|
||||
# 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})
|
||||
MESSAGE(FATAL_ERROR "Please install OpenBlas, MKL or ATLAS.")
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
SET(CBLAS_SOURCES_DIR ${THIRD_PARTY_PATH}/openblas)
|
||||
SET(CBLAS_INSTALL_DIR ${THIRD_PARTY_PATH}/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 ${THIRD_PARTY_PATH}/protobuf)
|
||||
SET(PROTOBUF_INSTALL_DIR ${THIRD_PARTY_PATH}/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,226 @@
|
||||
# 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)
|
||||
INCLUDE(python_module)
|
||||
|
||||
FIND_PACKAGE(PythonInterp 2.7)
|
||||
FIND_PACKAGE(PythonLibs 2.7)
|
||||
|
||||
SET(py_env "")
|
||||
|
||||
IF(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
|
||||
find_python_module(pip REQUIRED)
|
||||
find_python_module(numpy REQUIRED)
|
||||
find_python_module(wheel REQUIRED)
|
||||
find_python_module(google.protobuf REQUIRED)
|
||||
FIND_PACKAGE(NumPy REQUIRED)
|
||||
IF(${PY_GOOGLE.PROTOBUF_VERSION} VERSION_LESS "3.0.0")
|
||||
MESSAGE(FATAL_ERROR "Found Python Protobuf ${PY_GOOGLE.PROTOBUF_VERSION} < 3.0.0, "
|
||||
"please use pip to upgrade protobuf.")
|
||||
ENDIF(${PY_GOOGLE.PROTOBUF_VERSION} VERSION_LESS "3.0.0")
|
||||
ELSE(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
|
||||
##################################### PYTHON ########################################
|
||||
SET(PYTHON_SOURCES_DIR ${THIRD_PARTY_PATH}/python)
|
||||
SET(PYTHON_INSTALL_DIR ${THIRD_PARTY_PATH}/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()
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
SET(py_env
|
||||
PATH=${PYTHON_INSTALL_DIR}/bin
|
||||
PYTHONHOME=${PYTHON_INSTALL_DIR}
|
||||
PYTHONPATH=${PYTHON_INSTALL_DIR}/lib:${PYTHON_INSTALL_DIR}/lib/python2.7:${PY_SITE_PACKAGES_PATH})
|
||||
####################################################################################
|
||||
|
||||
##################################### 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)
|
||||
|
||||
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 ${py_env} ${PYTHON_EXECUTABLE} setup.py build
|
||||
INSTALL_COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py install
|
||||
DEPENDS python setuptools six
|
||||
)
|
||||
####################################################################################
|
||||
|
||||
LIST(APPEND external_project_dependencies python setuptools six cython wheel python-protobuf numpy)
|
||||
|
||||
ENDIF(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
|
||||
|
||||
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${PYTHON_NUMPY_INCLUDE_DIR})
|
||||
|
||||
MESSAGE("[Paddle] Python Executable: ${PYTHON_EXECUTABLE}")
|
||||
MESSAGE("[Paddle] Python Include: ${PYTHON_INCLUDE_DIRS}")
|
||||
MESSAGE("[Paddle] Python Libraries: ${PYTHON_LIBRARIES}")
|
@ -0,0 +1,74 @@
|
||||
# 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.
|
||||
|
||||
FIND_PACKAGE(SWIG)
|
||||
|
||||
IF(NOT SWIG_FOUND)
|
||||
# build swig as an external project
|
||||
INCLUDE(ExternalProject)
|
||||
|
||||
SET(SWIG_SOURCES_DIR ${THIRD_PARTY_PATH}/swig)
|
||||
SET(SWIG_INSTALL_DIR ${THIRD_PARTY_PATH}/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)
|
||||
ENDIF(NOT SWIG_FOUND)
|
@ -0,0 +1,60 @@
|
||||
# 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 ${THIRD_PARTY_PATH}/warpctc)
|
||||
SET(WARPCTC_INSTALL_DIR ${THIRD_PARTY_PATH}/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}
|
||||
CMAKE_ARGS -DWITH_TORCH=OFF
|
||||
CMAKE_ARGS -DBUILD_SHARED=ON
|
||||
)
|
||||
|
||||
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 ${THIRD_PARTY_PATH}/zlib)
|
||||
SET(ZLIB_INSTALL_DIR ${THIRD_PARTY_PATH}/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)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue