Fix xenia-core build on macOS
This commit is contained in:
parent
548758857f
commit
2962a266b5
|
@ -211,6 +211,11 @@ workspace("xenia")
|
||||||
architecture("x86_64")
|
architecture("x86_64")
|
||||||
if os.istarget("linux") then
|
if os.istarget("linux") then
|
||||||
platforms({"Linux"})
|
platforms({"Linux"})
|
||||||
|
elseif os.istarget("macosx") then
|
||||||
|
platforms({"Mac"})
|
||||||
|
xcodebuildsettings({
|
||||||
|
["ARCHS"] = "x86_64"
|
||||||
|
})
|
||||||
elseif os.istarget("windows") then
|
elseif os.istarget("windows") then
|
||||||
platforms({"Windows"})
|
platforms({"Windows"})
|
||||||
-- 10.0.15063.0: ID3D12GraphicsCommandList1::SetSamplePositions.
|
-- 10.0.15063.0: ID3D12GraphicsCommandList1::SetSamplePositions.
|
||||||
|
|
|
@ -48,7 +48,7 @@ void Arena::DebugFill() {
|
||||||
|
|
||||||
void* Arena::Alloc(size_t size, size_t align) {
|
void* Arena::Alloc(size_t size, size_t align) {
|
||||||
assert_true(
|
assert_true(
|
||||||
xe::bit_count(align) == 1 && align <= 16,
|
align > 0 && xe::is_pow2(align) && align <= 16,
|
||||||
"align needs to be a power of 2 and not greater than Chunk alignment");
|
"align needs to be a power of 2 and not greater than Chunk alignment");
|
||||||
|
|
||||||
// for alignment
|
// for alignment
|
||||||
|
|
|
@ -16,46 +16,7 @@
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
|
|
||||||
// These functions are modeled off of the Apple OSAtomic routines
|
#if XE_PLATFORM_WIN32
|
||||||
// https://developer.apple.com/documentation/kernel/osatomic_h (?)
|
|
||||||
// Original link (dead):
|
|
||||||
// https://developer.apple.com/library/mac/#documentation/DriversKernelHardware/Reference/libkern_ref/OSAtomic_h/
|
|
||||||
|
|
||||||
#if XE_PLATFORM_MAC
|
|
||||||
|
|
||||||
inline int32_t atomic_inc(volatile int32_t* value) {
|
|
||||||
return OSAtomicIncrement32Barrier(reinterpret_cast<volatile int32_t*>(value));
|
|
||||||
}
|
|
||||||
inline int32_t atomic_dec(volatile int32_t* value) {
|
|
||||||
return OSAtomicDecrement32Barrier(reinterpret_cast<volatile int32_t*>(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int32_t atomic_exchange(int32_t new_value, volatile int32_t* value) {
|
|
||||||
return OSAtomicCompareAndSwap32Barrier(*value, new_value, value);
|
|
||||||
}
|
|
||||||
inline int64_t atomic_exchange(int64_t new_value, volatile int64_t* value) {
|
|
||||||
return OSAtomicCompareAndSwap64Barrier(*value, new_value, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int32_t atomic_exchange_add(int32_t amount, volatile int32_t* value) {
|
|
||||||
return OSAtomicAdd32Barrier(amount, value) - amount;
|
|
||||||
}
|
|
||||||
inline int64_t atomic_exchange_add(int64_t amount, volatile int64_t* value) {
|
|
||||||
return OSAtomicAdd64Barrier(amount, value) - amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool atomic_cas(int32_t old_value, int32_t new_value,
|
|
||||||
volatile int32_t* value) {
|
|
||||||
return OSAtomicCompareAndSwap32Barrier(
|
|
||||||
old_value, new_value, reinterpret_cast<volatile int32_t*>(value));
|
|
||||||
}
|
|
||||||
inline bool atomic_cas(int64_t old_value, int64_t new_value,
|
|
||||||
volatile int64_t* value) {
|
|
||||||
return OSAtomicCompareAndSwap64Barrier(
|
|
||||||
old_value, new_value, reinterpret_cast<volatile int64_t*>(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif XE_PLATFORM_WIN32
|
|
||||||
|
|
||||||
inline int32_t atomic_inc(volatile int32_t* value) {
|
inline int32_t atomic_inc(volatile int32_t* value) {
|
||||||
return _InterlockedIncrement(reinterpret_cast<volatile long*>(value));
|
return _InterlockedIncrement(reinterpret_cast<volatile long*>(value));
|
||||||
|
@ -94,7 +55,7 @@ inline bool atomic_cas(int64_t old_value, int64_t new_value,
|
||||||
old_value) == old_value;
|
old_value) == old_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif XE_PLATFORM_LINUX
|
#elif XE_PLATFORM_LINUX || XE_PLATFORM_MAC
|
||||||
|
|
||||||
inline int32_t atomic_inc(volatile int32_t* value) {
|
inline int32_t atomic_inc(volatile int32_t* value) {
|
||||||
return __sync_add_and_fetch(value, 1);
|
return __sync_add_and_fetch(value, 1);
|
||||||
|
@ -132,7 +93,7 @@ inline bool atomic_cas(int64_t old_value, int64_t new_value,
|
||||||
|
|
||||||
#error No atomic primitives defined for this platform/cpu combination.
|
#error No atomic primitives defined for this platform/cpu combination.
|
||||||
|
|
||||||
#endif // OSX
|
#endif // XE_PLATFORM
|
||||||
|
|
||||||
inline uint32_t atomic_inc(volatile uint32_t* value) {
|
inline uint32_t atomic_inc(volatile uint32_t* value) {
|
||||||
return static_cast<uint32_t>(
|
return static_cast<uint32_t>(
|
||||||
|
|
|
@ -80,7 +80,7 @@ uint64_t Clock::host_tick_frequency_raw() {
|
||||||
// For some CPUs, Crystal frequency is not reported.
|
// For some CPUs, Crystal frequency is not reported.
|
||||||
if (ratio_num && ratio_den && cryst_freq) {
|
if (ratio_num && ratio_den && cryst_freq) {
|
||||||
// If it is, calculate the TSC frequency
|
// If it is, calculate the TSC frequency
|
||||||
auto tsc_freq = cryst_freq * ratio_num / ratio_den;
|
return cryst_freq * ratio_num / ratio_den;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,8 +280,7 @@ class Logger {
|
||||||
// many blocks needed for at least one log line.
|
// many blocks needed for at least one log line.
|
||||||
auto next_range = dp::sequence_range(next_sequence, desired_count);
|
auto next_range = dp::sequence_range(next_sequence, desired_count);
|
||||||
|
|
||||||
auto available_sequence = claim_strategy_.wait_until_published(
|
claim_strategy_.wait_until_published(next_range.last(), last_sequence);
|
||||||
next_range.last(), last_sequence);
|
|
||||||
|
|
||||||
size_t read_count = 0;
|
size_t read_count = 0;
|
||||||
auto available_range = next_range;
|
auto available_range = next_range;
|
||||||
|
|
|
@ -241,7 +241,6 @@ std::string_view::size_type find_any_of(const std::string_view haystack,
|
||||||
|
|
||||||
auto [haystack_begin, haystack_end] = make_citer(haystack);
|
auto [haystack_begin, haystack_end] = make_citer(haystack);
|
||||||
auto [needle_begin, needle_end] = make_citer(needles);
|
auto [needle_begin, needle_end] = make_citer(needles);
|
||||||
auto needle_count = count(needles);
|
|
||||||
|
|
||||||
auto it = find_needle(haystack_begin, haystack_end, needle_begin, needle_end);
|
auto it = find_needle(haystack_begin, haystack_end, needle_begin, needle_end);
|
||||||
if (it == haystack_end) {
|
if (it == haystack_end) {
|
||||||
|
@ -261,7 +260,6 @@ std::string_view::size_type find_any_of_case(const std::string_view haystack,
|
||||||
|
|
||||||
auto [haystack_begin, haystack_end] = make_citer(haystack);
|
auto [haystack_begin, haystack_end] = make_citer(haystack);
|
||||||
auto [needle_begin, needle_end] = make_citer(needles);
|
auto [needle_begin, needle_end] = make_citer(needles);
|
||||||
auto needle_count = count(needles);
|
|
||||||
|
|
||||||
auto it =
|
auto it =
|
||||||
find_needle_case(haystack_begin, haystack_end, needle_begin, needle_end);
|
find_needle_case(haystack_begin, haystack_end, needle_begin, needle_end);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit fb6c32ddf75d818dce39e2f7d00401e9864a8d4d
|
Subproject commit e07c38c67578352e3f3e769cdac91650ea9575a9
|
|
@ -30,7 +30,7 @@ function sdl2_include()
|
||||||
includedirs({
|
includedirs({
|
||||||
path.getrelative(".", third_party_path) .. "/SDL2/include",
|
path.getrelative(".", third_party_path) .. "/SDL2/include",
|
||||||
})
|
})
|
||||||
filter("platforms:Linux")
|
filter("platforms:Linux or platforms:Mac")
|
||||||
includedirs(sdl2_sys_includedirs)
|
includedirs(sdl2_sys_includedirs)
|
||||||
filter({})
|
filter({})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue