blob: 365978ee857b7bfeee9a410062b5aa6122efe0dd [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
67LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-lite
68LOCAL_STATIC_LIBRARIES := libtextclassifier_protos
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
72include $(BUILD_SHARED_LIBRARY)
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +000073
Matt Sharifid40f9762017-03-14 21:24:23 +010074# -----------------------
75# libtextclassifier_tests
76# -----------------------
77
78include $(CLEAR_VARS)
79
80LOCAL_MODULE := libtextclassifier_tests
81LOCAL_MODULE_TAGS := tests
82
83LOCAL_CPP_EXTENSION := .cc
Alex Salcianu8914de92017-03-20 11:40:48 -040084LOCAL_CFLAGS += $(MY_LIBTEXTCLASSIFIER_CFLAGS)
85LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS)
Matt Sharifid40f9762017-03-14 21:24:23 +010086
87LOCAL_TEST_DATA := $(call find-test-data-in-subdirs, $(LOCAL_PATH), *, tests/testdata)
88
Matt Sharifibe876dc2017-03-17 17:02:43 +010089LOCAL_CPPFLAGS_32 += -DTEST_DATA_DIR="\"/data/nativetest/libtextclassifier_tests/tests/testdata/\""
90LOCAL_CPPFLAGS_64 += -DTEST_DATA_DIR="\"/data/nativetest64/libtextclassifier_tests/tests/testdata/\""
91
Matt Sharifid40f9762017-03-14 21:24:23 +010092LOCAL_SRC_FILES := $(patsubst ./%,%, $(shell cd $(LOCAL_PATH); \
93 find . -name "*.cc" -and -not -name ".*"))
94LOCAL_C_INCLUDES += .
95LOCAL_C_INCLUDES += $(proto_sources_dir)/proto/external/libtextclassifier
96
97LOCAL_STATIC_LIBRARIES := libtextclassifier_protos libgmock
98LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-lite
99
100include $(BUILD_NATIVE_TEST)
101
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +0000102# ------------
103# LangId model
104# ------------
105
106include $(CLEAR_VARS)
107LOCAL_MODULE := textclassifier.langid.model
108LOCAL_MODULE_CLASS := ETC
109LOCAL_MODULE_TAGS := optional
110LOCAL_MODULE_OWNER := google
111LOCAL_SRC_FILES := ./models/textclassifier.langid.model
112LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier
113include $(BUILD_PREBUILT)
114
115# ----------------------
116# Smart Selection models
117# ----------------------
118
119include $(CLEAR_VARS)
120LOCAL_MODULE := textclassifier.smartselection.en.model
121LOCAL_MODULE_CLASS := ETC
122LOCAL_MODULE_TAGS := optional
123LOCAL_MODULE_OWNER := google
124LOCAL_SRC_FILES := ./models/textclassifier.smartselection.en.model
125LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier
126include $(BUILD_PREBUILT)
127