Skip to content

Commit

Permalink
* Use the new BUILD_PATH environment variable passed by the `javac…
Browse files Browse the repository at this point in the history
…pp` plugin to the `cppbuild.sh` script files

Also move all custom header files into `include` subdirectories so they can be picked up as that type of resources
  • Loading branch information
saudet committed May 7, 2017
1 parent 6acba4c commit 778b586
Show file tree
Hide file tree
Showing 23 changed files with 139 additions and 53 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Use the new `BUILD_PATH` environment variable passed by the `javacpp` plugin to the `cppbuild.sh` script files
* Let presets pick up `include` or `link` paths from cached resources ([pull #101](https://github.com/bytedeco/javacpp-presets/pull/101))
* Update presets for Visual Studio 2015 ([issue #298](https://github.com/bytedeco/javacpp-presets/issues/298))
* Reuse the presets for HDF5 with Caffe
Expand Down
20 changes: 18 additions & 2 deletions caffe/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ mkdir -p include lib bin

OPENCV_PATH="$INSTALL_PATH/../../../opencv/cppbuild/$PLATFORM/"
HDF5_PATH="$INSTALL_PATH/../../../hdf5/cppbuild/$PLATFORM/"
OPENBLAS_PATH="$INSTALL_PATH/../../../openblas/cppbuild/$PLATFORM/"

if [[ -n "${BUILD_PATH:-}" ]]; then
PREVIFS="$IFS"
IFS="$PATH_SEPARATOR"
for P in $BUILD_PATH; do
if [[ -d "$P/include/opencv2" ]]; then
OPENCV_PATH="$P"
elif [[ -f "$P/include/hdf5.h" ]]; then
HDF5_PATH="$P"
elif [[ -f "$P/include/openblas_config.h" ]]; then
OPENBLAS_PATH="$P"
fi
done
IFS="$PREVIFS"
fi

echo "Decompressing archives..."
tar --totals -xf ../glog-$GLOG.tar.gz || true
Expand Down Expand Up @@ -127,9 +143,9 @@ cd ..
ln -sf libboost_thread.a lib/libboost_thread-mt.a

# OSX has Accelerate, but...
export C_INCLUDE_PATH="$INSTALL_PATH/../../../openblas/cppbuild/$PLATFORM/include/"
export C_INCLUDE_PATH="$OPENBLAS_PATH/include/"
export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH"
export LIBRARY_PATH="$INSTALL_PATH/../../../openblas/cppbuild/$PLATFORM/lib/"
export LIBRARY_PATH="$OPENBLAS_PATH/lib/"

cd caffe-$CAFFE_VERSION
patch -Np1 < ../../../caffe-nogpu.patch
Expand Down
6 changes: 3 additions & 3 deletions caffe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@
<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/${javacpp.platform}/include/opencv/</includePath>
<includePath>${basedir}/../opencv/cppbuild/${javacpp.platform}/include/</includePath>
<includePath>${basedir}/../hdf5/target/classes/org/bytedeco/javacpp/</includePath>
<includePath>${basedir}/../hdf5/target/classes/org/bytedeco/javacpp/include/</includePath>
<includePath>${basedir}/../hdf5/cppbuild/${javacpp.platform}/include/</includePath>
<includePath>${basedir}/../openblas/target/classes/org/bytedeco/javacpp/</includePath>
<includePath>${basedir}/../openblas/target/classes/org/bytedeco/javacpp/include/</includePath>
<includePath>${basedir}/../openblas/cppbuild/${javacpp.platform}/include/</includePath>
<includePath>${basedir}/cppbuild/${javacpp.platform}/include/</includePath>
</includePaths>
Expand Down
15 changes: 13 additions & 2 deletions chilitags/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,25 @@ cd chilitags-$CHILITAGS_VERSION

OPENCV_PATH=$INSTALL_PATH/../../../opencv/cppbuild/$PLATFORM/

if [[ -n "${BUILD_PATH:-}" ]]; then
PREVIFS="$IFS"
IFS="$PATH_SEPARATOR"
for P in $BUILD_PATH; do
if [[ -d "$P/include/opencv2" ]]; then
OPENCV_PATH="$P"
fi
done
IFS="$PREVIFS"
fi

case $PLATFORM in
android-arm)
ANDROID_STANDALONE_TOOLCHAIN=$ANDROID_NDK ANDROID_NATIVE_API_LEVEL=14 ANDROID_ABI=armeabi-v7a ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 $CMAKE -DANDROID_ABI=armeabi-v7a -DCMAKE_TOOLCHAIN_FILE=$OPENCV_PATH/opencv-3.2.0/platforms/android/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-armeabi-v7a/
ANDROID_STANDALONE_TOOLCHAIN=$ANDROID_NDK ANDROID_NATIVE_API_LEVEL=14 ANDROID_ABI=armeabi-v7a ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 $CMAKE -DANDROID_ABI=armeabi-v7a -DCMAKE_TOOLCHAIN_FILE=$OPENCV_PATH/sdk/native/jni/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-armeabi-v7a/
make -j4
make install
;;
android-x86)
ANDROID_STANDALONE_TOOLCHAIN=$ANDROID_NDK ANDROID_NATIVE_API_LEVEL=14 ANDROID_ABI=x86 ANDROID_TOOLCHAIN_NAME=x86-4.9 $CMAKE -DANDROID_ABI=x86 -DCMAKE_TOOLCHAIN_FILE=$OPENCV_PATH/opencv-3.2.0/platforms/android/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-x86/
ANDROID_STANDALONE_TOOLCHAIN=$ANDROID_NDK ANDROID_NATIVE_API_LEVEL=14 ANDROID_ABI=x86 ANDROID_TOOLCHAIN_NAME=x86-4.9 $CMAKE -DANDROID_ABI=x86 -DCMAKE_TOOLCHAIN_FILE=$OPENCV_PATH/sdk/native/jni/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-x86/
make -j4
make install
;;
Expand Down
2 changes: 1 addition & 1 deletion chilitags/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,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/${javacpp.platform}/include/opencv/</includePath>
<includePath>${basedir}/../opencv/cppbuild/${javacpp.platform}/include/</includePath>
<includePath>${basedir}/cppbuild/${javacpp.platform}/include/</includePath>
Expand Down
11 changes: 11 additions & 0 deletions flandmark/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ cd flandmark-$FLANDMARK_VERSION

OPENCV_PATH=$INSTALL_PATH/../../../opencv/cppbuild/$PLATFORM/

if [[ -n "${BUILD_PATH:-}" ]]; then
PREVIFS="$IFS"
IFS="$PATH_SEPARATOR"
for P in $BUILD_PATH; do
if [[ -d "$P/include/opencv2" ]]; then
OPENCV_PATH="$P"
fi
done
IFS="$PREVIFS"
fi

case $PLATFORM in
android-arm)
$CMAKE -DCMAKE_TOOLCHAIN_FILE=$INSTALL_PATH/../../android-arm.cmake -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-armeabi-v7a/
Expand Down
2 changes: 1 addition & 1 deletion flandmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,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/${javacpp.platform}/include/opencv/</includePath>
<includePath>${basedir}/../opencv/cppbuild/${javacpp.platform}/include/</includePath>
<includePath>${basedir}/cppbuild/${javacpp.platform}/include/</includePath>
Expand Down
2 changes: 1 addition & 1 deletion hdf5/src/main/java/org/bytedeco/javacpp/presets/hdf5.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"H5AtomType.h", "H5PredType.h", "H5EnumType.h", "H5IntType.h", "H5FloatType.h", "H5StrType.h", "H5CompType.h", "H5ArrayType.h",
"H5VarLenType.h", "H5DataSet.h", "H5Group.h", "H5File.h", "H5Library.h"},
link = {"hdf5@.100", "hdf5_hl@.100", "hdf5_cpp@.100"}, resource = {"include", "lib"}),
@Platform(value = "windows", link = {"libhdf5", "libhdf5_hl", "libhdf5_cpp", "libszip", "libzlib"}, preload = {"msvcp120", "msvcr120"}),
@Platform(value = "windows", link = {"libhdf5", "libhdf5_hl", "libhdf5_cpp", "libszip", "libzlib"}, preload = {"msvcp140", "vcruntime140"}),
@Platform(value = "windows-x86", includepath = "C:/Program Files (x86)/HDF_Group/HDF5/1.10.0/include/",
preloadpath = "C:/Program Files (x86)/HDF_Group/HDF5/1.10.0/bin/",
linkpath = "C:/Program Files (x86)/HDF_Group/HDF5/1.10.0/lib/"),
Expand Down
21 changes: 19 additions & 2 deletions mxnet/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ download https://github.com/dmlc/mxnet/archive/master.tar.gz mxnet-$MXNET_VERSIO
mkdir -p $PLATFORM
cd $PLATFORM
INSTALL_PATH=`pwd`

