Skip to content

Commit 3068fda

Browse files
committed
Copy more C++ headers into the package
1 parent 10b4715 commit 3068fda

File tree

2 files changed

+37
-10
lines changed

2 files changed

+37
-10
lines changed

3_build_tensorflow_cpp_generic_x86_64.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,31 @@ cd $DIR/tensorflow
1919
# Clean up
2020
git clean -fdx
2121
git reset --hard
22-
git apply < $DIR/tf_base.patch || exit 1
23-
git apply < $DIR/tf_generic_x86_64.patch || exit 1
22+
23+
patch -p1 < $DIR/tf_base.patch
24+
if [ $? != 0 ]; then
25+
echo -e "FATAL: tf_base.patch FAILED!"
26+
exit 1
27+
fi
28+
patch -p1 < $DIR/tf_generic_x86_64.patch
29+
if [ $? != 0 ]; then
30+
echo -e "FATAL: tf_generic_x86_64.patch FAILED!"
31+
exit 1
32+
fi
2433

2534
# Build the Tensorflow
2635
cd tensorflow/contrib/cmake
2736
cmake . -Dtensorflow_ENABLE_GRPC_SUPPORT=OFF -Dtensorflow_ENABLE_SSL_SUPPORT=OFF -Dtensorflow_BUILD_PYTHON_BINDINGS=OFF \
28-
-Dtensorflow_ENABLE_POSITION_INDEPENDENT_CODE=ON -Dtensorflow_BUILD_SHARED_LIB=ON -Dtensorflow_BUILD_CC_EXAMPLE=OFF -DCMAKE_BUILD_TYPE=Release || exit 1
29-
make -j8 tensorflow || exit 1
30-
cd ../../..
37+
-Dtensorflow_ENABLE_POSITION_INDEPENDENT_CODE=ON -Dtensorflow_BUILD_SHARED_LIB=ON -Dtensorflow_BUILD_CC_EXAMPLE=OFF -DCMAKE_BUILD_TYPE=Release \
38+
-DCMAKE_INSTALL_PREFIX=${DIR}/tensorflow/install || exit 1
39+
make -j8 tensorflow install || exit 1
40+
41+
# Copy headers
42+
cd ${DIR}/tensorflow/install/include || exit 1
43+
cp -rf * $DIR/packaging/headers/ || exit 1
3144

3245
# Copy/prepare the final binaries
46+
cd $DIR/tensorflow
3347
cp tensorflow/contrib/cmake/protobuf/src/protobuf/libprotobuf.a $DIR/packaging/libs/libprotobuf-tf-static.a || exit 1
3448
g++ -shared -o $DIR/packaging/libs/libprotobuf-tf.so -Wl,--whole-archive -l:libprotobuf-tf-static.a -L$DIR/packaging/libs/ -Wl,--no-whole-archive || exit 1
3549
cp tensorflow/contrib/cmake/nsync/src/nsync/libnsync.a $DIR/packaging/libs/libnsync-tf.a || exit 1

3_build_tensorflow_cpp_optimized_x86_64.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,30 @@ cd $DIR/tensorflow
1919
# Clean up
2020
git clean -fdx
2121
git reset --hard
22-
git apply < $DIR/tf_base.patch || exit 1
23-
git apply < $DIR/tf_optimized_x86_64.patch || exit 1
22+
patch -p1 < $DIR/tf_base.patch
23+
if [ $? != 0 ]; then
24+
echo -e "FATAL: tf_base.patch FAILED!"
25+
exit 1
26+
fi
27+
patch -p1 < $DIR/tf_optimized_x86_64.patch
28+
if [ $? != 0 ]; then
29+
echo -e "FATAL: tf_optimized_x86_64.patch FAILED!"
30+
exit 1
31+
fi
2432

2533
# Build the Tensorflow
2634
cd tensorflow/contrib/cmake
2735
cmake . -Dtensorflow_ENABLE_GRPC_SUPPORT=OFF -Dtensorflow_ENABLE_SSL_SUPPORT=OFF -Dtensorflow_BUILD_PYTHON_BINDINGS=OFF \
28-
-Dtensorflow_ENABLE_POSITION_INDEPENDENT_CODE=ON -Dtensorflow_BUILD_SHARED_LIB=ON -Dtensorflow_BUILD_CC_EXAMPLE=OFF -DCMAKE_BUILD_TYPE=Release || exit 1
29-
make -j8 tensorflow || exit 1
30-
cd ../../..
36+
-Dtensorflow_ENABLE_POSITION_INDEPENDENT_CODE=ON -Dtensorflow_BUILD_SHARED_LIB=ON -Dtensorflow_BUILD_CC_EXAMPLE=OFF -DCMAKE_BUILD_TYPE=Release \
37+
-DCMAKE_INSTALL_PREFIX=${DIR}/tensorflow/install || exit 1
38+
make -j8 tensorflow install || exit 1
39+
40+
# Copy headers
41+
cd ${DIR}/tensorflow/install/include || exit 1
42+
cp -rf * $DIR/packaging/headers/ || exit 1
3143

3244
# Copy/prepare the final binaries
45+
cd $DIR/tensorflow
3346
cp tensorflow/contrib/cmake/protobuf/src/protobuf/libprotobuf.a $DIR/packaging/libs/libprotobuf-tf-static.a || exit 1
3447
g++ -shared -o $DIR/packaging/libs/libprotobuf-tf.so -Wl,--whole-archive -l:libprotobuf-tf-static.a -L$DIR/packaging/libs/ -Wl,--no-whole-archive || exit 1
3548
cp tensorflow/contrib/cmake/nsync/src/nsync/libnsync.a $DIR/packaging/libs/libnsync-tf.a || exit 1

0 commit comments

Comments
 (0)