[Build] Generalize POSIX platform guards
Most non-Windows code paths use standard POSIX APIs (sockets, signals, dlopen, threading) that work on any POSIX platform. Change Linux-specific guards to !WIN32 or #else where the code is portable. Linux-specific APIs (SIGRTMIN, Vulkan/X11, fontconfig/GTK) remain Linux-guarded.
This commit is contained in:
@@ -12,10 +12,10 @@
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/platform.h"
|
||||
|
||||
#if XE_PLATFORM_LINUX
|
||||
#include <dlfcn.h>
|
||||
#elif XE_PLATFORM_WIN32
|
||||
#if XE_PLATFORM_WIN32
|
||||
#include "xenia/base/platform_win.h"
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
namespace xe {
|
||||
@@ -29,7 +29,14 @@ std::unique_ptr<RenderDocAPI> RenderDocAPI::CreateIfConnected() {
|
||||
// The RenderDoc library should already be loaded into the process if
|
||||
// RenderDoc is attached - this is why RTLD_NOLOAD or GetModuleHandle instead
|
||||
// of LoadLibrary.
|
||||
#if XE_PLATFORM_LINUX
|
||||
#if XE_PLATFORM_WIN32
|
||||
renderdoc_api->library_ = GetModuleHandleW(L"renderdoc.dll");
|
||||
if (!renderdoc_api->library_) {
|
||||
return nullptr;
|
||||
}
|
||||
get_api = pRENDERDOC_GetAPI(
|
||||
GetProcAddress(renderdoc_api->library_, "RENDERDOC_GetAPI"));
|
||||
#else
|
||||
#if XE_PLATFORM_ANDROID
|
||||
const char* const library_name = "libVkLayer_GLES_RenderDoc.so";
|
||||
#else
|
||||
@@ -41,13 +48,6 @@ std::unique_ptr<RenderDocAPI> RenderDocAPI::CreateIfConnected() {
|
||||
}
|
||||
get_api =
|
||||
pRENDERDOC_GetAPI(dlsym(renderdoc_api->library_, "RENDERDOC_GetAPI"));
|
||||
#elif XE_PLATFORM_WIN32
|
||||
renderdoc_api->library_ = GetModuleHandleW(L"renderdoc.dll");
|
||||
if (!renderdoc_api->library_) {
|
||||
return nullptr;
|
||||
}
|
||||
get_api = pRENDERDOC_GetAPI(
|
||||
GetProcAddress(renderdoc_api->library_, "RENDERDOC_GetAPI"));
|
||||
#endif
|
||||
|
||||
// get_api will be null if RenderDoc is not connected, or the API isn't
|
||||
@@ -65,7 +65,7 @@ std::unique_ptr<RenderDocAPI> RenderDocAPI::CreateIfConnected() {
|
||||
}
|
||||
|
||||
RenderDocAPI::~RenderDocAPI() {
|
||||
#if XE_PLATFORM_LINUX
|
||||
#if !XE_PLATFORM_WIN32
|
||||
if (library_) {
|
||||
dlclose(library_);
|
||||
}
|
||||
|
||||
@@ -37,10 +37,10 @@ class RenderDocAPI {
|
||||
private:
|
||||
explicit RenderDocAPI() = default;
|
||||
|
||||
#if XE_PLATFORM_LINUX
|
||||
void* library_ = nullptr;
|
||||
#elif XE_PLATFORM_WIN32
|
||||
#if XE_PLATFORM_WIN32
|
||||
HMODULE library_ = nullptr;
|
||||
#else
|
||||
void* library_ = nullptr;
|
||||
#endif
|
||||
|
||||
const RENDERDOC_API_1_0_0* api_1_0_0_ = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user