[win32, build] first iteration on build script for win32

This commit is contained in:
martinfouilleul 2023-06-16 19:46:58 +02:00
parent 37ab5ca5e4
commit ea4a19b074
3 changed files with 134 additions and 125 deletions

55
build.bat Normal file
View File

@ -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
)

@ -1 +1 @@
Subproject commit b2d2d2a587f3c8a0b7dae5521f3202b92f57ae08
Subproject commit debcffce2a2dccab3c3abf8972d0adb11052a515

View File

@ -8,8 +8,6 @@
#ifndef __ORCA_RUNTIME_H_
#define __ORCA_RUNTIME_H_
#include"platform/platform_io_internal.h"
#include"wasm3.h"
#include"m3_env.h"
#include"m3_compile.h"
@ -42,8 +40,14 @@ typedef struct g_event_handler_desc
} g_event_handler_desc;
const g_event_handler_desc G_EVENT_HANDLER_DESC[] = {
#define G_EVENT_HANDLER_DESC_ENTRY(kind, name, rets, args) {STR8(name), STR8(rets), STR8(args)},
#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) {STR8LIT(name), STR8LIT(rets), STR8LIT(args)},
G_EVENTS(G_EVENT_HANDLER_DESC_ENTRY)
#undef G_EVENT_HANDLER_DESC_ENTRY
#undef STR8LIT
};
typedef struct wasm_memory
@ -67,57 +71,7 @@ typedef struct orca_runtime
} orca_runtime;
typedef struct log_entry
{
list_elt listElt;
u64 cap;
log_level level;
str8 file;
str8 function;
int line;
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();