Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
2afe08ea
P
Paddle
项目概览
Crayon鑫
/
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看板
提交
2afe08ea
编写于
6月 01, 2017
作者:
G
gangliao
提交者:
GitHub
6月 01, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2343 from gangliao/import_lib
import 3rd party target in CMake
上级
a9e143ea
661a8e93
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
43 addition
and
52 deletion
+43
-52
cmake/external/gflags.cmake
cmake/external/gflags.cmake
+5
-1
cmake/external/glog.cmake
cmake/external/glog.cmake
+5
-1
cmake/external/gtest.cmake
cmake/external/gtest.cmake
+11
-2
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+8
-2
cmake/external/warpctc.cmake
cmake/external/warpctc.cmake
+5
-1
cmake/generic.cmake
cmake/generic.cmake
+8
-32
paddle/majel/CMakeLists.txt
paddle/majel/CMakeLists.txt
+1
-1
paddle/majel/test/CMakeLists.txt
paddle/majel/test/CMakeLists.txt
+0
-12
未找到文件。
cmake/external/gflags.cmake
浏览文件 @
2afe08ea
...
...
@@ -26,7 +26,7 @@ ENDIF(WIN32)
INCLUDE_DIRECTORIES
(
${
GFLAGS_INCLUDE_DIR
}
)
ExternalProject_Add
(
gflags
extern_
gflags
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/gflags/gflags.git"
PREFIX
${
GFLAGS_SOURCES_DIR
}
...
...
@@ -44,4 +44,8 @@ ExternalProject_Add(
-DCMAKE_BUILD_TYPE:STRING=Release
)
ADD_LIBRARY
(
gflags STATIC IMPORTED
)
SET_PROPERTY
(
TARGET gflags PROPERTY IMPORTED_LOCATION
${
GFLAGS_LIBRARIES
}
)
ADD_DEPENDENCIES
(
gflags extern_gflags
)
LIST
(
APPEND external_project_dependencies gflags
)
cmake/external/glog.cmake
浏览文件 @
2afe08ea
...
...
@@ -27,7 +27,7 @@ ENDIF(WIN32)
INCLUDE_DIRECTORIES
(
${
GLOG_INCLUDE_DIR
}
)
ExternalProject_Add
(
glog
extern_
glog
${
EXTERNAL_PROJECT_LOG_ARGS
}
DEPENDS gflags
GIT_REPOSITORY
"https://github.com/google/glog.git"
...
...
@@ -48,4 +48,8 @@ ExternalProject_Add(
-DCMAKE_BUILD_TYPE:STRING=Release
)
ADD_LIBRARY
(
glog STATIC IMPORTED
)
SET_PROPERTY
(
TARGET glog PROPERTY IMPORTED_LOCATION
${
GLOG_LIBRARIES
}
)
ADD_DEPENDENCIES
(
glog extern_glog
)
LIST
(
APPEND external_project_dependencies glog
)
cmake/external/gtest.cmake
浏览文件 @
2afe08ea
...
...
@@ -35,7 +35,7 @@ IF(WITH_TESTING)
ENDIF
(
WIN32
)
ExternalProject_Add
(
gtest
extern_
gtest
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/google/googletest.git"
GIT_TAG
"release-1.8.0"
...
...
@@ -55,5 +55,14 @@ IF(WITH_TESTING)
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=Release
)
LIST
(
APPEND external_project_dependencies gtest
)
ADD_LIBRARY
(
gtest STATIC IMPORTED
)
SET_PROPERTY
(
TARGET gtest PROPERTY IMPORTED_LOCATION
${
GTEST_LIBRARIES
}
)
ADD_DEPENDENCIES
(
gtest extern_gtest
)
ADD_LIBRARY
(
gtest_main STATIC IMPORTED
)
SET_PROPERTY
(
TARGET gtest_main PROPERTY IMPORTED_LOCATION
${
GTEST_MAIN_LIBRARIES
}
)
ADD_DEPENDENCIES
(
gtest_main extern_gtest
)
LIST
(
APPEND external_project_dependencies gtest gtest_main
)
ENDIF
(
WITH_TESTING
)
cmake/external/openblas.cmake
浏览文件 @
2afe08ea
...
...
@@ -41,7 +41,7 @@ IF(NOT ${CBLAS_FOUND})
ENDIF
()
ExternalProject_Add
(
openblas
extern_
openblas
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git
GIT_TAG
${
OPENBLAS_COMMIT
}
...
...
@@ -53,8 +53,14 @@ IF(NOT ${CBLAS_FOUND})
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
)
LIST
(
APPEND external_project_dependencies openblas
)
ENDIF
(
NOT
${
CBLAS_FOUND
}
)
MESSAGE
(
STATUS
"BLAS library:
${
CBLAS_LIBRARIES
}
"
)
INCLUDE_DIRECTORIES
(
${
CBLAS_INC_DIR
}
)
ADD_LIBRARY
(
cblas STATIC IMPORTED
)
SET_PROPERTY
(
TARGET cblas PROPERTY IMPORTED_LOCATION
${
CBLAS_LIBRARIES
}
)
IF
(
NOT
${
CBLAS_FOUND
}
)
ADD_DEPENDENCIES
(
cblas extern_openblas
)
LIST
(
APPEND external_project_dependencies cblas
)
ENDIF
(
NOT
${
CBLAS_FOUND
}
)
cmake/external/warpctc.cmake
浏览文件 @
2afe08ea
...
...
@@ -43,7 +43,7 @@ ELSE()
ENDIF
()
ExternalProject_Add
(
warpctc
extern_
warpctc
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/gangliao/warp-ctc.git"
PREFIX
${
WARPCTC_SOURCES_DIR
}
...
...
@@ -65,4 +65,8 @@ ExternalProject_Add(
-DCMAKE_INSTALL_PREFIX:PATH=
${
WARPCTC_INSTALL_DIR
}
)
ADD_LIBRARY
(
warpctc STATIC IMPORTED
)
SET_PROPERTY
(
TARGET warpctc PROPERTY IMPORTED_LOCATION
${
WARPCTC_LIBRARIES
}
)
ADD_DEPENDENCIES
(
warpctc extern_warpctc
)
LIST
(
APPEND external_project_dependencies warpctc
)
cmake/generic.cmake
浏览文件 @
2afe08ea
...
...
@@ -29,24 +29,10 @@
# https://cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html
#
# generic.cmake depends on {GLOG,GFLAGS,GTEST,GTEST_MAIN}_LIBRARIES
# generated by cmake/external/*.cmake.
# Because gflags depends on pthread, I copied the following snippet
# from https://stackoverflow.com/a/29871891/724872.
set
(
THREADS_PREFER_PTHREAD_FLAG ON
)
find_package
(
Threads REQUIRED
)
function
(
link_glog_gflags TARGET_NAME
)
target_link_libraries
(
${
TARGET_NAME
}
${
GLOG_LIBRARIES
}
${
GFLAGS_LIBRARIES
}
Threads::Threads
)
add_dependencies
(
${
TARGET_NAME
}
glog gflags
)
endfunction
()
function
(
link_gtest TARGET_NAME
)
target_link_libraries
(
${
TARGET_NAME
}
${
GTEST_LIBRARIES
}
${
GTEST_MAIN_LIBRARIES
}
)
add_dependencies
(
${
TARGET_NAME
}
gtest
)
endfunction
()
if
(
NOT APPLE
)
find_package
(
Threads REQUIRED
)
link_libraries
(
${
CMAKE_THREAD_LIBS_INIT
}
)
endif
(
NOT APPLE
)
# cc_library parses tensor.cc and figures out that target also depend on tensor.h.
# cc_library(tensor
...
...
@@ -83,7 +69,6 @@ function(cc_binary TARGET_NAME)
target_link_libraries
(
${
TARGET_NAME
}
${
cc_binary_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
cc_binary_DEPS
}
)
endif
()
link_glog_gflags
(
${
TARGET_NAME
}
)
endfunction
(
cc_binary
)
# The dependency to target tensor implies that if any of
...
...
@@ -100,12 +85,8 @@ function(cc_test TARGET_NAME)
set
(
multiValueArgs SRCS DEPS
)
cmake_parse_arguments
(
cc_test
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
add_executable
(
${
TARGET_NAME
}
${
cc_test_SRCS
}
)
if
(
cc_test_DEPS
)
target_link_libraries
(
${
TARGET_NAME
}
${
cc_test_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
cc_test_DEPS
}
)
endif
()
link_glog_gflags
(
${
TARGET_NAME
}
)
link_gtest
(
${
TARGET_NAME
}
)
target_link_libraries
(
${
TARGET_NAME
}
${
cc_test_DEPS
}
gtest gtest_main
)
add_dependencies
(
${
TARGET_NAME
}
${
cc_test_DEPS
}
gtest gtest_main
)
add_test
(
${
TARGET_NAME
}
${
TARGET_NAME
}
)
endif
()
endfunction
(
cc_test
)
...
...
@@ -146,7 +127,6 @@ function(nv_binary TARGET_NAME)
target_link_libraries
(
${
TARGET_NAME
}
${
nv_binary_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
nv_binary_DEPS
}
)
endif
()
link_glog_gflags
(
${
TARGET_NAME
}
)
endif
()
endfunction
(
nv_binary
)
...
...
@@ -164,12 +144,8 @@ function(nv_test TARGET_NAME)
set
(
multiValueArgs SRCS DEPS
)
cmake_parse_arguments
(
nv_test
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
cuda_add_executable
(
${
TARGET_NAME
}
${
nv_test_SRCS
}
)
if
(
nv_test_DEPS
)
target_link_libraries
(
${
TARGET_NAME
}
${
nv_test_DEPS
}
)
add_dependencies
(
${
TARGET_NAME
}
${
nv_test_DEPS
}
)
endif
()
link_glog_gflags
(
${
TARGET_NAME
}
)
link_gtest
(
${
TARGET_NAME
}
)
target_link_libraries
(
${
TARGET_NAME
}
${
nv_test_DEPS
}
gtest gtest_main
)
add_dependencies
(
${
TARGET_NAME
}
${
nv_test_DEPS
}
gtest gtest_main
)
add_test
(
${
TARGET_NAME
}
${
TARGET_NAME
}
)
endif
()
endfunction
(
nv_test
)
...
...
paddle/majel/CMakeLists.txt
浏览文件 @
2afe08ea
cc_library
(
place SRCS place.cc
)
cc_test
(
place_test SRCS place_test.cc DEPS place
)
cc_test
(
place_test SRCS place_test.cc DEPS place
glog gflags
)
cc_library
(
ddim SRCS ddim.cc
)
cc_test
(
ddim_test SRCS ddim_test.cc DEPS ddim
)
...
...
paddle/majel/test/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
a9e143ea
cc_test
(
place_test
SRCS place_test.cc
DEPS place
)
cc_test
(
ddim_test
SRCS ddim_test.cc
DEPS ddim
)
if
(
WITH_GPU
)
nv_test
(
cuda_test SRCS cuda_test.cu
)
nv_test
(
dim_test SRCS dim_test.cu DEPS ddim
)
endif
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录