Skip to content

Commit fff6fa0

Browse files
authored
Merge pull request #11807 from typhoonzero/reduce_generic_cmake_dep
move find_fluid_modules
2 parents ceba2cd + 53f2171 commit fff6fa0

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

cmake/generic.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ if(NOT APPLE AND NOT ANDROID)
9696
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -pthread -ldl -lrt")
9797
endif(NOT APPLE AND NOT ANDROID)
9898

99+
set_property(GLOBAL PROPERTY FLUID_MODULES "")
100+
# find all fluid modules is used for paddle fluid static library
101+
# for building inference libs
102+
function(find_fluid_modules TARGET_NAME)
103+
get_filename_component(__target_path ${TARGET_NAME} ABSOLUTE)
104+
string(REGEX REPLACE "^${PADDLE_SOURCE_DIR}/" "" __target_path ${__target_path})
105+
string(FIND "${__target_path}" "fluid" pos)
106+
if(pos GREATER 1)
107+
get_property(fluid_modules GLOBAL PROPERTY FLUID_MODULES)
108+
set(fluid_modules ${fluid_modules} ${TARGET_NAME})
109+
set_property(GLOBAL PROPERTY FLUID_MODULES "${fluid_modules}")
110+
endif()
111+
endfunction(find_fluid_modules)
112+
99113
function(merge_static_libs TARGET_NAME)
100114
set(libs ${ARGN})
101115
list(REMOVE_DUPLICATES libs)

cmake/inference_lib.cmake

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
set_property(GLOBAL PROPERTY FLUID_MODULES "")
16-
# find all fluid modules is used for paddle fluid static library
17-
function(find_fluid_modules TARGET_NAME)
18-
get_filename_component(__target_path ${TARGET_NAME} ABSOLUTE)
19-
string(REGEX REPLACE "^${PADDLE_SOURCE_DIR}/" "" __target_path ${__target_path})
20-
string(FIND "${__target_path}" "fluid" pos)
21-
if(pos GREATER 1)
22-
get_property(fluid_modules GLOBAL PROPERTY FLUID_MODULES)
23-
set(fluid_modules ${fluid_modules} ${TARGET_NAME})
24-
set_property(GLOBAL PROPERTY FLUID_MODULES "${fluid_modules}")
25-
endif()
26-
endfunction(find_fluid_modules)
27-
2815
# make package for paddle fluid shared and static library
2916
function(copy TARGET)
3017
set(options "")

0 commit comments

Comments
 (0)