-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
APL-VH-Android: March 2024 Release of APL 2024.1 compliant Viewhost Code
- Loading branch information
1 parent
c41ebf3
commit 083314b
Showing
271 changed files
with
12,347 additions
and
1,775 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# For more information about using CMake with Android Studio, read the | ||
# documentation: https://d.android.com/studio/projects/add-native-code.html | ||
|
||
# Sets the minimum version of CMake required to build the native library. | ||
include(FetchContent OPTIONAL RESULT_VARIABLE HAS_FETCH_CONTENT) | ||
|
||
cmake_minimum_required(VERSION 3.18.1) | ||
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(ENABLE_PIC ON) | ||
project (alexaextjni VERSION 1.0.0 LANGUAGES C CXX) | ||
|
||
|
||
# Creates and names a library, sets it as either STATIC | ||
# or SHARED, and provides the relative paths to its source code. | ||
# You can define multiple libraries, and CMake builds them for you. | ||
# Gradle automatically packages shared libraries with your APK. | ||
|
||
add_library( # Sets the name of the library. | ||
alexaextjni | ||
# Sets the library as a static library. | ||
STATIC | ||
src/main/cpp/jniextensionexecutor.cpp | ||
src/main/cpp/jniextensionproxy.cpp | ||
src/main/cpp/jniextensionregistrar.cpp | ||
src/main/cpp/jniextensionresource.cpp) | ||
|
||
# Searches for a specified prebuilt library and stores the path as a | ||
# variable. Because CMake includes system libraries in the search path by | ||
# default, you only need to specify the name of the public NDK library | ||
# you want to add. CMake verifies that the library exists before | ||
# completing its build. | ||
|
||
if (NOT ANDROID) | ||
# Ensure jni.h is found | ||
find_package(JNI REQUIRED) | ||
include_directories(${JAVA_INCLUDE_PATH}) | ||
include_directories(${JAVA_INCLUDE_PATH2}) | ||
|
||
add_library(alexaext STATIC IMPORTED) | ||
set_target_properties(alexaext | ||
PROPERTIES | ||
IMPORTED_LOCATION | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../coreengine/.cxx/cmake/debug/host/_deps/aplcore-build/extensions/alexaext/libalexaext.a" | ||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/../coreengine/src/main/cpp/alexaext/include" | ||
) | ||
|
||
add_library(rapidjson INTERFACE) | ||
target_include_directories(rapidjson INTERFACE | ||
# When we're building against RapidJSON, just use the include directory we discovered above | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../coreengine/src/main/cpp/rapidjson/include> | ||
) | ||
|
||
target_link_libraries(alexaextjni rapidjson alexaext) | ||
else() | ||
find_library( # Sets the name of the path variable. | ||
log-lib | ||
|
||
# Specifies the name of the NDK library that | ||
# you want CMake to locate. | ||
log) | ||
|
||
# Specifies libraries CMake should link to your target library. You | ||
# can link multiple libraries, such as libraries you define in this | ||
# build script, prebuilt third-party libraries, or system libraries. | ||
|
||
target_link_libraries( # Specifies the target library. | ||
alexaextjni | ||
|
||
# Links the target library to the log library | ||
# included in the NDK. | ||
${log-lib}) | ||
|
||
find_package(coreengine REQUIRED CONFIG) | ||
target_link_libraries(alexaextjni coreengine::alexaext coreengine::rapidjson) | ||
endif() | ||
|
||
# Specifies a path to native header files. | ||
include_directories(src/main/cpp/include) | ||
|
||
# Common lib includes | ||
include_directories(../common/src/main/cpp/include) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import org.apache.tools.ant.taskdefs.condition.Os | ||
|
||
apply plugin: 'com.android.library' | ||
|
||
ext { | ||
cmakeProjectPath = projectDir.absolutePath | ||
if (Os.isFamily(Os.FAMILY_WINDOWS)) { | ||
cmakeProjectPath = cmakeProjectPath.replace('\\', '/') | ||
} | ||
aplAndroidCmakeArgs = "-DCMAKE_VERBOSE_MAKEFILE=ON" | ||
} | ||
|
||
android { | ||
namespace 'com.amazon.alexa.android.extension.alexaextjni' | ||
compileSdk 34 | ||
buildToolsVersion = "33.0.0" | ||
ndkVersion "23.0.7599858" | ||
|
||
defaultConfig { | ||
minSdkVersion 22 | ||
versionCode 1 | ||
versionName "1.0" | ||
targetSdkVersion 34 | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles 'consumer-rules.pro' | ||
|
||
externalNativeBuild { | ||
cmake { | ||
// Sets optional flags for the C++ compiler. | ||
cppFlags "-std=c++11", "-fno-rtti", "-fno-exceptions" | ||
// Build the APL Core JNI library (excludes all other targets) | ||
targets "alexaextjni" | ||
// Enable APL Core JNI build, and be verbose. | ||
arguments aplAndroidCmakeArgs | ||
} | ||
} | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
externalNativeBuild { | ||
cmake { | ||
version "3.18.1" | ||
path "CMakeLists.txt" | ||
} | ||
} | ||
|
||
buildFeatures { | ||
prefab true | ||
prefabPublishing true | ||
} | ||
prefab { | ||
alexaextjni { | ||
headers "src/main/cpp/include" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation project(":common") | ||
implementation project(':coreengine') | ||
} | ||
|
||
task buildHostJNI(type: com.amazon.apl.android.CMakeTask) { | ||
cmakeArgs aplAndroidCmakeArgs | ||
makeTargets "alexaextjni" | ||
dependsOn ':coreengine:buildHostJNI' | ||
} | ||
|
||
project.afterEvaluate { | ||
// Dump configuration settings | ||
println "APL CMake Args: " + aplAndroidCmakeArgs | ||
println "Android SDK Directory: " + android.sdkDirectory.path | ||
println "Android NDK Directory: " + android.ndkDirectory.path | ||
|
||
// We need to make sure the host jni library is built before any debug or release unit testing. | ||
tasks.preDebugUnitTestBuild.dependsOn(buildHostJNI) | ||
tasks.preReleaseUnitTestBuild.dependsOn(buildHostJNI) | ||
tasks.buildHostJNI.dependsOn(':coreengine:buildHostJNI') | ||
tasks.buildHostJNI.dependsOn(':common:buildHostJNI') | ||
} | ||
|
||
tasks.build.dependsOn(buildHostJNI) | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.