From 5cfe6e1b58a78befa1271e9a7282519b6cffa6e8 Mon Sep 17 00:00:00 2001 From: Cyprien Noel Date: Wed, 14 Oct 2015 14:29:54 -0700 Subject: [PATCH] Using Maven dependencies during native build --- .gitignore | 3 +++ caffe/cppbuild.sh | 16 +++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d39140b350c..272ae221a67 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,6 @@ # IntelliJ *.iml +# Dependency lists generated from Maven +javacpp.incs.txt +javacpp.libs.txt diff --git a/caffe/cppbuild.sh b/caffe/cppbuild.sh index e876f2cfc4d..5f632727b43 100755 --- a/caffe/cppbuild.sh +++ b/caffe/cppbuild.sh @@ -68,8 +68,6 @@ cd $PLATFORM INSTALL_PATH=`pwd` mkdir -p include lib bin -OPENCV_PATH="$INSTALL_PATH/../../../opencv/cppbuild/$PLATFORM/" - echo "Decompressing archives" tar --totals -xzf ../glog-$GLOG.tar.gz tar --totals -xzf ../gflags-$GFLAGS.tar.gz @@ -143,12 +141,20 @@ if [[ $PLATFORM != macosx-* ]]; then cd .. fi +# List Maven dependencies +pushd ../.. +mvn org.bytedeco:javacpp:1.1-SNAPSHOT:build -DwriteIncludes=javacpp.incs.txt -DwriteLibs=javacpp.libs.txt +popd + cd caffe-$CAFFE_VERSION cp Makefile.config.example Makefile.config +printf "\n" >> Makefile.config +printf "INCLUDE_DIRS += \$(shell cat ../../../javacpp.incs.txt)\n" >> Makefile.config +printf "LIBRARY_DIRS += \$(shell cat ../../../javacpp.libs.txt)\n" >> Makefile.config export PATH=../bin:$PATH -export CXXFLAGS="-I../include -I$OPENCV_PATH/include" -export NVCCFLAGS="-I../include -I$OPENCV_PATH/include" -export LINKFLAGS="-L../lib -L$OPENCV_PATH/lib" +export CXXFLAGS="-I../include" +export NVCCFLAGS="-I../include" +export LINKFLAGS="-L../lib" make -j $MAKEJ BLAS=$BLAS DISTRIBUTE_DIR=.. lib # Manual deploy to avoid Caffe's python build mkdir -p ../include/caffe/proto