Skip to content

Commit 4862111

Browse files
Fix submodule (PaddlePaddle#1384)
1 parent 3ad6d4d commit 4862111

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

cmake/paddle.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ endif()
7171
# submodule Paddle first
7272
set(paddle_submodule $ENV{paddle_submodule})
7373
if(paddle_submodule)
74+
get_filename_component(REPO_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../"
75+
ABSOLUTE)
76+
get_filename_component(PADDLE_SOURCE_DIR "${REPO_SOURCE_DIR}/Paddle" ABSOLUTE)
77+
message(STATUS "PADDLE_SOURCE_DIR=${PADDLE_SOURCE_DIR}")
7478
message(
7579
"Paddle submodule already exists, skip git submodule update --init Paddle")
7680
else()

cmake/third_party.cmake

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,34 @@ macro(check_update_submodule MODULE_NAME)
4141
endmacro()
4242

4343
# ########################## include third_party ###############################
44-
45-
check_update_submodule(gflags)
44+
if(NOT paddle_submodule)
45+
check_update_submodule(gflags)
46+
check_update_submodule(glog)
47+
endif()
4648
include(external/gflags) # gflags
47-
48-
check_update_submodule(glog)
4949
include(external/glog) # glog
5050

5151
list(APPEND third_party_deps extern_gflags extern_glog)
5252
if(NOT ON_INFER)
53-
check_update_submodule(pybind)
53+
if(NOT paddle_submodule)
54+
check_update_submodule(pybind)
55+
endif()
5456
include(external/pybind11) # pybind
5557
list(APPEND third_party_deps extern_pybind)
5658
endif()
5759

5860
if(WITH_TESTING)
59-
check_update_submodule(gtest)
61+
if(NOT paddle_submodule)
62+
check_update_submodule(gtest)
63+
endif()
6064
include(external/gtest) # gtest
6165
list(APPEND third_party_deps extern_gtest)
6266
endif()
6367

6468
if(WITH_MKL AND NOT WITH_ARM)
65-
check_update_submodule(onednn)
69+
if(NOT paddle_submodule)
70+
check_update_submodule(onednn)
71+
endif()
6672
include(external/onednn) # onednn
6773
list(APPEND third_party_deps extern_onednn)
6874
endif()

0 commit comments

Comments
 (0)