Compilation targets of WIN, WEB, and LINUX; ftw to nftw for emscripten [2deca9ddb9]
This commit is contained in:
parent
a58da54994
commit
1b1d080528
37
Makefile
37
Makefile
|
@ -7,6 +7,7 @@ UNAME != uname
|
||||||
# DBG --- build with debugging symbols and logging
|
# DBG --- build with debugging symbols and logging
|
||||||
# ED --- build with or without editor
|
# ED --- build with or without editor
|
||||||
# OPT --- Optimize
|
# OPT --- Optimize
|
||||||
|
# OS --- Set to WIN, WEB, MAC, IOS, LINUX
|
||||||
|
|
||||||
QFLAGS :=
|
QFLAGS :=
|
||||||
|
|
||||||
|
@ -17,7 +18,6 @@ ifdef DBG
|
||||||
ifeq ($(CC),tcc)
|
ifeq ($(CC),tcc)
|
||||||
QFLAGS +=
|
QFLAGS +=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
QFLAGS += -O2
|
QFLAGS += -O2
|
||||||
INFO = rel
|
INFO = rel
|
||||||
|
@ -34,9 +34,25 @@ endif
|
||||||
|
|
||||||
QFLAGS += -DHAVE_CEIL -DHAVE_FLOOR -DHAVE_FMOD -DHAVE_LRINT -DHAVE_LRINTF
|
QFLAGS += -DHAVE_CEIL -DHAVE_FLOOR -DHAVE_FMOD -DHAVE_LRINT -DHAVE_LRINTF
|
||||||
|
|
||||||
|
|
||||||
PTYPE != uname -m
|
PTYPE != uname -m
|
||||||
|
|
||||||
|
ifeq ($(OS), WIN)
|
||||||
|
LINKER_FLAGS += $(QFLAGS) -static
|
||||||
|
ELIBS = engine d3d11 dxgi quickjs gdi32 ws2_32 ole32 winmm setupapi m
|
||||||
|
CLIBS =
|
||||||
|
EXT = .exe
|
||||||
|
CC = x86_64-w64-mingw32-gcc
|
||||||
|
else ifeq ($(OS), WEB)
|
||||||
|
LINKER_FLAGS += $(QFLAGS) -static -sFULL_ES3
|
||||||
|
ELIBS = engine pthread quickjs GL c m dl
|
||||||
|
CLIBS =
|
||||||
|
CC = emcc
|
||||||
|
else
|
||||||
|
LINKER_FLAGS += $(QFLAGS) -L/usr/local/lib -pthread -rdynamic
|
||||||
|
ELIBS = engine pthread quickjs GL c m dl X11 Xi Xcursor EGL asound
|
||||||
|
CLIBS =
|
||||||
|
endif
|
||||||
|
|
||||||
BIN = bin/$(CC)/$(INFO)/
|
BIN = bin/$(CC)/$(INFO)/
|
||||||
|
|
||||||
objprefix = $(BIN)obj
|
objprefix = $(BIN)obj
|
||||||
|
@ -70,7 +86,7 @@ includeflag != find source -type d -name include
|
||||||
includeflag += $(engincs) source/engine/thirdparty/Nuklear
|
includeflag += $(engincs) source/engine/thirdparty/Nuklear
|
||||||
includeflag := $(addprefix -I, $(includeflag))
|
includeflag := $(addprefix -I, $(includeflag))
|
||||||
|
|
||||||
WARNING_FLAGS = -Wall -Wno-incompatible-function-pointer-types -Wno-unused-function# -pedantic -Wextra -Wwrite-strings -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types -Wno-unused-function
|
WARNING_FLAGS = -Wall -Wno-incompatible-function-pointer-types -Wno-unused-function# -pedantic -Wextra -Wwrite-strings -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types -Wno-unused-function -Wno-int-conversion
|
||||||
|
|
||||||
SEM = 0.0.1
|
SEM = 0.0.1
|
||||||
COM != fossil describe
|
COM != fossil describe
|
||||||
|
@ -80,17 +96,6 @@ COMPILER_FLAGS = $(includeflag) $(QFLAGS) -MD $(WARNING_FLAGS) -I. -DCP_USE_DOUB
|
||||||
|
|
||||||
LIBPATH = -L$(BIN)
|
LIBPATH = -L$(BIN)
|
||||||
|
|
||||||
ifeq ($(OS), WIN32)
|
|
||||||
LINKER_FLAGS = $(QFLAGS) -static
|
|
||||||
ELIBS = engine glfw3 opengl32 quickjs gdi32 ws2_32 ole32 winmm setupapi m
|
|
||||||
CLIBS =
|
|
||||||
EXT = .exe
|
|
||||||
else
|
|
||||||
LINKER_FLAGS = $(QFLAGS) -L/usr/local/lib -pthread -rdynamic
|
|
||||||
ELIBS = engine pthread yughc quickjs GL c m dl X11 Xi Xcursor EGL asound
|
|
||||||
CLIBS =
|
|
||||||
endif
|
|
||||||
|
|
||||||
NAME = yugine$(EXT)
|
NAME = yugine$(EXT)
|
||||||
|
|
||||||
ELIBS != $(call prefix, $(ELIBS), -l)
|
ELIBS != $(call prefix, $(ELIBS), -l)
|
||||||
|
@ -154,10 +159,6 @@ $(objprefix)/%.o:%.c
|
||||||
@echo Making C object $@
|
@echo Making C object $@
|
||||||
@$(CC) $(COMPILER_FLAGS)
|
@$(CC) $(COMPILER_FLAGS)
|
||||||
|
|
||||||
.PHONY: docs
|
|
||||||
docs:
|
|
||||||
asciidoctor docs/*.adoc
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@echo Cleaning project
|
@echo Cleaning project
|
||||||
|
|
|
@ -568,7 +568,7 @@ JSValue dukext2paths(char *ext) {
|
||||||
dukext = ext;
|
dukext = ext;
|
||||||
dukarr = JS_NewArray(js);
|
dukarr = JS_NewArray(js);
|
||||||
dukidx = 0;
|
dukidx = 0;
|
||||||
ftw(".", duk2path, 10);
|
nftw(".", duk2path, 10,0);
|
||||||
return dukarr;
|
return dukarr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "stb_ds.h"
|
#include "stb_ds.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "stb_ds.h"
|
#include "stb_ds.h"
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "stb_ds.h"
|
#include "stb_ds.h"
|
||||||
|
|
||||||
|
#include "sokol/sokol_app.h"
|
||||||
|
|
||||||
#include "HandmadeMath.h"
|
#include "HandmadeMath.h"
|
||||||
|
|
||||||
int renderMode = LIT;
|
int renderMode = LIT;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
char *DATA_PATH = NULL;
|
char *DATA_PATH = NULL;
|
||||||
char *PREF_PATH = NULL;
|
char *PREF_PATH = NULL;
|
||||||
|
|
||||||
char *prefabs;
|
char **prefabs;
|
||||||
|
|
||||||
const char *EXT_PREFAB = ".prefab";
|
const char *EXT_PREFAB = ".prefab";
|
||||||
const char *EXT_LEVEL = ".level";
|
const char *EXT_LEVEL = ".level";
|
||||||
|
@ -89,7 +89,7 @@ static int ext_check(const char *path, const struct stat *sb, int typeflag) {
|
||||||
void fill_extensions(char *paths, const char *path, const char *ext) {
|
void fill_extensions(char *paths, const char *path, const char *ext) {
|
||||||
cur_ext = ext;
|
cur_ext = ext;
|
||||||
arrfree(paths);
|
arrfree(paths);
|
||||||
ftw(".", ext_check, 10);
|
nftw(".", ext_check, 10, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void findPrefabs() {
|
void findPrefabs() {
|
||||||
|
|
|
@ -13,7 +13,7 @@ extern int stemlen;
|
||||||
|
|
||||||
void resources_init();
|
void resources_init();
|
||||||
|
|
||||||
extern char *prefabs;
|
extern char **prefabs;
|
||||||
void findPrefabs();
|
void findPrefabs();
|
||||||
void fill_extensions(char *paths, const char *path, const char *ext);
|
void fill_extensions(char *paths, const char *path, const char *ext);
|
||||||
char *get_filename_from_path(char *path, int extension);
|
char *get_filename_from_path(char *path, int extension);
|
||||||
|
|
|
@ -87,7 +87,7 @@ struct sprite *id2sprite(int id) {
|
||||||
return &sprites[id];
|
return &sprites[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
static sprite_count = 0;
|
static int sprite_count = 0;
|
||||||
|
|
||||||
void sprite_flush() {
|
void sprite_flush() {
|
||||||
sprite_count = 0;
|
sprite_count = 0;
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "openglrender.h"
|
#include "openglrender.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "resources.h"
|
||||||
|
|
||||||
#include "datastream.h"
|
#include "datastream.h"
|
||||||
|
|
||||||
|
@ -33,7 +35,15 @@
|
||||||
|
|
||||||
#define SOKOL_TRACE_HOOKS
|
#define SOKOL_TRACE_HOOKS
|
||||||
#define SOKOL_IMPL
|
#define SOKOL_IMPL
|
||||||
|
|
||||||
|
#if defined __linux__
|
||||||
#define SOKOL_GLCORE33
|
#define SOKOL_GLCORE33
|
||||||
|
#elif __EMSCRIPTEN__
|
||||||
|
#define SOKOL_GLES3
|
||||||
|
#elif __WIN32
|
||||||
|
#define SOKOL_D3D11
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "sokol/sokol_gfx.h"
|
#include "sokol/sokol_gfx.h"
|
||||||
#include "sokol/sokol_app.h"
|
#include "sokol/sokol_app.h"
|
||||||
#include "sokol/sokol_audio.h"
|
#include "sokol/sokol_audio.h"
|
||||||
|
@ -140,6 +150,7 @@ static char **args;
|
||||||
void c_init() {
|
void c_init() {
|
||||||
int logout = 0;
|
int logout = 0;
|
||||||
#if DBG
|
#if DBG
|
||||||
|
#if __linux
|
||||||
if (logout) {
|
if (logout) {
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
char fname[100];
|
char fname[100];
|
||||||
|
@ -161,8 +172,9 @@ void c_init() {
|
||||||
signal(SIGABRT, seghandle);
|
signal(SIGABRT, seghandle);
|
||||||
signal(SIGFPE, seghandle);
|
signal(SIGFPE, seghandle);
|
||||||
signal(SIGBUS, seghandle);
|
signal(SIGBUS, seghandle);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
resources_init();
|
resources_init();
|
||||||
phys2d_init();
|
phys2d_init();
|
||||||
sound_init();
|
sound_init();
|
||||||
|
@ -196,8 +208,6 @@ void c_frame()
|
||||||
double elapsed = sapp_frame_duration();
|
double elapsed = sapp_frame_duration();
|
||||||
appTime += elapsed;
|
appTime += elapsed;
|
||||||
|
|
||||||
nuke_input_begin();
|
|
||||||
|
|
||||||
// if (sim_playing())
|
// if (sim_playing())
|
||||||
input_poll(fmax(0, renderMS-elapsed));
|
input_poll(fmax(0, renderMS-elapsed));
|
||||||
// else
|
// else
|
||||||
|
|
|
@ -14,6 +14,7 @@ void print_stacktrace();
|
||||||
const char *engine_info();
|
const char *engine_info();
|
||||||
|
|
||||||
int frame_fps();
|
int frame_fps();
|
||||||
|
double get_timescale();
|
||||||
|
|
||||||
extern double appTime;
|
extern double appTime;
|
||||||
extern double renderMS;
|
extern double renderMS;
|
||||||
|
|
Loading…
Reference in a new issue