mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[ion] Conditionaly use EPSILON_SIMULATOR_HAS_LIBPNG
Avoid it on Emscripten where it's not available
This commit is contained in:
@@ -8,4 +8,13 @@ TARGET ?= $(HOST)
|
||||
|
||||
BUILD_DIR := $(BUILD_DIR)/$(TARGET)
|
||||
|
||||
EPSILON_SIMULATOR_HAS_LIBPNG ?= 1
|
||||
|
||||
include build/platform.simulator.$(TARGET).mak
|
||||
|
||||
SFLAGS += -DEPSILON_SIMULATOR_HAS_LIBPNG=$(EPSILON_SIMULATOR_HAS_LIBPNG)
|
||||
|
||||
ifeq ($(EPSILON_SIMULATOR_HAS_LIBPNG),1)
|
||||
SFLAGS += `libpng-config --cflags`
|
||||
LDFLAGS += `libpng-config --ldflags`
|
||||
endif
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
TOOLCHAIN = emscripten
|
||||
EXE = js
|
||||
EPSILON_SIMULATOR_HAS_LIBPNG = 0
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
# Headless targets
|
||||
epsilon_headless_src = $(base_src) $(ion_headless_src) $(apps_default_src)
|
||||
$(BUILD_DIR)/epsilon.headless.$(EXE): $(call object_for,$(epsilon_headless_src))
|
||||
$(BUILD_DIR)/epsilon.headless.$(EXE): LDFLAGS += `libpng-config --ldflags`
|
||||
|
||||
test_runner_headless_src = $(test_base_src) $(ion_headless_src)
|
||||
$(BUILD_DIR)/test.headless.$(EXE): $(call object_for,$(test_runner_headless_src))
|
||||
$(BUILD_DIR)/test.headless.$(EXE): LDFLAGS += `libpng-config --ldflags`
|
||||
|
||||
HANDY_TARGETS += epsilon.headless test.headless
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ ion_simulator_headless_src += $(addprefix ion/src/simulator/shared/, \
|
||||
main_headless.cpp \
|
||||
)
|
||||
|
||||
$(call object_for,ion/src/simulator/shared/framebuffer_png.cpp): SFLAGS += `libpng-config --cflags`
|
||||
|
||||
ion_console_stdio_src = ion/src/simulator/shared/console_stdio.cpp
|
||||
|
||||
include ion/src/simulator/$(TARGET)/Makefile
|
||||
|
||||
@@ -27,6 +27,7 @@ Event getPlatformEvent() {
|
||||
}
|
||||
event = Ion::Events::Event(c);
|
||||
}
|
||||
#if EPSILON_SIMULATOR_HAS_LIBPNG
|
||||
if (sEventCount++ > sLogAfterNumberOfEvents && sLogAfterNumberOfEvents >= 0) {
|
||||
char filename[32];
|
||||
sprintf(filename, "event%d.png", sEventCount);
|
||||
@@ -35,6 +36,7 @@ Event getPlatformEvent() {
|
||||
printf("Event %d is %s\n", sEventCount, event.name());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#if EPSILON_SIMULATOR_HAS_LIBPNG
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include <ion/display.h>
|
||||
#include <stdlib.h>
|
||||
@@ -51,3 +53,5 @@ void Ion::Simulator::Framebuffer::writeToFile(const char * filename) {
|
||||
png_destroy_write_struct(&png, (png_infopp)NULL);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user