Matt Sharifi | bda09f1 | 2017-03-10 12:29:15 +0100 | [diff] [blame] | 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 | |
Alex Salcianu | 8914de9 | 2017-03-20 11:40:48 -0400 | [diff] [blame] | 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 | |
| 23 | LOCAL_PATH := $(call my-dir) |
| 24 | |
| 25 | # Custom C/C++ compilation flags: |
| 26 | MY_LIBTEXTCLASSIFIER_CFLAGS := \ |
| 27 | -Wno-unused-parameter \ |
| 28 | -Wno-sign-compare \ |
| 29 | -Wno-missing-field-initializers \ |
| 30 | -Wno-ignored-qualifiers \ |
Alex Salcianu | a43c726 | 2017-03-21 10:41:18 -0400 | [diff] [blame^] | 31 | -Wno-undefined-var-template \ |
| 32 | -fvisibility=hidden |
Alex Salcianu | 8914de9 | 2017-03-20 11:40:48 -0400 | [diff] [blame] | 33 | |
Matt Sharifi | bda09f1 | 2017-03-10 12:29:15 +0100 | [diff] [blame] | 34 | # ------------------------ |
| 35 | # libtextclassifier_protos |
| 36 | # ------------------------ |
| 37 | |
Matt Sharifi | bda09f1 | 2017-03-10 12:29:15 +0100 | [diff] [blame] | 38 | include $(CLEAR_VARS) |
| 39 | |
| 40 | LOCAL_MODULE := libtextclassifier_protos |
| 41 | |
Alex Salcianu | 8914de9 | 2017-03-20 11:40:48 -0400 | [diff] [blame] | 42 | LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS) |
| 43 | |
Matt Sharifi | bda09f1 | 2017-03-10 12:29:15 +0100 | [diff] [blame] | 44 | LOCAL_SRC_FILES := $(call all-proto-files-under, .) |
| 45 | LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-lite |
| 46 | |
| 47 | include $(BUILD_STATIC_LIBRARY) |
| 48 | |
| 49 | # ----------------- |
| 50 | # libtextclassifier |
| 51 | # ----------------- |
| 52 | |
Matt Sharifi | d40f976 | 2017-03-14 21:24:23 +0100 | [diff] [blame] | 53 | include $(CLEAR_VARS) |
| 54 | LOCAL_MODULE := libtextclassifier |
| 55 | |
| 56 | proto_sources_dir := $(generated_sources_dir) |
| 57 | |
| 58 | LOCAL_CPP_EXTENSION := .cc |
Alex Salcianu | 8914de9 | 2017-03-20 11:40:48 -0400 | [diff] [blame] | 59 | LOCAL_CFLAGS += $(MY_LIBTEXTCLASSIFIER_CFLAGS) |
| 60 | LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS) |
Matt Sharifi | d40f976 | 2017-03-14 21:24:23 +0100 | [diff] [blame] | 61 | |
Matt Sharifi | bda09f1 | 2017-03-10 12:29:15 +0100 | [diff] [blame] | 62 | LOCAL_SRC_FILES := $(patsubst ./%,%, $(shell cd $(LOCAL_PATH); \ |
Matt Sharifi | d40f976 | 2017-03-14 21:24:23 +0100 | [diff] [blame] | 63 | find . -name "*.cc" -and -not -name ".*" -and -not -path "./tests/*")) |
Matt Sharifi | bda09f1 | 2017-03-10 12:29:15 +0100 | [diff] [blame] | 64 | LOCAL_C_INCLUDES += . |
Matt Sharifi | d40f976 | 2017-03-14 21:24:23 +0100 | [diff] [blame] | 65 | LOCAL_C_INCLUDES += $(proto_sources_dir)/proto/external/libtextclassifier |
Matt Sharifi | bda09f1 | 2017-03-10 12:29:15 +0100 | [diff] [blame] | 66 | |
| 67 | LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-lite |
| 68 | LOCAL_STATIC_LIBRARIES := libtextclassifier_protos |
Abodunrinwa Toki | 61f99dd | 2017-03-14 18:16:15 +0000 | [diff] [blame] | 69 | LOCAL_REQUIRED_MODULES := textclassifier.langid.model |
Abodunrinwa Toki | 72282c6 | 2017-03-15 19:30:31 +0000 | [diff] [blame] | 70 | LOCAL_REQUIRED_MODULES += textclassifier.smartselection.en.model |
Matt Sharifi | bda09f1 | 2017-03-10 12:29:15 +0100 | [diff] [blame] | 71 | |
| 72 | include $(BUILD_SHARED_LIBRARY) |
Abodunrinwa Toki | 61f99dd | 2017-03-14 18:16:15 +0000 | [diff] [blame] | 73 | |
Matt Sharifi | d40f976 | 2017-03-14 21:24:23 +0100 | [diff] [blame] | 74 | # ----------------------- |
| 75 | # libtextclassifier_tests |
| 76 | # ----------------------- |
| 77 | |
| 78 | include $(CLEAR_VARS) |
| 79 | |
| 80 | LOCAL_MODULE := libtextclassifier_tests |
| 81 | LOCAL_MODULE_TAGS := tests |
| 82 | |
| 83 | LOCAL_CPP_EXTENSION := .cc |
Alex Salcianu | 8914de9 | 2017-03-20 11:40:48 -0400 | [diff] [blame] | 84 | LOCAL_CFLAGS += $(MY_LIBTEXTCLASSIFIER_CFLAGS) |
| 85 | LOCAL_STRIP_MODULE := $(LIBTEXTCLASSIFIER_STRIP_OPTS) |
Matt Sharifi | d40f976 | 2017-03-14 21:24:23 +0100 | [diff] [blame] | 86 | |
| 87 | LOCAL_TEST_DATA := $(call find-test-data-in-subdirs, $(LOCAL_PATH), *, tests/testdata) |
| 88 | |
Matt Sharifi | be876dc | 2017-03-17 17:02:43 +0100 | [diff] [blame] | 89 | LOCAL_CPPFLAGS_32 += -DTEST_DATA_DIR="\"/data/nativetest/libtextclassifier_tests/tests/testdata/\"" |
| 90 | LOCAL_CPPFLAGS_64 += -DTEST_DATA_DIR="\"/data/nativetest64/libtextclassifier_tests/tests/testdata/\"" |
| 91 | |
Matt Sharifi | d40f976 | 2017-03-14 21:24:23 +0100 | [diff] [blame] | 92 | LOCAL_SRC_FILES := $(patsubst ./%,%, $(shell cd $(LOCAL_PATH); \ |
| 93 | find . -name "*.cc" -and -not -name ".*")) |
| 94 | LOCAL_C_INCLUDES += . |
| 95 | LOCAL_C_INCLUDES += $(proto_sources_dir)/proto/external/libtextclassifier |
| 96 | |
| 97 | LOCAL_STATIC_LIBRARIES := libtextclassifier_protos libgmock |
| 98 | LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-lite |
| 99 | |
| 100 | include $(BUILD_NATIVE_TEST) |
| 101 | |
Abodunrinwa Toki | 61f99dd | 2017-03-14 18:16:15 +0000 | [diff] [blame] | 102 | # ------------ |
| 103 | # LangId model |
| 104 | # ------------ |
| 105 | |
| 106 | include $(CLEAR_VARS) |
| 107 | LOCAL_MODULE := textclassifier.langid.model |
| 108 | LOCAL_MODULE_CLASS := ETC |
| 109 | LOCAL_MODULE_TAGS := optional |
| 110 | LOCAL_MODULE_OWNER := google |
| 111 | LOCAL_SRC_FILES := ./models/textclassifier.langid.model |
| 112 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier |
| 113 | include $(BUILD_PREBUILT) |
| 114 | |
| 115 | # ---------------------- |
| 116 | # Smart Selection models |
| 117 | # ---------------------- |
| 118 | |
| 119 | include $(CLEAR_VARS) |
| 120 | LOCAL_MODULE := textclassifier.smartselection.en.model |
| 121 | LOCAL_MODULE_CLASS := ETC |
| 122 | LOCAL_MODULE_TAGS := optional |
| 123 | LOCAL_MODULE_OWNER := google |
| 124 | LOCAL_SRC_FILES := ./models/textclassifier.smartselection.en.model |
| 125 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/textclassifier |
| 126 | include $(BUILD_PREBUILT) |
| 127 | |