mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-23 23:33:45 +02:00
Add SDL headers and PhysFS to libretro builds
I don't think I'll be needing SDL. Pretty sure about 100% of the functionality of SDL that's currently being used here is either trivial to reimplement or needs to be replaced for the libretro core to work in the first place. For example, I already know I'm going to need to completely replace the SDL input handling with libretro's input API. Also, I'll need to get rid of the use of SDL threads in the audio code later because libretro cores need to render audio synchronously with the video rendering. I'm including the SDL headers, though, to reduce the number of compilation errors.
This commit is contained in:
parent
afed16f086
commit
a44f3b16b3
4 changed files with 24 additions and 12 deletions
11
meson.build
11
meson.build
|
@ -98,6 +98,15 @@ if get_option('retro') == true
|
|||
'ENABLE_ZSTD': true,
|
||||
})
|
||||
|
||||
physfs_options = cmake.subproject_options()
|
||||
physfs_options.add_cmake_defines({
|
||||
'CMAKE_POSITION_INDEPENDENT_CODE': get_option('b_staticpic'),
|
||||
'PHYSFS_BUILD_STATIC': true,
|
||||
'PHYSFS_BUILD_SHARED': false,
|
||||
'PHYSFS_BUILD_TEST': false,
|
||||
'PHYSFS_BUILD_DOCS': false,
|
||||
})
|
||||
|
||||
openal_options = cmake.subproject_options()
|
||||
openal_options.add_cmake_defines({
|
||||
'CMAKE_POSITION_INDEPENDENT_CODE': get_option('b_staticpic'),
|
||||
|
@ -174,6 +183,7 @@ if get_option('retro') == true
|
|||
cmake.subproject('liblzma', options: liblzma_options).dependency('liblzma'),
|
||||
cmake.subproject('zstd', options: zstd_options).dependency('libzstd_static'),
|
||||
cmake.subproject('libzip', options: libzip_options).dependency('zip'),
|
||||
cmake.subproject('physfs', options: physfs_options).dependency('physfs-static'),
|
||||
cmake.subproject('openal-soft', options: openal_options).dependency('OpenAL'),
|
||||
],
|
||||
c_args: [
|
||||
|
@ -200,6 +210,7 @@ if get_option('retro') == true
|
|||
include_directories(retro_phase1),
|
||||
include_directories(join_paths(retro_phase1, 'wasm2c')),
|
||||
include_directories(join_paths(retro_phase1, 'mkxp-retro-ruby')),
|
||||
include_directories(join_paths(retro_phase1, 'sdl/include')),
|
||||
],
|
||||
sources: [
|
||||
'src/core.cpp',
|
||||
|
|
|
@ -6,6 +6,7 @@ LIBYAML_VERSION ?= 0.2.5
|
|||
ZLIB_VERSION ?= 1.3.1
|
||||
OPENSSL_VERSION ?= 3.2.0
|
||||
WASM_RT_VERSION ?= 1.0.36
|
||||
SDL_VERSION ?= 2.30.11
|
||||
P7ZIP_VERSION ?= 17.06
|
||||
TARGET ?= wasm32-wasip1
|
||||
WASI_SDK ?= /opt/wasi-sdk
|
||||
|
@ -51,7 +52,7 @@ ruby-dist: $(OUTDIR)/mkxp-retro-dist.zip.c $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-
|
|||
|
||||
ruby-bindings: $(OUTDIR)/mkxp-sandbox-bindgen.cpp $(OUTDIR)/mkxp-sandbox-bindgen.h
|
||||
|
||||
deps: $(OUTDIR)/libretro.h $(OUTDIR)/wasm2c/wasm-rt.h $(OUTDIR)/wasm2c/wasm-rt-impl.c $(OUTDIR)/wasm2c/wasm-rt-mem-impl.c
|
||||
deps: $(OUTDIR)/libretro.h $(OUTDIR)/wasm2c/wasm-rt.h $(OUTDIR)/wasm2c/wasm-rt-impl.c $(OUTDIR)/wasm2c/wasm-rt-mem-impl.c $(OUTDIR)/sdl/include/SDL.h
|
||||
|
||||
clean: clean-ruby-dist clean-ruby-bindings clean-deps
|
||||
rm -rf $(LIBDIR)/*
|
||||
|
@ -70,6 +71,7 @@ clean-ruby-bindings:
|
|||
clean-deps:
|
||||
rm -f $(OUTDIR)/libretro.h
|
||||
rm -rf $(OUTDIR)/wasm2c
|
||||
rm -rf $(OUTDIR)/sdl
|
||||
rm -rf $(DOWNLOADS)/wabt
|
||||
|
||||
$(OUTDIR)/libretro.h:
|
||||
|
@ -77,11 +79,16 @@ $(OUTDIR)/libretro.h:
|
|||
$(CURL) -s -L -o $(OUTDIR)/libretro.h https://raw.githubusercontent.com/libretro/libretro-common/$(LIBRETRO_REF)/include/libretro.h
|
||||
|
||||
$(OUTDIR)/wasm2c/wasm-rt.h $(OUTDIR)/wasm2c/wasm-rt-impl.c $(OUTDIR)/wasm2c/wasm-rt-mem-impl.c &:
|
||||
mkdir -p $(DOWNLOADS)
|
||||
mkdir -p $(OUTDIR)
|
||||
$(CLONE) $(GITHUB)/WebAssembly/wabt $(DOWNLOADS)/wabt -b $(WASM_RT_VERSION)
|
||||
$(SED) -i 's/# *define * WASM_RT_C11_AVAILABLE//g' $(DOWNLOADS)/wabt/wasm2c/wasm-rt.h # Stop wasm-rt from trying to use threads because it causes compiler errors on some game console toolchains, and also because OpenAL Soft defines a header file named "threads.h" which conflicts with the C11 threads.h that this file tries to include
|
||||
cp -r $(DOWNLOADS)/wabt/wasm2c $(OUTDIR)
|
||||
|
||||
$(OUTDIR)/sdl/include/SDL.h:
|
||||
mkdir -p $(OUTDIR)
|
||||
$(CLONE) $(GITHUB)/libsdl-org/SDL $(OUTDIR)/sdl -b release-$(SDL_VERSION)
|
||||
|
||||
# Cross Ruby (targets WASI)
|
||||
|
||||
$(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby.h $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby-impl.h $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby_0.c $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby_1.c $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby_2.c $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby_3.c $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby_4.c $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby_5.c $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby_6.c $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby_7.c &: $(LIBDIR)/mkxp-retro-dist/bin/ruby
|
||||
|
|
|
@ -24,17 +24,7 @@
|
|||
|
||||
#include "util.h"
|
||||
|
||||
#ifdef MKXPZ_RETRO
|
||||
struct SDL_Rect
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
};
|
||||
#else
|
||||
# include <SDL_rect.h>
|
||||
#endif // MKXPZ_RETRO
|
||||
#include <SDL_rect.h>
|
||||
|
||||
struct Vec2
|
||||
{
|
||||
|
|
4
subprojects/physfs.wrap
Normal file
4
subprojects/physfs.wrap
Normal file
|
@ -0,0 +1,4 @@
|
|||
[wrap-git]
|
||||
url = https://github.com/icculus/physfs
|
||||
revision = release-3.2.0
|
||||
depth = 1
|
Loading…
Add table
Reference in a new issue