From 82f85a4a6e963e16f732a8eca900592ed8a6b3c5 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 7 Nov 2024 07:46:13 +0300 Subject: [PATCH] Add WebAssembly and Solaris definitions from engine --- cmake/LibraryNaming.cmake | 6 ++++++ public/build.h | 16 ++++++++++++++++ scripts/waifulib/library_naming.py | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/cmake/LibraryNaming.cmake b/cmake/LibraryNaming.cmake index d71919fa..5f263436 100644 --- a/cmake/LibraryNaming.cmake +++ b/cmake/LibraryNaming.cmake @@ -54,6 +54,8 @@ check_group_build_target(XASH_SERENITY XASH_PLATFORM) check_group_build_target(XASH_IRIX XASH_PLATFORM) check_group_build_target(XASH_NSWITCH XASH_PLATFORM) check_group_build_target(XASH_PSVITA XASH_PLATFORM) +check_group_build_target(XASH_WASI XASH_PLATFORM) +check_group_build_target(XASH_SUNOS XASH_PLATFORM) check_group_build_target(XASH_X86 XASH_ARCHITECTURE) check_group_build_target(XASH_AMD64 XASH_ARCHITECTURE) check_group_build_target(XASH_ARM XASH_ARCHITECTURE) @@ -105,6 +107,10 @@ elseif(XASH_PSVITA) set(BUILDOS "psvita") elseif(XASH_IRIX) set(BUILDOS "irix") +elseif(XASH_WASI) + set(BUILDOS "wasi") +elseif(XASH_SUNOS) + set(BUILDOS "sunos") else() message(SEND_ERROR "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug") endif() diff --git a/public/build.h b/public/build.h index 851939b5..24fd9d5b 100644 --- a/public/build.h +++ b/public/build.h @@ -81,10 +81,13 @@ Then you can use another oneliner to query all variables: #undef XASH_RISCV_SINGLEFP #undef XASH_RISCV_SOFTFP #undef XASH_SERENITY +#undef XASH_SUNOS #undef XASH_WIN32 #undef XASH_X86 #undef XASH_NSWITCH #undef XASH_PSVITA +#undef XASH_WASI +#undef XASH_WASM //================================================================ // @@ -126,6 +129,10 @@ Then you can use another oneliner to query all variables: #define XASH_NSWITCH 1 #elif defined __vita__ #define XASH_PSVITA 1 + #elif defined __wasi__ + #define XASH_WASI 1 + #elif defined __sun__ + #define XASH_SUNOS 1 #else #error #endif @@ -234,10 +241,19 @@ Then you can use another oneliner to query all variables: #else #error "Unknown RISC-V float ABI" #endif +#elif defined __wasm__ + #if defined __wasm64__ + #define XASH_64BIT 1 + #endif + #define XASH_WASM 1 #else #error "Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug" #endif +#if !XASH_64BIT && ( defined( __LP64__ ) || defined( _LP64 )) +#define XASH_64BIT 1 +#endif + #if XASH_ARM == 8 #define XASH_ARMv8 1 #elif XASH_ARM == 7 diff --git a/scripts/waifulib/library_naming.py b/scripts/waifulib/library_naming.py index ac2faf6f..0095a88c 100644 --- a/scripts/waifulib/library_naming.py +++ b/scripts/waifulib/library_naming.py @@ -60,6 +60,8 @@ DEFINES = [ 'XASH_X86', 'XASH_NSWITCH', 'XASH_PSVITA', +'XASH_WASI', +'XASH_SUNOS', ] def configure(conf): @@ -97,6 +99,10 @@ def configure(conf): buildos = "psvita" elif conf.env.XASH_IRIX: buildos = "irix" + elif conf.env.XASH_WASI: + buildos = "wasi" + elif conf.env.XASH_SUNOS: + buildos = "sunos" else: conf.fatal("Place your operating system name in build.h and library_naming.py!\n" "If this is a mistake, try to fix conditions above and report a bug")