Skip to content

Commit

Permalink
Local repo with include files and libs
Browse files Browse the repository at this point in the history
  • Loading branch information
cypof committed Nov 5, 2015
1 parent 1d86294 commit e070b4a
Show file tree
Hide file tree
Showing 8 changed files with 586 additions and 1,191 deletions.
28 changes: 16 additions & 12 deletions caffe/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,51 +86,51 @@ export CFLAGS="-fPIC"
export CXXFLAGS="-fPIC"

cd glog-$GLOG
./configure "--prefix=$INSTALL_PATH" --disable-shared
./configure "--prefix=$INSTALL_PATH"
make -j $MAKEJ
make install
cd ..

cd gflags-$GFLAGS
mkdir -p build
cd build
"$CMAKE" -DBUILD_SHARED_LIBS=OFF "-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH" ..
"$CMAKE" -DBUILD_SHARED_LIBS=ON "-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH" ..
make -j $MAKEJ
make install
cd ../..

cd protobuf-$PROTO
./configure "--prefix=$INSTALL_PATH" --disable-shared
./configure "--prefix=$INSTALL_PATH"
make -j $MAKEJ
make install
cd ..

cd leveldb-$LEVELDB
make -j $MAKEJ
cp -a libleveldb.a "$INSTALL_PATH/lib"
cp -a include/leveldb "$INSTALL_PATH/include/"
cp -a libleveldb.* "$INSTALL_PATH/lib"
cd ..

cd snappy-$SNAPPY
./configure "--prefix=$INSTALL_PATH" --disable-shared
./configure "--prefix=$INSTALL_PATH"
make -j $MAKEJ
make install
cd ..

cd lmdb-LMDB_$LMDB/libraries/liblmdb
make -j $MAKEJ "CC=$CC" "XCFLAGS=$CFLAGS" "CPPFLAGS=$CXXFLAGS"
cp -a lmdb.h ../../../include/
cp -a liblmdb.a ../../../lib/
cp -a lmdb.h "$INSTALL_PATH/include/"
cp -a liblmdb.so "$INSTALL_PATH/lib"
cd ../../..

cd boost_$BOOST
./bootstrap.sh --with-libraries=system,thread
./b2 install "--prefix=$INSTALL_PATH" "address-model=$BINARY" link=static "toolset=$TOOLSET" "cxxflags=$CXXFLAGS"
./b2 install "--prefix=$INSTALL_PATH" "address-model=$BINARY" "toolset=$TOOLSET" "cxxflags=$CXXFLAGS"
cd ..
ln -sf libboost_thread.a lib/libboost_thread-mt.a
ln -sf libboost_thread.so lib/libboost_thread-mt.so

cd hdf5-$HDF5
LDFLAGS= ./configure "--prefix=$INSTALL_PATH" --disable-shared
LDFLAGS= ./configure "--prefix=$INSTALL_PATH"
make -j $MAKEJ
make install
cd ..
Expand All @@ -139,11 +139,15 @@ cd ..
if [[ $PLATFORM != macosx-* ]]; then
# blas (requires fortran, e.g. sudo yum install gcc-gfortran)
cd OpenBLAS-$OPENBLAS
make -j $MAKEJ "CC=$CC" "FC=$FC" BINARY=$BINARY NO_SHARED=1
make install "PREFIX=$INSTALL_PATH" NO_SHARED=1
make -j $MAKEJ "CC=$CC" "FC=$FC" BINARY=$BINARY
make install "PREFIX=$INSTALL_PATH"
cd ..
fi

