Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
341dee06
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
341dee06
编写于
11月 25, 2019
作者:
Z
zhouwei25
提交者:
liuwei1031
11月 25, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cache 3rd source code, improve stability, reduce the compilation time (#21190)
上级
8ac7687e
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
316 addition
and
148 deletion
+316
-148
cmake/external/boost.cmake
cmake/external/boost.cmake
+13
-10
cmake/external/cares.cmake
cmake/external/cares.cmake
+1
-1
cmake/external/cub.cmake
cmake/external/cub.cmake
+12
-6
cmake/external/dgc.cmake
cmake/external/dgc.cmake
+5
-5
cmake/external/dlpack.cmake
cmake/external/dlpack.cmake
+14
-6
cmake/external/eigen.cmake
cmake/external/eigen.cmake
+29
-19
cmake/external/gflags.cmake
cmake/external/gflags.cmake
+10
-4
cmake/external/glog.cmake
cmake/external/glog.cmake
+10
-7
cmake/external/gtest.cmake
cmake/external/gtest.cmake
+14
-8
cmake/external/mkldnn.cmake
cmake/external/mkldnn.cmake
+23
-17
cmake/external/mklml.cmake
cmake/external/mklml.cmake
+15
-9
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+2
-2
cmake/external/protobuf.cmake
cmake/external/protobuf.cmake
+13
-12
cmake/external/pybind11.cmake
cmake/external/pybind11.cmake
+14
-6
cmake/external/threadpool.cmake
cmake/external/threadpool.cmake
+14
-5
cmake/external/warpctc.cmake
cmake/external/warpctc.cmake
+9
-5
cmake/external/xxhash.cmake
cmake/external/xxhash.cmake
+22
-19
cmake/external/zlib.cmake
cmake/external/zlib.cmake
+10
-4
cmake/third_party.cmake
cmake/third_party.cmake
+86
-3
未找到文件。
cmake/external/boost.cmake
浏览文件 @
341dee06
...
...
@@ -22,26 +22,29 @@ set(BOOST_PROJECT "extern_boost")
# version of boost, say, 1.66.0, doesn't build on CentOS 6. We
# checked that the devtools package of CentOS 6 installs boost 1.41.0.
# So we use 1.41.0 here.
set
(
BOOST_VER
"1.41.0"
)
set
(
BOOST_TAR
"boost_1_41_0"
CACHE STRING
""
FORCE
)
set
(
BOOST_URL
"http://paddlepaddledeps.bj.bcebos.com/
${
BOOST_TAR
}
.tar.gz"
CACHE STRING
""
FORCE
)
set
(
BOOST_VER
"1.41.0"
)
set
(
BOOST_TAR
"boost_1_41_0"
CACHE STRING
""
FORCE
)
set
(
BOOST_URL
"http://paddlepaddledeps.bj.bcebos.com/
${
BOOST_TAR
}
.tar.gz"
CACHE STRING
""
FORCE
)
MESSAGE
(
STATUS
"BOOST_
TAR:
${
BOOST_TA
R
}
, BOOST_URL:
${
BOOST_URL
}
"
)
MESSAGE
(
STATUS
"BOOST_
VERSION:
${
BOOST_VE
R
}
, BOOST_URL:
${
BOOST_URL
}
"
)
set
(
BOOST_SOURCES_DIR
${
THIRD_PARTY_PATH
}
/boost
)
set
(
BOOST_DOWNLOAD_DIR
"
${
BOOST_SOURCES_DIR
}
/src/
${
BOOST_PROJECT
}
"
)
set
(
BOOST_PREFIX_DIR
${
THIRD_PARTY_PATH
}
/boost
)
cache_third_party
(
${
BOOST_PROJECT
}
URL
${
BOOST_URL
}
DIR
${
BOOST_PREFIX_DIR
}
)
set
(
BOOST_INCLUDE_DIR
"
${
BOOST_
DOWNLOAD
_DIR
}
"
CACHE PATH
"boost include directory."
FORCE
)
set
(
BOOST_INCLUDE_DIR
"
${
BOOST_
SOURCE
_DIR
}
"
CACHE PATH
"boost include directory."
FORCE
)
set_directory_properties
(
PROPERTIES CLEAN_NO_CUSTOM 1
)
include_directories
(
${
BOOST_INCLUDE_DIR
}
)
ExternalProject_Add
(
${
BOOST_PROJECT
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
DOWNLOAD_DIR
${
BOOST_DOWNLOAD_DIR
}
URL
${
BOOST_URL
}
"
${
BOOST_DOWNLOAD_CMD
}
"
PREFIX
${
BOOST_PREFIX_DIR
}
DOWNLOAD_DIR
${
BOOST_SOURCE_DIR
}
SOURCE_DIR
${
BOOST_SOURCE_DIR
}
DOWNLOAD_NO_PROGRESS 1
PREFIX
${
BOOST_SOURCES_DIR
}
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
...
...
cmake/external/cares.cmake
浏览文件 @
341dee06
...
...
@@ -36,7 +36,7 @@ ExternalProject_Add(
CONFIGURE_COMMAND ./buildconf && ./configure --disable-shared --prefix=
${
CARES_INSTALL_DIR
}
BUILD_IN_SOURCE 1
PATCH_COMMAND
${
PATCH_COMMAND_CARES
}
BUILD_COMMAND make -j
8
BUILD_COMMAND make -j
$
(
nproc
)
INSTALL_COMMAND make install
)
...
...
cmake/external/cub.cmake
浏览文件 @
341dee06
...
...
@@ -14,18 +14,24 @@
include
(
ExternalProject
)
set
(
CUB_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/cub
)
set
(
CUB_INCLUDE_DIR
${
CUB_SOURCE_DIR
}
/src/extern_cub
)
set
(
CUB_PREFIX_DIR
${
THIRD_PARTY_PATH
}
/cub
)
set
(
CUB_REPOSITORY https://github.com/NVlabs/cub.git
)
set
(
CUB_TAG v1.8.0
)
include_directories
(
${
CUB_INCLUDE_DIR
}
)
cache_third_party
(
extern_cub
REPOSITORY
${
CUB_REPOSITORY
}
TAG
${
CUB_TAG
}
DIR
${
CUB_PREFIX_DIR
}
)
include_directories
(
${
CUB_SOURCE_DIR
}
)
ExternalProject_Add
(
extern_cub
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
GIT_REPOSITORY
"https://github.com/NVlabs/cub.git
"
GIT_TAG
"v1.8.0"
PREFIX
${
CUB_SOURCE_DIR
}
"
${
CUB_DOWNLOAD_CMD
}
"
PREFIX
${
CUB_PREFIX_DIR
}
SOURCE_DIR
${
CUB_SOURCE_DIR
}
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
...
...
cmake/external/dgc.cmake
浏览文件 @
341dee06
...
...
@@ -17,17 +17,17 @@ INCLUDE(ExternalProject)
SET
(
DGC_SOURCES_DIR
"
${
THIRD_PARTY_PATH
}
/dgc"
)
SET
(
DGC_INSTALL_DIR
"
${
THIRD_PARTY_PATH
}
/install/dgc"
)
SET
(
DGC_INCLUDE_DIR
"
${
DGC_INSTALL_DIR
}
/include"
CACHE PATH
"dgc include directory."
FORCE
)
SET
(
DGC_LIBRARIES
"
${
DGC_INSTALL_DIR
}
/lib/libdgc.a"
CACHE FILEPATH
"dgc library."
FORCE
)
SET
(
DGC_LIBRARIES
"
${
DGC_INSTALL_DIR
}
/lib/libdgc.a"
CACHE FILEPATH
"dgc library."
FORCE
)
INCLUDE_DIRECTORIES
(
${
DGC_INCLUDE_DIR
}
)
ExternalProject_Add
(
extern_dgc
${
EXTERNAL_PROJECT_LOG_ARGS
}
URL
"http://fleet.bj.bcebos.com/collective_ef2216a.tgz"
URL_MD5
"2f67549fd5f1262383d83289abc4f88f"
SOURCE_DIR
"
${
DGC_SOURCES_DIR
}
"
URL
"http://fleet.bj.bcebos.com/collective_ef2216a.tgz"
URL_MD5
"2f67549fd5f1262383d83289abc4f88f"
SOURCE_DIR
"
${
DGC_SOURCES_DIR
}
"
CONFIGURE_COMMAND
""
BUILD_COMMAND make -j
BUILD_COMMAND make -j
$
(
nproc
)
INSTALL_COMMAND mkdir -p
${
DGC_INSTALL_DIR
}
/lib/
${
DGC_INCLUDE_DIR
}
/dgc
&& cp
${
DGC_SOURCES_DIR
}
/build/lib/libdgc.a
${
DGC_LIBRARIES
}
&& cp
${
DGC_SOURCES_DIR
}
/build/include/dgc.h
${
DGC_INCLUDE_DIR
}
/dgc/
...
...
cmake/external/dlpack.cmake
浏览文件 @
341dee06
...
...
@@ -14,19 +14,27 @@
include
(
ExternalProject
)
set
(
DLPACK_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/dlpack
)
set
(
DLPACK_INCLUDE_DIR
${
DLPACK_SOURCE_DIR
}
/src/extern_dlpack/include
)
set
(
DLPACK_PREFIX_DIR
${
THIRD_PARTY_PATH
}
/dlpack
)
set
(
DLPACK_REPOSITORY https://github.com/dmlc/dlpack.git
)
set
(
DLPACK_TAG v0.2
)
cache_third_party
(
extern_dlpack
REPOSITORY
${
DLPACK_REPOSITORY
}
TAG
${
DLPACK_TAG
}
DIR
${
DLPACK_PREFIX_DIR
}
)
set
(
DLPACK_INCLUDE_DIR
${
DLPACK_SOURCE_DIR
}
/include
)
include_directories
(
${
DLPACK_INCLUDE_DIR
}
)
ExternalProject_Add
(
extern_dlpack
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
GIT_REPOSITORY
"https://github.com/dmlc/dlpack.git
"
GIT_TAG
"v0.2"
PREFIX
${
DLPACK_SOURCE_DIR
}
UPDATE_COMMAND
""
"
${
DLPACK_DOWNLOAD_CMD
}
"
PREFIX
${
DLPACK_PREFIX_DIR
}
SOURCE_DIR
${
DLPACK_SOURCE_DIR
}
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
...
...
cmake/external/eigen.cmake
浏览文件 @
341dee06
...
...
@@ -12,28 +12,41 @@
# See the License for the specific language governing permissions and
# limitations under the License.
INCLUDE
(
ExternalProject
)
include
(
ExternalProject
)
SET
(
EIGEN_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/eigen3
)
SET
(
EIGEN_INCLUDE_DIR
${
EIGEN_SOURCE_DIR
}
/src/extern_eigen3
)
INCLUDE_DIRECTORIES
(
${
EIGEN_INCLUDE_DIR
}
)
set
(
EIGEN_PREFIX_DIR
${
THIRD_PARTY_PATH
}
/eigen3
)
# eigen on cuda9.1 missing header of math_funtions.hpp
# https://stackoverflow.com/questions/43113508/math-functions-hpp-not-found-when-using-cuda-with-eigen
if
(
WITH_AMD_GPU
)
set
(
EIGEN_REPOSITORY https://github.com/sabreshao/hipeigen.git
)
set
(
EIGEN_TAG 7cb2b6e5a4b4a1efe658abb215cd866c6fb2275e
)
endif
()
if
(
WIN32
)
set
(
EIGEN_
GIT_
REPOSITORY https://github.com/wopeizl/eigen-git-mirror
)
set
(
EIGEN_
GIT_TAG
support_cuda9_win
)
set
(
EIGEN_REPOSITORY https://github.com/wopeizl/eigen-git-mirror
)
set
(
EIGEN_
TAG
support_cuda9_win
)
else
()
set
(
EIGEN_
GIT_
REPOSITORY https://github.com/eigenteam/eigen-git-mirror
)
set
(
EIGEN_
GIT_TAG
917060c364181f33a735dc023818d5a54f60e54c
)
set
(
EIGEN_REPOSITORY https://github.com/eigenteam/eigen-git-mirror
)
set
(
EIGEN_
TAG
917060c364181f33a735dc023818d5a54f60e54c
)
endif
()
cache_third_party
(
extern_eigen3
REPOSITORY
${
EIGEN_REPOSITORY
}
TAG
${
EIGEN_TAG
}
DIR
${
EIGEN_PREFIX_DIR
}
)
set
(
EIGEN_INCLUDE_DIR
${
EIGEN_SOURCE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
EIGEN_INCLUDE_DIR
}
)
if
(
WITH_AMD_GPU
)
ExternalProject_Add
(
extern_eigen3
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
GIT_REPOSITORY
"https://github.com/sabreshao/hipeigen.git
"
GIT_TAG 7cb2b6e5a4b4a1efe658abb215cd866c6fb2275e
PREFIX
${
EIGEN_SOURCE_DIR
}
UPDATE_COMMAND
""
"
${
DOWNLOAD_CMD
}
"
PREFIX
${
EIGEN_PREFIX_DIR
}
SOURCE_DIR
${
EIGEN_SOURCE_DIR
}
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
...
...
@@ -44,13 +57,10 @@ else()
extern_eigen3
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
GIT_REPOSITORY
"
${
EIGEN_GIT_REPOSITORY
}
"
# eigen on cuda9.1 missing header of math_funtions.hpp
# https://stackoverflow.com/questions/43113508/math-functions-hpp-not-found-when-using-cuda-with-eigen
GIT_TAG
${
EIGEN_GIT_TAG
}
PREFIX
${
EIGEN_SOURCE_DIR
}
DOWNLOAD_NAME
"eigen"
UPDATE_COMMAND
""
"
${
EIGEN_DOWNLOAD_CMD
}
"
PREFIX
${
EIGEN_PREFIX_DIR
}
SOURCE_DIR
${
EIGEN_SOURCE_DIR
}
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
...
...
cmake/external/gflags.cmake
浏览文件 @
341dee06
...
...
@@ -14,9 +14,11 @@
INCLUDE
(
ExternalProject
)
SET
(
GFLAGS_
SOURCES
_DIR
${
THIRD_PARTY_PATH
}
/gflags
)
SET
(
GFLAGS_
PREFIX
_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
)
set
(
GFLAGS_REPOSITORY https://github.com/gflags/gflags.git
)
set
(
GFLAGS_TAG 77592648e3f3be87d6c7123eb81cbad75f9aef5a
)
IF
(
WIN32
)
set
(
GFLAGS_LIBRARIES
"
${
GFLAGS_INSTALL_DIR
}
/lib/gflags_static.lib"
CACHE FILEPATH
"GFLAGS_LIBRARIES"
FORCE
)
ELSE
(
WIN32
)
...
...
@@ -27,13 +29,17 @@ ENDIF(WIN32)
INCLUDE_DIRECTORIES
(
${
GFLAGS_INCLUDE_DIR
}
)
cache_third_party
(
extern_gflags
REPOSITORY
${
GFLAGS_REPOSITORY
}
TAG
${
GFLAGS_TAG
}
)
ExternalProject_Add
(
extern_gflags
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
GIT_REPOSITORY
"https://github.com/gflags/gflags.git
"
GIT_TAG 77592648e3f3be87d6c7123eb81cbad75f9aef5a
PREFIX
${
GFLAGS_SOURCES
_DIR
}
"
${
GFLAGS_DOWNLOAD_CMD
}
"
PREFIX
${
GFLAGS_PREFIX_DIR
}
SOURCE_DIR
${
GFLAGS_SOURCE
_DIR
}
BUILD_COMMAND
${
BUILD_COMMAND
}
INSTALL_COMMAND
${
INSTALL_COMMAND
}
UPDATE_COMMAND
""
...
...
cmake/external/glog.cmake
浏览文件 @
341dee06
...
...
@@ -14,9 +14,11 @@
INCLUDE
(
ExternalProject
)
SET
(
GLOG_
SOURCES_DIR
${
THIRD_PARTY_PATH
}
/glog
)
SET
(
GLOG_
PREFIX_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
)
SET
(
GLOG_REPOSITORY https://github.com/google/glog.git
)
SET
(
GLOG_TAG v0.3.5
)
IF
(
WIN32
)
SET
(
GLOG_LIBRARIES
"
${
GLOG_INSTALL_DIR
}
/lib/glog.lib"
CACHE FILEPATH
"glog library."
FORCE
)
...
...
@@ -28,17 +30,18 @@ ENDIF(WIN32)
INCLUDE_DIRECTORIES
(
${
GLOG_INCLUDE_DIR
}
)
SET
(
GLOG_REPOSITORY
"https://github.com/google/glog.git"
)
SET
(
GLOG_TAG
"v0.3.5"
)
cache_third_party
(
extern_glog
REPOSITORY
${
GLOG_REPOSITORY
}
TAG
${
GLOG_TAG
}
)
ExternalProject_Add
(
extern_glog
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
DEPENDS gflags
GIT_REPOSITORY
${
GLOG_REPOSITORY
}
GIT_TAG
${
GLOG_TAG
}
PREFIX
${
GLOG_SOURCES
_DIR
}
"
${
GLOG_DOWNLOAD_CMD
}
"
DEPENDS gflags
PREFIX
${
GLOG_PREFIX_DIR
}
SOURCE_DIR
${
GLOG_SOURCE
_DIR
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
...
...
cmake/external/gtest.cmake
浏览文件 @
341dee06
...
...
@@ -21,9 +21,11 @@ ENDIF()
INCLUDE
(
GNUInstallDirs
)
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
)
SET
(
GTEST_PREFIX_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
)
set
(
GTEST_REPOSITORY https://github.com/google/googletest.git
)
set
(
GTEST_TAG release-1.8.1
)
INCLUDE_DIRECTORIES
(
${
GTEST_INCLUDE_DIR
}
)
...
...
@@ -44,14 +46,18 @@ IF(WITH_MKLML)
SET
(
GTEST_DEPENDS
${
MKLML_PROJECT
}
)
ENDIF
()
cache_third_party
(
extern_gtest
REPOSITORY
${
GTEST_REPOSITORY
}
TAG
${
GTEST_TAG
}
)
ExternalProject_Add
(
extern_gtest
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
"
${
GTEST_DOWNLOAD_CMD
}
"
DEPENDS
${
GTEST_DEPENDS
}
GIT_REPOSITORY
"https://github.com/google/googletest.git"
GIT_TAG
"release-1.8.1"
PREFIX
${
GTEST_SOURCES_DIR
}
PREFIX
${
GTEST_PREFIX_DIR
}
SOURCE_DIR
${
GTEST_SOURCE_DIR
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
...
...
@@ -69,8 +75,8 @@ ExternalProject_Add(
-DCMAKE_BUILD_TYPE=
${
THIRD_PARTY_BUILD_TYPE
}
${
EXTERNAL_OPTIONAL_ARGS
}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
GTEST_INSTALL_DIR
}
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=
${
THIRD_PARTY_BUILD_TYPE
}
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=
${
THIRD_PARTY_BUILD_TYPE
}
)
ADD_LIBRARY
(
gtest STATIC IMPORTED GLOBAL
)
...
...
cmake/external/mkldnn.cmake
浏览文件 @
341dee06
...
...
@@ -15,9 +15,11 @@
INCLUDE
(
ExternalProject
)
SET
(
MKLDNN_PROJECT
"extern_mkldnn"
)
SET
(
MKLDNN_
SOURCES
_DIR
${
THIRD_PARTY_PATH
}
/mkldnn
)
SET
(
MKLDNN_
PREFIX
_DIR
${
THIRD_PARTY_PATH
}
/mkldnn
)
SET
(
MKLDNN_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/mkldnn
)
SET
(
MKLDNN_INC_DIR
"
${
MKLDNN_INSTALL_DIR
}
/include"
CACHE PATH
"mkldnn include directory."
FORCE
)
SET
(
MKLDNN_REPOSITORY https://github.com/intel/mkl-dnn.git
)
SET
(
MKLDNN_TAG aef88b7c233f48f8b945da310f1b973da31ad033
)
# Introduce variables:
# * CMAKE_INSTALL_LIBDIR
...
...
@@ -49,29 +51,33 @@ ELSE()
SET
(
MKLDNN_CXXFLAG
"
${
CMAKE_CXX_FLAGS
}
/EHsc"
)
ENDIF
(
NOT WIN32
)
cache_third_party
(
${
MKLDNN_PROJECT
}
REPOSITORY
${
MKLDNN_REPOSITORY
}
TAG
${
MKLDNN_TAG
}
)
ExternalProject_Add
(
${
MKLDNN_PROJECT
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
"
${
MKLDNN_DOWNLOAD_CMD
}
"
DEPENDS
${
MKLDNN_DEPENDS
}
GIT_REPOSITORY
"https://github.com/intel/mkl-dnn.git"
GIT_TAG
"aef88b7c233f48f8b945da310f1b973da31ad033"
PREFIX
${
MKLDNN_SOURCES_DIR
}
PREFIX
${
MKLDNN_PREFIX_DIR
}
SOURCE_DIR
${
MKLDNN_SOURCE_DIR
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
CMAKE_ARGS
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
CMAKE_ARGS
-DCMAKE_CXX_FLAGS_RELEASE=
${
CMAKE_CXX_FLAGS_RELEASE
}
CMAKE_ARGS
-DCMAKE_CXX_FLAGS_DEBUG=
${
CMAKE_CXX_FLAGS_DEBUG
}
CMAKE_ARGS
-DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
CMAKE_ARGS
-DCMAKE_C_FLAGS_DEBUG=
${
CMAKE_C_FLAGS_DEBUG
}
CMAKE_ARGS
-DCMAKE_C_FLAGS_RELEASE=
${
CMAKE_C_FLAGS_RELEASE
}
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=
${
MKLDNN_INSTALL_DIR
}
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
CMAKE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
CMAKE_ARGS
-DMKLROOT=
${
MKLML_ROOT
}
CMAKE_ARGS
-DCMAKE_C_FLAGS=
${
MKLDNN_CFLAG
}
CMAKE_ARGS
-DCMAKE_CXX_FLAGS=
${
MKLDNN_CXXFLAG
}
CMAKE_ARGS
-DWITH_TEST=OFF -DWITH_EXAMPLE=OFF
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_FLAGS_RELEASE=
${
CMAKE_CXX_FLAGS_RELEASE
}
-DCMAKE_CXX_FLAGS_DEBUG=
${
CMAKE_CXX_FLAGS_DEBUG
}
-DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
-DCMAKE_C_FLAGS_DEBUG=
${
CMAKE_C_FLAGS_DEBUG
}
-DCMAKE_C_FLAGS_RELEASE=
${
CMAKE_C_FLAGS_RELEASE
}
-DCMAKE_INSTALL_PREFIX=
${
MKLDNN_INSTALL_DIR
}
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DMKLROOT=
${
MKLML_ROOT
}
-DCMAKE_C_FLAGS=
${
MKLDNN_CFLAG
}
-DCMAKE_CXX_FLAGS=
${
MKLDNN_CXXFLAG
}
-DWITH_TEST=OFF -DWITH_EXAMPLE=OFF
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
MKLDNN_INSTALL_DIR
}
-DMKLROOT:PATH=
${
MKLML_ROOT
}
)
...
...
cmake/external/mklml.cmake
浏览文件 @
341dee06
...
...
@@ -43,24 +43,30 @@ ENDIF()
SET
(
MKLML_PROJECT
"extern_mklml"
)
MESSAGE
(
STATUS
"MKLML_VER:
${
MKLML_VER
}
, MKLML_URL:
${
MKLML_URL
}
"
)
SET
(
MKLML_SOURCE_DIR
"
${
THIRD_PARTY_PATH
}
/mklml"
)
SET
(
MKLML_DOWNLOAD_DIR
"
${
MKLML_SOURCE_DIR
}
/src/
${
MKLML_PROJECT
}
"
)
SET
(
MKLML_PREFIX_DIR
"
${
THIRD_PARTY_PATH
}
/mklml"
)
cache_third_party
(
${
MKLML_PROJECT
}
URL
${
MKLML_URL
}
DIR
${
MKLML_PREFIX_DIR
}
)
ExternalProject_Add
(
${
MKLML_PROJECT
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
PREFIX
${
MKLML_SOURCE_DIR
}
URL
${
MKLML_URL
}
DOWNLOAD_DIR
${
MKLML_DOWNLOAD_DIR
}
"
${
MKLML_DOWNLOAD_CMD
}
"
PREFIX
${
MKLML_PREFIX_DIR
}
DOWNLOAD_DIR
${
MKLML_SOURCE_DIR
}
SOURCE_DIR
${
MKLML_SOURCE_DIR
}
DOWNLOAD_NO_PROGRESS 1
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
UPDATE_COMMAND
""
INSTALL_COMMAND
${
CMAKE_COMMAND
}
-E copy_directory
${
MKLML_DOWNLOAD_DIR
}
/include
${
MKLML_INC_DIR
}
&&
${
CMAKE_COMMAND
}
-E copy_directory
${
MKLML_DOWNLOAD_DIR
}
/lib
${
MKLML_LIB_DIR
}
UPDATE_COMMAND
""
INSTALL_COMMAND
""
)
add_custom_command
(
TARGET
${
MKLML_PROJECT
}
POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E copy_directory
${
MKLML_SOURCE_DIR
}
/include
${
MKLML_INC_DIR
}
COMMAND
${
CMAKE_COMMAND
}
-E copy_directory
${
MKLML_SOURCE_DIR
}
/lib
${
MKLML_LIB_DIR
}
)
INCLUDE_DIRECTORIES
(
${
MKLML_INC_DIR
}
)
ADD_LIBRARY
(
mklml SHARED IMPORTED GLOBAL
)
...
...
cmake/external/openblas.cmake
浏览文件 @
341dee06
...
...
@@ -42,8 +42,8 @@ IF(NOT WIN32)
PREFIX
${
CBLAS_SOURCES_DIR
}
INSTALL_DIR
${
CBLAS_INSTALL_DIR
}
BUILD_IN_SOURCE 1
BUILD_COMMAND
${
CMAKE_MAKE_PROGRAM
}
${
COMMON_ARGS
}
${
OPTIONAL_ARGS
}
INSTALL_COMMAND
${
CMAKE_MAKE_PROGRAM
}
install NO_SHARED=1 NO_LAPACK=1 PREFIX=<INSTALL_DIR>
BUILD_COMMAND
make -j$
(
nproc
)
${
COMMON_ARGS
}
${
OPTIONAL_ARGS
}
INSTALL_COMMAND
make
install NO_SHARED=1 NO_LAPACK=1 PREFIX=<INSTALL_DIR>
&& rm -r
${
CBLAS_INSTALL_DIR
}
/lib/cmake
${
CBLAS_INSTALL_DIR
}
/lib/pkgconfig
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
...
...
cmake/external/protobuf.cmake
浏览文件 @
341dee06
...
...
@@ -17,10 +17,6 @@ INCLUDE(ExternalProject)
IF
(
NOT WIN32
)
FIND_PACKAGE
(
Protobuf QUIET
)
ENDIF
(
NOT WIN32
)
macro
(
UNSET_VAR VAR_NAME
)
UNSET
(
${
VAR_NAME
}
CACHE
)
UNSET
(
${
VAR_NAME
}
)
endmacro
()
UNSET_VAR
(
PROTOBUF_INCLUDE_DIR
)
UNSET_VAR
(
PROTOBUF_FOUND
)
...
...
@@ -160,7 +156,7 @@ endif()
FUNCTION
(
build_protobuf TARGET_NAME BUILD_FOR_HOST
)
STRING
(
REPLACE
"extern_"
""
TARGET_DIR_NAME
"
${
TARGET_NAME
}
"
)
SET
(
PROTOBUF_
SOURCES_DIR
${
THIRD_PARTY_PATH
}
/
${
TARGET_DIR_NAME
}
)
SET
(
PROTOBUF_
PREFIX_DIR
${
THIRD_PARTY_PATH
}
/
${
TARGET_DIR_NAME
}
)
SET
(
PROTOBUF_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/
${
TARGET_DIR_NAME
}
)
SET
(
${
TARGET_NAME
}
_INCLUDE_DIR
"
${
PROTOBUF_INSTALL_DIR
}
/include"
PARENT_SCOPE
)
...
...
@@ -203,21 +199,26 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
"-DCMAKE_GENERATOR_PLATFORM=
${
CMAKE_GENERATOR_PLATFORM
}
"
)
ENDIF
()
SET
(
PROTOBUF_REPO
"https://github.com/protocolbuffers/protobuf.git"
)
SET
(
PROTOBUF_TAG
"9f75c5aa851cd877fb0d93ccc31b8567a6706546"
)
SET
(
PROTOBUF_REPOSITORY https://github.com/protocolbuffers/protobuf.git
)
SET
(
PROTOBUF_TAG 9f75c5aa851cd877fb0d93ccc31b8567a6706546
)
cache_third_party
(
${
TARGET_NAME
}
REPOSITORY
${
PROTOBUF_REPOSITORY
}
TAG
${
PROTOBUF_TAG
}
DIR
${
PROTOBUF_PREFIX_DIR
}
)
ExternalProject_Add
(
${
TARGET_NAME
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
PREFIX
${
PROTOBUF_SOURCES_DIR
}
"
${
PROTOBUF_DOWNLOAD_CMD
}
"
PREFIX
${
PROTOBUF_PREFIX_DIR
}
SOURCE_DIR
${
PROTOBUF_SOURCE_DIR
}
UPDATE_COMMAND
""
DEPENDS zlib
GIT_REPOSITORY
${
PROTOBUF_REPO
}
GIT_TAG
${
PROTOBUF_TAG
}
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
${
PROTOBUF_SOURCES_DIR
}
/src/
${
TARGET_NAME
}
/cmake
${
OPTIONAL_ARGS
}
${
CMAKE_COMMAND
}
${
PROTOBUF_SOURCE_DIR
}
/cmake
${
OPTIONAL_ARGS
}
-Dprotobuf_BUILD_TESTS=OFF
-DCMAKE_SKIP_RPATH=ON
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
...
...
cmake/external/pybind11.cmake
浏览文件 @
341dee06
...
...
@@ -14,18 +14,26 @@
include
(
ExternalProject
)
set
(
PYBIND_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/pybind
)
set
(
PYBIND_PREFIX_DIR
${
THIRD_PARTY_PATH
}
/pybind
)
SET
(
PYBIND_REPOSITORY https://github.com/pybind/pybind11.git
)
SET
(
PYBIND_TAG v2.2.4
)
include_directories
(
${
PYBIND_SOURCE_DIR
}
/src/extern_pybind/include
)
cache_third_party
(
extern_pybind
REPOSITORY
${
PYBIND_REPOSITORY
}
TAG
${
PYBIND_TAG
}
DIR
${
PYBIND_PREFIX_DIR
}
)
set
(
PYBIND_INCLUDE_DIR
${
PYBIND_SOURCE_DIR
}
/include
)
include_directories
(
${
PYBIND_INCLUDE_DIR
}
)
ExternalProject_Add
(
extern_pybind
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
GIT_REPOSITORY
"https://github.com/pybind/pybind11.git
"
GIT_TAG
"v2.2.4"
PREFIX
${
PYBIND_SOURCE_DIR
}
UPDATE_COMMAND
""
"
${
PYBIND_DOWNLOAD_CMD
}
"
PREFIX
${
PYBIND_PREFIX_DIR
}
SOURCE_DIR
${
PYBIND_SOURCE_DIR
}
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
...
...
cmake/external/threadpool.cmake
浏览文件 @
341dee06
...
...
@@ -14,17 +14,26 @@
INCLUDE
(
ExternalProject
)
SET
(
THREADPOOL_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/threadpool
)
SET
(
THREADPOOL_INCLUDE_DIR
${
THREADPOOL_SOURCE_DIR
}
/src/extern_threadpool
)
SET
(
THREADPOOL_PREFIX_DIR
${
THIRD_PARTY_PATH
}
/threadpool
)
set
(
THREADPOOL_REPOSITORY https://github.com/progschj/ThreadPool.git
)
set
(
THREADPOOL_TAG 9a42ec1329f259a5f4881a291db1dcb8f2ad9040
)
INCLUDE_DIRECTORIES
(
${
THREADPOOL_INCLUDE_DIR
}
)
cache_third_party
(
extern_threadpool
REPOSITORY
${
THREADPOOL_REPOSITORY
}
TAG
${
THREADPOOL_TAG
}
DIR
${
THREADPOOL_PREFIX_DIR
}
)
include_directories
(
${
THREADPOOL_SOURCE_DIR
}
)
ExternalProject_Add
(
extern_threadpool
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
GIT_REPOSITORY
"https://github.com/progschj/ThreadPool.git
"
GIT_TAG 9a42ec1329f259a5f4881a291db1dcb8f2ad9040
PREFIX
${
THREADPOOL_SOURCE_DIR
}
"
${
THREADPOOL_DOWNLOAD_CMD
}
"
PREFIX
${
THREADPOOL_PREFIX_DIR
}
SOURCE_DIR
${
THREADPOOL_SOURCE_DIR
}
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
...
...
cmake/external/warpctc.cmake
浏览文件 @
341dee06
...
...
@@ -14,9 +14,12 @@
INCLUDE
(
ExternalProject
)
SET
(
WARPCTC_
SOURCES
_DIR
${
THIRD_PARTY_PATH
}
/warpctc
)
SET
(
WARPCTC_
PREFIX
_DIR
${
THIRD_PARTY_PATH
}
/warpctc
)
SET
(
WARPCTC_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/warpctc
)
# TODO: Use the official github address instead of private branch
set
(
WARPCTC_REPOSITORY https://github.com/wopeizl/warp-ctc.git
)
SET
(
WARPCTC_INCLUDE_DIR
"
${
WARPCTC_INSTALL_DIR
}
/include"
CACHE PATH
"Warp-ctc Directory"
FORCE
)
# Used in unit test test_WarpCTCLayer
...
...
@@ -29,15 +32,16 @@ ELSE()
SET
(
USE_OMP ON
)
ENDIF
()
# TODO: Use the official github address instead of private branch
SET
(
WARPCTC_REPOSITORY
"https://github.com/wopeizl/warp-ctc.git"
)
cache_third_party
(
extern_warpctc
REPOSITORY
${
WARPCTC_REPOSITORY
}
)
ExternalProject_Add
(
extern_warpctc
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
GIT_REPOSITORY
${
WARPCTC_REPOSITORY
}
PREFIX
${
WARPCTC_SOURCES_DIR
}
"
${
WARPCTC_DOWNLOAD_CMD
}
"
PREFIX
${
WARPCTC_PREFIX_DIR
}
SOURCE_DIR
${
WARPCTC_SOURCE_DIR
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
...
...
cmake/external/xxhash.cmake
浏览文件 @
341dee06
...
...
@@ -14,17 +14,24 @@
INCLUDE
(
ExternalProject
)
set
(
XXHASH_
SOURCE
_DIR
${
THIRD_PARTY_PATH
}
/xxhash
)
set
(
XXHASH_
PREFIX
_DIR
${
THIRD_PARTY_PATH
}
/xxhash
)
set
(
XXHASH_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/xxhash
)
set
(
XXHASH_INCLUDE_DIR
"
${
XXHASH_INSTALL_DIR
}
/include"
)
set
(
XXHASH_REPOSITORY https://github.com/Cyan4973/xxHash
)
set
(
XXHASH_TAG v0.6.5
)
cache_third_party
(
extern_xxhash
REPOSITORY
${
XXHASH_REPOSITORY
}
TAG
${
XXHASH_TAG
}
DIR
${
XXHASH_PREFIX_DIR
}
)
IF
(
WITH_STATIC_LIB
)
SET
(
BUILD_CMD make lib
)
ELSE
()
IF
(
APPLE
)
SET
(
BUILD_CMD sed -i \"\"
"s/-Wstrict-prototypes -Wundef/-Wstrict-prototypes -Wundef -fPIC/g"
${
XXHASH_SOURCE_DIR
}
/
src/extern_xxhash/
Makefile && make lib
)
SET
(
BUILD_CMD sed -i \"\"
"s/-Wstrict-prototypes -Wundef/-Wstrict-prototypes -Wundef -fPIC/g"
${
XXHASH_SOURCE_DIR
}
/Makefile && make lib
)
ELSE
(
APPLE
)
SET
(
BUILD_CMD sed -i
"s/-Wstrict-prototypes -Wundef/-Wstrict-prototypes -Wundef -fPIC/g"
${
XXHASH_SOURCE_DIR
}
/
src/extern_xxhash/
Makefile && make lib
)
SET
(
BUILD_CMD sed -i
"s/-Wstrict-prototypes -Wundef/-Wstrict-prototypes -Wundef -fPIC/g"
${
XXHASH_SOURCE_DIR
}
/Makefile && make lib
)
ENDIF
(
APPLE
)
ENDIF
()
...
...
@@ -33,15 +40,13 @@ if(WIN32)
extern_xxhash
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
GIT_REPOSITORY
"https://github.com/Cyan4973/xxHash"
GIT_TAG
"v0.6.5"
PREFIX
${
XXHASH_SOURCE_DIR
}
DOWNLOAD_NAME
"xxhash"
UPDATE_COMMAND
""
BUILD_IN_SOURCE 1
PATCH_COMMAND
"
${
XXHASH_DOWNLOAD_CMD
}
"
PREFIX
${
XXHASH_PREFIX_DIR
}
SOURCE_DIR
${
XXHASH_SOURCE_DIR
}
UPDATE_COMMAND
""
PATCH_COMMAND
""
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
${
XXHASH_SOURCE_DIR
}
/src/extern_xxhash
/cmake_unofficial
${
CMAKE_COMMAND
}
${
XXHASH_SOURCE_DIR
}
/cmake_unofficial
-DCMAKE_INSTALL_PREFIX:PATH=
${
XXHASH_INSTALL_DIR
}
-DCMAKE_BUILD_TYPE:STRING=
${
CMAKE_BUILD_TYPE
}
-DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
...
...
@@ -57,16 +62,14 @@ else()
ExternalProject_Add
(
extern_xxhash
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/Cyan4973/xxHash"
GIT_TAG
"v0.6.5"
PREFIX
${
XXHASH_SOURCE_DIR
}
DOWNLOAD_NAME
"xxhash"
UPDATE_COMMAND
""
"
${
XXHASH_DOWNLOAD_CMD
}
"
PREFIX
${
XXHASH_PREFIX_DIR
}
SOURCE_DIR
${
XXHASH_SOURCE_DIR
}
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_IN_SOURCE 1
PATCH_COMMAND
BUILD_IN_SOURCE 1
BUILD_COMMAND
${
BUILD_CMD
}
INSTALL_COMMAND
export PREFIX=
${
XXHASH_INSTALL_DIR
}
/ && make
install
INSTALL_COMMAND
make PREFIX=
${
XXHASH_INSTALL_DIR
}
install
TEST_COMMAND
""
)
endif
()
...
...
cmake/external/zlib.cmake
浏览文件 @
341dee06
...
...
@@ -14,21 +14,27 @@
INCLUDE
(
ExternalProject
)
SET
(
ZLIB_
SOURCES
_DIR
${
THIRD_PARTY_PATH
}
/zlib
)
SET
(
ZLIB_
PREFIX
_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
)
set
(
ZLIB_REPOSITORY https://github.com/madler/zlib.git
)
set
(
ZLIB_TAG v1.2.8
)
INCLUDE_DIRECTORIES
(
${
ZLIB_INCLUDE_DIR
}
)
# For zlib code to include its own headers.
INCLUDE_DIRECTORIES
(
${
THIRD_PARTY_PATH
}
/install
)
# For Paddle code to include zlib.h.
cache_third_party
(
extern_zlib
REPOSITORY
${
ZLIB_REPOSITORY
}
TAG
${
ZLIB_TAG
}
)
ExternalProject_Add
(
extern_zlib
${
EXTERNAL_PROJECT_LOG_ARGS
}
${
SHALLOW_CLONE
}
GIT_REPOSITORY
"https://github.com/madler/zlib.git
"
GIT_TAG
"v1.2.8"
PREFIX
${
ZLIB_SOURCES
_DIR
}
"
${
ZLIB_DOWNLOAD_CMD
}
"
PREFIX
${
ZLIB_PREFIX_DIR
}
SOURCE_DIR
${
ZLIB_SOURCE
_DIR
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
...
...
cmake/third_party.cmake
浏览文件 @
341dee06
...
...
@@ -12,13 +12,96 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
compile third party for fluid on both windows/linux/mac
#
Creat a target named "third_party", which can compile external dependencies on all platform(windows/linux/mac)
set
(
THIRD_PARTY_PATH
"
${
CMAKE_BINARY_DIR
}
/third_party"
CACHE STRING
"A path setting third party libraries download & build directories."
)
set
(
THIRD_PARTY_PATH
"
${
CMAKE_BINARY_DIR
}
/third_party"
CACHE STRING
"A path setting third party libraries download & build directories."
)
set
(
THIRD_PARTY_CACHE_PATH
"
${
CMAKE_SOURCE_DIR
}
"
CACHE STRING
"A path cache third party source code to avoid repeated download."
)
set
(
THIRD_PARTY_BUILD_TYPE Release
)
# cache funciton to avoid repeat download code of third_party.
# This function has 4 parameters, URL/REPOSITOR/TAG/DIR:
# 1. URL: specify download url of 3rd party
# 2. REPOSITORY and TAG: specify git REPOSITORY and tag/branch/commitID of 3rd party
# 3. DIR(optional): Unify the source dir in cached and uncached mode to "${TARGET}_SOURCE_DIR".
#
# The function Return 2 PARENT_SCOPE variables:
# 1. ${TARGET}_DOWNLOAD_DIR: Simply place "${TARGET}_DOWNLOAD_DIR" in ExternalProject_Add,
# and you no longer need to set any donwnload steps in ExternalProject_Add.
# 2. ${TARGET}_SOURCE_DIR: Value of argument: SOURCE_DIR of ExternalProject_Add.
# For example:
# Cache_third_party (${TARGET}
# REPOSITORY ${TARGET_REPOSITORY}
# TAG ${TARGET_TAG})
FUNCTION
(
cache_third_party TARGET
)
SET
(
options
""
)
SET
(
oneValueArgs URL REPOSITORY TAG DIR
)
SET
(
multiValueArgs
""
)
cmake_parse_arguments
(
cache_third_party
"
${
optionps
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
STRING
(
REPLACE
"extern_"
""
TARGET_NAME
${
TARGET
}
)
STRING
(
REGEX REPLACE
"[0-9]+"
""
TARGET_NAME
${
TARGET_NAME
}
)
STRING
(
TOUPPER
${
TARGET_NAME
}
TARGET_NAME
)
IF
(
cache_third_party_REPOSITORY
)
SET
(
${
TARGET_NAME
}
_DOWNLOAD_CMD
GIT_REPOSITORY
${
cache_third_party_REPOSITORY
}
)
IF
(
cache_third_party_TAG
)
LIST
(
APPEND
${
TARGET_NAME
}
_DOWNLOAD_CMD
GIT_TAG
${
cache_third_party_TAG
}
)
ENDIF
()
ELSEIF
(
cache_third_party_URL
)
SET
(
${
TARGET_NAME
}
_DOWNLOAD_CMD
URL
${
cache_third_party_URL
}
)
ELSE
()
MESSAGE
(
FATAL_ERROR
"Download link (Git repo or URL) must be specified for cache!"
)
ENDIF
()
IF
(
NOT WITH_TP_CACHE
)
# The uniform argument "{TAGGET}_SOURCE_DIR" must exists for these targets even if not cache
SET
(
LISTS xxhash protobuf boost mklml cub dlpack eigen pybind threadpool
)
FOREACH
(
tmp
${
LISTS
}
)
IF
(
${
TARGET
}
MATCHES
${
tmp
}
AND cache_third_party_DIR
)
SET
(
${
TARGET_NAME
}
_SOURCE_DIR
"
${
cache_third_party_DIR
}
/src/
${
TARGET
}
"
)
ENDIF
()
ENDFOREACH
()
ELSE
()
# Generate and verify cache dir for third_party source code
SET
(
cache_third_party_REPOSITORY
${
cache_third_party_REPOSITORY
}
${
cache_third_party_URL
}
)
IF
(
cache_third_party_REPOSITORY AND cache_third_party_TAG
)
STRING
(
MD5 HASH_REPO
${
cache_third_party_REPOSITORY
}
)
STRING
(
MD5 HASH_GIT
${
cache_third_party_TAG
}
)
STRING
(
SUBSTRING
${
HASH_REPO
}
0 8 HASH_REPO
)
STRING
(
SUBSTRING
${
HASH_GIT
}
0 8 HASH_GIT
)
STRING
(
CONCAT HASH
${
HASH_REPO
}
${
HASH_GIT
}
)
SET
(
${
TARGET_NAME
}
_SOURCE_DIR
${
THIRD_PARTY_CACHE_PATH
}
/third_party/
${
TARGET
}
_
${
HASH
}
)
ELSEIF
(
cache_third_party_REPOSITORY
)
STRING
(
MD5 HASH_REPO
${
cache_third_party_REPOSITORY
}
)
STRING
(
SUBSTRING
${
HASH_REPO
}
0 16 HASH
)
SET
(
${
TARGET_NAME
}
_SOURCE_DIR
${
THIRD_PARTY_CACHE_PATH
}
/third_party/
${
TARGET
}
_
${
HASH
}
)
ENDIF
()
IF
(
EXISTS
${${
TARGET_NAME
}
_SOURCE_DIR
}
)
# judge whether the cache dir is empty
FILE
(
GLOB files
${${
TARGET_NAME
}
_SOURCE_DIR
}
/*
)
LIST
(
LENGTH files files_len
)
IF
(
files_len GREATER 0
)
list
(
APPEND
${
TARGET_NAME
}
_DOWNLOAD_CMD DOWNLOAD_COMMAND
""
)
ENDIF
()
ENDIF
()
ENDIF
()
# Pass the variable to parent scope, the double quotation marks can't be removed
SET
(
${
TARGET_NAME
}
_SOURCE_DIR
"
${${
TARGET_NAME
}
_SOURCE_DIR
}
"
PARENT_SCOPE
)
SET
(
${
TARGET_NAME
}
_DOWNLOAD_CMD
"
${${
TARGET_NAME
}
_DOWNLOAD_CMD
}
"
PARENT_SCOPE
)
ENDFUNCTION
()
MACRO
(
UNSET_VAR VAR_NAME
)
UNSET
(
${
VAR_NAME
}
CACHE
)
UNSET
(
${
VAR_NAME
}
)
ENDMACRO
()
# Correction of flags on different Platform(WIN/MAC) and Print Warning Message
if
(
APPLE
)
if
(
WITH_MKL
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录