blob: fd131754ca15157081083fbf59e7bbcb844c5f25 [file] [log] [blame]
Matt Sharifibda09f12017-03-10 12:29:15 +01001# 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
Alex Salcianu8914de92017-03-20 11:40:48 -040015# 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 \
Alex Salcianua43c7262017-03-21 10:41:18 -040031 -Wno-undefined-var-template \
32 -fvisibility=hidden
Alex Salcianu8914de92017-03-20 11:40:48 -040033
Matt Sharifibda09f12017-03-10 12:29:15 +010034# ------------------------
35# libtextclassifier_protos
36# ------------------------
37
Matt Sharifibda09f12017-03-10 12:29:15 +010038include $(CLEAR_VARS)
39
40LOCAL_MODULE := libtextclassifier_protos
41
Alex Salcianu8914de92017-03-20 11:40:48 -040042LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS)
43
Matt Sharifibda09f12017-03-10 12:29:15 +010044LOCAL_SRC_FILES := $(call all-proto-files-under, .)
45LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-lite
46
47include $(BUILD_STATIC_LIBRARY)
48
49# -----------------
50# libtextclassifier
51# -----------------
52
Matt Sharifid40f9762017-03-14 21:24:23 +010053include $(CLEAR_VARS)
54LOCAL_MODULE := libtextclassifier
55
56proto_sources_dir := $(generated_sources_dir)
57
58LOCAL_CPP_EXTENSION := .cc
Alex Salcianu8914de92017-03-20 11:40:48 -040059LOCAL_CFLAGS += $(MY_LIBTEXTCLASSIFIER_CFLAGS)
60LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS)
Matt Sharifid40f9762017-03-14 21:24:23 +010061
Dan Willemsene5954072017-03-29 21:54:57 -070062LOCAL_SRC_FILES := $(filter-out tests/%,$(call all-subdir-cpp-files))
Matt Sharifid40f9762017-03-14 21:24:23 +010063LOCAL_C_INCLUDES += $(proto_sources_dir)/proto/external/libtextclassifier
Matt Sharifibda09f12017-03-10 12:29:15 +010064
Alex Salcianu29fc69f2017-03-22 18:27:33 -040065LOCAL_STATIC_LIBRARIES += libtextclassifier_protos
Lukas Zilkad3bc59a2017-04-03 17:32:27 +020066LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-lite
Alex Salcianu29fc69f2017-03-22 18:27:33 -040067LOCAL_SHARED_LIBRARIES += liblog
Lukas Zilkad3bc59a2017-04-03 17:32:27 +020068LOCAL_SHARED_LIBRARIES += libicuuc libicui18n
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +000069LOCAL_REQUIRED_MODULES := textclassifier.langid.model
Abodunrinwa Toki72282c62017-03-15 19:30:31 +000070LOCAL_REQUIRED_MODULES += textclassifier.smartselection.en.model
Matt Sharifibda09f12017-03-10 12:29:15 +010071
Dan Willemsene5954072017-03-29 21:54:57 -070072LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/jni.lds
73LOCAL_LDFLAGS += -Wl,-version-script=$(LOCAL_PATH)/jni.lds
Alex Salcianu5fc7e542017-03-24 16:54:05 -040074
Matt Sharifibda09f12017-03-10 12:29:15 +010075include $(BUILD_SHARED_LIBRARY)
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +000076
Matt Sharifid40f9762017-03-14 21:24:23 +010077# -----------------------
78# libtextclassifier_tests
79# -----------------------
80
81include $(CLEAR_VARS)
82
83LOCAL_MODULE := libtextclassifier_tests
84LOCAL_MODULE_TAGS := tests
85
86LOCAL_CPP_EXTENSION := .cc
Alex Salcianu8914de92017-03-20 11:40:48 -040087LOCAL_CFLAGS += $(MY_LIBTEXTCLASSIFIER_CFLAGS)
88LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS)
Matt Sharifid40f9762017-03-14 21:24:23 +010089
90LOCAL_TEST_DATA := $(call find-test-data-in-subdirs, $(LOCAL_PATH), *, tests/testdata)
91
Matt Sharifibe876dc2017-03-17 17:02:43 +010092LOCAL_CPPFLAGS_32 += -DTEST_DATA_DIR="\"/data/nativetest/libtextclassifier_tests/tests/testdata/\""
93LOCAL_CPPFLAGS_64 += -DTEST_DATA_DIR="\"/data/nativetest64/libtextclassifier_tests/tests/testdata/\""
94
Dan Willemsene5954072017-03-29 21:54:57 -070095LOCAL_SRC_FILES := $(call all-subdir-cpp-files)
Matt Sharifid40f9762017-03-14 21:24:23 +010096LOCAL_C_INCLUDES += $(proto_sources_dir)/proto/external/libtextclassifier
97
Alex Salcianu29fc69f2017-03-22 18:27:33 -040098LOCAL_STATIC_LIBRARIES += libtextclassifier_protos libgmock
99LOCAL_SHARED_LIBRARIES += libprotobuf-cpp-lite
100LOCAL_SHARED_LIBRARIES += liblog
Lukas Zilkad3bc59a2017-04-03 17:32:27 +0200101LOCAL_SHARED_LIBRARIES += libicuuc libicui18n
Matt Sharifid40f9762017-03-14 21:24:23 +0100102
103include $(BUILD_NATIVE_TEST)
104
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +0000105# ------------
106# LangId model
107# ------------
108
109include $(CLEAR_VARS)
110LOCAL_MODULE := textclassifier.langid.model
111LOCAL_MODULE_CLASS := ETC
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +0000112LOCAL_MODULE_OWNER := google
113LOCAL_SRC_FILES := ./models/textclassifier.langid.model
114LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier
115include $(BUILD_PREBUILT)
116
117# ----------------------
118# Smart Selection models
119# ----------------------
120
121include $(CLEAR_VARS)
122LOCAL_MODULE := textclassifier.smartselection.en.model
123LOCAL_MODULE_CLASS := ETC
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +0000124LOCAL_MODULE_OWNER := google
125LOCAL_SRC_FILES := ./models/textclassifier.smartselection.en.model
126LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier
127include $(BUILD_PREBUILT)