futokb/native/jni/Android.mk

115 lines
3.6 KiB
Makefile
Raw Normal View History

2023-07-06 19:57:49 +01:00
# Copyright (C) 2011 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
LOCAL_PATH := $(call my-dir)
2023-11-07 14:48:48 +00:00
LOCAL_ARM_NEON := true
2023-07-06 19:57:49 +01:00
############ some local flags
# If you change any of those flags, you need to rebuild both libjni_latinime_common_static
# and the shared library that uses libjni_latinime_common_static.
2024-04-09 20:45:13 +01:00
FLAG_DBG ?= true
2023-07-06 19:57:49 +01:00
FLAG_DO_PROFILE ?= false
######################################
include $(CLEAR_VARS)
LATIN_IME_SRC_DIR := src
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
LOCAL_CFLAGS += -Wall -Wextra -Weffc++ -Wformat=2 -Wcast-qual -Wcast-align \
2023-07-06 19:57:49 +01:00
-Wwrite-strings -Wfloat-equal -Wpointer-arith -Winit-self -Wredundant-decls \
-Woverloaded-virtual -Wsign-promo -Wno-system-headers -Wno-deprecated-copy
# To suppress compiler warnings for unused variables/functions used for debug features etc.
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
# Needed to build with ggml
#LOCAL_CFLAGS += -Wno-cast-align -Wno-format-nonliteral -Wno-float-equal -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable
LOCAL_CFLAGS += -fexceptions -O3
# protobuf-lite isn't so lite
LOCAL_CFLAGS += -DHAVE_PTHREAD
#LOCAL_CFLAGS += -Wno-ignored-qualifiers -Wno-cast-qual
2023-07-06 19:57:49 +01:00
# HACK: -mstackrealign is required for x86 builds running on pre-KitKat devices to avoid crashes
# with SSE instructions.
ifeq ($(TARGET_ARCH), x86)
LOCAL_CFLAGS += -mstackrealign
endif # x86
include $(LOCAL_PATH)/NativeFileList.mk
LOCAL_SRC_FILES := \
$(LATIN_IME_JNI_SRC_FILES) \
$(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_CORE_SRC_FILES))
ifeq ($(FLAG_DO_PROFILE), true)
$(warning Making profiling version of native library)
LOCAL_CFLAGS += -DFLAG_DO_PROFILE -funwind-tables
else # FLAG_DO_PROFILE
ifeq ($(FLAG_DBG), true)
$(warning Making debug version of native library)
2024-04-09 20:45:13 +01:00
LOCAL_CFLAGS += -DFLAG_DBG #-funwind-tables -fno-inline
2023-07-06 19:57:49 +01:00
ifeq ($(FLAG_FULL_DBG), true)
$(warning Making full debug version of native library)
LOCAL_CFLAGS += -DFLAG_FULL_DBG
endif # FLAG_FULL_DBG
endif # FLAG_DBG
endif # FLAG_DO_PROFILE
LOCAL_MODULE := libjni_latinime_common_static
LOCAL_MODULE_TAGS := optional
LOCAL_CLANG := true
LOCAL_SDK_VERSION := 14
LOCAL_NDK_STL_VARIANT := c++_static
include $(BUILD_STATIC_LIBRARY)
######################################
include $(CLEAR_VARS)
# All code in LOCAL_WHOLE_STATIC_LIBRARIES will be built into this shared library.
LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_common_static
2024-03-31 00:11:01 +00:00
LOCAL_LDFLAGS += -llog
2023-07-06 19:57:49 +01:00
ifeq ($(FLAG_DO_PROFILE), true)
$(warning Making profiling version of native library)
else # FLAG_DO_PROFILE
ifeq ($(FLAG_DBG), true)
$(warning Making debug version of native library)
endif # FLAG_DBG
endif # FLAG_DO_PROFILE
LOCAL_MODULE := libjni_latinime
LOCAL_MODULE_TAGS := optional
LOCAL_CLANG := true
LOCAL_SDK_VERSION := 14
LOCAL_NDK_STL_VARIANT := c++_static
LOCAL_LDFLAGS += -ldl
include $(BUILD_SHARED_LIBRARY)
#################### Clean up the tmp vars
include $(LOCAL_PATH)/CleanupNativeFileList.mk
#################### Unit test on host environment
#include $(LOCAL_PATH)/HostUnitTests.mk
#################### Unit test on target environment
#include $(LOCAL_PATH)/TargetUnitTests.mk