blob: 40de22e7c456f5f0801cd180d5981c08876b4350 [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 \
31 -Wno-undefined-var-template
32
Matt Sharifibda09f12017-03-10 12:29:15 +010033# ------------------------
34# libtextclassifier_protos
35# ------------------------
36
Matt Sharifibda09f12017-03-10 12:29:15 +010037include $(CLEAR_VARS)
38
39LOCAL_MODULE := libtextclassifier_protos
40
Alex Salcianu8914de92017-03-20 11:40:48 -040041LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS)
42
Matt Sharifibda09f12017-03-10 12:29:15 +010043LOCAL_SRC_FILES := $(call all-proto-files-under, .)
44LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-lite
45
46include $(BUILD_STATIC_LIBRARY)
47
48# -----------------
49# libtextclassifier
50# -----------------
51
Matt Sharifid40f9762017-03-14 21:24:23 +010052include $(CLEAR_VARS)
53LOCAL_MODULE := libtextclassifier
54
55proto_sources_dir := $(generated_sources_dir)
56
57LOCAL_CPP_EXTENSION := .cc
Alex Salcianu8914de92017-03-20 11:40:48 -040058LOCAL_CFLAGS += $(MY_LIBTEXTCLASSIFIER_CFLAGS)
59LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS)
Matt Sharifid40f9762017-03-14 21:24:23 +010060
Matt Sharifibda09f12017-03-10 12:29:15 +010061LOCAL_SRC_FILES := $(patsubst ./%,%, $(shell cd $(LOCAL_PATH); \
Matt Sharifid40f9762017-03-14 21:24:23 +010062 find . -name "*.cc" -and -not -name ".*" -and -not -path "./tests/*"))
Matt Sharifibda09f12017-03-10 12:29:15 +010063LOCAL_C_INCLUDES += .
Matt Sharifid40f9762017-03-14 21:24:23 +010064LOCAL_C_INCLUDES += $(proto_sources_dir)/proto/external/libtextclassifier
Matt Sharifibda09f12017-03-10 12:29:15 +010065
66LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-lite
67LOCAL_STATIC_LIBRARIES := libtextclassifier_protos
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +000068LOCAL_REQUIRED_MODULES := textclassifier.langid.model
Abodunrinwa Toki72282c62017-03-15 19:30:31 +000069LOCAL_REQUIRED_MODULES += textclassifier.smartselection.en.model
Matt Sharifibda09f12017-03-10 12:29:15 +010070
71include $(BUILD_SHARED_LIBRARY)
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +000072
Matt Sharifid40f9762017-03-14 21:24:23 +010073# -----------------------
74# libtextclassifier_tests
75# -----------------------
76
77include $(CLEAR_VARS)
78
79LOCAL_MODULE := libtextclassifier_tests
80LOCAL_MODULE_TAGS := tests
81
82LOCAL_CPP_EXTENSION := .cc
Alex Salcianu8914de92017-03-20 11:40:48 -040083LOCAL_CFLAGS += $(MY_LIBTEXTCLASSIFIER_CFLAGS)
84LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS)
Matt Sharifid40f9762017-03-14 21:24:23 +010085
86LOCAL_TEST_DATA := $(call find-test-data-in-subdirs, $(LOCAL_PATH), *, tests/testdata)
87
Matt Sharifibe876dc2017-03-17 17:02:43 +010088LOCAL_CPPFLAGS_32 += -DTEST_DATA_DIR="\"/data/nativetest/libtextclassifier_tests/tests/testdata/\""
89LOCAL_CPPFLAGS_64 += -DTEST_DATA_DIR="\"/data/nativetest64/libtextclassifier_tests/tests/testdata/\""
90
Matt Sharifid40f9762017-03-14 21:24:23 +010091LOCAL_SRC_FILES := $(patsubst ./%,%, $(shell cd $(LOCAL_PATH); \
92 find . -name "*.cc" -and -not -name ".*"))
93LOCAL_C_INCLUDES += .
94LOCAL_C_INCLUDES += $(proto_sources_dir)/proto/external/libtextclassifier
95
96LOCAL_STATIC_LIBRARIES := libtextclassifier_protos libgmock
97LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-lite
98
99include $(BUILD_NATIVE_TEST)
100
Abodunrinwa Toki61f99dd2017-03-14 18:16:15 +0000101# ------------
102# LangId model
103# ------------
104
105include $(CLEAR_VARS)
106LOCAL_MODULE := textclassifier.langid.model
107LOCAL_MODULE_CLASS := ETC
108LOCAL_MODULE_TAGS := optional
109LOCAL_MODULE_OWNER := google
110LOCAL_SRC_FILES := ./models/textclassifier.langid.model
111LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier
112include $(BUILD_PREBUILT)
113
114# ----------------------
115# Smart Selection models
116# ----------------------
117
118include $(CLEAR_VARS)
119LOCAL_MODULE := textclassifier.smartselection.en.model
120LOCAL_MODULE_CLASS := ETC
121LOCAL_MODULE_TAGS := optional
122LOCAL_MODULE_OWNER := google
123LOCAL_SRC_FILES := ./models/textclassifier.smartselection.en.model
124LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier
125include $(BUILD_PREBUILT)
126