[win32, build] first iteration on build script for win32
This commit is contained in:
parent
37ab5ca5e4
commit
ea4a19b074
|
@ -0,0 +1,55 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
set target=%1%
|
||||||
|
if "%~1%" == "" set target=orca
|
||||||
|
|
||||||
|
if not exist bin mkdir bin
|
||||||
|
if not exist bin\obj mkdir bin\obj
|
||||||
|
|
||||||
|
if %target% == wasm3 (
|
||||||
|
echo building wasm3
|
||||||
|
|
||||||
|
set wasm3_includes=/I .\ext\wasm3\source
|
||||||
|
set wasm3_sources=/I .\ext\wasm3\source\*.c
|
||||||
|
|
||||||
|
for %%f in ( .\ext\wasm3\source\*.c ) do (
|
||||||
|
cl /nologo /Zi /Zc:preprocessor /c /Fo:bin\obj\%%~nf.obj %wasm3_includes% %%f
|
||||||
|
)
|
||||||
|
lib /nologo /out:bin\wasm3.lib bin\obj\*.obj
|
||||||
|
)
|
||||||
|
|
||||||
|
if %target% == milepost (
|
||||||
|
echo building milepost
|
||||||
|
cd milepost
|
||||||
|
build.bat
|
||||||
|
cd ..
|
||||||
|
)
|
||||||
|
|
||||||
|
if %target% == orca (
|
||||||
|
echo building orca
|
||||||
|
|
||||||
|
::copy libraries
|
||||||
|
copy milepost\bin\milepost.dll bin
|
||||||
|
copy milepost\bin\milepost.dll.lib bin
|
||||||
|
|
||||||
|
::generate wasm3 api bindings
|
||||||
|
python3 scripts\bindgen.py core src
|
||||||
|
|
||||||
|
python3 scripts\bindgen.py gles src
|
||||||
|
|
||||||
|
python3 scripts\bindgen2.py canvas src\canvas_api.json^
|
||||||
|
--guest-stubs sdk\orca_surface.c^
|
||||||
|
--guest-include graphics.h^
|
||||||
|
--wasm3-bindings src\canvas_api_bind_gen.c
|
||||||
|
|
||||||
|
python3 scripts\bindgen2.py io^
|
||||||
|
src\io_api.json^
|
||||||
|
--guest-stubs sdk\io_stubs.c^
|
||||||
|
--wasm3-bindings src\io_api_bind_gen.c
|
||||||
|
|
||||||
|
::compile orca
|
||||||
|
set INCLUDES=/I src /I sdk /I ext\wasm3\source /I milepost\src /I milepost\ext /I ..\vcpkg\packages\pthreads_x64-windows\include
|
||||||
|
set LIBS=/LIBPATH:bin /LIBPATH:..\vcpkg\packages\pthreads_x64-windows\lib milepost.dll.lib wasm3.lib pthreadVC3.lib
|
||||||
|
|
||||||
|
cl /Zi /Zc:preprocessor /std:c11 %INCLUDES% src\main.c /link %LIBS% /out:bin\orca.exe
|
||||||
|
)
|
2
milepost
2
milepost
|
@ -1 +1 @@
|
||||||
Subproject commit b2d2d2a587f3c8a0b7dae5521f3202b92f57ae08
|
Subproject commit debcffce2a2dccab3c3abf8972d0adb11052a515
|
202
src/orca_app.h
202
src/orca_app.h
|
@ -1,124 +1,78 @@
|
||||||
/************************************************************//**
|
/************************************************************//**
|
||||||
*
|
*
|
||||||
* @file: orca_runtime.h
|
* @file: orca_runtime.h
|
||||||
* @author: Martin Fouilleul
|
* @author: Martin Fouilleul
|
||||||
* @date: 17/04/2023
|
* @date: 17/04/2023
|
||||||
*
|
*
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
#ifndef __ORCA_RUNTIME_H_
|
#ifndef __ORCA_RUNTIME_H_
|
||||||
#define __ORCA_RUNTIME_H_
|
#define __ORCA_RUNTIME_H_
|
||||||
|
|
||||||
#include"platform/platform_io_internal.h"
|
#include"wasm3.h"
|
||||||
|
#include"m3_env.h"
|
||||||
#include"wasm3.h"
|
#include"m3_compile.h"
|
||||||
#include"m3_env.h"
|
|
||||||
#include"m3_compile.h"
|
#define G_EVENTS(X) \
|
||||||
|
X(G_EVENT_START, "OnInit", "", "") \
|
||||||
#define G_EVENTS(X) \
|
X(G_EVENT_MOUSE_DOWN, "OnMouseDown", "", "i") \
|
||||||
X(G_EVENT_START, "OnInit", "", "") \
|
X(G_EVENT_MOUSE_UP, "OnMouseUp", "", "i") \
|
||||||
X(G_EVENT_MOUSE_DOWN, "OnMouseDown", "", "i") \
|
X(G_EVENT_MOUSE_ENTER, "OnMouseEnter", "", "") \
|
||||||
X(G_EVENT_MOUSE_UP, "OnMouseUp", "", "i") \
|
X(G_EVENT_MOUSE_LEAVE, "OnMouseLeave", "", "") \
|
||||||
X(G_EVENT_MOUSE_ENTER, "OnMouseEnter", "", "") \
|
X(G_EVENT_MOUSE_MOVE, "OnMouseMove", "", "ffff") \
|
||||||
X(G_EVENT_MOUSE_LEAVE, "OnMouseLeave", "", "") \
|
X(G_EVENT_MOUSE_WHEEL, "OnMouseWheel", "", "ff") \
|
||||||
X(G_EVENT_MOUSE_MOVE, "OnMouseMove", "", "ffff") \
|
X(G_EVENT_KEY_DOWN, "OnKeyDown", "", "i") \
|
||||||
X(G_EVENT_MOUSE_WHEEL, "OnMouseWheel", "", "ff") \
|
X(G_EVENT_KEY_UP, "OnKeyUp", "", "i") \
|
||||||
X(G_EVENT_KEY_DOWN, "OnKeyDown", "", "i") \
|
X(G_EVENT_FRAME_REFRESH, "OnFrameRefresh", "", "") \
|
||||||
X(G_EVENT_KEY_UP, "OnKeyUp", "", "i") \
|
X(G_EVENT_FRAME_RESIZE, "OnFrameResize", "", "ii")
|
||||||
X(G_EVENT_FRAME_REFRESH, "OnFrameRefresh", "", "") \
|
|
||||||
X(G_EVENT_FRAME_RESIZE, "OnFrameResize", "", "ii")
|
typedef enum {
|
||||||
|
#define G_EVENT_KIND(kind, ...) kind,
|
||||||
typedef enum {
|
G_EVENTS(G_EVENT_KIND)
|
||||||
#define G_EVENT_KIND(kind, ...) kind,
|
G_EVENT_COUNT
|
||||||
G_EVENTS(G_EVENT_KIND)
|
} guest_event_kind;
|
||||||
G_EVENT_COUNT
|
|
||||||
} guest_event_kind;
|
|
||||||
|
typedef struct g_event_handler_desc
|
||||||
|
{
|
||||||
typedef struct g_event_handler_desc
|
str8 name;
|
||||||
{
|
str8 retTags;
|
||||||
str8 name;
|
str8 argTags;
|
||||||
str8 retTags;
|
} g_event_handler_desc;
|
||||||
str8 argTags;
|
|
||||||
} g_event_handler_desc;
|
const g_event_handler_desc G_EVENT_HANDLER_DESC[] = {
|
||||||
|
|
||||||
const g_event_handler_desc G_EVENT_HANDLER_DESC[] = {
|
#define STR8LIT(s) {sizeof(s), s} //NOTE: msvc doesn't accept STR8(s) as compile-time constant...
|
||||||
#define G_EVENT_HANDLER_DESC_ENTRY(kind, name, rets, args) {STR8(name), STR8(rets), STR8(args)},
|
#define G_EVENT_HANDLER_DESC_ENTRY(kind, name, rets, args) {STR8LIT(name), STR8LIT(rets), STR8LIT(args)},
|
||||||
G_EVENTS(G_EVENT_HANDLER_DESC_ENTRY)
|
|
||||||
};
|
G_EVENTS(G_EVENT_HANDLER_DESC_ENTRY)
|
||||||
|
|
||||||
typedef struct wasm_memory
|
#undef G_EVENT_HANDLER_DESC_ENTRY
|
||||||
{
|
#undef STR8LIT
|
||||||
char* ptr;
|
};
|
||||||
u64 reserved;
|
|
||||||
u64 committed;
|
typedef struct wasm_memory
|
||||||
|
{
|
||||||
} wasm_memory;
|
char* ptr;
|
||||||
|
u64 reserved;
|
||||||
typedef struct orca_runtime
|
u64 committed;
|
||||||
{
|
|
||||||
str8 wasmBytecode;
|
} wasm_memory;
|
||||||
wasm_memory wasmMemory;
|
|
||||||
|
typedef struct orca_runtime
|
||||||
// wasm3 data
|
{
|
||||||
IM3Environment m3Env;
|
str8 wasmBytecode;
|
||||||
IM3Runtime m3Runtime;
|
wasm_memory wasmMemory;
|
||||||
IM3Module m3Module;
|
|
||||||
IM3Function eventHandlers[G_EVENT_COUNT];
|
// wasm3 data
|
||||||
|
IM3Environment m3Env;
|
||||||
} orca_runtime;
|
IM3Runtime m3Runtime;
|
||||||
|
IM3Module m3Module;
|
||||||
typedef struct log_entry
|
IM3Function eventHandlers[G_EVENT_COUNT];
|
||||||
{
|
|
||||||
list_elt listElt;
|
} orca_runtime;
|
||||||
u64 cap;
|
|
||||||
|
|
||||||
log_level level;
|
orca_runtime* orca_runtime_get();
|
||||||
str8 file;
|
|
||||||
str8 function;
|
|
||||||
int line;
|
#endif //__ORCA_RUNTIME_H_
|
||||||
str8 msg;
|
|
||||||
|
|
||||||
u64 recordIndex;
|
|
||||||
|
|
||||||
} log_entry;
|
|
||||||
|
|
||||||
typedef struct orca_debug_overlay
|
|
||||||
{
|
|
||||||
bool show;
|
|
||||||
mg_surface surface;
|
|
||||||
mg_canvas canvas;
|
|
||||||
mg_font fontReg;
|
|
||||||
mg_font fontBold;
|
|
||||||
ui_context ui;
|
|
||||||
|
|
||||||
|
|
||||||
mem_arena logArena;
|
|
||||||
list_info logEntries;
|
|
||||||
list_info logFreeList;
|
|
||||||
u32 entryCount;
|
|
||||||
u32 maxEntries;
|
|
||||||
u64 logEntryTotalCount;
|
|
||||||
bool logScrollToLast;
|
|
||||||
|
|
||||||
} orca_debug_overlay;
|
|
||||||
|
|
||||||
typedef struct orca_app
|
|
||||||
{
|
|
||||||
mp_window window;
|
|
||||||
mg_surface surface;
|
|
||||||
mg_canvas canvas;
|
|
||||||
|
|
||||||
file_table fileTable;
|
|
||||||
file_handle rootDir;
|
|
||||||
|
|
||||||
orca_runtime runtime;
|
|
||||||
|
|
||||||
orca_debug_overlay debugOverlay;
|
|
||||||
|
|
||||||
} orca_app;
|
|
||||||
|
|
||||||
orca_app* orca_app_get();
|
|
||||||
orca_runtime* orca_runtime_get();
|
|
||||||
|
|
||||||
|
|
||||||
#endif //__ORCA_RUNTIME_H_
|
|
||||||
|
|
Loading…
Reference in New Issue