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