mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-23 23:33:45 +02:00
Compile Ruby with -Oz -DNDEBUG
in libretro builds
This commit is contained in:
parent
b9bb3535ae
commit
d7e002f9b0
12 changed files with 141 additions and 133 deletions
10
.github/workflows/autobuild.yml
vendored
10
.github/workflows/autobuild.yml
vendored
|
@ -733,7 +733,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
brew install -q git gpatch meson cmake
|
brew install -q git meson cmake
|
||||||
|
|
||||||
- id: short-sha
|
- id: short-sha
|
||||||
name: Get Git commit hash
|
name: Get Git commit hash
|
||||||
|
@ -763,7 +763,7 @@ jobs:
|
||||||
echo "cpu = '${{ matrix.cpu }}'" | tee -a ${{ runner.temp }}/cross.ini
|
echo "cpu = '${{ matrix.cpu }}'" | tee -a ${{ runner.temp }}/cross.ini
|
||||||
echo "endian = '${{ matrix.endian }}'" | tee -a ${{ runner.temp }}/cross.ini
|
echo "endian = '${{ matrix.endian }}'" | tee -a ${{ runner.temp }}/cross.ini
|
||||||
echo '--------------------------------------------------------------------------------'
|
echo '--------------------------------------------------------------------------------'
|
||||||
PATH="$HOMEBREW_PREFIX/opt/gpatch/libexec/gnubin:$PATH" meson setup build --cross-file ${{ runner.temp }}/cross.ini --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1
|
meson setup build --cross-file ${{ runner.temp }}/cross.ini --buildtype release -Db_lto=true -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1
|
||||||
|
|
||||||
- name: Build core
|
- name: Build core
|
||||||
run: |
|
run: |
|
||||||
|
@ -896,7 +896,7 @@ jobs:
|
||||||
echo "[host_machine]" | tee -a ~/cross.ini
|
echo "[host_machine]" | tee -a ~/cross.ini
|
||||||
echo "system = 'bare'" | tee -a ~/cross.ini
|
echo "system = 'bare'" | tee -a ~/cross.ini
|
||||||
echo "cpu_family = 'arm'" | tee -a ~/cross.ini
|
echo "cpu_family = 'arm'" | tee -a ~/cross.ini
|
||||||
echo "cpu = 'generic-armv7-a'" | tee -a ~/cross.ini
|
echo "cpu = 'cortex-a9'" | tee -a ~/cross.ini
|
||||||
echo "endian = 'little'" | tee -a ~/cross.ini
|
echo "endian = 'little'" | tee -a ~/cross.ini
|
||||||
echo '--------------------------------------------------------------------------------'
|
echo '--------------------------------------------------------------------------------'
|
||||||
git config --global --add safe.directory "$(pwd)"
|
git config --global --add safe.directory "$(pwd)"
|
||||||
|
@ -952,7 +952,7 @@ jobs:
|
||||||
echo "[host_machine]" | tee -a ~/cross.ini
|
echo "[host_machine]" | tee -a ~/cross.ini
|
||||||
echo "system = 'bare'" | tee -a ~/cross.ini
|
echo "system = 'bare'" | tee -a ~/cross.ini
|
||||||
echo "cpu_family = 'ppc'" | tee -a ~/cross.ini
|
echo "cpu_family = 'ppc'" | tee -a ~/cross.ini
|
||||||
echo "cpu = 'ppc'" | tee -a ~/cross.ini
|
echo "cpu = 'ppc750'" | tee -a ~/cross.ini
|
||||||
echo "endian = 'big'" | tee -a ~/cross.ini
|
echo "endian = 'big'" | tee -a ~/cross.ini
|
||||||
echo '--------------------------------------------------------------------------------'
|
echo '--------------------------------------------------------------------------------'
|
||||||
git config --global --add safe.directory "$(pwd)"
|
git config --global --add safe.directory "$(pwd)"
|
||||||
|
@ -1008,7 +1008,7 @@ jobs:
|
||||||
echo "[host_machine]" | tee -a ~/cross.ini
|
echo "[host_machine]" | tee -a ~/cross.ini
|
||||||
echo "system = 'bare'" | tee -a ~/cross.ini
|
echo "system = 'bare'" | tee -a ~/cross.ini
|
||||||
echo "cpu_family = 'aarch64'" | tee -a ~/cross.ini
|
echo "cpu_family = 'aarch64'" | tee -a ~/cross.ini
|
||||||
echo "cpu = 'generic-armv8-a'" | tee -a ~/cross.ini
|
echo "cpu = 'cortex-a57'" | tee -a ~/cross.ini
|
||||||
echo "endian = 'little'" | tee -a ~/cross.ini
|
echo "endian = 'little'" | tee -a ~/cross.ini
|
||||||
echo '--------------------------------------------------------------------------------'
|
echo '--------------------------------------------------------------------------------'
|
||||||
git config --global --add safe.directory "$(pwd)"
|
git config --global --add safe.directory "$(pwd)"
|
||||||
|
|
|
@ -95,7 +95,7 @@ sandbox::sandbox() : ruby(new struct w2c_ruby), wasi(new wasi_t(ruby)), bindings
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass the command-line arguments to Ruby
|
// Pass the command-line arguments to Ruby
|
||||||
AWAIT(w2c_ruby_ruby_init_stack(RB, ruby->w2c_0x5F_stack_pointer));
|
AWAIT(w2c_ruby_ruby_init_stack(RB, w2c_ruby_rb_wasm_get_stack_pointer(RB)));
|
||||||
AWAIT(w2c_ruby_ruby_init(RB));
|
AWAIT(w2c_ruby_ruby_init(RB));
|
||||||
usize node;
|
usize node;
|
||||||
AWAIT(node = w2c_ruby_ruby_options(RB, args.size(), argv_buf));
|
AWAIT(node = w2c_ruby_ruby_options(RB, args.size(), argv_buf));
|
||||||
|
|
|
@ -243,7 +243,7 @@ if get_option('retro') == true
|
||||||
include_directories(join_paths(retro_phase1, 'sdl/include')),
|
include_directories(join_paths(retro_phase1, 'sdl/include')),
|
||||||
],
|
],
|
||||||
sources: [
|
sources: [
|
||||||
vcs_tag(command: ['git', 'rev-parse', '--short', 'HEAD'], input: 'src/git-hash.h.in', output: 'git-hash.h', replace_string: '@MKXPZ_GIT_HASH@'),
|
vcs_tag(command: ['git', 'rev-parse', '--short', 'HEAD'], fallback: 'unknown', input: 'src/git-hash.h.in', output: 'git-hash.h', replace_string: '@MKXPZ_GIT_HASH@'),
|
||||||
'src/core.cpp',
|
'src/core.cpp',
|
||||||
'src/sharedstate.cpp',
|
'src/sharedstate.cpp',
|
||||||
'src/audio/alstream.cpp',
|
'src/audio/alstream.cpp',
|
||||||
|
@ -283,7 +283,7 @@ if get_option('retro') == true
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
|
||||||
global_sources += vcs_tag(command: ['git', 'rev-parse', '--short', 'HEAD'], input: 'src/git-hash.h.in', output: 'git-hash.h', replace_string: '@MKXPZ_GIT_HASH@')
|
global_sources += vcs_tag(command: ['git', 'rev-parse', '--short', 'HEAD'], fallback: 'unknown', input: 'src/git-hash.h.in', output: 'git-hash.h', replace_string: '@MKXPZ_GIT_HASH@')
|
||||||
|
|
||||||
xxd = find_program('xxd', native: true)
|
xxd = find_program('xxd', native: true)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Configure flags are based on the ones from https://github.com/ruby/ruby.wasm
|
# Configure flags are based on the ones from https://github.com/ruby/ruby.wasm
|
||||||
|
|
||||||
RUBY_VERSION ?= 3.3
|
RUBY_VERSION ?= 3.3
|
||||||
LIBRETRO_REF ?= 80d7a25029b9c60f3c71cda49108f4545897d195
|
LIBRETRO_REF ?= 7e74808db6706b89723811421ed43d8e8fdc6143
|
||||||
LIBYAML_VERSION ?= 0.2.5
|
LIBYAML_VERSION ?= 0.2.5
|
||||||
ZLIB_VERSION ?= 1.3.1
|
ZLIB_VERSION ?= 1.3.1
|
||||||
OPENSSL_VERSION ?= 3.2.0
|
OPENSSL_VERSION ?= 3.2.0
|
||||||
|
@ -26,9 +26,10 @@ RANLIB ?= ranlib
|
||||||
CFLAGS ?=
|
CFLAGS ?=
|
||||||
CXXFLAGS ?=
|
CXXFLAGS ?=
|
||||||
LDFLAGS ?=
|
LDFLAGS ?=
|
||||||
WASI_CFLAGS ?= -O3
|
WASI_CFLAGS ?= -Oz -DNDEBUG
|
||||||
WASI_CXXFLAGS ?= -O3
|
WASI_CXXFLAGS ?= -Oz -DNDEBUG
|
||||||
WASI_LDFLAGS ?=
|
WASI_LDFLAGS ?=
|
||||||
|
WASM_OPT_FLAGS ?= -Oz
|
||||||
|
|
||||||
BUILD_PREFIX := ${PWD}/build
|
BUILD_PREFIX := ${PWD}/build
|
||||||
OUTDIR := $(BUILD_PREFIX)/retro-phase1
|
OUTDIR := $(BUILD_PREFIX)/retro-phase1
|
||||||
|
@ -153,10 +154,10 @@ $(DOWNLOADS)/crossruby/Makefile $(DOWNLOADS)/crossruby/.ext/include/$(TARGET)/ru
|
||||||
WASI_SDK_PATH=$(WASI_SDK) \
|
WASI_SDK_PATH=$(WASI_SDK) \
|
||||||
$(WASI_TOOLCHAIN) \
|
$(WASI_TOOLCHAIN) \
|
||||||
LDFLAGS='-Wl,--export-dynamic,--stack-first,-z,stack-size=16777216 $(WASI_LDFLAGS)' \
|
LDFLAGS='-Wl,--export-dynamic,--stack-first,-z,stack-size=16777216 $(WASI_LDFLAGS)' \
|
||||||
XCFLAGS='-DWASM_SETJMP_STACK_BUFFER_SIZE=24576 -DWASM_FIBER_STACK_BUFFER_SIZE=24576 -DWASM_SCAN_STACK_BUFFER_SIZE=24576 $(WASI_CFLAGS)' \
|
XCFLAGS='-DWASM_SETJMP_STACK_BUFFER_SIZE=24576 -DWASM_FIBER_STACK_BUFFER_SIZE=24576 -DWASM_SCAN_STACK_BUFFER_SIZE=24576' \
|
||||||
debugflags=-g \
|
|
||||||
cppflags='$(WASI_CXXFLAGS)' \
|
cppflags='$(WASI_CXXFLAGS)' \
|
||||||
wasmoptflags='-O4 -g --pass-arg=asyncify-ignore-imports' \
|
optflags='$(WASI_CFLAGS) -fno-fast-math' \
|
||||||
|
wasmoptflags='$(WASM_OPT_FLAGS) --pass-arg=asyncify-ignore-imports' \
|
||||||
$(shell $(RUBY) -e 'puts "ac_cv_func_dlopen=no" if RUBY_VERSION.split(".")[..1].join(".").to_f < 3.3') \
|
$(shell $(RUBY) -e 'puts "ac_cv_func_dlopen=no" if RUBY_VERSION.split(".")[..1].join(".").to_f < 3.3') \
|
||||||
--disable-install-doc
|
--disable-install-doc
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,20 @@ The build process for the libretro core is divided into two phases.
|
||||||
|
|
||||||
All the files produced by this phase are platform-agnostic, so you can run this build phase on any computer, regardless of which operating system or CPU architecture the libretro core is for.
|
All the files produced by this phase are platform-agnostic, so you can run this build phase on any computer, regardless of which operating system or CPU architecture the libretro core is for.
|
||||||
|
|
||||||
Download [WASI SDK](https://github.com/WebAssembly/wasi-sdk), [Binaryen](https://github.com/WebAssembly/binaryen) and [WABT](https://github.com/WebAssembly/wabt). Currently you must use WASI SDK version 21; later versions of the WASI SDK do not work. Binaryen and WABT versions can be arbitrary as long as they're relatively recent. You also need to have either [Universal Ctags](https://github.com/universal-ctags/ctags) or [Exuberant Ctags](https://ctags.sourceforge.net) installed, which we use for generating bindings for the Ruby C API.
|
Required software:
|
||||||
|
* C and C++ compilers
|
||||||
|
* Make
|
||||||
|
* GNU Autotools
|
||||||
|
* [Git](https://git-scm.com)
|
||||||
|
* [xxd](https://github.com/vim/vim/blob/master/runtime/doc/xxd.man)
|
||||||
|
* [curl](https://curl.se)
|
||||||
|
* [Info-ZIP Zip](https://infozip.sourceforge.net/Zip.html) (the `zip` package found in many package managers)
|
||||||
|
* [WASI SDK](https://github.com/WebAssembly/wasi-sdk) (currently you need WASI SDK version 21; later versions don't work yet)
|
||||||
|
* [Binaryen](https://github.com/WebAssembly/binaryen)
|
||||||
|
* [WABT](https://github.com/WebAssembly/wabt)
|
||||||
|
* Either [Universal Ctags](https://github.com/universal-ctags/ctags) or [Exuberant Ctags](https://ctags.sourceforge.net)
|
||||||
|
|
||||||
Then go to the directory that this README.md is in and run this command, filling in the paths to WASI SDK, `wasm-opt` from Binaryen, `wasm2c` from WABT and `ctags` from Universal Ctags or Exuberant Ctags accordingly:
|
Go to the directory that this README.md is in and run this command, filling in the paths to WASI SDK, `wasm-opt` from Binaryen, `wasm2c` from WABT and `ctags` from Universal Ctags or Exuberant Ctags accordingly:
|
||||||
|
|
||||||
```
|
```
|
||||||
make WASI_SDK=/path/to/wasi-sdk WASM_OPT=/path/to/binaryen/bin/wasm-opt WASM2C=/path/to/wabt/bin/wasm2c CTAGS=/path/to/ctags
|
make WASI_SDK=/path/to/wasi-sdk WASM_OPT=/path/to/binaryen/bin/wasm-opt WASM2C=/path/to/wabt/bin/wasm2c CTAGS=/path/to/ctags
|
||||||
|
@ -16,7 +27,16 @@ This will produce the directory "retro/build/retro-phase1".
|
||||||
|
|
||||||
# Phase 2
|
# Phase 2
|
||||||
|
|
||||||
This phase produces the actual core file. You need to have [Meson](https://mesonbuild.com), [Ninja](https://ninja-build.org), [CMake](https://cmake.org), [Git](https://git-scm.com), a C compiler and a C++ compiler. No software libraries are required other than the system libraries.
|
This phase produces the actual core file.
|
||||||
|
|
||||||
|
Required software:
|
||||||
|
* C and C++ compilers
|
||||||
|
* [Git](https://git-scm.com)
|
||||||
|
* [Meson](https://mesonbuild.com)
|
||||||
|
* [Ninja](https://ninja-build.org)
|
||||||
|
* [CMake](https://cmake.org)
|
||||||
|
|
||||||
|
No software libraries are required other than the system libraries.
|
||||||
|
|
||||||
Go to the root directory of this repository and run:
|
Go to the root directory of this repository and run:
|
||||||
|
|
||||||
|
@ -25,5 +45,3 @@ meson setup build -Dretro=true -Dretro_phase1_path=path/to/retro-phase1
|
||||||
cd build
|
cd build
|
||||||
ninja
|
ninja
|
||||||
```
|
```
|
||||||
|
|
||||||
If you have a program named `patch` in your PATH, it has to be GNU patch. If your `patch` program isn't GNU patch (e.g. macOS comes with its own incompatible version of `patch` that will break this build system), either install GNU patch and then temporarily add it to your PATH for the duration of the `meson setup` command, or temporarily remove your `patch` program from the PATH for the duration of the `meson setup` command: the build system will fall back to using `git apply` if `patch` is not found, which will work fine.
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** extra-ruby-bindings.h
|
** ruby-bindings.h
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
|
|
|
@ -340,20 +340,23 @@ HEADER_START = <<~HEREDOC
|
||||||
}
|
}
|
||||||
|
|
||||||
static wasm_ptr_t init_inner(struct bindings &bind, struct fiber &fiber) {
|
static wasm_ptr_t init_inner(struct bindings &bind, struct fiber &fiber) {
|
||||||
|
wasm_ptr_t sp = w2c_#{MODULE_NAME}_rb_wasm_get_stack_pointer(bind.instance.get());
|
||||||
|
|
||||||
if (fiber.stack_ptr == fiber.stack.size()) {
|
if (fiber.stack_ptr == fiber.stack.size()) {
|
||||||
fiber.stack.emplace_back(
|
fiber.stack.emplace_back(
|
||||||
bind,
|
bind,
|
||||||
stack_frame_destructor,
|
stack_frame_destructor,
|
||||||
boost::typeindex::type_id<T>(),
|
boost::typeindex::type_id<T>(),
|
||||||
(bind.instance->w2c_0x5F_stack_pointer -= sizeof(T))
|
(sp -= sizeof(T))
|
||||||
);
|
);
|
||||||
assert(bind.instance->w2c_0x5F_stack_pointer % sizeof(VALUE) == 0);
|
assert(sp % sizeof(VALUE) == 0);
|
||||||
new(bind.instance->w2c_memory.data + bind.instance->w2c_0x5F_stack_pointer) T(bind);
|
new(bind.instance->w2c_memory.data + sp) T(bind);
|
||||||
} else if (fiber.stack_ptr > fiber.stack.size()) {
|
} else if (fiber.stack_ptr > fiber.stack.size()) {
|
||||||
throw SandboxTrapException();
|
throw SandboxTrapException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fiber.stack[fiber.stack_ptr].type == boost::typeindex::type_id<T>()) {
|
if (fiber.stack[fiber.stack_ptr].type == boost::typeindex::type_id<T>()) {
|
||||||
|
w2c_#{MODULE_NAME}_rb_wasm_set_stack_pointer(bind.instance.get(), sp);
|
||||||
return fiber.stack[fiber.stack_ptr++].ptr;
|
return fiber.stack[fiber.stack_ptr++].ptr;
|
||||||
} else {
|
} else {
|
||||||
while (fiber.stack.size() > fiber.stack_ptr) {
|
while (fiber.stack.size() > fiber.stack_ptr) {
|
||||||
|
@ -364,11 +367,12 @@ HEADER_START = <<~HEREDOC
|
||||||
bind,
|
bind,
|
||||||
stack_frame_destructor,
|
stack_frame_destructor,
|
||||||
boost::typeindex::type_id<T>(),
|
boost::typeindex::type_id<T>(),
|
||||||
(bind.instance->w2c_0x5F_stack_pointer -= sizeof(T))
|
(sp -= sizeof(T))
|
||||||
);
|
);
|
||||||
assert(bind.instance->w2c_0x5F_stack_pointer % sizeof(VALUE) == 0);
|
assert(sp % sizeof(VALUE) == 0);
|
||||||
new(bind.instance->w2c_memory.data + bind.instance->w2c_0x5F_stack_pointer) T(bind);
|
new(bind.instance->w2c_memory.data + sp) T(bind);
|
||||||
return bind.instance->w2c_0x5F_stack_pointer;
|
w2c_#{MODULE_NAME}_rb_wasm_set_stack_pointer(bind.instance.get(), sp);
|
||||||
|
return sp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +390,7 @@ HEADER_START = <<~HEREDOC
|
||||||
assert(fiber.stack.size() == fiber.stack_ptr);
|
assert(fiber.stack.size() == fiber.stack_ptr);
|
||||||
assert(fiber.stack.back().type == boost::typeindex::type_id<T>());
|
assert(fiber.stack.back().type == boost::typeindex::type_id<T>());
|
||||||
|
|
||||||
bind.instance->w2c_0x5F_stack_pointer = fiber.stack.back().ptr + sizeof(T);
|
w2c_#{MODULE_NAME}_rb_wasm_set_stack_pointer(bind.instance.get(), fiber.stack.back().ptr + sizeof(T));
|
||||||
fiber.stack.pop_back();
|
fiber.stack.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
17
src/core.cpp
17
src/core.cpp
|
@ -38,20 +38,16 @@
|
||||||
using namespace mkxp_retro;
|
using namespace mkxp_retro;
|
||||||
using namespace mkxp_sandbox;
|
using namespace mkxp_sandbox;
|
||||||
|
|
||||||
#if defined(__unix__) || defined(__APPLE__)
|
|
||||||
static inline void *malloc_align(size_t alignment, size_t size) {
|
static inline void *malloc_align(size_t alignment, size_t size) {
|
||||||
|
#if defined(__unix__) || defined(__APPLE__)
|
||||||
void *mem;
|
void *mem;
|
||||||
return posix_memalign(&mem, alignment, size) ? NULL : mem;
|
return posix_memalign(&mem, alignment, size) ? NULL : mem;
|
||||||
}
|
|
||||||
#elif defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
|
#elif defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
|
||||||
static inline void *malloc_align(size_t alignment, size_t size) {
|
|
||||||
return _aligned_malloc(size, alignment);
|
return _aligned_malloc(size, alignment);
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static inline void *malloc_align(size_t alignment, size_t size) {
|
|
||||||
return aligned_alloc(alignment, size);
|
return aligned_alloc(alignment, size);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
extern unsigned char GMGSx_sf2[];
|
extern unsigned char GMGSx_sf2[];
|
||||||
extern unsigned int GMGSx_sf2_len;
|
extern unsigned int GMGSx_sf2_len;
|
||||||
|
@ -74,14 +70,19 @@ static void fluid_log(int level, char *message, void *data) {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case FLUID_PANIC:
|
case FLUID_PANIC:
|
||||||
log_printf(RETRO_LOG_ERROR, "fluidsynth: panic: %s\n", message);
|
log_printf(RETRO_LOG_ERROR, "fluidsynth: panic: %s\n", message);
|
||||||
|
break;
|
||||||
case FLUID_ERR:
|
case FLUID_ERR:
|
||||||
log_printf(RETRO_LOG_ERROR, "fluidsynth: error: %s\n", message);
|
log_printf(RETRO_LOG_ERROR, "fluidsynth: error: %s\n", message);
|
||||||
|
break;
|
||||||
case FLUID_WARN:
|
case FLUID_WARN:
|
||||||
log_printf(RETRO_LOG_WARN, "fluidsynth: warning: %s\n", message);
|
log_printf(RETRO_LOG_WARN, "fluidsynth: warning: %s\n", message);
|
||||||
|
break;
|
||||||
case FLUID_INFO:
|
case FLUID_INFO:
|
||||||
log_printf(RETRO_LOG_INFO, "fluidsynth: %s\n", message);
|
log_printf(RETRO_LOG_INFO, "fluidsynth: %s\n", message);
|
||||||
|
break;
|
||||||
case FLUID_DBG:
|
case FLUID_DBG:
|
||||||
log_printf(RETRO_LOG_DEBUG, "fluidsynth: debug: %s\n", message);
|
log_printf(RETRO_LOG_DEBUG, "fluidsynth: debug: %s\n", message);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,11 +378,11 @@ extern "C" RETRO_API size_t retro_serialize_size() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" RETRO_API bool retro_serialize(void *data, size_t size) {
|
extern "C" RETRO_API bool retro_serialize(void *data, size_t len) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" RETRO_API bool retro_unserialize(const void *data, size_t size) {
|
extern "C" RETRO_API bool retro_unserialize(const void *data, size_t len) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
# Fixes compilation errors when compiling liblzma in MSYS2 and for homebrew consoles.
|
|
||||||
|
|
||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
||||||
--- a/CMakeLists.txt
|
|
||||||
+++ b/CMakeLists.txt
|
|
||||||
@@ -204,7 +204,6 @@ if((MINGW OR CYGWIN) AND (
|
|
||||||
# in PACKAGE_NAME_DEFINITION works with gcc and clang too so we don't need
|
|
||||||
# to worry how to pass different flags to windres and the C compiler.
|
|
||||||
# Keep the original PACKAGE_NAME intact for generation of liblzma.pc.
|
|
||||||
- string(APPEND CMAKE_RC_FLAGS " --use-temp-file")
|
|
||||||
string(REPLACE " " "\\x20" PACKAGE_NAME_DEFINITION "${PACKAGE_NAME}")
|
|
||||||
|
|
||||||
# Use octal because "Program Files" would become \x20F.
|
|
||||||
@@ -1113,23 +1112,6 @@ target_compile_definitions(liblzma PRIVATE TUKLIB_SYMBOL_PREFIX=lzma_)
|
|
||||||
tuklib_cpucores(liblzma)
|
|
||||||
tuklib_physmem(liblzma)
|
|
||||||
|
|
||||||
-# While liblzma can be built without tuklib_cpucores or tuklib_physmem
|
|
||||||
-# modules, the liblzma API functions lzma_cputhreads() and lzma_physmem()
|
|
||||||
-# will then be useless (which isn't too bad but still unfortunate). Since
|
|
||||||
-# I expect the CMake-based builds to be only used on systems that are
|
|
||||||
-# supported by these tuklib modules, problems with these tuklib modules
|
|
||||||
-# are considered a hard error for now. This hopefully helps to catch bugs
|
|
||||||
-# in the CMake versions of the tuklib checks.
|
|
||||||
-if(NOT TUKLIB_CPUCORES_FOUND OR NOT TUKLIB_PHYSMEM_FOUND)
|
|
||||||
- # Use SEND_ERROR instead of FATAL_ERROR. If someone reports a bug,
|
|
||||||
- # seeing the results of the remaining checks can be useful too.
|
|
||||||
- message(SEND_ERROR
|
|
||||||
- "tuklib_cpucores() or tuklib_physmem() failed. "
|
|
||||||
- "Unless you really are building for a system where these "
|
|
||||||
- "modules are not supported (unlikely), this is a bug in the "
|
|
||||||
- "included cmake/tuklib_*.cmake files that should be fixed. "
|
|
||||||
- "To build anyway, edit this CMakeLists.txt to ignore this error.")
|
|
||||||
-endif()
|
|
||||||
|
|
||||||
# Check for __attribute__((__constructor__)) support.
|
|
||||||
# This needs -Werror because some compilers just warn
|
|
||||||
@@ -1747,7 +1729,7 @@ endif()
|
|
||||||
# xz
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
-if(NOT MSVC OR MSVC_VERSION GREATER_EQUAL 1900)
|
|
||||||
+if(FALSE)
|
|
||||||
add_executable(xz
|
|
||||||
src/common/mythread.h
|
|
||||||
src/common/sysdefs.h
|
|
|
@ -106,3 +106,32 @@ diff --git a/common/alsem.h b/common/alsem.h
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace al
|
} // namespace al
|
||||||
|
diff --git a/common/althrd_setname.cpp b/common/althrd_setname.cpp
|
||||||
|
--- a/common/althrd_setname.cpp
|
||||||
|
+++ b/common/althrd_setname.cpp
|
||||||
|
@@ -55,13 +55,25 @@ using setname_t4 = int(*)(pthread_t, const char*, void*);
|
||||||
|
{ func(name); }
|
||||||
|
|
||||||
|
[[maybe_unused]] void setname_caller(setname_t2 func, const char *name)
|
||||||
|
+#ifdef MKXPZ_DEVKITPPC
|
||||||
|
+{ func(42, name); }
|
||||||
|
+#else
|
||||||
|
{ func(pthread_self(), name); }
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
[[maybe_unused]] void setname_caller(setname_t3 func, const char *name)
|
||||||
|
+#ifdef MKXPZ_DEVKITPPC
|
||||||
|
+{ func(42, name); }
|
||||||
|
+#else
|
||||||
|
{ func(pthread_self(), name); }
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
[[maybe_unused]] void setname_caller(setname_t4 func, const char *name)
|
||||||
|
+#ifdef MKXPZ_DEVKITPPC
|
||||||
|
+{ func(42, "%s", const_cast<char*>(name)); /* NOLINT(*-const-cast) */ }
|
||||||
|
+#else
|
||||||
|
{ func(pthread_self(), "%s", const_cast<char*>(name)); /* NOLINT(*-const-cast) */ }
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,23 @@
|
||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
--- a/CMakeLists.txt
|
--- a/CMakeLists.txt
|
||||||
+++ b/CMakeLists.txt
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -64,11 +64,11 @@ endif(COMMAND CMAKE_POLICY)
|
||||||
|
|
||||||
|
project(OpenAL)
|
||||||
|
|
||||||
|
-if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
- set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
|
||||||
|
- "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
|
||||||
|
- FORCE)
|
||||||
|
-endif()
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
if(NOT CMAKE_DEBUG_POSTFIX)
|
||||||
|
set(CMAKE_DEBUG_POSTFIX "" CACHE STRING
|
||||||
|
"Library postfix for debug builds. Normally left blank."
|
||||||
@@ -79,8 +79,8 @@ set(ALSOFT_STD_VERSION_PROPS
|
@@ -79,8 +79,8 @@ set(ALSOFT_STD_VERSION_PROPS
|
||||||
# Require C++17.
|
# Require C++17.
|
||||||
CXX_STANDARD 17
|
CXX_STANDARD 17
|
||||||
|
@ -103,6 +120,41 @@ diff --git a/alc/alconfig.cpp b/alc/alconfig.cpp
|
||||||
|
|
||||||
if(auto homedir = al::getenv("HOME"))
|
if(auto homedir = al::getenv("HOME"))
|
||||||
{
|
{
|
||||||
|
diff --git a/common/atomic.h b/common/atomic.h
|
||||||
|
--- a/common/atomic.h
|
||||||
|
+++ b/common/atomic.h
|
||||||
|
@@ -94,9 +94,9 @@ public:
|
||||||
|
{ return unique_ptr_t{mPointer.exchange(ptr.release(), m)}; }
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
- auto is_lock_free() const noexcept -> bool { return mPointer.is_lock_free(); }
|
||||||
|
+ auto is_lock_free() const noexcept -> bool { return true; }
|
||||||
|
|
||||||
|
- static constexpr auto is_always_lock_free = std::atomic<gsl::owner<T*>>::is_always_lock_free;
|
||||||
|
+ static constexpr auto is_always_lock_free = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace al
|
||||||
|
diff --git a/core/context.cpp b/core/context.cpp
|
||||||
|
--- a/core/context.cpp
|
||||||
|
+++ b/core/context.cpp
|
||||||
|
@@ -18,12 +18,12 @@
|
||||||
|
#include "voice_change.h"
|
||||||
|
|
||||||
|
|
||||||
|
-#ifdef __cpp_lib_atomic_is_always_lock_free
|
||||||
|
-static_assert(std::atomic<ContextBase::AsyncEventBitset>::is_always_lock_free, "atomic<bitset> isn't lock-free");
|
||||||
|
-#endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
|
||||||
|
ContextBase::ContextBase(DeviceBase *device) : mDevice{device}
|
||||||
|
-{ assert(mEnabledEvts.is_lock_free()); }
|
||||||
|
+{ }
|
||||||
|
|
||||||
|
ContextBase::~ContextBase()
|
||||||
|
{
|
||||||
diff --git a/core/helpers.cpp b/core/helpers.cpp
|
diff --git a/core/helpers.cpp b/core/helpers.cpp
|
||||||
--- a/core/helpers.cpp
|
--- a/core/helpers.cpp
|
||||||
+++ b/core/helpers.cpp
|
+++ b/core/helpers.cpp
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
diff --git a/build/cmake/CMakeLists.txt b/CMakeLists.txt
|
|
||||||
rename from build/cmake/CMakeLists.txt
|
|
||||||
rename to CMakeLists.txt
|
|
||||||
--- a/build/cmake/CMakeLists.txt
|
|
||||||
+++ b/CMakeLists.txt
|
|
||||||
@@ -23,8 +23,8 @@ cmake_policy(VERSION ${ZSTD_CMAKE_POLICY_VERSION})
|
|
||||||
|
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH on)
|
|
||||||
|
|
||||||
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
|
|
||||||
-set(ZSTD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
|
|
||||||
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/CMakeModules")
|
|
||||||
+set(ZSTD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
||||||
set(LIBRARY_DIR ${ZSTD_SOURCE_DIR}/lib)
|
|
||||||
# Parse version
|
|
||||||
include(GetZstdLibraryVersion)
|
|
||||||
@@ -143,7 +143,7 @@ endif ()
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# Add source directories
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
-add_subdirectory(lib)
|
|
||||||
+add_subdirectory(build/cmake/lib)
|
|
||||||
|
|
||||||
option(ZSTD_PROGRAMS_LINK_SHARED "PROGRAMS LINK SHARED" OFF)
|
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ add_custom_target(clean-all
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
write_basic_package_version_file(
|
|
||||||
- "${CMAKE_CURRENT_BINARY_DIR}/zstdConfigVersion.cmake"
|
|
||||||
+ "${CMAKE_CURRENT_BINARY_DIR}/build/cmake/zstdConfigVersion.cmake"
|
|
||||||
VERSION ${zstd_VERSION}
|
|
||||||
COMPATIBILITY SameMajorVersion
|
|
||||||
)
|
|
||||||
@@ -205,12 +205,12 @@ install(EXPORT zstdExports
|
|
||||||
DESTINATION ${ConfigPackageLocation}
|
|
||||||
)
|
|
||||||
configure_package_config_file(
|
|
||||||
- zstdConfig.cmake.in
|
|
||||||
- "${CMAKE_CURRENT_BINARY_DIR}/zstdConfig.cmake"
|
|
||||||
+ build/cmake/zstdConfig.cmake.in
|
|
||||||
+ "${CMAKE_CURRENT_BINARY_DIR}/build/cmake/zstdConfig.cmake"
|
|
||||||
INSTALL_DESTINATION ${ConfigPackageLocation}
|
|
||||||
)
|
|
||||||
install(FILES
|
|
||||||
- "${CMAKE_CURRENT_BINARY_DIR}/zstdConfig.cmake"
|
|
||||||
- "${CMAKE_CURRENT_BINARY_DIR}/zstdConfigVersion.cmake"
|
|
||||||
+ "${CMAKE_CURRENT_BINARY_DIR}/build/cmake/zstdConfig.cmake"
|
|
||||||
+ "${CMAKE_CURRENT_BINARY_DIR}/build/cmake/zstdConfigVersion.cmake"
|
|
||||||
DESTINATION ${ConfigPackageLocation}
|
|
||||||
)
|
|
Loading…
Add table
Reference in a new issue