diff --git a/extension/android/CMakeLists.txt b/extension/android/CMakeLists.txt index c2707af310a..b2f37eca2b1 100644 --- a/extension/android/CMakeLists.txt +++ b/extension/android/CMakeLists.txt @@ -226,6 +226,25 @@ if(EXECUTORCH_BUILD_LLAMA_JNI) endif() endif() +if(EXECUTORCH_BUILD_GEMMA3N_JNI) + # Gemma3N runner sources compiled directly into the JNI library + target_sources( + executorch_jni + PRIVATE + jni/fb/jni_layer_gemma3n.cpp # @oss-disable + ${EXECUTORCH_ROOT}/examples/models/fb/gemma3n/runner/speech_encoder.cpp # @oss-disable + ${EXECUTORCH_ROOT}/examples/models/fb/gemma3n/runner/text_decoder_runner.cpp # @oss-disable + ${EXECUTORCH_ROOT}/examples/models/fb/gemma3n/runner/gemma3n_runner.cpp # @oss-disable + ) + target_include_directories( + executorch_jni + PRIVATE ${EXECUTORCH_ROOT}/.. # @oss-disable + ) + target_compile_definitions( + executorch_jni PRIVATE ENABLE_XNNPACK_SHARED_WORKSPACE # @oss-disable + ) +endif() + target_include_directories( executorch_jni PRIVATE diff --git a/scripts/build_android_library.sh b/scripts/build_android_library.sh index 0fb9e909884..21cc91ec5a8 100755 --- a/scripts/build_android_library.sh +++ b/scripts/build_android_library.sh @@ -45,6 +45,7 @@ build_android_native_library() { -DEXECUTORCH_BUILD_EXTENSION_ASR_RUNNER="${EXECUTORCH_BUILD_EXTENSION_LLM:-ON}" \ -DEXECUTORCH_BUILD_EXTENSION_TRAINING=ON \ -DEXECUTORCH_BUILD_LLAMA_JNI="${EXECUTORCH_BUILD_EXTENSION_LLM:-ON}" \ + # @oss-disable: -DEXECUTORCH_BUILD_GEMMA3N_JNI="${EXECUTORCH_BUILD_GEMMA3N_JNI:-OFF}" \ -DEXECUTORCH_BUILD_NEURON="${EXECUTORCH_BUILD_NEURON}" \ -DNEURON_BUFFER_ALLOCATOR_LIB="${NEURON_BUFFER_ALLOCATOR_LIB}" \ -DEXECUTORCH_BUILD_QNN="${EXECUTORCH_BUILD_QNN}" \