orca/src/orca.c

109 lines
3.0 KiB
C
Raw Normal View History

2023-08-19 12:49:23 +00:00
/************************************************************/ /**
2023-03-05 15:05:43 +00:00
*
This commit restructures the codebase to melt the milepost platform layer into the main orca codebase. Here's a list of commits squashed in this update: - move angle files to ext/ and pull includes/libs from there when needed - remove milepost/ext/angle_headers - Collapsed milepost/ext into ext - Collapse milepost/scripts into scripts/ - collapse milepost/resources into resources/. WARN: this temporarily breaks milepost's native examples - collapse milepost/test into test/ - renamed test/ to tests/ - build milepost directly into build/bin - remove unused GLES and KHR folders from sdk/ - reorganizing milepost directory tree into app, graphics, platfrom, ui, util - collapse milepost/src to src/ - Move all native examples to sketches/ and remove milepost repo - Moving sketches resources into their own shared folder separate from the runtime's resource folder - Moving all binding code to src/wasmbind - Moving all binding code to src/wasmbind - pong: fix typo in error log - fixing log parameter order - add error logs to mg_image_create_* - Fix build scripts on windows - fixed include mistake after rebase - collapsing milepost.{h|c|m} to orca.{h|c|m} and moving from sdk/ to src/ - rename orca_app.h/main.c to runtime.h/c - collapsed sdk/ to src/ - put old sdk files into their respective dirs - renamed canvas_api.json to surface_api.json - moved all stb headers in ext/stb/ - remove unused OpenSansLatinSubset.ttf font - moving cstdlib to src/wasmlibc and removing some duplicates with src/platform - move libc stdarg and string functions from platform/ to wasmlibc/ - rename wasmlibc to libc-shim to reflect non-completeness - Expose abort/assert variadic functions and macros to orca apps, and forward libc-shim abort/assert to these - move Orca API runtime implementations to runtime_xxx - fix missing math constants when including math.h with msvc in graphics_common.c - Change name of runtime to orca_runtime. When bundling on Windows, change name of runtime executable to the name of the app.
2023-08-09 11:06:32 +00:00
* @file: orca.c
2023-03-05 15:05:43 +00:00
* @author: Martin Fouilleul
* @date: 13/02/2021
* @revision:
*
*****************************************************************/
//---------------------------------------------------------------
// platform implementations
//---------------------------------------------------------------
2023-08-19 12:49:23 +00:00
#include "platform/platform.h"
2023-04-18 16:05:54 +00:00
#if OC_PLATFORM_WINDOWS
2023-08-19 12:49:23 +00:00
#include "platform/native_debug.c"
#include "platform/win32_memory.c"
#include "platform/win32_clock.c"
#include "platform/win32_string_helpers.c"
#include "platform/win32_path.c"
#include "platform/win32_io.c"
#include "platform/win32_thread.c"
#include "platform/win32_platform.c"
2023-08-19 12:49:23 +00:00
//TODO
#elif OC_PLATFORM_MACOS
2023-08-19 12:49:23 +00:00
#include "platform/native_debug.c"
#include "platform/unix_memory.c"
#include "platform/osx_clock.c"
#include "platform/posix_io.c"
#include "platform/posix_thread.c"
#include "platform/osx_platform.c"
2023-08-19 12:49:23 +00:00
/*
2023-03-05 15:05:43 +00:00
#include"platform/unix_rng.c"
#include"platform/posix_socket.c"
*/
#elif PLATFORM_LINUX
2023-08-19 12:49:23 +00:00
#include "platform/native_debug.c"
#include "platform/unix_base_memory.c"
#include "platform/linux_clock.c"
#include "platform/posix_io.c"
#include "platform/posix_thread.c"
/*
2023-03-05 15:05:43 +00:00
#include"platform/unix_rng.c"
#include"platform/posix_socket.c"
*/
#elif OC_PLATFORM_ORCA
2023-08-19 12:49:23 +00:00
#include "platform/orca_debug.c"
#include "platform/orca_clock.c"
#include "platform/orca_memory.c"
#include "platform/orca_malloc.c"
#include "platform/platform_io_common.c"
#include "platform/orca_io_stubs.c"
#include "platform/orca_platform.c"
#include "platform/platform_path.c"
2023-03-05 15:05:43 +00:00
#else
2023-08-19 12:49:23 +00:00
#error "Unsupported platform"
2023-03-05 15:05:43 +00:00
#endif
2023-04-18 16:05:54 +00:00
//---------------------------------------------------------------
// utilities implementations
//---------------------------------------------------------------
2023-08-19 12:49:23 +00:00
#include "util/algebra.c"
#include "util/hash.c"
#include "util/memory.c"
#include "util/ringbuffer.c"
#include "util/strings.c"
#include "util/utf8.c"
2023-04-18 16:05:54 +00:00
2023-03-05 15:05:43 +00:00
//---------------------------------------------------------------
// app/graphics layer
//---------------------------------------------------------------
#if OC_PLATFORM_WINDOWS
2023-08-19 12:49:23 +00:00
#include "app/win32_app.c"
#include "graphics/graphics_common.c"
#include "graphics/graphics_surface.c"
2023-03-05 15:05:43 +00:00
2023-08-19 12:49:23 +00:00
#if OC_COMPILE_GL || OC_COMPILE_GLES
#include "graphics/gl_loader.c"
#endif
2023-03-05 15:05:43 +00:00
2023-08-19 12:49:23 +00:00
#if OC_COMPILE_GL
#include "graphics/wgl_surface.c"
#endif
2023-08-19 12:49:23 +00:00
#if OC_COMPILE_CANVAS
#include "graphics/gl_canvas.c"
#endif
2023-03-05 15:05:43 +00:00
2023-08-19 12:49:23 +00:00
#if OC_COMPILE_GLES
#include "graphics/egl_surface.c"
#endif
2023-03-05 15:05:43 +00:00
#elif OC_PLATFORM_MACOS
2023-08-19 12:49:23 +00:00
//NOTE: macos application layer and graphics backends are defined in orca.m
#elif OC_PLATFORM_ORCA
2023-08-19 12:49:23 +00:00
#include "app/orca_app.c"
#include "wasmbind/core_api_stubs.c"
2023-08-19 12:49:23 +00:00
#include "graphics/graphics_common.c"
#include "graphics/orca_surface_stubs.c"
2023-03-05 15:05:43 +00:00
#else
2023-08-19 12:49:23 +00:00
#error "Unsupported platform"
2023-03-05 15:05:43 +00:00
#endif
2023-08-19 12:49:23 +00:00
#include "ui/input_state.c"
#include "ui/ui.c"