Compare commits
2 commits
1ff46c3975
...
cb30231c2f
Author | SHA1 | Date | |
---|---|---|---|
John Alanbrook | cb30231c2f | ||
John Alanbrook | eaa3bf00c5 |
38
Makefile
38
Makefile
|
@ -1,4 +1,5 @@
|
|||
MAKEFLAGS = --jobs=8
|
||||
PROCS != nproc --all
|
||||
MAKEFLAGS = -j $(PROCS)
|
||||
UNAME != uname
|
||||
MAKEDIR != pwd
|
||||
# Options
|
||||
|
@ -72,7 +73,7 @@ else
|
|||
CPPFLAGS += -O2
|
||||
endif
|
||||
|
||||
CPPFLAGS += -DHAVE_CEIL -DCP_USE_CGTYPES=0 -DCP_USE_DOUBLES=0 -DHAVE_FLOOR -DHAVE_FMOD -DHAVE_LRINT -DHAVE_LRINTF $(includeflag) -MD $(WARNING_FLAGS) -I. -DVER=\"$(SEM)\" -DCOM=\"$(COM)\" -DINFO=\"$(INFO)\" #-DENABLE_SINC_MEDIUM_CONVERTER -DENABLE_SINC_FAST_CONVERTER -DCP_COLLISION_TYPE_TYPE=uintptr_t -DCP_BITMASK_TYPE=uintptr_t
|
||||
CPPFLAGS += -DHAVE_CEIL -DCP_USE_CGTYPES=0 -DCP_USE_DOUBLES=0 -DHAVE_FLOOR -DHAVE_FMOD -DHAVE_LRINT -DHAVE_LRINTF $(includeflag) $(WARNING_FLAGS) -I. -DVER=\"$(SEM)\" -DCOM=\"$(COM)\" -DINFO=\"$(INFO)\" #-DENABLE_SINC_MEDIUM_CONVERTER -DENABLE_SINC_FAST_CONVERTER -DCP_COLLISION_TYPE_TYPE=uintptr_t -DCP_BITMASK_TYPE=uintptr_t
|
||||
CPPFLAGS += -DCONFIG_VERSION=\"2024-02-14\" -DCONFIG_BIGNUM #for quickjs
|
||||
|
||||
# ENABLE_SINC_[BEST|FAST|MEDIUM]_CONVERTER
|
||||
|
@ -170,20 +171,39 @@ LDPATHS := $(STEAM)/redistributable_bin/$(PLATFORM)
|
|||
LDPATHS := $(addprefix -L, $(LDPATHS))
|
||||
|
||||
DEPENDS = $(OBJS:.o=.d)
|
||||
-include $(DEPENDS)
|
||||
|
||||
ifndef VERBOSE
|
||||
.SILENT:
|
||||
endif
|
||||
|
||||
DEPFLAGS = -MT $(@:.d=.o) -MM -MG $< -o $@
|
||||
|
||||
%$(INFO).d: %.c
|
||||
@echo Making deps $@
|
||||
$(CROSS)$(CC) $(CPPFLAGS) $(DEPFLAGS)
|
||||
|
||||
%$(INFO).d: %.cpp
|
||||
@echo Making deps $@
|
||||
$(CROSS)$(CXX) $(CPPFLAGS) $(DEPFLAGS)
|
||||
|
||||
%$(INFO).d: %.m
|
||||
@echo Making deps $@
|
||||
$(CROSS)$(CC) $(CPPFLAGS) $(DEPFLAGS)
|
||||
|
||||
ifneq ($(MAKECMDGOALS), clean)
|
||||
include $(DEPENDS)
|
||||
endif
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
all: $(NAME)
|
||||
cp -f $(NAME) $(APP)$(EXT)
|
||||
|
||||
prereqs: source/engine/core.cdb.h
|
||||
|
||||
$(NAME): $(OBJS) $(DEPS)
|
||||
@echo Linking $(NAME)
|
||||
$(CROSS)$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@
|
||||
@echo Finished build
|
||||
|
||||
%$(INFO).o: %.c prereqs
|
||||
%$(INFO).o: %.c
|
||||
@echo Making C object $@
|
||||
$(CROSS)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
|
@ -195,9 +215,7 @@ $(NAME): $(OBJS) $(DEPS)
|
|||
@echo Making Objective-C object $@
|
||||
$(CROSS)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
SCRIPTS := $(shell ls scripts/*.js*)
|
||||
CORE != (ls icons/* fonts/*)
|
||||
CORE := $(CORE) $(SCRIPTS)
|
||||
CORE != (ls icons/* fonts/* shaders/*.cg scripts/*.js*)
|
||||
|
||||
packer: tools/packer.c source/engine/miniz.c
|
||||
@echo Making packer
|
||||
|
@ -207,7 +225,7 @@ core.cdb: packer $(CORE)
|
|||
@echo Packing core.cdb
|
||||
./packer $@ $(CORE)
|
||||
|
||||
source/engine/core.cdb.h: core.cdb
|
||||
core.cdb.h: core.cdb
|
||||
@echo Making $@
|
||||
xxd -i $< > $@
|
||||
|
||||
|
|
|
@ -1556,8 +1556,9 @@ Math.sortpointsccw = function(points)
|
|||
var yaml = {};
|
||||
yaml.tojson = function(yaml)
|
||||
{
|
||||
// Replace key value pairs that are strings with quotation marks around them
|
||||
yaml = yaml.replace(/(\w+):/g, '"$1":');
|
||||
yaml = yaml.replace(/: ([\w\.]+)/g, ': "$1"');
|
||||
yaml = yaml.replace(/: ([\w\.\/]+)/g, ': "$1"'); // TODO: make this more general
|
||||
|
||||
yaml = yaml.split("\n");
|
||||
var cont = {};
|
||||
|
|
|
@ -115,7 +115,12 @@ render.make_shader = function(shader)
|
|||
{
|
||||
var file = shader;
|
||||
shader = io.slurp(shader);
|
||||
var writejson = `${file.name()}_c.json`;
|
||||
console.info(shader);
|
||||
if (!shader) {
|
||||
console.info(`not found! slurping shaders/${file}`);
|
||||
shader = io.slurp(`shaders/${file}`);
|
||||
}
|
||||
var writejson = `.prosperon/${file.name()}.shader.json`;
|
||||
var st = profile.now();
|
||||
|
||||
breakme: if (io.exists(writejson)) {
|
||||
|
@ -133,7 +138,7 @@ render.make_shader = function(shader)
|
|||
return obj;
|
||||
}
|
||||
|
||||
var out = `${file.name()}.shader`;
|
||||
var out = `.prosperon/${file.name()}.shader`;
|
||||
|
||||
var files = [file];
|
||||
|
||||
|
@ -142,6 +147,9 @@ render.make_shader = function(shader)
|
|||
for (var inc of incs) {
|
||||
var filez = inc.match(/#include <(.*)>/)[1];
|
||||
var macro = io.slurp(filez);
|
||||
if (!macro)
|
||||
macro = io.slurp(`shaders/${filez}`);
|
||||
|
||||
shader = shader.replace(inc, macro);
|
||||
files.push(filez);
|
||||
}
|
||||
|
|
|
@ -1219,6 +1219,10 @@ JSValue js_io_slurpbytes(JSContext *js, JSValue self, int argc, JSValue *argv)
|
|||
char *f = js2str(argv[0]);
|
||||
size_t len;
|
||||
unsigned char *d = slurp_file(f,&len);
|
||||
if (!d) {
|
||||
JS_FreeCString(js,f);
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
JSValue ret = JS_NewArrayBufferCopy(js,d,len);
|
||||
JS_FreeCString(js,f);
|
||||
free(d);
|
||||
|
|
Loading…
Reference in a new issue