Skip to content

Commit 565606a

Browse files
authored
Merge pull request #10827 from luotao1/paddle_script
change CMAKE_INSTALL_PREFIX in inference_lib_dist to FLUID_INSTALL_DIR
2 parents 718f63c + 91d8373 commit 565606a

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ endif()
100100
set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
101101
"A path setting third party libraries download & build directories.")
102102

103+
set(FLUID_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_install_dir" CACHE STRING
104+
"A path setting fluid shared and static libraries")
105+
103106
if (WITH_C_API AND WITH_PYTHON)
104107
message(WARNING "It is suggest not embedded a python interpreter in Paddle "
105108
"when using C-API. It will give an unpredictable behavior when using a "

cmake/inference_lib.cmake

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,80 +52,80 @@ function(copy TARGET)
5252
endfunction()
5353

5454
# third party
55-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/eigen3")
55+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/eigen3")
5656
copy(eigen3_lib
5757
SRCS ${EIGEN_INCLUDE_DIR}/Eigen/Core ${EIGEN_INCLUDE_DIR}/Eigen/src ${EIGEN_INCLUDE_DIR}/unsupported/Eigen
5858
DSTS ${dst_dir}/Eigen ${dst_dir}/Eigen ${dst_dir}/unsupported
5959
)
6060

61-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/gflags")
61+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/install/gflags")
6262
copy(gflags_lib
6363
SRCS ${GFLAGS_INCLUDE_DIR} ${GFLAGS_LIBRARIES}
6464
DSTS ${dst_dir} ${dst_dir}/lib
6565
)
6666

67-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/glog")
67+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/install/glog")
6868
copy(glog_lib
6969
SRCS ${GLOG_INCLUDE_DIR} ${GLOG_LIBRARIES}
7070
DSTS ${dst_dir} ${dst_dir}/lib
7171
)
7272

73-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/boost/")
73+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/boost/")
7474
copy(boost_lib
7575
SRCS ${BOOST_INCLUDE_DIR}/boost
7676
DSTS ${dst_dir}
7777
)
7878

7979
if(NOT PROTOBUF_FOUND)
80-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/protobuf")
80+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/install/protobuf")
8181
copy(protobuf_lib
8282
SRCS ${PROTOBUF_INCLUDE_DIR} ${PROTOBUF_LIBRARY}
8383
DSTS ${dst_dir} ${dst_dir}/lib
8484
)
8585
endif()
8686

8787
if(NOT CBLAS_FOUND)
88-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/openblas")
88+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/install/openblas")
8989
copy(openblas_lib
9090
SRCS ${CBLAS_INSTALL_DIR}/lib ${CBLAS_INSTALL_DIR}/include
9191
DSTS ${dst_dir} ${dst_dir}
9292
)
9393
elseif (WITH_MKLML)
94-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/mklml")
94+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/install/mklml")
9595
copy(mklml_lib
9696
SRCS ${MKLML_LIB} ${MKLML_IOMP_LIB} ${MKLML_INC_DIR}
9797
DSTS ${dst_dir}/lib ${dst_dir}/lib ${dst_dir}
9898
)
9999
endif()
100100

101101
if(WITH_MKLDNN)
102-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/mkldnn")
102+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/install/mkldnn")
103103
copy(mkldnn_lib
104104
SRCS ${MKLDNN_INC_DIR} ${MKLDNN_SHARED_LIB}
105105
DSTS ${dst_dir} ${dst_dir}/lib
106106
)
107107
endif()
108108

109109
if(NOT MOBILE_INFERENCE AND NOT RPI)
110-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/snappy")
110+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/install/snappy")
111111
copy(snappy_lib
112112
SRCS ${SNAPPY_INCLUDE_DIR} ${SNAPPY_LIBRARIES}
113113
DSTS ${dst_dir} ${dst_dir}/lib)
114114

115-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/snappystream")
115+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/install/snappystream")
116116
copy(snappystream_lib
117117
SRCS ${SNAPPYSTREAM_INCLUDE_DIR} ${SNAPPYSTREAM_LIBRARIES}
118118
DSTS ${dst_dir} ${dst_dir}/lib)
119119

120-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/zlib")
120+
set(dst_dir "${FLUID_INSTALL_DIR}/third_party/install/zlib")
121121
copy(zlib_lib
122122
SRCS ${ZLIB_INCLUDE_DIR} ${ZLIB_LIBRARIES}
123123
DSTS ${dst_dir} ${dst_dir}/lib)
124124
endif()
125125

126126
# paddle fluid module
127127
set(src_dir "${PADDLE_SOURCE_DIR}/paddle/fluid")
128-
set(dst_dir "${CMAKE_INSTALL_PREFIX}/paddle/fluid")
128+
set(dst_dir "${FLUID_INSTALL_DIR}/paddle/fluid")
129129
set(module "framework")
130130
copy(framework_lib DEPS framework_py_proto
131131
SRCS ${src_dir}/${module}/*.h ${src_dir}/${module}/details/*.h ${PADDLE_BINARY_DIR}/paddle/fluid/framework/framework.pb.h
@@ -165,15 +165,15 @@ copy(pybind_lib
165165
# CMakeCache Info
166166
copy(cmake_cache
167167
SRCS ${CMAKE_CURRENT_BINARY_DIR}/CMakeCache.txt
168-
DSTS ${CMAKE_INSTALL_PREFIX})
168+
DSTS ${FLUID_INSTALL_DIR})
169169

170170
add_custom_target(inference_lib_dist DEPENDS ${inference_lib_dist_dep})
171171

172172
# paddle fluid version
173173
execute_process(
174174
COMMAND ${GIT_EXECUTABLE} log --pretty=format:%H -1
175175
OUTPUT_VARIABLE PADDLE_GIT_COMMIT)
176-
set(version_file ${CMAKE_INSTALL_PREFIX}/version.txt)
176+
set(version_file ${FLUID_INSTALL_DIR}/version.txt)
177177
file(WRITE ${version_file}
178178
"GIT COMMIT ID: ${PADDLE_GIT_COMMIT}\n"
179179
"WITH_MKL: ${WITH_MKL}\n"

paddle/fluid/train/demo/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# WITH_MKLDNN=ON|OFF
88
99
PADDLE_LIB=/paddle/lib/dir
10-
cmake .. -DCMAKE_INSTALL_PREFIX=$PADDLE_LIB \
10+
cmake .. -DFLUID_INSTALL_DIR=$PADDLE_LIB \
1111
-DCMAKE_BUILD_TYPE=Release \
1212
-DWITH_FLUID_ONLY=ON \
1313
-DWITH_GPU=OFF \
@@ -42,7 +42,7 @@ cd build
4242
# WITH_MKLDNN=ON|OFF
4343
PADDLE_LIB=/paddle/lib/dir
4444
45-
# PADDLE_LIB is the same with CMAKE_INSTALL_PREFIX when building the lib
45+
# PADDLE_LIB is the same with FLUID_INSTALL_DIR when building the lib
4646
cmake .. -DPADDLE_LIB=$PADDLE_LIB \
4747
-DWITH_MKLDNN=OFF \
4848
-DWITH_MKL=OFF

paddle/scripts/paddle_build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,8 @@ function gen_fluid_inference_lib() {
493493
========================================
494494
EOF
495495
make -j `nproc` inference_lib_dist
496-
fi
496+
tar -cf ${PADDLE_ROOT}/build/fluid.tgz ${PADDLE_ROOT}/build/fluid_install_dir
497+
fi
497498
}
498499

499500
function main() {

0 commit comments

Comments
 (0)