OPENCV_PATH="$INSTALL_PATH/../../../opencv/cppbuild/$PLATFORM/"
OPENBLAS_PATH="$INSTALL_PATH/../../../openblas/cppbuild/$PLATFORM/"

if [[ -n "${BUILD_PATH:-}" ]]; then
PREVIFS="$IFS"
IFS="$PATH_SEPARATOR"
for P in $BUILD_PATH; do
if [[ -d "$P/include/opencv2" ]]; then
OPENCV_PATH="$P"
elif [[ -f "$P/include/openblas_config.h" ]]; then
OPENBLAS_PATH="$P"
fi
done
IFS="$PREVIFS"
fi

echo "Decompressing archives..."
tar --totals -xzf ../dmlc-core-$MXNET_VERSION.tar.gz
tar --totals -xzf ../mshadow-$MXNET_VERSION.tar.gz
Expand All @@ -54,9 +71,9 @@ ln -snf ../mshadow-$MXNET_VERSION mshadow
ln -snf ../ps-lite-$MXNET_VERSION ps-lite
ln -snf ../nnvm-$MXNET_VERSION nnvm

export C_INCLUDE_PATH="$INSTALL_PATH/../../../openblas/cppbuild/$PLATFORM/include/:$INSTALL_PATH/../../../opencv/cppbuild/$PLATFORM/include/"
export C_INCLUDE_PATH="$OPENBLAS_PATH/include/:$OPENCV_PATH/include/"
export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH"
export LIBRARY_PATH="$INSTALL_PATH/../../../openblas/cppbuild/$PLATFORM/lib/:$INSTALL_PATH/../../../opencv/cppbuild/$PLATFORM/lib/"
export LIBRARY_PATH="$OPENBLAS_PATH/lib/:$OPENCV_PATH/lib/"

