WIP: Implement native pihelper library

Signed-off-by: William Brawner <me@wbrawner.com>
This commit is contained in:
William Brawner 2020-01-11 11:41:18 -07:00
parent b6bf045fd0
commit f01cae55ae
10 changed files with 93 additions and 2 deletions

9
.gitmodules vendored Normal file
View file

@ -0,0 +1,9 @@
[submodule "libpihelper/src/main/c/libpihelper"]
path = libpihelper/src/main/c/libpihelper
url = git@git.wbrawner.com:/pub/git/Pi-Helper/pihelper.git
[submodule "libpihelper/src/main/c/curl"]
path = libpihelper/src/main/c/curl
url = https://github.com/curl/curl
[submodule "libpihelper/src/main/c/openssl"]
path = libpihelper/src/main/c/openssl
url = https://github.com/openssl/openssl

1
libpihelper/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

43
libpihelper/build.gradle Normal file
View file

@ -0,0 +1,43 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
externalNativeBuild {
cmake {
path "src/main/c/CMakeLists.txt"
version "3.10.2"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}

View file

@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wbrawner.libpihelper">
<uses-permission android:name="android.permission.INTERNET" />
<application android:usesCleartextTraffic="true" />
</manifest>

View file

@ -0,0 +1,27 @@
# Set the minimum required version for cmake
cmake_minimum_required(VERSION 3.4.1)
set(PIHELPER_STATIC off CACHE BOOL "")
set(PIHELPER_SHARED on CACHE BOOL "")
add_subdirectory(libpihelper)
add_library(
pihelper
SHARED
pihelper-android.c
)
# Include the Android logging library for native code
find_library(
log-lib
log
)
# Link our library with the Android logging library
target_link_libraries(
pihelper
${log-lib}
libpihelpershared
)

@ -0,0 +1 @@
Subproject commit 7e599ee5f180c0526914686826fa64b4403f09d2

View file

@ -0,0 +1,4 @@
package com.wbrawner.libpihelper;
public class PiHelperNative {
}

View file

@ -27,7 +27,7 @@ android {
} }
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':libpihelper')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"

View file

@ -1,2 +1,3 @@
include ':app', ':piholeclient' include ':app', ':piholeclient', ':libpihelper'
rootProject.name='Pi-helper' rootProject.name='Pi-helper'