caffe能否移植到arm平台( 四 )
g_generate_on_host="192.168.0.6"
g_generate="$1"G_GENERATE_H5DETECT="H5Tinit.c"G_GENERATE_H5MAKE_LIBSETTINGS="H5lib_settings.c"G_INITIAL_DIR="$PWD"
function cmake_tool_chain_helper(){ local toolchain="$1" local build_dir="$2"
cat \u0026lt;\u0026lt; EOF \u0026gt; $build_dir/${toolchain}.cmake set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER $toolchain-gcc) set(CMAKE_CXX_COMPILER $toolchain-g++)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)EOF}
function generate_fake_tools(){ echo "#!/bin/sh" \u0026gt; H5detect echo "#!/bin/sh" \u0026gt; H5make_libsettings chmod +x H5detect H5make_libsettings}
function build_for_platform(){ local platform="$1" local build_dir="$2" local toolchain="$3" local install_dir="$4"
test -e "$build_dir" || mkdir -p "$build_dir" cd "$build_dir"
cmake_tool_chain_helper "$toolchain" "$build_dir"
# run 2 times as errors will occur due to not supported cross compiling # 1st run configure # 2nd run generate Makefiles for x in 1 2 ; do cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="${build_dir}/${toolchain}.cmake" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${install_dir}" \\ -DBUILD_TESTING=false -DHDF5_BUILD_EXAMPLES=false -DCMAKE_CXX_FLAGS="-D_GNU_SOURCE" -DCMAKE_C_FLAGS="-D_GNU_SOURCE" .. done
# make: it will fail several time due to plattform depending files to be generated # we have them allready generated on the arm platform # so we replace the tools with a fake tools local path_gen_files="${G_INITIAL_DIR}/arm_files/generated/${platform}" if ;then local dir=/path/on/device/
path_gen_files="/tmp/h5_generated" test -e "$path_gen_files" || mkdir "$path_gen_files"
for x in bin/H5detect bin/H5make_libsettings H5detect H5make_libsettings; do test -e "$x" \u0026amp;\u0026amp; rm "$x" done
# try to generate files on host -\u0026gt; this will fail make
echo "-------------------" echo "# ---\u0026gt; copy files to target" echo "-------------------" scp bin/H5detect bin/H5make_libsettings libhdf5.settings root@${g_generate_on_host}:${dir} || exit 1
echo "-------------------" echo "# ---\u0026gt; chmod those files" echo "-------------------" ssh root@${g_generate_on_host} "cd $dir \u0026amp;\u0026gt; /dev/null ; chmod +x H5detect H5make_libsettings"
echo "-------------------" echo "# ---\u0026gt; generate "$path_gen_files"/$G_GENERATE_H5DETECT" echo "-------------------" ssh root@${g_generate_on_host} "cd $dir \u0026amp;\u0026gt; /dev/null ; ./H5detect" \u0026gt; "$path_gen_files"/$G_GENERATE_H5DETECT
echo "-------------------" echo "# ---\u0026gt; generate "$path_gen_files"/$G_GENERATE_H5MAKE_LIBSETTINGS" echo "-------------------" ssh root@${g_generate_on_host} "cd $dir \u0026amp;\u0026gt; /dev/null ; ./H5make_libsettings" \u0026gt; "$path_gen_files"/$G_GENERATE_H5MAKE_LIBSETTINGS fi
推荐阅读
- 广东今年角膜捐献量和移植手术量较往年均有增加
- 汽车知识|押宝全新造型,东风雪铁龙新C5能否成为神龙公司“救世主”
- 中国版Evan能火吗美国9岁男童录制评测玩具视频年入800万,中国能否复制成功
- 汽车市场|中期改款再战D级车市场,新雷克萨斯LS能否超过宝马7系等对手?
- 澎湃汽车圈|试驾名爵MG领航 运动性和实用性能否兼顾?
- 天天汽车|超高性价比实力宠粉,2021款奕歌能否点燃你的心?
- 能否推荐一个能用快播看电影且电影都是中英双字幕的网站
- 汽车|定位更细分SUV市场,领克06能否扩大领克的“朋友圈”?
- 汽车白话|看脸蛋、观腰身、品内饰长安欧尚X5“塑光美学”能否打动挑剔的你
- 环球车讯网|软件能否定义汽车