[ion][escher] Move image inliner to ion

This commit is contained in:
Émilie Feral
2020-07-03 16:03:20 +02:00
committed by EmilieNumworks
parent ca56ba6327
commit f7479e0cf5
3 changed files with 32 additions and 31 deletions

View File

@@ -91,34 +91,3 @@ escher_src += $(addprefix escher/src/,\
tests_src += $(addprefix escher/test/,\
layout_field.cpp\
)
$(eval $(call rule_for, \
HOSTCC, \
escher/image/inliner, \
escher/image/inliner.c $(addprefix ion/src/external/lz4/, lz4.c lz4hc.c), \
$$(HOSTCC) -std=c99 `libpng-config --cflags` $$^ `libpng-config --ldflags` -o $$@, \
global \
))
INLINER := $(BUILD_DIR)/escher/image/inliner
.PRECIOUS: $(BUILD_DIR)/%.h $(BUILD_DIR)/%.cpp
$(eval $(call rule_for, \
INLINER, \
%.h %.cpp, \
%.png $$(INLINER), \
$$(INLINER) $$< $$(basename $$@).h $$(basename $$@).cpp, \
global \
))
# Mark a .cpp file as depending on a .png one
# This is called with $1 = code.cpp and $2 = image.png
# First, we mark code.o as requiring image.o. Rules will take care of inlining
# the PNG and building the inlined cpp file. Second, we add the directory
# corresponding to the one of code.cpp in the output dir as a header search
# path. Since $1 can be a list, we have to map with foreach.
define depends_on_image
$(call object_for,$(1)): $(call object_for,$(2))
$(call object_for,$(1)): SFLAGS += $(foreach d,$(sort $(dir $(call object_for,$(1)))),-I$(d))
escher_src += $(2)
endef

View File

@@ -11,6 +11,38 @@ ifndef ION_KEYBOARD_LAYOUT
endif
SFLAGS += -Iion/include/ion/keyboard/$(ION_KEYBOARD_LAYOUT)
# Image inliner
$(eval $(call rule_for, \
HOSTCC, \
ion/image/inliner, \
ion/image/inliner.c $(addprefix ion/src/external/lz4/, lz4.c lz4hc.c), \
$$(HOSTCC) -std=c99 `libpng-config --cflags` $$^ `libpng-config --ldflags` -o $$@, \
global \
))
INLINER := $(BUILD_DIR)/ion/image/inliner
.PRECIOUS: $(BUILD_DIR)/%.h $(BUILD_DIR)/%.cpp
$(eval $(call rule_for, \
INLINER, \
%.h %.cpp, \
%.png $$(INLINER), \
$$(INLINER) $$< $$(basename $$@).h $$(basename $$@).cpp, \
global \
))
# Mark a .cpp file as depending on a .png one
# This is called with $1 = code.cpp and $2 = image.png
# First, we mark code.o as requiring image.o. Rules will take care of inlining
# the PNG and building the inlined cpp file. Second, we add the directory
# corresponding to the one of code.cpp in the output dir as a header search
# path. Since $1 can be a list, we have to map with foreach.
define depends_on_image
$(call object_for,$(1)): $(call object_for,$(2))
$(call object_for,$(1)): SFLAGS += $(foreach d,$(sort $(dir $(call object_for,$(1)))),-I$(d))
ion_src += $(2)
endef
include ion/src/$(PLATFORM)/Makefile
-include ion/test/$(PLATFORM)/Makefile
include ion/src/shared/tools/Makefile