1# Copyright (C) 2017 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# Useful environment variables that can be set on the mmma command line, as 16# <key>=<value> pairs: 17# 18# LIBTEXTCLASSIFIER_STRIP_OPTS: (optional) value for LOCAL_STRIP_MODULE (for all 19# modules we build). NOT for prod builds. Can be set to keep_symbols for 20# debug / treemap purposes. 21 22 23LOCAL_PATH := $(call my-dir) 24 25# Custom C/C++ compilation flags: 26MY_LIBTEXTCLASSIFIER_CFLAGS := \ 27 -Wno-unused-parameter \ 28 -Wno-sign-compare \ 29 -Wno-missing-field-initializers \ 30 -Wno-ignored-qualifiers \ 31 -Wno-undefined-var-template \ 32 -fvisibility=hidden 33 34# Only enable debug logging in userdebug/eng builds. 35ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) 36 MY_LIBTEXTCLASSIFIER_CFLAGS += -DTC_DEBUG_LOGGING=1 37endif 38 39# ------------------------ 40# libtextclassifier_protos 41# ------------------------ 42 43include $(CLEAR_VARS) 44 45LOCAL_MODULE := libtextclassifier_protos 46 47LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS) 48 49LOCAL_SRC_FILES := $(call all-proto-files-under, .) 50LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-lite 51 52include $(BUILD_STATIC_LIBRARY) 53 54# ----------------- 55# libtextclassifier 56# ----------------- 57 58include $(CLEAR_VARS) 59LOCAL_MODULE := libtextclassifier 60 61proto_sources_dir := $(generated_sources_dir) 62 63LOCAL_CPP_EXTENSION := .cc 64LOCAL_CFLAGS += $(MY_LIBTEXTCLASSIFIER_CFLAGS) 65LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS) 66 67LOCAL_SRC_FILES := $(filter-out tests/%,$(call all-subdir-cpp-files)) 68LOCAL_C_INCLUDES += $(proto_sources_dir)/proto/external/libtextclassifier 69 70LOCAL_STATIC_LIBRARIES += libtextclassifier_protos 71LOCAL_SHARED_LIBRARIES += libprotobuf-cpp-lite 72LOCAL_SHARED_LIBRARIES += liblog 73LOCAL_SHARED_LIBRARIES += libicuuc libicui18n 74 75LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/jni.lds 76LOCAL_LDFLAGS += -Wl,-version-script=$(LOCAL_PATH)/jni.lds 77 78include $(BUILD_SHARED_LIBRARY) 79 80# ----------------------- 81# libtextclassifier_tests 82# ----------------------- 83 84include $(CLEAR_VARS) 85 86LOCAL_MODULE := libtextclassifier_tests 87LOCAL_COMPATIBILITY_SUITE := device-tests 88LOCAL_MODULE_TAGS := tests 89 90LOCAL_CPP_EXTENSION := .cc 91LOCAL_CFLAGS += $(MY_LIBTEXTCLASSIFIER_CFLAGS) 92LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS) 93 94LOCAL_TEST_DATA := $(call find-test-data-in-subdirs, $(LOCAL_PATH), *, tests/testdata) 95 96LOCAL_CPPFLAGS_32 += -DTEST_DATA_DIR="\"/data/nativetest/libtextclassifier_tests/tests/testdata/\"" 97LOCAL_CPPFLAGS_64 += -DTEST_DATA_DIR="\"/data/nativetest64/libtextclassifier_tests/tests/testdata/\"" 98 99LOCAL_SRC_FILES := $(call all-subdir-cpp-files) 100LOCAL_C_INCLUDES += $(proto_sources_dir)/proto/external/libtextclassifier 101 102LOCAL_STATIC_LIBRARIES += libtextclassifier_protos libgmock 103LOCAL_SHARED_LIBRARIES += libprotobuf-cpp-lite 104LOCAL_SHARED_LIBRARIES += liblog 105LOCAL_SHARED_LIBRARIES += libicuuc libicui18n 106 107include $(BUILD_NATIVE_TEST) 108 109# ------------ 110# LangId model 111# ------------ 112 113include $(CLEAR_VARS) 114LOCAL_MODULE := textclassifier.langid.model 115LOCAL_MODULE_CLASS := ETC 116LOCAL_MODULE_OWNER := google 117LOCAL_SRC_FILES := ./models/textclassifier.langid.model 118LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 119include $(BUILD_PREBUILT) 120 121# ---------------------- 122# Smart Selection models 123# ---------------------- 124 125include $(CLEAR_VARS) 126LOCAL_MODULE := textclassifier.smartselection.ar.model 127LOCAL_MODULE_CLASS := ETC 128LOCAL_MODULE_OWNER := google 129LOCAL_SRC_FILES := ./models/textclassifier.smartselection.ar.model 130LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 131include $(BUILD_PREBUILT) 132 133include $(CLEAR_VARS) 134LOCAL_MODULE := textclassifier.smartselection.de.model 135LOCAL_MODULE_CLASS := ETC 136LOCAL_MODULE_OWNER := google 137LOCAL_SRC_FILES := ./models/textclassifier.smartselection.de.model 138LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 139include $(BUILD_PREBUILT) 140 141include $(CLEAR_VARS) 142LOCAL_MODULE := textclassifier.smartselection.en.model 143LOCAL_MODULE_CLASS := ETC 144LOCAL_MODULE_OWNER := google 145LOCAL_SRC_FILES := ./models/textclassifier.smartselection.en.model 146LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 147include $(BUILD_PREBUILT) 148 149include $(CLEAR_VARS) 150LOCAL_MODULE := textclassifier.smartselection.es.model 151LOCAL_MODULE_CLASS := ETC 152LOCAL_MODULE_OWNER := google 153LOCAL_SRC_FILES := ./models/textclassifier.smartselection.es.model 154LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 155include $(BUILD_PREBUILT) 156 157include $(CLEAR_VARS) 158LOCAL_MODULE := textclassifier.smartselection.fr.model 159LOCAL_MODULE_CLASS := ETC 160LOCAL_MODULE_OWNER := google 161LOCAL_SRC_FILES := ./models/textclassifier.smartselection.fr.model 162LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 163include $(BUILD_PREBUILT) 164 165include $(CLEAR_VARS) 166LOCAL_MODULE := textclassifier.smartselection.it.model 167LOCAL_MODULE_CLASS := ETC 168LOCAL_MODULE_OWNER := google 169LOCAL_SRC_FILES := ./models/textclassifier.smartselection.it.model 170LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 171include $(BUILD_PREBUILT) 172 173include $(CLEAR_VARS) 174LOCAL_MODULE := textclassifier.smartselection.ja.model 175LOCAL_MODULE_CLASS := ETC 176LOCAL_MODULE_OWNER := google 177LOCAL_SRC_FILES := ./models/textclassifier.smartselection.ja.model 178LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 179include $(BUILD_PREBUILT) 180 181include $(CLEAR_VARS) 182LOCAL_MODULE := textclassifier.smartselection.ko.model 183LOCAL_MODULE_CLASS := ETC 184LOCAL_MODULE_OWNER := google 185LOCAL_SRC_FILES := ./models/textclassifier.smartselection.ko.model 186LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 187include $(BUILD_PREBUILT) 188 189include $(CLEAR_VARS) 190LOCAL_MODULE := textclassifier.smartselection.nl.model 191LOCAL_MODULE_CLASS := ETC 192LOCAL_MODULE_OWNER := google 193LOCAL_SRC_FILES := ./models/textclassifier.smartselection.nl.model 194LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 195include $(BUILD_PREBUILT) 196 197include $(CLEAR_VARS) 198LOCAL_MODULE := textclassifier.smartselection.pl.model 199LOCAL_MODULE_CLASS := ETC 200LOCAL_MODULE_OWNER := google 201LOCAL_SRC_FILES := ./models/textclassifier.smartselection.pl.model 202LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 203include $(BUILD_PREBUILT) 204 205include $(CLEAR_VARS) 206LOCAL_MODULE := textclassifier.smartselection.pt.model 207LOCAL_MODULE_CLASS := ETC 208LOCAL_MODULE_OWNER := google 209LOCAL_SRC_FILES := ./models/textclassifier.smartselection.pt.model 210LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 211include $(BUILD_PREBUILT) 212 213include $(CLEAR_VARS) 214LOCAL_MODULE := textclassifier.smartselection.ru.model 215LOCAL_MODULE_CLASS := ETC 216LOCAL_MODULE_OWNER := google 217LOCAL_SRC_FILES := ./models/textclassifier.smartselection.ru.model 218LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 219include $(BUILD_PREBUILT) 220 221include $(CLEAR_VARS) 222LOCAL_MODULE := textclassifier.smartselection.th.model 223LOCAL_MODULE_CLASS := ETC 224LOCAL_MODULE_OWNER := google 225LOCAL_SRC_FILES := ./models/textclassifier.smartselection.th.model 226LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 227include $(BUILD_PREBUILT) 228 229include $(CLEAR_VARS) 230LOCAL_MODULE := textclassifier.smartselection.tr.model 231LOCAL_MODULE_CLASS := ETC 232LOCAL_MODULE_OWNER := google 233LOCAL_SRC_FILES := ./models/textclassifier.smartselection.tr.model 234LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 235include $(BUILD_PREBUILT) 236 237include $(CLEAR_VARS) 238LOCAL_MODULE := textclassifier.smartselection.zh-Hant.model 239LOCAL_MODULE_CLASS := ETC 240LOCAL_MODULE_OWNER := google 241LOCAL_SRC_FILES := ./models/textclassifier.smartselection.zh-Hant.model 242LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 243include $(BUILD_PREBUILT) 244 245include $(CLEAR_VARS) 246LOCAL_MODULE := textclassifier.smartselection.zh.model 247LOCAL_MODULE_CLASS := ETC 248LOCAL_MODULE_OWNER := google 249LOCAL_SRC_FILES := ./models/textclassifier.smartselection.zh.model 250LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier 251include $(BUILD_PREBUILT) 252 253# ----------------------- 254# Smart Selection bundles 255# ----------------------- 256 257include $(CLEAR_VARS) 258LOCAL_MODULE := textclassifier.smartselection.bundle1 259LOCAL_REQUIRED_MODULES := textclassifier.smartselection.en.model 260LOCAL_REQUIRED_MODULES += textclassifier.smartselection.es.model 261LOCAL_REQUIRED_MODULES += textclassifier.smartselection.de.model 262LOCAL_REQUIRED_MODULES += textclassifier.smartselection.fr.model 263include $(BUILD_STATIC_LIBRARY) 264