diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..fd3a7a5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,45 @@ +# https://github.com/mgerhardy/caveexpress/blob/master/.travis.yml +# https://github.com/googlesamples/android-ndk/blob/ba6a5a46cf5c0d4b76e2d56a78f321e4668e6e26/.travis.yml +# https://github.com/travis-ci/travis-ci/issues/8360 +# https://github.com/owncloud/android/blob/master/.travis.yml + +language: android + +jdk: + - oraclejdk8 + +addons: + apt_packages: + - swig + +android: + components: + - tools + - platform-tools + - build-tools-25.0.2 + - android-25 + +before_install: + - cmake --version + - swig -version + - echo "y" | sdkmanager "cmake;3.6.4111459" + - curl -L http://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip -O + - unzip -oq android-ndk-r16b-linux-x86_64.zip && rm android-ndk-r16b-linux-x86_64.zip + - export ANDROID_NDK_HOME=`pwd`/android-ndk-r16b + - git clone https://github.com/cmusphinx/sphinxbase + - git clone https://github.com/cmusphinx/pocketsphinx + - export POCKETSPHINX_HOME=`pwd`/pocketsphinx + - export SPINXBASE_HOME=`pwd`/sphinxbase + +before_deploy: + - mv build/outputs/aar/pocketsphinx-android-5prealpha-release.aar build/outputs/aar/pocketsphinx-android-5prealpha.aar + +deploy: + provider: bintray + file: descriptor.json + user: nshmyrev + # TODO ecrypt yours here: + key: + secure: MX/XIxovXXaiQbbtOnUaUS5NxyLmLGJ0ShBBpujJogUtuERs+GdRnymZx/Bprp5s18AozkpI1ekG3AA/rv/BEzoO61lB5xGF/Zvs3G4QB/WAsLiCZ/iBncSsMqS6/Q+uJYZXw1/JJj02rZ9F2ERpCvvbxPQm9zWlXkc/P8s/5DQ= + on: + all_branches: true diff --git a/CMakeLists.txt b/CMakeLists.txt index 0584b49..c9d726e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.4.1) -set(SPHINXBASE_SRC ../sphinxbase/src/libsphinxbase) -set(POCKETSPHINX_SRC ../pocketsphinx/src/libpocketsphinx) +set(SPHINXBASE_SRC $ENV{SPINXBASE_HOME}/src/libsphinxbase) +set(POCKETSPHINX_SRC $ENV{POCKETSPHINX_HOME}/src/libpocketsphinx) set(SPHINXBASE_SOURCES fe/fe_interface.c @@ -103,13 +103,13 @@ foreach(source ${POCKETSPHINX_SOURCES}) endforeach() -add_library( pocketsphinx_jni SHARED +add_library( pocketsphinx_jni SHARED build/generated-src/cpp/pocketsphinx_wrap.c - build/generated-src/cpp/sphinxbase_wrap.c + build/generated-src/cpp/sphinxbase_wrap.c ${SPHINXBASE_SOURCES_ABS} ${POCKETSPHINX_SOURCES_ABS} ) - -include_directories(../sphinxbase/include ../sphinxbase/include/android ../sphinxbase/include/sphinxbase ../pocketsphinx/include) + +include_directories($ENV{SPINXBASE_HOME}/include $ENV{SPINXBASE_HOME}/include/android $ENV{SPINXBASE_HOME}/include/sphinxbase $ENV{POCKETSPHINX_HOME}/include) add_definitions(-DHAVE_CONFIG_H) add_compile_options(-O3) diff --git a/README.md b/README.md index 32a11d5..c9fdea4 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ the following command to checkout from repository: git clone https://github.com/cmusphinx/sphinxbase git clone https://github.com/cmusphinx/pocketsphinx git clone https://github.com/cmusphinx/pocketsphinx-android +export POCKETSPHINX_HOME=`pwd`/pocketsphinx +export SPINXBASE_HOME=`pwd`/sphinxbase ``` After checkout you need to update the file 'local.properties' in the @@ -43,20 +45,43 @@ sdk.dir=/Users/User/Library/Android/sdk ndk.dir=/Users/User/Library/Android/sdk/ndk-bundle ``` -After everything is set, run `gradle build`. It will create +After everything is set, run `./gradlew build`. It will create pocketsphinx-android-5prealpha-release.aar and pocketsphinx-android-5prealpha-debug.aar in build/output. Using the library ================= +Add bintray maven to your repositories + + allprojects { + repositories { + maven { + url "https://dl.bintray.com" + } + jcenter() + google() + } + } + + +Add `pocketsphinx-android` to your dependencies + + dependencies { + implementation 'edu.cmu.pocketsphinx.android:pocketsphinx-android:5prealpha@aar' + } + + +Using the library locally +================= + Library is distributed as android archive AAR. You can add it to your project as usual with Android Studio or directly in gradle dependencies { compile (name:'pocketsphinx-android-debug', ext:'aar') } - + repositories { flatDir { dirs 'libs' diff --git a/build.gradle b/build.gradle index d069dc0..b163dd3 100644 --- a/build.gradle +++ b/build.gradle @@ -46,22 +46,25 @@ task mkdir { } } +def sphinxbase_home = "$System.env.SPINXBASE_HOME" +def pocketsphinx_home = "$System.env.POCKETSPHINX_HOME" + task swigSb(type: Exec) { commandLine 'swig', - "-I../sphinxbase/include", "-I../sphinxbase/swig", - "-java", "-package", "edu.cmu.pocketsphinx", + "-I$sphinxbase_home/include", "-I$sphinxbase_home/swig", + "-java", "-package", "edu.cmu.pocketsphinx", "-outdir", "build/generated-src/java", "-o", "build/generated-src/cpp/sphinxbase_wrap.c", - "../sphinxbase/swig/sphinxbase.i" + "$sphinxbase_home/swig/sphinxbase.i" } task swigPs(type: Exec) { commandLine 'swig', - "-I../sphinxbase/swig", - "-I../pocketsphinx/include", - "-I../pocketsphinx/swig", + "-I$sphinxbase_home/swig", + "-I$pocketsphinx_home/include", + "-I$pocketsphinx_home/swig", "-java", "-package", "edu.cmu.pocketsphinx", - "-outdir", "build/generated-src/java", "-o", "build/generated-src/cpp/pocketsphinx_wrap.c", - "../pocketsphinx/swig/pocketsphinx.i" + "-outdir", "build/generated-src/java", "-o", "build/generated-src/cpp/pocketsphinx_wrap.c", + "$pocketsphinx_home/swig/pocketsphinx.i" } preBuild.dependsOn mkdir, swigSb, swigPs diff --git a/descriptor.json b/descriptor.json new file mode 100644 index 0000000..d234459 --- /dev/null +++ b/descriptor.json @@ -0,0 +1,34 @@ +{ + "package": { + "subject": "edu.cmu.pocketsphinx", + "repo": "android", + "name": "pocketsphinx-android", + "vcs_url": "https://github.com/cmusphinx/pocketsphinx-android.git", + "licenses": ["BSD 3-Clause"], + "github_use_tag_release_notes": true + }, + "version": { + "name": "5prealpha", + "desc": "Testing releases", + "released": "2017-01-28", + "vcs_tag": "5prealpha", + "attributes": [{ + "name": "versionName", + "values": ["5prealpha"], + "type": "string" + }, { + "name": "versionCode", + "values": [5], + "type": "number" + }], + "gpgSign": false + }, + "files": [{ + "includePattern": "build/outputs/aar/(.*)", + "uploadPattern": "pocketsphinx-android/5prealpha/$1", + "matrixParams": { + "override": 1 + } + }], + "publish": true +}