beginning of android + moved config.js files to src + temp warn fix in bw_one_pole
This commit is contained in:
parent
d9272453fd
commit
c2769cdf21
14
examples/common/android/AndroidManifest.xml
Normal file
14
examples/common/android/AndroidManifest.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.orastron.@NAME@">
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-sdk android:minSdkVersion="16" /> <!-- for miniaudio -->
|
||||
<application android:label="@NAME@">
|
||||
<activity android:name=".MainActivity" android:label="@NAME@">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
23
examples/common/android/MainActivity.java
Normal file
23
examples/common/android/MainActivity.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.orastron.@NAME@;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
WebView webView = new WebView(this);
|
||||
setContentView(webView);
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webView.setWebChromeClient(new WebChromeClient());
|
||||
webView.setWebViewClient(new WebViewClient());
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webView.loadUrl("file:///android_asset/index.html");
|
||||
}
|
||||
}
|
87
examples/common/android/android.mk
Normal file
87
examples/common/android/android.mk
Normal file
@ -0,0 +1,87 @@
|
||||
COMMON_DIR := ${ROOT_DIR}/../../common/android
|
||||
BUILD_TOOLS_DIR := ${HOME}/Android/Sdk/build-tools/34.0.0
|
||||
JAR_FILE := ${HOME}/Android/Sdk/platforms/android-34/android.jar
|
||||
|
||||
JAVAC := javac
|
||||
KOTLINC := kotlinc
|
||||
KEYTOOL := keytool
|
||||
CXX := ${HOME}/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi23-clang++
|
||||
ADB := ${HOME}/Android/Sdk/platform-tools/adb
|
||||
APKSIGNER := ${BUILD_TOOLS_DIR}/apksigner
|
||||
ZIPALIGN := ${BUILD_TOOLS_DIR}/zipalign
|
||||
AAPT := ${BUILD_TOOLS_DIR}/aapt
|
||||
D8 := ${BUILD_TOOLS_DIR}/d8
|
||||
|
||||
CXXFLAGS := \
|
||||
-fPIC \
|
||||
-DNDEBUG \
|
||||
-I${ROOT_DIR}/../src \
|
||||
-I${COMMON_DIR} \
|
||||
-I${ROOT_DIR}/../../../include \
|
||||
-O3 \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Wpedantic \
|
||||
-std=c++20
|
||||
LDFLAGS := \
|
||||
-shared \
|
||||
-static-libstdc++ \
|
||||
-ljnigraphics \
|
||||
-llog \
|
||||
-landroid
|
||||
|
||||
SOURCES_COMMON := \
|
||||
${COMMON_DIR}/jni.cpp
|
||||
|
||||
all: build/${NAME}.apk
|
||||
|
||||
build/${NAME}.apk: build/gen/${NAME}.aligned.apk build/apk/lib/armeabi-v7a/lib${NAME}.so build/gen/keystore.jks
|
||||
${APKSIGNER} sign --ks build/gen/keystore.jks --ks-key-alias androidkey --ks-pass pass:android --key-pass pass:android --out $@ build/gen/${NAME}.aligned.apk
|
||||
|
||||
build/gen/keystore.jks: | build/gen
|
||||
${KEYTOOL} -genkeypair -keystore $@ -alias androidkey -dname "CN=orastron.com, OU=ID, O=ORASTRON, L=Abc, S=Xyz, C=IT" -validity 10000 -keyalg RSA -keysize 2048 -storepass android -keypass android
|
||||
|
||||
build/gen/${NAME}.aligned.apk: build/gen/${NAME}.unsigned.apk
|
||||
${ZIPALIGN} -f -p 4 $^ $@
|
||||
|
||||
build/gen/${NAME}.unsigned.apk: build/apk/classes.dex build/gen/AndroidManifest.xml build/assets/index.html build/assets/config.js | build/gen
|
||||
#${AAPT} package -f -M build/gen/AndroidManifest.xml -I ${JAR_FILE} -F $@ build/apk
|
||||
#${AAPT} package -f -M build/gen/AndroidManifest.xml -S ${COMMON_DIR}/res -I ${JAR_FILE} -F $@ build/apk
|
||||
${AAPT} package -f -M build/gen/AndroidManifest.xml -A build/assets -I ${JAR_FILE} -F $@ build/apk
|
||||
|
||||
build/apk/classes.dex: build/apk/my_classes.jar
|
||||
cd build/apk && ${BUILD_TOOLS_DIR}/d8 ../../$^ ${JAR_FILE} && cd ../..
|
||||
|
||||
build/apk/my_classes.jar: build/obj/com/orastron/${NAME}/MainActivity.class | build/apk
|
||||
${D8} build/obj/com/orastron/${NAME}/MainActivity.class --output $@ --no-desugaring
|
||||
#${D8} $^ --output $@ --no-desugaring
|
||||
|
||||
build/apk/lib/armeabi-v7a/lib${NAME}.so: ${SOURCES} | build/apk/lib/armeabi-v7a
|
||||
${CXX} $^ ${CXXFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
build/obj/com/orastron/${NAME}/MainActivity.class: build/gen/com/orastron/${NAME}/MainActivity.java | build/obj
|
||||
${JAVAC} -classpath ${JAR_FILE} -d build/obj build/gen/com/orastron/${NAME}/MainActivity.java
|
||||
|
||||
build/gen/com/orastron/${NAME}/MainActivity.java: ${COMMON_DIR}/MainActivity.java | build/gen/com/orastron/${NAME}
|
||||
cat $^ | sed s:@NAME@:${NAME}:g > $@
|
||||
|
||||
build/gen/AndroidManifest.xml: ${COMMON_DIR}/AndroidManifest.xml | build/gen/com/orastron/${NAME}
|
||||
cat $^ | sed s:@NAME@:${NAME}:g > $@
|
||||
|
||||
build/assets/index.html: ${COMMON_DIR}/index.html | build/assets
|
||||
cp $^ $@
|
||||
|
||||
build/assets/config.js: ${ROOT_DIR}/../src/config.js | build/assets
|
||||
cp $^ $@
|
||||
|
||||
build/apk build/apk/lib/armeabi-v7a build/obj build/gen/com/orastron/${NAME} build/gen build/assets:
|
||||
mkdir -p $@
|
||||
|
||||
clean:
|
||||
rm -fr build
|
||||
|
||||
install: build/${NAME}.apk
|
||||
[ -n "`${ADB} shell pm list packages | grep ^package:com.orastron.${NAME}$$`" ] && ${ADB} uninstall com.orastron.${NAME}; exit 0
|
||||
${ADB} install $^
|
||||
|
||||
.PHONY: all clean install
|
14
examples/common/android/index.html
Normal file
14
examples/common/android/index.html
Normal file
@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="config.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.onload = function () {
|
||||
var elemDiv = document.createElement('pre');
|
||||
elemDiv.innerText = JSON.stringify(parameters, null, 2);
|
||||
document.body.appendChild(elemDiv);
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
0
examples/common/android/jni.cpp
Normal file
0
examples/common/android/jni.cpp
Normal file
0
examples/common/android/platform.h
Normal file
0
examples/common/android/platform.h
Normal file
@ -58,11 +58,11 @@ build/web/module.wasm: ${SOURCES} | build/web
|
||||
build/web/index.html: ${INDEX} | build/web
|
||||
cp ${INDEX} $@
|
||||
|
||||
build/web/processor.js: ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js | build/web
|
||||
cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@
|
||||
build/web/processor.js: ${ROOT_DIR}/../src/config.js ${ROOT_DIR}/../../common/web/processor.js | build/web
|
||||
cat ${ROOT_DIR}/../src/config.js ${ROOT_DIR}/../../common/web//processor.js > $@
|
||||
|
||||
build/web/config.js: ${ROOT_DIR}/config.js | build/web
|
||||
cp ${ROOT_DIR}/config.js $@
|
||||
build/web/config.js: ${ROOT_DIR}/../src/config.js | build/web
|
||||
cp $^ $@
|
||||
|
||||
build/web/key.pem: build/web/cert.pem
|
||||
|
||||
|
6
examples/fx_one_pole/android/Makefile
Normal file
6
examples/fx_one_pole/android/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
NAME := bw_example_fx_one_pole
|
||||
SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_one_pole.c
|
||||
|
||||
include ${ROOT_DIR}/../../common/android/android.mk
|
@ -910,6 +910,7 @@ static inline char bw_one_pole_coeffs_is_valid(const bw_one_pole_coeffs *BW_REST
|
||||
if (coeffs->hash != bw_hash_sdbm("bw_one_pole_coeffs"))
|
||||
return 0;
|
||||
#endif
|
||||
(void)coeffs;
|
||||
//...
|
||||
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user