sed -i="" 's/$(shell pkg-config --cflags opencv)//' Makefile
sed -i="" 's/$(shell pkg-config --libs opencv)/-lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_core/' Makefile
Expand Down
4 changes: 2 additions & 2 deletions mxnet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@
<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/${javacpp.platform}/include/opencv/</includePath>
<includePath>${basedir}/../opencv/cppbuild/${javacpp.platform}/include/</includePath>
<includePath>${basedir}/../openblas/target/classes/org/bytedeco/javacpp/</includePath>
<includePath>${basedir}/../openblas/target/classes/org/bytedeco/javacpp/include/</includePath>
<includePath>${basedir}/../openblas/cppbuild/${javacpp.platform}/include/</includePath>
<includePath>${basedir}/cppbuild/${javacpp.platform}/include/</includePath>
</includePaths>
Expand Down
10 changes: 6 additions & 4 deletions opencv/src/main/java/org/bytedeco/javacpp/opencv_shape.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,9 @@ F.L. Bookstein (PAMI 1989). :

/** \brief An Chi based cost extraction. :
*/
@Namespace("cv") public static class ChiHistogramCostExtractor extends HistogramCostExtractor {
static { Loader.load(); }
@Namespace("cv") @Opaque public static class ChiHistogramCostExtractor extends HistogramCostExtractor {
/** Empty constructor. Calls {@code super((Pointer)null)}. */
public ChiHistogramCostExtractor() { super((Pointer)null); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public ChiHistogramCostExtractor(Pointer p) { super(p); }
}
Expand All @@ -408,8 +409,9 @@ F.L. Bookstein (PAMI 1989). :

/** \brief An EMD-L1 based cost extraction. :
*/
@Namespace("cv") public static class EMDL1HistogramCostExtractor extends HistogramCostExtractor {
static { Loader.load(); }
@Namespace("cv") @Opaque public static class EMDL1HistogramCostExtractor extends HistogramCostExtractor {
/** Empty constructor. Calls {@code super((Pointer)null)}. */
public EMDL1HistogramCostExtractor() { super((Pointer)null); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public EMDL1HistogramCostExtractor(Pointer p) { super(p); }
}
Expand Down
24 changes: 12 additions & 12 deletions opencv/src/main/java/org/bytedeco/javacpp/opencv_ximgproc.java
Original file line number Diff line number Diff line change
Expand Up @@ -1447,11 +1447,11 @@ or tort (including negligence or otherwise) arising in any way out of
/** \brief Color-based strategy for the selective search segmentation algorithm
The class is implemented from the algorithm described in \cite uijlings2013selective.
*/
@Namespace("cv::ximgproc::segmentation") public static class SelectiveSearchSegmentationStrategyColor extends SelectiveSearchSegmentationStrategy {
static { Loader.load(); }
@Namespace("cv::ximgproc::segmentation") @Opaque public static class SelectiveSearchSegmentationStrategyColor extends SelectiveSearchSegmentationStrategy {
/** Empty constructor. Calls {@code super((Pointer)null)}. */
public SelectiveSearchSegmentationStrategyColor() { super((Pointer)null); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public SelectiveSearchSegmentationStrategyColor(Pointer p) { super(p); }

}

/** \brief Create a new color-based strategy */
Expand All @@ -1460,11 +1460,11 @@ or tort (including negligence or otherwise) arising in any way out of
/** \brief Size-based strategy for the selective search segmentation algorithm
The class is implemented from the algorithm described in \cite uijlings2013selective.
*/
@Namespace("cv::ximgproc::segmentation") public static class SelectiveSearchSegmentationStrategySize extends SelectiveSearchSegmentationStrategy {
static { Loader.load(); }
@Namespace("cv::ximgproc::segmentation") @Opaque public static class SelectiveSearchSegmentationStrategySize extends SelectiveSearchSegmentationStrategy {
/** Empty constructor. Calls {@code super((Pointer)null)}. */
public SelectiveSearchSegmentationStrategySize() { super((Pointer)null); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public SelectiveSearchSegmentationStrategySize(Pointer p) { super(p); }

}

/** \brief Create a new size-based strategy */
Expand All @@ -1473,11 +1473,11 @@ or tort (including negligence or otherwise) arising in any way out of
/** \brief Texture-based strategy for the selective search segmentation algorithm
The class is implemented from the algorithm described in \cite uijlings2013selective.
*/
@Namespace("cv::ximgproc::segmentation") public static class SelectiveSearchSegmentationStrategyTexture extends SelectiveSearchSegmentationStrategy {
static { Loader.load(); }
@Namespace("cv::ximgproc::segmentation") @Opaque public static class SelectiveSearchSegmentationStrategyTexture extends SelectiveSearchSegmentationStrategy {
/** Empty constructor. Calls {@code super((Pointer)null)}. */
public SelectiveSearchSegmentationStrategyTexture() { super((Pointer)null); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public SelectiveSearchSegmentationStrategyTexture(Pointer p) { super(p); }

}

/** \brief Create a new size-based strategy */
Expand All @@ -1486,11 +1486,11 @@ or tort (including negligence or otherwise) arising in any way out of
/** \brief Fill-based strategy for the selective search segmentation algorithm
The class is implemented from the algorithm described in \cite uijlings2013selective.
*/
@Namespace("cv::ximgproc::segmentation") public static class SelectiveSearchSegmentationStrategyFill extends SelectiveSearchSegmentationStrategy {
static { Loader.load(); }
@Namespace("cv::ximgproc::segmentation") @Opaque public static class SelectiveSearchSegmentationStrategyFill extends SelectiveSearchSegmentationStrategy {
/** Empty constructor. Calls {@code super((Pointer)null)}. */
public SelectiveSearchSegmentationStrategyFill() { super((Pointer)null); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public SelectiveSearchSegmentationStrategyFill(Pointer p) { super(p); }

}

/** \brief Create a new fill-based strategy */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
"<opencv2/core/utility.hpp>", "<opencv2/core/types_c.h>", "<opencv2/core/core_c.h>", "<opencv2/core/types.hpp>",
"<opencv2/core.hpp>", "<opencv2/core/operations.hpp>", "<opencv2/core/bufferpool.hpp>", "<opencv2/core/mat.hpp>",
"<opencv2/core/persistence.hpp>", "<opencv2/core/optim.hpp>", "opencv_adapters.h"}, link = {"opencv_core@.3.2", "opencv_imgproc@.3.2"},
resource = {"include", "lib", "sdk", "share"}),
resource = {"include", "lib", "sdk", "share", "x86", "x64", "OpenCVConfig.cmake", "OpenCVConfig-version.cmake"}),
@Platform(value = "linux", preloadpath = {"/usr/lib/", "/usr/lib32/", "/usr/lib64/"}, preload = "gomp@.1"),
@Platform(value = "linux-armhf", preloadpath = {"/usr/arm-linux-gnueabihf/lib/", "/usr/lib/arm-linux-gnueabihf/"}),
@Platform(value = "linux-x86", preloadpath = {"/usr/lib32/", "/usr/lib/"}),
@Platform(value = "linux-x86_64", preloadpath = {"/usr/lib64/", "/usr/lib/"}),
@Platform(value = "linux-ppc64", preloadpath = {"/usr/lib/powerpc64-linux-gnu/", "/usr/lib/powerpc64le-linux-gnu/"}),
@Platform(value = "windows", define = "_WIN32_WINNT 0x0502", link = {"opencv_core320", "opencv_imgproc320"}, preload = {"msvcr120", "msvcp120"}),
@Platform(value = "windows-x86", preloadpath = "C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/redist/x86/Microsoft.VC120.CRT/"),
@Platform(value = "windows-x86_64", preloadpath = "C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/redist/x64/Microsoft.VC120.CRT/")},
@Platform(value = "windows", define = "_WIN32_WINNT 0x0502", link = {"opencv_core320", "opencv_imgproc320"}, preload = {"msvcp140", "vcruntime140"}),
@Platform(value = "windows-x86", preloadpath = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/redist/x86/Microsoft.VC140.CRT/"),
@Platform(value = "windows-x86_64", preloadpath = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/redist/x64/Microsoft.VC140.CRT/")},
target = "org.bytedeco.javacpp.opencv_core", helper = "org.bytedeco.javacpp.helper.opencv_core")
public class opencv_core implements InfoMapper {
public void map(InfoMap infoMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @author Bram Biesbrouck
*/
@Properties(inherit = {opencv_highgui.class, opencv_ml.class}, value = {
@Platform(include = {"<opencv2/text.hpp>", "<opencv2/text/erfilter.hpp>", "<opencv2/text/ocr.hpp>", "opencv_adapters.h"},
@Platform(include = {"<opencv2/text.hpp>", "<opencv2/text/erfilter.hpp>", "<opencv2/text/ocr.hpp>"},
link = "opencv_text@.3.2"),
@Platform(value = "windows", link = "opencv_text320")},
target = "org.bytedeco.javacpp.opencv_text")
Expand Down
Loading

0 comments on commit 778b586

Please sign in to comment.