Skip to content

Commit

Permalink
Using Maven dependencies during native build
Browse files Browse the repository at this point in the history
  • Loading branch information
cypof committed Oct 14, 2015
1 parent 7707e13 commit 5cfe6e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@
# IntelliJ
*.iml

# Dependency lists generated from Maven
javacpp.incs.txt
javacpp.libs.txt
16 changes: 11 additions & 5 deletions caffe/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5cfe6e1

Please sign in to comment.