blob: 3fad5f23e93cf2028050b1d061d98305ba8ff247 [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
Matt Sharifibda09f12017-03-10 12:29:15 +010062LOCAL_SRC_FILES := $(patsubst ./%,%, $(shell cd $(LOCAL_PATH); \
Matt Sharifid40f9762017-03-14 21:24:23 +010063 find . -name "*.cc" -and -not -name ".*" -and -not -path "./tests/*"))
Matt Sharifibda09f12017-03-10 12:29:15 +010064LOCAL_C_INCLUDES += .
Matt Sharifid40f9762017-03-14 21:24:23 +010065LOCAL_C_INCLUDES += $(proto_sources_dir)/proto/external/libtextclassifier
Matt Sharifibda09f12017-03-10 12:29:15 +010066
Alex Salcianu29fc69f2017-03-22 18:27:33 -040067LOCAL_STATIC_LIBRARIES += libtextclassifier_protos
68LOCAL_SHARED_LIBRARIES += libprotobuf-cpp-lite
69LOCAL_SHARED_LIBRARIES += liblog
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +000070LOCAL_REQUIRED_MODULES := textclassifier.langid.model
Abodunrinwa Toki72282c62017-03-15 19:30:31 +000071LOCAL_REQUIRED_MODULES += textclassifier.smartselection.en.model
Matt Sharifibda09f12017-03-10 12:29:15 +010072
73include $(BUILD_SHARED_LIBRARY)
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +000074
Matt Sharifid40f9762017-03-14 21:24:23 +010075# -----------------------
76# libtextclassifier_tests
77# -----------------------
78
79include $(CLEAR_VARS)
80
81LOCAL_MODULE := libtextclassifier_tests
82LOCAL_MODULE_TAGS := tests
83
84LOCAL_CPP_EXTENSION := .cc
Alex Salcianu8914de92017-03-20 11:40:48 -040085LOCAL_CFLAGS += $(MY_LIBTEXTCLASSIFIER_CFLAGS)
86LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS)
Matt Sharifid40f9762017-03-14 21:24:23 +010087
88LOCAL_TEST_DATA := $(call find-test-data-in-subdirs, $(LOCAL_PATH), *, tests/testdata)
89
Matt Sharifibe876dc2017-03-17 17:02:43 +010090LOCAL_CPPFLAGS_32 += -DTEST_DATA_DIR="\"/data/nativetest/libtextclassifier_tests/tests/testdata/\""
91LOCAL_CPPFLAGS_64 += -DTEST_DATA_DIR="\"/data/nativetest64/libtextclassifier_tests/tests/testdata/\""
92
Matt Sharifid40f9762017-03-14 21:24:23 +010093LOCAL_SRC_FILES := $(patsubst ./%,%, $(shell cd $(LOCAL_PATH); \
94 find . -name "*.cc" -and -not -name ".*"))
95LOCAL_C_INCLUDES += .
96LOCAL_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
Matt Sharifid40f9762017-03-14 21:24:23 +0100101
102include $(BUILD_NATIVE_TEST)
103
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +0000104# ------------
105# LangId model
106# ------------
107
108include $(CLEAR_VARS)
109LOCAL_MODULE := textclassifier.langid.model
110LOCAL_MODULE_CLASS := ETC
111LOCAL_MODULE_TAGS := optional
112LOCAL_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
124LOCAL_MODULE_TAGS := optional
125LOCAL_MODULE_OWNER := google
126LOCAL_SRC_FILES := ./models/textclassifier.smartselection.en.model
127LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier
128include $(BUILD_PREBUILT)