mirror of https://github.com/bsnes-emu/bsnes.git
Allow Haiku build of libretro target
This commit is contained in:
parent
74f6ffe89b
commit
6fc6bf14a3
|
@ -19,6 +19,8 @@ obj/libretro.o: target-libretro/libretro.cpp
|
||||||
all: $(objects)
|
all: $(objects)
|
||||||
ifeq ($(platform),linux)
|
ifeq ($(platform),linux)
|
||||||
$(strip $(compiler) -o out/$(name).so -shared $(objects) -Wl,--no-undefined -Wl,--version-script=target-libretro/link.T -lgomp -Wl,-Bdynamic $(options))
|
$(strip $(compiler) -o out/$(name).so -shared $(objects) -Wl,--no-undefined -Wl,--version-script=target-libretro/link.T -lgomp -Wl,-Bdynamic $(options))
|
||||||
|
else ifeq ($(platform),haiku)
|
||||||
|
$(strip $(compiler) -o out/$(name).so -shared $(objects) -Wl,--no-undefined -Wl,--version-script=target-libretro/link.T -lgomp -Wl,-Bdynamic $(options))
|
||||||
else ifeq ($(platform),windows)
|
else ifeq ($(platform),windows)
|
||||||
$(strip $(compiler) -o out/$(name).dll -shared $(objects) -Wl,--no-undefined -Wl,--version-script=target-libretro/link.T -lgomp -Wl,-Bdynamic $(options))
|
$(strip $(compiler) -o out/$(name).dll -shared $(objects) -Wl,--no-undefined -Wl,--version-script=target-libretro/link.T -lgomp -Wl,-Bdynamic $(options))
|
||||||
else ifeq ($(platform),macos)
|
else ifeq ($(platform),macos)
|
||||||
|
|
|
@ -32,6 +32,8 @@ ifeq ($(platform),)
|
||||||
platform := linux
|
platform := linux
|
||||||
else ifneq ($(findstring BSD,$(uname)),)
|
else ifneq ($(findstring BSD,$(uname)),)
|
||||||
platform := bsd
|
platform := bsd
|
||||||
|
else ifneq ($(findstring Haiku,$(uname)),)
|
||||||
|
platform := haiku
|
||||||
else
|
else
|
||||||
$(error unknown platform, please specify manually.)
|
$(error unknown platform, please specify manually.)
|
||||||
endif
|
endif
|
||||||
|
@ -139,6 +141,11 @@ ifeq ($(platform),bsd)
|
||||||
options += -lstdc++ -lm
|
options += -lstdc++ -lm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# haiku settings
|
||||||
|
ifeq ($(platform),haiku)
|
||||||
|
options += -lroot
|
||||||
|
endif
|
||||||
|
|
||||||
# threading support
|
# threading support
|
||||||
ifeq ($(threaded),true)
|
ifeq ($(threaded),true)
|
||||||
ifneq ($(filter $(platform),linux bsd),)
|
ifneq ($(filter $(platform),linux bsd),)
|
||||||
|
|
|
@ -267,6 +267,7 @@ inline auto directory::copy(const string& source, const string& target) -> bool
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
inline auto directoryIsFolder(DIR* dp, struct dirent* ep) -> bool {
|
inline auto directoryIsFolder(DIR* dp, struct dirent* ep) -> bool {
|
||||||
|
#if defined(PLATFORM_MACOS) || defined(PLATFORM_LINUX) || defined(PLATFORM_BSD)
|
||||||
if(ep->d_type == DT_DIR) return true;
|
if(ep->d_type == DT_DIR) return true;
|
||||||
if(ep->d_type == DT_LNK || ep->d_type == DT_UNKNOWN) {
|
if(ep->d_type == DT_LNK || ep->d_type == DT_UNKNOWN) {
|
||||||
//symbolic links must be resolved to determine type
|
//symbolic links must be resolved to determine type
|
||||||
|
@ -274,6 +275,15 @@ inline auto directory::copy(const string& source, const string& target) -> bool
|
||||||
fstatat(dirfd(dp), ep->d_name, &sp, 0);
|
fstatat(dirfd(dp), ep->d_name, &sp, 0);
|
||||||
return S_ISDIR(sp.st_mode);
|
return S_ISDIR(sp.st_mode);
|
||||||
}
|
}
|
||||||
|
#else // strictly POSIX systems
|
||||||
|
struct stat sp = {0};
|
||||||
|
stat(ep->d_name, &sp);
|
||||||
|
if S_ISDIR(sp.st_mode) return true;
|
||||||
|
if (S_ISLNK(sp.st_mode) || not S_ISREG(sp.st_mode)) {
|
||||||
|
fstatat(dirfd(dp), ep->d_name, &sp, 0);
|
||||||
|
return S_ISDIR(sp.st_mode);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace nall {
|
||||||
using uint = unsigned;
|
using uint = unsigned;
|
||||||
|
|
||||||
enum class Compiler : uint { Clang, GCC, Microsoft, Unknown };
|
enum class Compiler : uint { Clang, GCC, Microsoft, Unknown };
|
||||||
enum class Platform : uint { Windows, MacOS, Linux, BSD, Android, Unknown };
|
enum class Platform : uint { Windows, MacOS, Linux, BSD, Haiku, Android, Unknown };
|
||||||
enum class API : uint { Windows, Posix, Unknown };
|
enum class API : uint { Windows, Posix, Unknown };
|
||||||
enum class DisplayServer : uint { Windows, Quartz, Xorg, Unknown };
|
enum class DisplayServer : uint { Windows, Quartz, Xorg, Unknown };
|
||||||
enum class Architecture : uint { x86, amd64, ARM32, ARM64, PPC32, PPC64, Unknown };
|
enum class Architecture : uint { x86, amd64, ARM32, ARM64, PPC32, PPC64, Unknown };
|
||||||
|
@ -105,6 +105,13 @@ namespace nall {
|
||||||
constexpr auto platform() -> Platform { return Platform::BSD; }
|
constexpr auto platform() -> Platform { return Platform::BSD; }
|
||||||
constexpr auto api() -> API { return API::Posix; }
|
constexpr auto api() -> API { return API::Posix; }
|
||||||
constexpr auto display() -> DisplayServer { return DisplayServer::Xorg; }
|
constexpr auto display() -> DisplayServer { return DisplayServer::Xorg; }
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
#define PLATFORM_HAIKU
|
||||||
|
#define API_POSIX
|
||||||
|
#define DISPLAY_UNKNOWN
|
||||||
|
constexpr auto platform() -> Platform { return Platform::Haiku; }
|
||||||
|
constexpr auto api() -> API { return API::Posix; }
|
||||||
|
constexpr auto display() -> DisplayServer { return DisplayServer::Unknown; }
|
||||||
#else
|
#else
|
||||||
#warning "unable to detect platform"
|
#warning "unable to detect platform"
|
||||||
#define PLATFORM_UNKNOWN
|
#define PLATFORM_UNKNOWN
|
||||||
|
|
Loading…
Reference in New Issue