-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Add the automatic update of submodules in cmake. #951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Automatically init submodules | ||
if(EXISTS ${PROJECT_SOURCE_DIR}/.gitmodules) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PROJECT_SOURCE_DIR => ${PROJ_ROOT} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
# warp-ctc | ||
function(FindWarpCTC) | ||
set(WARPCTC_ROOT $ENV{WARPCTC_ROOT} CACHE PATH "Folder contains warp-ctc") | ||
find_path(WARPCTC_INCLUDE_DIR ctc.h PATHS | ||
${WARPCTC_ROOT}/include ${PROJECT_SOURCE_DIR}/warp-ctc/include) | ||
endfunction(FindWarpCTC) | ||
|
||
FindWarpCTC() | ||
if(NOT WARPCTC_INCLUDE_DIR) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 是不是可以不用 if(EXISTS ${PROJECT_SOURCE_DIR}/.gitmodules)
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init -- warp-ctc
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_OUTPUT
RESULT_VARIABLE GIT_RESULT)
message(STATUS ${GIT_OUTPUT})
if(${GIT_RESULT})
...
else()
fatal...
endif()
endif() 另外modules一次性 --recursive 有什么区别? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我其实对于这个GIT_RESULT做了挺多次实验,发现有时候,执行 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里可否用 @gangliao 在 https://github.com/gangliao/CodeCoverageCMake/blob/master/cmake/third_party.cmake 这里使用的 |
||
execute_process( | ||
COMMAND ${GIT_EXECUTABLE} submodule update --init -- warp-ctc | ||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | ||
OUTPUT_VARIABLE GIT_OUTPUT | ||
RESULT_VARIABLE GIT_RESULT) | ||
message(STATUS ${GIT_OUTPUT}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CHECK GIT_RESULT is ok There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我其实对于这个GIT_RESULT做了挺多次实验,发现有时候,执行git submodule update --init -- warp-ctc并没有把warp-ctc拉下来,返回结果一直都是0。不知道是不是我哪里弄得不对。。。 |
||
FindWarpCTC() | ||
endif() | ||
|
||
if(NOT WARPCTC_INCLUDE_DIR) | ||
message(FATAL_ERROR "warp-ctc must be set." | ||
"Try set WARPCTC_ROOT or run command git submodule --init -- warp-ctc.") | ||
else() | ||
message(STATUS "Found warp-ctc (include: ${WARPCTC_INCLUDE_DIR})") | ||
endif() | ||
include_directories(${WARPCTC_INCLUDE_DIR}) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,8 @@ limitations under the License. */ | |
#ifndef HL_WARPCTC_WRAP_H_ | ||
#define HL_WARPCTC_WRAP_H_ | ||
|
||
#include "ctc.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里是不是还是原来的写法(`#include "warp-ctc/include/ctc.h")更清晰,能体现出头文件到底在哪里。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 增加了一个WARPCTC_ROOT的cmake选项,原意是如果用户机器上已经安装过warp-ctc,则可以直接使用已经安装好的这个版本。看是否需要支持这种情况吧。 |
||
#include "hl_base.h" | ||
#include "warp-ctc/include/ctc.h" | ||
|
||
typedef ctcStatus_t hl_warpctc_status_t; | ||
typedef ctcOptions hl_warpctc_options_t; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
名字叫submodules,以后的第三方模块意思是都写里面?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个,其实我不确定,原来有考虑要不要写一个通用的。不过,也许以后也不会再有submodule了。