diff options
-rw-r--r-- | android/build/binary.make | 5 | ||||
-rw-r--r-- | android/build/clear_vars.make | 1 | ||||
-rw-r--r-- | android/build/definitions.make | 20 |
3 files changed, 26 insertions, 0 deletions
diff --git a/android/build/binary.make b/android/build/binary.make index 5052dc1..e22a96d 100644 --- a/android/build/binary.make +++ b/android/build/binary.make @@ -21,12 +21,17 @@ LOCAL_OBJS_DIR := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE)) LOCAL_OBJECTS := LOCAL_CC ?= $(CC) LOCAL_C_SOURCES := $(filter %.c,$(LOCAL_SRC_FILES) $(LOCAL_GENERATED_SOURCES)) +LOCAL_CXX_SOURCES := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES) $(LOCAL_GENERATED_SOURCES)) LOCAL_OBJC_SOURCES := $(filter %.m,$(LOCAL_SRC_FILES) $(LOCAL_GENERATED_SOURCES)) $(foreach src,$(LOCAL_C_SOURCES), \ $(eval $(call compile-c-source,$(src))) \ ) +$(foreach src,$(LOCAL_CXX_SOURCES), \ + $(eval $(call compile-cxx-source,$(src))) \ +) + $(foreach src,$(LOCAL_OBJC_SOURCES), \ $(eval $(call compile-objc-source,$(src))) \ ) diff --git a/android/build/clear_vars.make b/android/build/clear_vars.make index a9289b0..f84ecb4 100644 --- a/android/build/clear_vars.make +++ b/android/build/clear_vars.make @@ -28,3 +28,4 @@ LOCAL_STATIC_LIBRARIES := LOCAL_BUILT_MODULE := LOCAL_PREBUILT_OBJ_FILES := +LOCAL_CPP_EXTENSION := .cpp diff --git a/android/build/definitions.make b/android/build/definitions.make index 54d1a8a..e190cdd 100644 --- a/android/build/definitions.make +++ b/android/build/definitions.make @@ -68,6 +68,26 @@ $$(OBJ): $$(SRC_PATH)/$$(SRC) $(hide) $$(BUILD_SYSTEM)/mkdeps.sh $$(PRIVATE_OBJ) $$(PRIVATE_OBJ).d.tmp $$(PRIVATE_OBJ).d endef +# Compile a C++ source file +# +define compile-cxx-source +SRC:=$(1) +OBJ:=$$(LOCAL_OBJS_DIR)/$$(SRC:%$(LOCAL_CPP_EXTENSION)=%.o) +LOCAL_OBJECTS += $$(OBJ) +DEPENDENCY_DIRS += $$(dir $$(OBJ)) +$$(OBJ): PRIVATE_CFLAGS := $$(CFLAGS) $$(LOCAL_CFLAGS) -I$$(LOCAL_PATH) -I$$(OBJS_DIR) +$$(OBJ): PRIVATE_CXX := $$(LOCAL_CC) +$$(OBJ): PRIVATE_OBJ := $$(OBJ) +$$(OBJ): PRIVATE_MODULE := $$(LOCAL_MODULE) +$$(OBJ): PRIVATE_SRC := $$(SRC_PATH)/$$(SRC) +$$(OBJ): PRIVATE_SRC0 := $$(SRC) +$$(OBJ): $$(SRC_PATH)/$$(SRC) + @mkdir -p $$(dir $$(PRIVATE_OBJ)) + @echo "Compile: $$(PRIVATE_MODULE) <= $$(PRIVATE_SRC0)" + $(hide) $$(PRIVATE_CXX) $$(PRIVATE_CFLAGS) -c -o $$(PRIVATE_OBJ) -MMD -MP -MF $$(PRIVATE_OBJ).d.tmp $$(PRIVATE_SRC) + $(hide) $$(BUILD_SYSTEM)/mkdeps.sh $$(PRIVATE_OBJ) $$(PRIVATE_OBJ).d.tmp $$(PRIVATE_OBJ).d +endef + # Compile an Objective-C source file # define compile-objc-source |