Add system command; correct makefile
This commit is contained in:
parent
ecb2882e7e
commit
3023a12184
16
Info.plist
Normal file
16
Info.plist
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>Prosperon</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>pockle.world.prosperon</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Prosperon</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>0.5</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright © 2024 Pockle World. All rights reserved.</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
16
Makefile
16
Makefile
|
@ -173,6 +173,7 @@ SHADERS = $(shell ls source/shaders/*.sglsl)
|
||||||
SHADERS := $(patsubst %.sglsl, %.sglsl.h, $(SHADERS))
|
SHADERS := $(patsubst %.sglsl, %.sglsl.h, $(SHADERS))
|
||||||
|
|
||||||
install: $(NAME)
|
install: $(NAME)
|
||||||
|
@echo Copying to destination
|
||||||
cp -f $(NAME) $(DESTDIR)/$(APP)
|
cp -f $(NAME) $(DESTDIR)/$(APP)
|
||||||
|
|
||||||
$(NAME): libengine$(INFO).a libquickjs$(INFO).a
|
$(NAME): libengine$(INFO).a libquickjs$(INFO).a
|
||||||
|
@ -181,13 +182,14 @@ $(NAME): libengine$(INFO).a libquickjs$(INFO).a
|
||||||
@echo Finished build
|
@echo Finished build
|
||||||
|
|
||||||
libengine$(INFO).a: $(OBJS)
|
libengine$(INFO).a: $(OBJS)
|
||||||
|
@echo Archiving $@
|
||||||
$(AR) rcs $@ $(OBJS)
|
$(AR) rcs $@ $(OBJS)
|
||||||
|
|
||||||
QUICKJS := source/engine/thirdparty/quickjs
|
QUICKJS := source/engine/thirdparty/quickjs
|
||||||
libquickjs$(INFO).a: $(QUICKJS)/libregexp$(INFO).o $(QUICKJS)/quickjs$(INFO).o $(QUICKJS)/libunicode$(INFO).o $(QUICKJS)/cutils$(INFO).o $(QUICKJS)/libbf$(INFO).o
|
libquickjs$(INFO).a: $(QUICKJS)/libregexp$(INFO).o $(QUICKJS)/quickjs$(INFO).o $(QUICKJS)/libunicode$(INFO).o $(QUICKJS)/cutils$(INFO).o $(QUICKJS)/libbf$(INFO).o
|
||||||
$(AR) rcs $@ $^
|
$(AR) rcs $@ $^
|
||||||
|
|
||||||
%$(INFO).o: %.c $(SHADERS) source/engine/core.cdb.h
|
%$(INFO).o: %.c $(SHADERS)
|
||||||
@echo Making C object $@
|
@echo Making C object $@
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
@ -206,6 +208,10 @@ shaders: $(SHADERS)
|
||||||
@echo Creating shader $^
|
@echo Creating shader $^
|
||||||
./sokol-shdc --ifdef -i $^ --slang=glsl330:hlsl5:metal_macos:metal_ios:metal_sim:glsl300es -o $@
|
./sokol-shdc --ifdef -i $^ --slang=glsl330:hlsl5:metal_macos:metal_ios:metal_sim:glsl300es -o $@
|
||||||
|
|
||||||
|
SCRIPTS := $(shell ls scripts/*.js*)
|
||||||
|
CORE != (ls icons/* fonts/*)
|
||||||
|
CORE := $(CORE) $(SCRIPTS)
|
||||||
|
|
||||||
CDB = source/engine/thirdparty/tinycdb
|
CDB = source/engine/thirdparty/tinycdb
|
||||||
CDB_C != find $(CDB) -name *.c
|
CDB_C != find $(CDB) -name *.c
|
||||||
CDB_O := $(patsubst %.c, %.o, $(CDB_C))
|
CDB_O := $(patsubst %.c, %.o, $(CDB_C))
|
||||||
|
@ -223,19 +229,15 @@ packer: tools/packer.c tools/libcdb.a
|
||||||
cc $^ -I$(CDB) -o packer
|
cc $^ -I$(CDB) -o packer
|
||||||
|
|
||||||
core.cdb: packer $(CORE)
|
core.cdb: packer $(CORE)
|
||||||
|
@echo Packing core.cdb
|
||||||
./packer $(CORE)
|
./packer $(CORE)
|
||||||
chmod 644 out.cdb
|
chmod 644 out.cdb
|
||||||
mv out.cdb core.cdb
|
mv out.cdb core.cdb
|
||||||
|
|
||||||
source/engine/core.cdb.h: core.cdb
|
source/engine/core.cdb.h: core.cdb
|
||||||
@echo Packing core.cdb.h
|
@echo Making $@
|
||||||
xxd -i $< > $@
|
xxd -i $< > $@
|
||||||
|
|
||||||
SCRIPTS := $(shell ls scripts/*.js*)
|
|
||||||
SCRIPT_O := $(addsuffix o, $(SCRIPTS))
|
|
||||||
CORE != (ls icons/* fonts/*)
|
|
||||||
CORE := $(CORE) $(SCRIPTS)
|
|
||||||
|
|
||||||
jsc: tools/jso.c tools/libquickjs.a
|
jsc: tools/jso.c tools/libquickjs.a
|
||||||
$(CC) $^ -lm -Iquickjs -o $@
|
$(CC) $^ -lm -Iquickjs -o $@
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,13 @@ os.prefpath = function() {
|
||||||
return otherpath[os.sys()] + "/" + (game.title ? game.title : "Untitled Prosperon Game");
|
return otherpath[os.sys()] + "/" + (game.title ? game.title : "Untitled Prosperon Game");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
os.openurl = function(url) {
|
||||||
|
if (os.sys() === 'windows')
|
||||||
|
os.system(`start ${url}`);
|
||||||
|
else
|
||||||
|
os.system(`open ${url}`);
|
||||||
|
}
|
||||||
|
|
||||||
var projectfile = ".prosperon/project.json";
|
var projectfile = ".prosperon/project.json";
|
||||||
|
|
||||||
Resources.is_sound = function(path) {
|
Resources.is_sound = function(path) {
|
||||||
|
|
|
@ -809,11 +809,16 @@ JSC_SCALL(os_make_texture,
|
||||||
JS_SetPropertyStr(js, ret, "path", JS_DupValue(js,argv[0]));
|
JS_SetPropertyStr(js, ret, "path", JS_DupValue(js,argv[0]));
|
||||||
)
|
)
|
||||||
|
|
||||||
|
JSC_SCALL(os_system,
|
||||||
|
system(str);
|
||||||
|
)
|
||||||
|
|
||||||
static const JSCFunctionListEntry js_os_funcs[] = {
|
static const JSCFunctionListEntry js_os_funcs[] = {
|
||||||
MIST_FUNC_DEF(os,sprite,1),
|
MIST_FUNC_DEF(os,sprite,1),
|
||||||
MIST_FUNC_DEF(os, cwd, 0),
|
MIST_FUNC_DEF(os, cwd, 0),
|
||||||
MIST_FUNC_DEF(os, env, 1),
|
MIST_FUNC_DEF(os, env, 1),
|
||||||
MIST_FUNC_DEF(os, sys, 0),
|
MIST_FUNC_DEF(os, sys, 0),
|
||||||
|
MIST_FUNC_DEF(os, system, 1),
|
||||||
MIST_FUNC_DEF(os, quit, 0),
|
MIST_FUNC_DEF(os, quit, 0),
|
||||||
MIST_FUNC_DEF(os, reindex_static, 0),
|
MIST_FUNC_DEF(os, reindex_static, 0),
|
||||||
MIST_FUNC_DEF(os, gc, 0),
|
MIST_FUNC_DEF(os, gc, 0),
|
||||||
|
|
Loading…
Reference in a new issue