# Make sure only shared libs are used
rm "$INSTALL_PATH"/lib/*.a
rm "$INSTALL_PATH"/lib/*.la

cd caffe-$CAFFE_VERSION
cp Makefile.config.example Makefile.config
export PATH=../bin:$PATH
Expand Down
3 changes: 2 additions & 1 deletion caffe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -58,7 +59,7 @@
<classPath>${project.build.outputDirectory}</classPath>
</classPaths>
<includePaths>
<includePath>${basedir}/../opencv/target/classes/org/bytedeco/javacpp/</includePath>
<includePath>${basedir}/../opencv/target/classes/org/bytedeco/javacpp/include/</includePath>
<includePath>${basedir}/../opencv/cppbuild/${platform}/include/opencv/</includePath>
<includePath>${basedir}/../opencv/cppbuild/${platform}/include/</includePath>
<includePath>${basedir}/cppbuild/${platform}/include/</includePath>
Expand Down
1,698 changes: 529 additions & 1,169 deletions caffe/src/main/java/org/bytedeco/javacpp/caffe.java

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions caffe/src/main/java/org/bytedeco/javacpp/presets/caffe.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@
* @author Samuel Audet
*/
@Properties(inherit=opencv_highgui.class, target="org.bytedeco.javacpp.caffe", value={
@Platform(value={"linux", "macosx"}, define={"CPU_ONLY", "SHARED_PTR_NAMESPACE boost", "USE_LEVELDB", "USE_LMDB", "USE_OPENCV"}, include={"caffe/caffe.hpp", "caffe/util/device_alternate.hpp",
"caffe/common.hpp", "caffe/proto/caffe.pb.h", "caffe/util/blocking_queue.hpp", "caffe/data_reader.hpp", "caffe/util/math_functions.hpp", "caffe/syncedmem.hpp",
"caffe/blob.hpp", "caffe/data_transformer.hpp", "caffe/filler.hpp", "caffe/internal_thread.hpp", "caffe/util/hdf5.hpp", "caffe/data_layers.hpp", "caffe/layer_factory.hpp",
"caffe/layer.hpp", "caffe/loss_layers.hpp", "caffe/neuron_layers.hpp", "caffe/common_layers.hpp", "caffe/net.hpp", "caffe/parallel.hpp", "caffe/solver.hpp", "caffe/solver_factory.hpp",
"caffe/sgd_solvers.hpp", "caffe/vision_layers.hpp", "caffe/util/benchmark.hpp", "caffe/util/db.hpp", "caffe/util/db_leveldb.hpp", "caffe/util/db_lmdb.hpp",
"caffe/util/io.hpp", "caffe/util/rng.hpp", "caffe/util/im2col.hpp", "caffe/util/insert_splits.hpp", "caffe/util/mkl_alternate.hpp",
"caffe/util/upgrade_proto.hpp", /* "caffe/util/cudnn.hpp" */}, link="caffe", includepath={"/usr/local/cuda/include/",
"/System/Library/Frameworks/vecLib.framework/", "/System/Library/Frameworks/Accelerate.framework/"}, linkpath="/usr/local/cuda/lib/") })
@Platform(value={"linux", "macosx"},
define={"CPU_ONLY", "SHARED_PTR_NAMESPACE boost", "USE_LEVELDB", "USE_LMDB", "USE_OPENCV"},
include={"caffe/caffe.hpp", "caffe/util/device_alternate.hpp", "caffe/common.hpp", "caffe/proto/caffe.pb.h", "caffe/util/blocking_queue.hpp",
"caffe/data_reader.hpp", "caffe/util/math_functions.hpp", "caffe/syncedmem.hpp", "caffe/blob.hpp", "caffe/data_transformer.hpp",
"caffe/filler.hpp", "caffe/internal_thread.hpp", "caffe/util/hdf5.hpp", "caffe/data_layers.hpp", "caffe/layer_factory.hpp",
"caffe/layer.hpp", "caffe/loss_layers.hpp", "caffe/neuron_layers.hpp", "caffe/common_layers.hpp", "caffe/net.hpp", "caffe/parallel.hpp",
"caffe/solver.hpp", "caffe/solver_factory.hpp", "caffe/sgd_solvers.hpp", "caffe/vision_layers.hpp", "caffe/util/benchmark.hpp",
"caffe/util/db.hpp", "caffe/util/db_leveldb.hpp", "caffe/util/db_lmdb.hpp", "caffe/util/io.hpp", "caffe/util/rng.hpp", "caffe/util/im2col.hpp",
"caffe/util/insert_splits.hpp", "caffe/util/mkl_alternate.hpp", "caffe/util/upgrade_proto.hpp", /* "caffe/util/cudnn.hpp" */},
link={"glog", "gflags", "protobuf", "boost_system", "boost_thread", "hdf5_hl", "hdf5", "leveldb", "snappy", "lmdb", "openblas", "caffe"},
includepath={"/usr/local/cuda/include/", "/System/Library/Frameworks/vecLib.framework/", "/System/Library/Frameworks/Accelerate.framework/"},
linkpath="/usr/local/cuda/lib/") })
public class caffe implements InfoMapper {
public void map(InfoMap infoMap) {
infoMap.put(new Info("NOT_IMPLEMENTED", "NO_GPU", "CUDA_POST_KERNEL_CHECK").cppTypes().annotations())
Expand Down
3 changes: 3 additions & 0 deletions opencv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
<value>${platform.oldcompiler}</value>
</property>
</propertyKeysAndValues>
<includePaths>
<includePath>${basedir}/src/main/resources/org/bytedeco/javacpp/include</includePath>
</includePaths>
</configuration>
</plugin>
<plugin>
Expand Down
25 changes: 24 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
<include>org/bytedeco/javacpp/presets/*</include>
</includes>
<excludes>
<exclude>org/bytedeco/javacpp/*.h</exclude>
<exclude>org/bytedeco/javacpp/include/</exclude>
<exclude>org/bytedeco/javacpp/linux-*/</exclude>
<exclude>org/bytedeco/javacpp/macosx-*/</exclude>
<exclude>org/bytedeco/javacpp/windows-*/</exclude>
Expand All @@ -242,6 +242,20 @@
</includes>
</configuration>
</execution>
<execution>
<id>include</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>include</classifier>
<skipIfEmpty>true</skipIfEmpty>
<includes>
<include>org/bytedeco/javacpp/include/</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down Expand Up @@ -283,6 +297,15 @@
<overWrite>true</overWrite>
<outputDirectory>${project.parent.build.directory}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<classifier>include</classifier>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.parent.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
Expand Down

0 comments on commit e070b4a

Please sign in to comment.