Modifications for web build
This commit is contained in:
parent
7e04937c8b
commit
9d75b38098
21
Makefile
21
Makefile
|
@ -15,7 +15,7 @@ INFO :=
|
||||||
LD = $(CC)
|
LD = $(CC)
|
||||||
|
|
||||||
STEAM = steam/sdk
|
STEAM = steam/sdk
|
||||||
STEAMAPI = steam_api
|
STEAMAPI =
|
||||||
|
|
||||||
CCC != $(CC) -v
|
CCC != $(CC) -v
|
||||||
ifneq ($(findstring clangcc , $(CCC)),)
|
ifneq ($(findstring clangcc , $(CCC)),)
|
||||||
|
@ -43,8 +43,7 @@ ifdef NQOA
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CC), emcc)
|
ifeq ($(CC), emcc)
|
||||||
LDFLAGS += #--closure 1 --emrun
|
LDFLAGS += --closure 1 --emrun --preload-file game.cdb
|
||||||
CPPFLAGS += -O0
|
|
||||||
OPT = 0
|
OPT = 0
|
||||||
NDEBUG = 1
|
NDEBUG = 1
|
||||||
AR = emar
|
AR = emar
|
||||||
|
@ -118,9 +117,10 @@ else ifeq ($(OS), IOS)
|
||||||
INFO :=$(INFO)_ios
|
INFO :=$(INFO)_ios
|
||||||
else ifeq ($(CC), emcc) # Then WEB
|
else ifeq ($(CC), emcc) # Then WEB
|
||||||
OS := Web
|
OS := Web
|
||||||
LDFLAGS += -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -pthread -sTOTAL_MEMORY=128MB
|
LDFLAGS += -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -sTOTAL_MEMORY=128MB -sSTACK_SIZE=5MB
|
||||||
CPPFLAGS += -pthread
|
CPPFLAGS += -dNSTEAM -sASSERTIONS=2
|
||||||
LDLIBS += pthread quickjs GL openal c m dl
|
LDLIBS += GL openal c m dl
|
||||||
|
STEAMAPI :=
|
||||||
EXT = .html
|
EXT = .html
|
||||||
else
|
else
|
||||||
UNAME != uname -s
|
UNAME != uname -s
|
||||||
|
@ -219,13 +219,13 @@ SCRIPTS := $(shell ls scripts/*.js*)
|
||||||
CORE != (ls icons/* fonts/*)
|
CORE != (ls icons/* fonts/*)
|
||||||
CORE := $(CORE) $(SCRIPTS)
|
CORE := $(CORE) $(SCRIPTS)
|
||||||
|
|
||||||
packer$(EXT): tools/packer.c source/engine/miniz.c
|
packer: tools/packer.c source/engine/miniz.c
|
||||||
@echo Making packer
|
@echo Making packer
|
||||||
$(CC) -O2 $^ -Isource/engine -o packer
|
$(CC) -O2 $^ -Isource/engine -o packer
|
||||||
|
|
||||||
core.cdb: packer$(EXT) $(CORE)
|
core.cdb: packer $(CORE)
|
||||||
@echo Packing core.cdb
|
@echo Packing core.cdb
|
||||||
./packer$(EXT) $@ $(CORE)
|
./packer $@ $(CORE)
|
||||||
|
|
||||||
source/engine/core.cdb.h: core.cdb
|
source/engine/core.cdb.h: core.cdb
|
||||||
@echo Making $@
|
@echo Making $@
|
||||||
|
@ -268,10 +268,11 @@ crossmac: Prosperon.icns
|
||||||
|
|
||||||
crossweb:
|
crossweb:
|
||||||
make CC=emcc
|
make CC=emcc
|
||||||
|
mv $(APP)_$(ARCH).html index.html
|
||||||
|
|
||||||
playweb:
|
playweb:
|
||||||
make crossweb
|
make crossweb
|
||||||
emrun $(NAME).html
|
emrun index.html
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo Cleaning project
|
@echo Cleaning project
|
||||||
|
|
|
@ -147,8 +147,8 @@ console.say = function(msg) {
|
||||||
console.transcript += msg;
|
console.transcript += msg;
|
||||||
};
|
};
|
||||||
console.log = console.say;
|
console.log = console.say;
|
||||||
var say = console.say;
|
globalThis.say = console.say;
|
||||||
var print = console.print;
|
globalThis.print = console.print;
|
||||||
|
|
||||||
console.pprint = function(msg,lvl = 0) {
|
console.pprint = function(msg,lvl = 0) {
|
||||||
if (typeof msg === 'object')
|
if (typeof msg === 'object')
|
||||||
|
@ -213,17 +213,14 @@ function use(file, env = {}, script)
|
||||||
|
|
||||||
if (use.cache[file]) {
|
if (use.cache[file]) {
|
||||||
var ret = use.cache[file].call(env);
|
var ret = use.cache[file].call(env);
|
||||||
profile.report(st, `CACHE eval ${file}`);
|
|
||||||
profile.addreport(profcache, file, st);
|
profile.addreport(profcache, file, st);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.info(`slurping ${file}`);
|
|
||||||
script ??= Resources.replstrs(file);
|
script ??= Resources.replstrs(file);
|
||||||
script = `(function() { var self = this; ${script}; })`;
|
script = `(function() { var self = this; ${script}; })`;
|
||||||
var fn = os.eval(file,script);
|
var fn = os.eval(file,script);
|
||||||
use.cache[file] = fn;
|
use.cache[file] = fn;
|
||||||
var ret = fn.call(env);
|
var ret = fn.call(env);
|
||||||
profile.report(st, `eval ${file}`);
|
|
||||||
profile.addreport(profcache, file, st);
|
profile.addreport(profcache, file, st);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ void log_print(const char *str)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
fprintf(writeout, str);
|
fprintf(writeout, str);
|
||||||
|
fprintf(stdout, str);
|
||||||
#endif
|
#endif
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,8 +229,8 @@ sapp_desc sokol_main(int argc, char **argv) {
|
||||||
if (argc > i+1) strcat(cmdstr, " ");
|
if (argc > i+1) strcat(cmdstr, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!LOADED_GAME)
|
// while (!LOADED_GAME)
|
||||||
sfetch_dowork();
|
// sfetch_dowork();
|
||||||
|
|
||||||
script_evalf("cmd_args('%s');", cmdstr);
|
script_evalf("cmd_args('%s');", cmdstr);
|
||||||
return start_desc;
|
return start_desc;
|
||||||
|
|
Loading…
Reference in a new issue