Skip to content

Commit

Permalink
* Add builds for Android to zlib sample project (issue #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Sep 12, 2020
1 parent f725eec commit 3939b5d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

* Add builds for Android to zlib sample project ([issue #5](https://github.com/bytedeco/gradle-javacpp/issues/5))

### September 9, 2020 version 1.5.4
* Initial release
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ dependencies {
}
tasks.withType(org.bytedeco.gradle.javacpp.BuildTask) {
// set here default values for all build tasks below, typically just includePath and linkPath
// set here default values for all build tasks below, typically just includePath and linkPath,
// but also properties to set the path to the NDK and its compiler in the case of Android
}
javacppBuildCommand {
Expand Down
8 changes: 7 additions & 1 deletion samples/zlib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java-library'
id 'org.bytedeco.gradle-javacpp-build' version '1.5.4'
id 'org.bytedeco.gradle-javacpp-build' version '1.5.5-SNAPSHOT'
}

group = 'org.bytedeco'
Expand All @@ -19,6 +19,12 @@ dependencies {
}

tasks.withType(org.bytedeco.gradle.javacpp.BuildTask) {
if (javacppPlatform.startsWith("android")) {
properties = "$javacppPlatform-clang"
propertyKeysAndValues = [ 'platform.root' : System.getProperty('user.home') + '/Android/Sdk/ndk-bundle/',
'platform.compiler' : "$buildDir/$javacppPlatform/toolchain/bin/clang++".toString() ]
test.enabled = false
}
includePath = ["$buildDir/$javacppPlatform/include"]
linkPath = ["$buildDir/$javacppPlatform/lib"]
}
Expand Down
28 changes: 28 additions & 0 deletions samples/zlib/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,34 @@ tar --totals -xf "zlib-$ZLIB_VERSION.tar.gz"
cd zlib-$ZLIB_VERSION

case $PLATFORM in
android-arm)
$PLATFORM_ROOT/build/tools/make_standalone_toolchain.py --arch arm --api 21 --install-dir=../toolchain
export PATH=`pwd`/../toolchain/bin/:$PATH
CC="arm-linux-androideabi-clang -fPIC" ./configure --prefix=.. --static
make -j $MAKEJ
make install
;;
android-arm64)
$PLATFORM_ROOT/build/tools/make_standalone_toolchain.py --arch arm64 --api 21 --install-dir=../toolchain
export PATH=`pwd`/../toolchain/bin/:$PATH
CC="aarch64-linux-android-clang -fPIC" ./configure --prefix=.. --static
make -j $MAKEJ
make install
;;
android-x86)
$PLATFORM_ROOT/build/tools/make_standalone_toolchain.py --arch x86 --api 21 --install-dir=../toolchain
export PATH=`pwd`/../toolchain/bin/:$PATH
CC="i686-linux-android-clang -fPIC" ./configure --prefix=.. --static
make -j $MAKEJ
make install
;;
android-x86_64)
$PLATFORM_ROOT/build/tools/make_standalone_toolchain.py --arch x86_64 --api 21 --install-dir=../toolchain
export PATH=`pwd`/../toolchain/bin/:$PATH
CC="x86_64-linux-android-clang -fPIC" ./configure --prefix=.. --static
make -j $MAKEJ
make install
;;
linux-x86)
CC="gcc -m32 -fPIC" ./configure --prefix=.. --static
make -j $MAKEJ
Expand Down
2 changes: 1 addition & 1 deletion samples/zlib/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ pluginManagement {

rootProject.name = 'zlib'

gradle.rootProject { ext.javacppVersion = '1.5.4' }
gradle.rootProject { ext.javacppVersion = '1.5.5-SNAPSHOT' }

0 comments on commit 3939b5d

Please sign in to comment.