Merge "Add support for RS in C++."

This commit is contained in:
Tim Murray 2012-11-01 15:32:19 -07:00 committed by Android (Google) Code Review
commit bad8550ccc
2 changed files with 78 additions and 1 deletions

View file

@ -266,6 +266,63 @@ else
debug_cflags :=
endif
####################################################
## Compile RenderScript with reflected C++
####################################################
renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
ifneq (,$(renderscript_sources))
renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
renderscript_intermediate := $(intermediates)/renderscript
ifeq ($(LOCAL_RENDERSCRIPT_CC),)
LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
endif
# Turn on all warnings and warnings as errors for RS compiles.
# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
renderscript_flags := -Wall -Werror
renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
LOCAL_RENDERSCRIPT_INCLUDES := \
$(TOPDIR)external/clang/lib/Headers \
$(TOPDIR)frameworks/rs/scriptc \
$(LOCAL_RENDERSCRIPT_INCLUDES)
ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
endif
$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
$(transform-renderscripts-to-cpp-and-bc)
# include the dependency files (.d) generated by llvm-rs-cc.
renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate)/, \
$(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
-include $(renderscript_generated_dep_files)
LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
rs_generated_cpps := $(addprefix \
$(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \
$(notdir $(renderscript_sources)))))
$(rs_generated_cpps) : $(RenderScript_file_stamp)
LOCAL_C_INCLUDES += $(renderscript_intermediate)
LOCAL_GENERATED_SOURCES += $(rs_generated_cpps)
endif
###########################################################
## Stuff source generated from one-off tools
###########################################################

View file

@ -796,7 +796,7 @@ rm -f $(@:$1=$(YACC_HEADER_SUFFIX))
endef
###########################################################
## Commands to compile RenderScript
## Commands to compile RenderScript to Java
###########################################################
define transform-renderscripts-to-java-and-bc
@ -819,6 +819,26 @@ $(hide) mkdir -p $(dir $@)
$(hide) touch $@
endef
###########################################################
## Commands to compile RenderScript to C++
###########################################################
define transform-renderscripts-to-cpp-and-bc
@echo "RenderScript: $(PRIVATE_MODULE) <= $(PRIVATE_RS_SOURCE_FILES)"
$(hide) rm -rf $(PRIVATE_RS_OUTPUT_DIR)
$(hide) mkdir -p $(PRIVATE_RS_OUTPUT_DIR)/
$(hide) $(PRIVATE_RS_CC) \
-o $(PRIVATE_RS_OUTPUT_DIR)/ \
-d $(PRIVATE_RS_OUTPUT_DIR) \
-a $@ -MD \
-reflect-c++ \
$(PRIVATE_RS_FLAGS) \
$(foreach inc,$(PRIVATE_RS_INCLUDES),$(addprefix -I , $(inc))) \
$(PRIVATE_RS_SOURCE_FILES)
$(hide) mkdir -p $(dir $@)
$(hide) touch $@
endef
###########################################################
## Commands for running aidl