Skip to content

Commit

Permalink
* Let GSL link with OpenBLAS, MKL, Accelerate, etc automatically ins…
Browse files Browse the repository at this point in the history
…tead of GSL CBLAS (issue #18)
  • Loading branch information
saudet committed Feb 14, 2018
1 parent 916b060 commit 13e8ab2
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 1,055 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Let GSL link with OpenBLAS, MKL, Accelerate, etc automatically instead of GSL CBLAS ([issue #18](https://github.com/bytedeco/javacpp-presets/issues/18))
* Append `@NoException` annotation to presets for libdc1394, libfreenect, MKL, OpenBLAS, FFTW, GSL, Leptonica, CUDA, and system APIs to reduce unneeded C++ overhead
* Fix mapping of `fftwf_iodim` and `fftwf_iodim64` for FFTW ([issue #523](https://github.com/bytedeco/javacpp-presets/issues/523))
* Add support for iOS and Accelerate to presets for OpenBLAS ([pull #515](https://github.com/bytedeco/javacpp-presets/pull/515))
Expand Down
17 changes: 15 additions & 2 deletions gsl/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,25 @@ download ftp://ftp.gnu.org/gnu/gsl/gsl-$GSL_VERSION.tar.gz gsl-$GSL_VERSION.tar.
mkdir -p $PLATFORM
cd $PLATFORM
INSTALL_PATH=`pwd`

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

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

echo "Decompressing archives..."
tar --totals -xzf ../gsl-$GSL_VERSION.tar.gz
cd gsl-$GSL_VERSION

export GSL_LDFLAGS="-L$OPENBLAS_PATH/ -L$OPENBLAS_PATH/lib/ -lopenblas"
case $PLATFORM in
android-arm)
export AR="$ANDROID_BIN-ar"
Expand All @@ -28,7 +43,6 @@ case $PLATFORM in
export CFLAGS="$CPPFLAGS -fPIC -ffunction-sections -funwind-tables -fstack-protector -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -Dlog2\(x\)=\(log\(x\)/1.44269504088896340736\)"
export LDFLAGS="-nostdlib -Wl,--fix-cortex-a8 -z text"
export LIBS="-lgcc -ldl -lz -lm -lc"
export GSL_LDFLAGS="-Lcblas/.libs/ -lgslcblas"
patch -Np1 < ../../../gsl-$GSL_VERSION-android.patch
./configure --prefix=$INSTALL_PATH --host="arm-linux-androideabi" --with-sysroot="$ANDROID_ROOT"
make -j $MAKEJ
Expand All @@ -44,7 +58,6 @@ case $PLATFORM in
export CFLAGS="$CPPFLAGS -fPIC -ffunction-sections -funwind-tables -mssse3 -mfpmath=sse -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -Dlog2\(x\)=\(log\(x\)/1.44269504088896340736\)"
export LDFLAGS="-nostdlib -z text"
export LIBS="-lgcc -ldl -lz -lm -lc"
export GSL_LDFLAGS="-Lcblas/.libs/ -lgslcblas"
patch -Np1 < ../../../gsl-$GSL_VERSION-android.patch
./configure --prefix=$INSTALL_PATH --host="i686-linux-android" --with-sysroot="$ANDROID_ROOT"
make -j $MAKEJ
Expand Down
5 changes: 5 additions & 0 deletions gsl/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
</properties>

<dependencies>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>openblas-platform</artifactId>
<version>0.2.20-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
Expand Down
51 changes: 51 additions & 0 deletions gsl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
</properties>

<dependencies>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>openblas</artifactId>
<version>0.2.20-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
Expand All @@ -39,6 +44,19 @@
<plugin>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<dependencies>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>openblas</artifactId>
<version>0.2.20-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>openblas</artifactId>
<version>0.2.20-${project.parent.version}</version>
<classifier>${javacpp.platform}</classifier>
</dependency>
</dependencies>
<configuration>
<encoding>ISO-8859-1</encoding>
<propertyKeysAndValues>
Expand All @@ -51,7 +69,40 @@
<value>${javacpp.platform.oldcompiler}</value>
</property>
</propertyKeysAndValues>
<classPaths>
<classPath>${basedir}/../openblas/target/classes/</classPath>
<classPath>${project.build.outputDirectory}</classPath>
</classPaths>
<includePaths>
<includePath>${basedir}/../openblas/target/classes/org/bytedeco/javacpp/include/</includePath>
<includePath>${basedir}/../openblas/src/main/resources/org/bytedeco/javacpp/include/</includePath>
<includePath>${basedir}/../openblas/cppbuild/${javacpp.platform}/include/</includePath>
<includePath>${basedir}/cppbuild/${javacpp.platform}/include/</includePath>
</includePaths>
<linkPaths>
<linkPath>${basedir}/../openblas/cppbuild/${javacpp.platform}/lib/</linkPath>
<linkPath>${basedir}/cppbuild/${javacpp.platform}/lib/</linkPath>
</linkPaths>
<preloadPaths>
<preloadPath>${basedir}/../openblas/cppbuild/${javacpp.platform}/bin/</preloadPath>
<preloadPath>${basedir}/cppbuild/${javacpp.platform}/bin/</preloadPath>
</preloadPaths>
<linkResource>/${javacpp.platform.library.path}/</linkResource>
</configuration>
<executions>
<execution>
<id>javacpp.parser</id>
<configuration>
<classOrPackageName>org.bytedeco.javacpp.presets.gsl</classOrPackageName>
</configuration>
</execution>
<execution>
<id>javacpp.compiler</id>
<configuration>
<classOrPackageName>org.bytedeco.javacpp.gsl</classOrPackageName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
Loading

0 comments on commit 13e8ab2

Please sign in to comment.