Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzpei9
Paddle
提交
e2d0e09a
P
Paddle
项目概览
wzpei9
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e2d0e09a
编写于
1月 05, 2017
作者:
L
liaogang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update external dependencies
上级
9e7f2b8d
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
379 addition
and
344 deletion
+379
-344
cmake/external/gflags.cmake
cmake/external/gflags.cmake
+11
-12
cmake/external/glog.cmake
cmake/external/glog.cmake
+12
-12
cmake/external/gtest.cmake
cmake/external/gtest.cmake
+33
-31
cmake/external/numpy.cmake
cmake/external/numpy.cmake
+0
-78
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+27
-23
cmake/external/protobuf.cmake
cmake/external/protobuf.cmake
+26
-25
cmake/external/python.cmake
cmake/external/python.cmake
+185
-57
cmake/external/swig.cmake
cmake/external/swig.cmake
+50
-74
cmake/external/warpctc.cmake
cmake/external/warpctc.cmake
+22
-18
cmake/external/zlib.cmake
cmake/external/zlib.cmake
+13
-14
未找到文件。
cmake/external/gflags.cmake
浏览文件 @
e2d0e09a
...
...
@@ -15,26 +15,25 @@
INCLUDE
(
ExternalProject
)
SET
(
GFLAGS_SOURCES_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/gflags
)
SET
(
GFLAGS_INSTALL_DIR
${
PROJECT_BINARY_DIR
}
/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
LOG_DOWNLOAD =ON
UPDATE_COMMAND
""
)
SET
(
GFLAGS_INCLUDE_DIR
"
${
GFLAGS_INSTALL_DIR
}
/include"
CACHE PATH
"gflags include directory."
FORCE
)
INCLUDE_DIRECTORIES
(
${
GFLAGS_INCLUDE_DIR
}
)
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
)
LIST
(
APPEND external_project_dependencies gflags
)
cmake/external/glog.cmake
浏览文件 @
e2d0e09a
...
...
@@ -15,27 +15,27 @@
INCLUDE
(
ExternalProject
)
SET
(
GLOG_SOURCES_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/glog
)
SET
(
GLOG_INSTALL_DIR
${
PROJECT_BINARY_DIR
}
/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
LOG_DOWNLOAD =ON
UPDATE_COMMAND
""
)
SET
(
GLOG_INCLUDE_DIR
"
${
GLOG_INSTALL_DIR
}
/include"
CACHE PATH
"glog include directory."
FORCE
)
INCLUDE_DIRECTORIES
(
${
GLOG_INCLUDE_DIR
}
)
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
)
LIST
(
APPEND external_project_dependencies glog
)
cmake/external/gtest.cmake
浏览文件 @
e2d0e09a
...
...
@@ -12,38 +12,40 @@
# See the License for the specific language governing permissions and
# limitations under the License.
INCLUDE
(
ExternalProject
)
IF
(
WITH_TESTING
)
ENABLE_TESTING
()
INCLUDE
(
ExternalProject
)
SET
(
GTEST_SOURCES_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/gtest
)
SET
(
GTEST_INSTALL_DIR
${
PROJECT_BINARY_DIR
}
/gtest
)
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
)
ExternalProject_Add
(
gtest
GIT_REPOSITORY
"https://github.com/google/googletest.git"
GIT_TAG
"release-1.8.0"
PREFIX
${
GTEST_SOURCES_DIR
}
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
LOG_DOWNLOAD =ON
UPDATE_COMMAND
""
)
INCLUDE_DIRECTORIES
(
${
GTEST_INCLUDE_DIR
}
)
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
)
IF
(
WIN32
)
set
(
GTEST_LIBRARIES
"
${
GTEST_INSTALL_DIR
}
/lib/gtest.lib"
"
${
GTEST_INSTALL_DIR
}
/lib/gtest_main.lib"
CACHE FILEPATH
"gtest libraries."
FORCE
)
ELSE
(
WIN32
)
set
(
GTEST_LIBRARIES
"
${
GTEST_INSTALL_DIR
}
/lib/libgtest.a"
"
${
GTEST_INSTALL_DIR
}
/lib/libgtest_main.a"
CACHE FILEPATH
"gtest libraries."
FORCE
)
ENDIF
(
WIN32
)
ENABLE_TESTING
()
LIST
(
APPEND external_project_dependencies gtest
)
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
)
cmake/external/numpy.cmake
已删除
100644 → 0
浏览文件 @
9e7f2b8d
# 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
(
NumPy
)
IF
(
NOT
${
NUMPY_FOUND
}
)
INCLUDE
(
ExternalProject
)
SET
(
NUMPY_SOURCES_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/numpy
)
SET
(
NUMPY_INSTALL_DIR
${
PROJECT_BINARY_DIR
}
/numpy
)
set
(
NUMPY_VERSION
"v1.11.3"
)
ExternalProject_Add
(
setuptools
PREFIX
${
PYTHON_SOURCES_DIR
}
/setuptools
URL http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
URL_MD5 7df2a529a074f613b509fb44feefe74e
BUILD_IN_SOURCE 1
UPDATE_COMMAND
""
PATCH_COMMAND
""
CONFIGURE_COMMAND
""
INSTALL_COMMAND
""
BUILD_COMMAND
${
PYTHON_EXECUTABLE
}
setup.py install
DEPENDS python zlib
)
ExternalProject_Add
(
cython
PREFIX
${
PYTHON_SOURCES_DIR
}
/cython
GIT_REPOSITORY https://github.com/cython/cython.git
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND
""
UPDATE_COMMAND
""
PATCH_COMMAND
""
INSTALL_COMMAND
""
BUILD_COMMAND
${
PYTHON_EXECUTABLE
}
setup.py install
DEPENDS python
)
ExternalProject_Add
(
numpy
GIT_REPOSITORY https://github.com/numpy/numpy.git
GIT_TAG
${
NUMPY_VERSION
}
CONFIGURE_COMMAND
""
UPDATE_COMMAND
""
PREFIX
${
NUMPY_SOURCES_DIR
}
BUILD_COMMAND
${
PYTHON_EXECUTABLE
}
setup.py build
INSTALL_COMMAND
${
PYTHON_EXECUTABLE
}
setup.py install
BUILD_IN_SOURCE 1
DEPENDS python setuptools cython
)
LIST
(
APPEND external_project_dependencies numpy
)
# find numpy include directory
FILE
(
WRITE
${
PROJECT_BINARY_DIR
}
/FindNumpyPath.py
"try: import numpy; print(numpy.get_include())
\n
except:pass
\n
"
)
EXEC_PROGRAM
(
"
${
PYTHON_EXECUTABLE
}
"
${
PROJECT_BINARY_DIR
}
ARGS
"FindNumpyPath.py"
OUTPUT_VARIABLE NUMPY_PATH
)
FIND_PATH
(
PYTHON_NUMPY_INCLUDE_DIR numpy/arrayobject.h
HINTS
"
${
NUMPY_PATH
}
"
"
${
PYTHON_INCLUDE_PATH
}
"
)
ENDIF
()
INCLUDE_DIRECTORIES
(
${
PYTHON_NUMPY_INCLUDE_DIR
}
)
cmake/external/openblas.cmake
浏览文件 @
e2d0e09a
...
...
@@ -12,31 +12,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.
INCLUDE
(
ExternalProject
)
INCLUDE
(
cblas
)
SET
(
CBLAS_SOURCES_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/openblas
)
SET
(
CBLAS_INSTALL_DIR
${
PROJECT_BINARY_DIR
}
/openblas
)
IF
(
NOT
${
CBLAS_FOUND
}
)
INCLUDE
(
ExternalProject
)
ExternalProject_Add
(
openblas
GIT_REPOSITORY
"https://github.com/xianyi/OpenBLAS.git"
GIT_TAG v0.2.19
PREFIX
${
CBLAS_SOURCES_DIR
}
INSTALL_DIR
${
CBLAS_INSTALL_DIR
}
BUILD_IN_SOURCE 1
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND cd
${
CBLAS_SOURCES_DIR
}
/src/openblas && make -j4
INSTALL_COMMAND cd
${
CBLAS_SOURCES_DIR
}
/src/openblas && make install PREFIX=<INSTALL_DIR>
)
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
)
SET
(
CBLAS_INCLUDE_DIR
"
${
CBLAS_INSTALL_DIR
}
/include"
CACHE PATH
"openblas include directory."
FORCE
)
INCLUDE_DIRECTORIES
(
${
CBLAS_INCLUDE_DIR
}
)
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
)
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
)
LIST
(
APPEND external_project_dependencies openblas
)
ENDIF
()
INCLUDE_DIRECTORIES
(
${
CBLAS_INC_DIR
}
)
cmake/external/protobuf.cmake
浏览文件 @
e2d0e09a
...
...
@@ -15,24 +15,9 @@
INCLUDE
(
ExternalProject
)
SET
(
PROTOBUF_SOURCES_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/protobuf
)
SET
(
PROTOBUF_INSTALL_DIR
${
PROJECT_BINARY_DIR
}
/protobuf
)
ExternalProject_Add
(
protobuf
PREFIX
${
PROTOBUF_SOURCES_DIR
}
DEPENDS zlib
GIT_REPOSITORY
"https://github.com/google/protobuf.git"
# GIT_TAG "v3.1.0"
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
}
UPDATE_COMMAND
""
)
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
)
...
...
@@ -44,18 +29,34 @@ IF(WIN32)
"
${
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
)
FIND_PATH
(
PROTOBUF_LIBS_DIR libprotoc.a
${
PROTOBUF_INSTALL_DIR
}
/lib
${
PROTOBUF_INSTALL_DIR
}
/lib64
NO_DEFAULT_PATH
)
IF
(
${
HOST_SYSTEM
}
STREQUAL
"centos"
)
SET
(
LIB
"lib64"
)
ELSE
()
SET
(
LIB
"lib"
)
ENDIF
(
)
SET
(
PROTOBUF_LITE_LIBRARY
"
${
PROTOBUF_
LIBS_DIR
}
/libprotobuf-lite.a"
CACHE FILEPATH
"protobuf lite library."
FORCE
)
"
${
PROTOBUF_
INSTALL_DIR
}
/
${
LIB
}
/libprotobuf-lite.a"
CACHE FILEPATH
"protobuf lite library."
FORCE
)
SET
(
PROTOBUF_LIBRARY
"
${
PROTOBUF_
LIBS_DIR
}
/libprotobuf.a"
CACHE FILEPATH
"protobuf library."
FORCE
)
"
${
PROTOBUF_
INSTALL_DIR
}
/
${
LIB
}
/libprotobuf.a"
CACHE FILEPATH
"protobuf library."
FORCE
)
SET
(
PROTOBUF_PROTOC_LIBRARY
"
${
PROTOBUF_
LIBS_DIR
}
/libprotoc.a"
CACHE FILEPATH
"protoc library."
FORCE
)
"
${
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
)
cmake/external/python.cmake
浏览文件 @
e2d0e09a
...
...
@@ -12,84 +12,212 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FIND_PACKAGE
(
PythonLibs 2.7
)
FIND_PACKAGE
(
PythonInterp 2.7
)
INCLUDE
(
ExternalProject
)
IF
((
NOT
${
PYTHONINTERP_FOUND
}
)
OR
(
NOT
${
PYTHONLIBS_FOUND
}
))
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
}
)
SET
(
PYTHON_SOURCES_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/Python
)
SET
(
PYTHON_INSTALL_DIR
${
PROJECT_BINARY_DIR
}
/Python
)
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
}
)
IF
(
MSVC
)
LIST
(
APPEND EXTERNAL_PROJECT_OPTIONAL_ARGS
PATCH_COMMAND
${
CMAKE_COMMAND
}
-DPYTHON_SRC_DIR:PATH=
${
_python_SOURCE_DIR
}
-P
${
CMAKE_CURRENT_LIST_DIR
}
/PythonPatch.cmake
)
ENDIF
()
INCLUDE_DIRECTORIES
(
${
PYTHON_INCLUDE_DIR
}
)
IF
(
APPLE
)
IF
(
APPLE
)
LIST
(
APPEND EXTERNAL_PROJECT_OPTIONAL_CMAKE_ARGS
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON
)
ENDIF
()
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON
)
ENDIF
()
SET
(
EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS
)
SET
(
EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS
)
# Force Python build to "Release".
IF
(
CMAKE_CONFIGURATION_TYPES
)
# Force Python build to "Release".
IF
(
CMAKE_CONFIGURATION_TYPES
)
SET
(
SAVED_CMAKE_CFG_INTDIR
${
CMAKE_CFG_INTDIR
}
)
SET
(
CMAKE_CFG_INTDIR
"Release"
)
ELSE
()
ELSE
()
LIST
(
APPEND EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Release
)
ENDIF
()
-DCMAKE_BUILD_TYPE:STRING=Release
)
ENDIF
()
ExternalProject_Add
(
python
ExternalProject_Add
(
python
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/python-cmake-buildsystem/python-cmake-buildsystem.git"
GIT_TAG
"ed5f9bcee540e47f82fa17f8360b820591aa6d66"
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_SHARED:BOOL=OFF
-DBUILD_STATIC:BOOL=ON
-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
}
-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
)
#####################################################################################
SET
(
_python_DIR
${
PYTHON_INSTALL_DIR
}
)
##################################### 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
)
####################################################################################
IF
(
UNIX
)
SET
(
_python_IMPORT_SUFFIX a
)
##################################### NUMPY ########################################
SET
(
NUMPY_SOURCES_DIR
${
PYTHON_SOURCES_DIR
}
/numpy
)
SET
(
NUMPY_TAG_VERSION
"v1.11.3"
)
SET
(
NUMPY_VERSION
"1.11.3"
)
IF
(
WIN32
)
SET
(
EGG_NAME
"numpy-
${
NUMPY_VERSION
}
-py2.7-
${
HOST_SYSTEM
}
.egg"
)
ELSE
(
WIN32
)
IF
(
APPLE
)
SET
(
_python_IMPORT_SUFFIX lib
)
ENDIF
()
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.
${
_python_IMPORT_SUFFIX
}
"
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_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
(
EGG_NAME
"numpy-
${
NUMPY_VERSION
}
-py2.7-
${
HOST_SYSTEM
}
-
${
MACOS_VERSION
}
-x86_64.egg"
)
ELSE
(
APPLE
)
SET
(
EGG_NAME
"numpy-
${
NUMPY_VERSION
}
-py2.7-linux-x86_64.egg"
)
ENDIF
(
APPLE
)
ENDIF
(
WIN32
)
LIST
(
APPEND external_project_dependencies python
)
SET
(
PYTHON_NUMPY_INCLUDE_DIR
"
${
PY_SITE_PACKAGES_PATH
}
/
${
EGG_NAME
}
/numpy/core/include"
)
IF
(
${
PYTHON_FOUND
}
)
# local python
SET
(
PYTHON_NUMPY_INCLUDE_DIR
"
${
PY_SITE_PACKAGES_PATH
}
/
${
EGG_NAME
}
/numpy/core/include"
)
ELSE
(
${
PYTHON_FOUND
}
)
# global python
SET
(
PYTHON_NUMPY_INCLUDE_DIR
""
)
SET
(
PY_SITE_PACKAGES_DIR
""
)
FILE
(
WRITE
${
PROJECT_BINARY_DIR
}
/FindNumpyPath.py
"try: import site; print(site.getsitepackages())
\n
except:pass
\n
"
)
EXEC_PROGRAM
(
"env
${
py_env
}
${
PYTHON_EXECUTABLE
}
"
${
PROJECT_BINARY_DIR
}
ARGS
"FindNumpyPath.py"
OUTPUT_VARIABLE NUMPY_PATH
)
ENDIF
()
STRING
(
REPLACE
"["
""
NUMPY_PATH
"
${
NUMPY_PATH
}
"
)
STRING
(
REPLACE
"]"
""
NUMPY_PATH
"
${
NUMPY_PATH
}
"
)
STRING
(
REPLACE
"'"
""
NUMPY_PATH
"
${
NUMPY_PATH
}
"
)
STRING
(
REPLACE
", "
";"
SITE_DIRS
"
${
NUMPY_PATH
}
"
)
INCLUDE_DIRECTORIES
(
${
PYTHON_INCLUDE_DIR
}
)
FOREACH
(
SITE_DIR
${
SITE_DIRS
}
)
IF
(
EXISTS
${
SITE_DIR
}
)
LIST
(
APPEND PYTHON_NUMPY_INCLUDE_DIR
"
${
SITE_DIR
}
/
${
EGG_NAME
}
/numpy/core/include"
)
SET
(
PY_SITE_PACKAGES_DIR
"
${
SITE_DIR
}
"
)
ENDIF
()
ENDFOREACH
()
ENDIF
(
${
PYTHON_FOUND
}
)
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
)
cmake/external/swig.cmake
浏览文件 @
e2d0e09a
...
...
@@ -12,83 +12,59 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
Look for system swig
FIND_PACKAGE
(
SWIG
)
#
build swig as an external project
INCLUDE
(
ExternalProject
)
IF
(
NOT
${
SWIG_FOUND
}
)
# build swig as an external project
INCLUDE
(
ExternalProject
)
SET
(
SWIG_SOURCES_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/swig
)
SET
(
SWIG_INSTALL_DIR
${
PROJECT_BINARY_DIR
}
/swig
)
SET
(
SWIG_TARGET_VERSION
"3.0.2"
)
SET
(
SWIG_DOWNLOAD_SRC_MD5
"62f9b0d010cef36a13a010dc530d0d41"
)
SET
(
SWIG_DOWNLOAD_WIN_MD5
"3f18de4fc09ab9abb0d3be37c11fbc8f"
)
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
""
)
SET
(
SWIG_DIR
${
SWIG_SOURCES_DIR
}
CACHE FILEPATH
"SWIG Directory"
FORCE
)
SET
(
SWIG_EXECUTABLE
${
SWIG_SOURCES_DIR
}
/swig.exe CACHE FILEPATH
"SWIG Executable"
FORCE
)
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
)
ELSE
(
WIN32
)
# From PCRE configure
ExternalProject_Add
(
pcre
GIT_REPOSITORY https://github.com/svn2github/pcre.git
PREFIX
${
SWIG_SOURCES_DIR
}
/pcre
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
SWIG_INSTALL_DIR
}
/pcre
)
# swig uses bison find it by cmake and pass it down
FIND_PACKAGE
(
BISON
)
# 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
)
# From SWIG configure
ExternalProject_Add
(
swig
URL https://github.com/swig/swig/archive/rel-3.0.10.tar.gz
PREFIX
${
SWIG_SOURCES_DIR
}
UPDATE_COMMAND
""
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
DEPENDS pcre
)
SET
(
SWIG_DIR
${
SWIG_INSTALL_DIR
}
/share/swig/
${
SWIG_TARGET_VERSION
}
)
SET
(
SWIG_EXECUTABLE
${
SWIG_INSTALL_DIR
}
/bin/swig
)
ENDIF
(
WIN32
)
set
(
SWIG_DIR
${
SWIG_INSTALL_DIR
}
/share/swig/
${
SWIG_TARGET_VERSION
}
CACHE FILEPATH
"SWIG Directory"
FORCE
)
set
(
SWIG_EXECUTABLE
${
SWIG_INSTALL_DIR
}
/bin/swig CACHE FILEPATH
"SWIG Executable"
FORCE
)
ENDIF
(
WIN32
)
LIST
(
APPEND external_project_dependencies swig
)
ENDIF
()
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_EXECUTABLE
}
-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
${
external_project_dependencies
}
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
${
external_project_dependencies
}
)
ENDFUNCTION
(
generate_python_api
)
LIST
(
APPEND external_project_dependencies swig
)
cmake/external/warpctc.cmake
浏览文件 @
e2d0e09a
...
...
@@ -15,28 +15,13 @@
INCLUDE
(
ExternalProject
)
SET
(
WARPCTC_SOURCES_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/warpctc
)
SET
(
WARPCTC_INSTALL_DIR
${
PROJECT_BINARY_DIR
}
/warpctc
)
IF
(
CMAKE_CXX_COMPILER_ID STREQUAL
"Clang"
OR CMAKE_CXX_COMPILER_ID STREQUAL
"AppleClang"
)
SET
(
USE_OMP ON
)
ELSE
()
SET
(
USE_OMP OFF
)
ENDIF
()
ExternalProject_Add
(
warpctc
GIT_REPOSITORY
"https://github.com/gangliao/warp-ctc.git"
PREFIX
${
WARPCTC_SOURCES_DIR
}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
WARPCTC_INSTALL_DIR
}
CMAKE_ARGS -DWITH_GPU=
${
WITH_GPU
}
CMAKE_ARGS -DWITH_OMP=
${
USE_OMP
}
UPDATE_COMMAND
""
)
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
)
...
...
@@ -51,4 +36,23 @@ ELSE(WIN32)
"
${
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
)
cmake/external/zlib.cmake
浏览文件 @
e2d0e09a
...
...
@@ -15,30 +15,29 @@
INCLUDE
(
ExternalProject
)
SET
(
ZLIB_SOURCES_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/third_party/zlib
)
SET
(
ZLIB_INSTALL_DIR
${
PROJECT_BINARY_DIR
}
/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
LOG_DOWNLOAD =ON
UPDATE_COMMAND
""
)
SET
(
ZLIB_ROOT
${
ZLIB_INSTALL_DIR
}
CACHE PATH
"zlib root directory."
FORCE
)
SET
(
ZLIB_INCLUDE_DIR
"
${
ZLIB_INSTALL_DIR
}
/include"
CACHE PATH
"zlib include directory."
FORCE
)
INCLUDE_DIRECTORIES
(
${
ZLIB_INCLUDE_DIR
}
)
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
)
LIST
(
APPEND external_project_dependencies zlib
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录