1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Mac OS build update and simplification, recent releases of macOS has clock_gettime support.

This commit is contained in:
David Carlier 2021-04-24 09:11:27 +01:00 committed by Ivan
parent 486ba6121d
commit 0b9e4ffe54
3 changed files with 10 additions and 2 deletions

View File

@ -8,6 +8,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)
# Check for a sufficient compiler and set build options
include(ConfigureCompiler)
include(CheckFunctionExists)
set(ADDITIONAL_LIBS "")
if(CMAKE_SYSTEM MATCHES "Linux")

View File

@ -505,6 +505,13 @@ target_link_libraries(rpcs3_emu
3rdparty::span 3rdparty::xxhash
)
if(APPLE)
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
if (${HAVE_CLOCK_GETTIME})
target_compile_definitions(rpcs3_emu PUBLIC -DHAVE_CLOCK_GETTIME)
endif()
endif()
if(USE_PRECOMPILED_HEADERS)
if(COMMAND target_precompile_headers)

View File

@ -44,13 +44,12 @@ const auto s_time_aux_info = []() -> time_aux_info_t
#elif __APPLE__
// XXX only supports a single timer
#if !defined(HAVE_CLOCK_GETTIME)
#define TIMER_ABSTIME -1
// The opengroup spec isn't clear on the mapping from REALTIME to CALENDAR being appropriate or not.
// http://pubs.opengroup.org/onlinepubs/009695299/basedefs/time.h.html
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME 1 // #define CALENDAR_CLOCK 1 from mach/clock_types.h
#define CLOCK_MONOTONIC 0 // #define SYSTEM_CLOCK 0
#endif
// the mach kernel uses struct mach_timespec, so struct timespec is loaded from <sys/_types/_timespec.h> for compatability
// struct timespec { time_t tv_sec; long tv_nsec; };
@ -103,6 +102,7 @@ static int clock_gettime(int clk_id, struct timespec* tp)
return retval;
}
#endif
#endif