mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-29 11:06:07 +00:00
Only use date library on macOS.
This commit is contained in:
parent
b557de2c62
commit
426d82d07b
|
@ -67,7 +67,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|||
|
||||
find_package(Boost 1.84.0 CONFIG)
|
||||
find_package(cryptopp 8.9.0 MODULE)
|
||||
find_package(date 3.0.1 CONFIG)
|
||||
find_package(fmt 10.2.1 CONFIG)
|
||||
find_package(glslang 14.2.0 CONFIG)
|
||||
find_package(magic_enum 0.9.6 CONFIG)
|
||||
|
@ -81,6 +80,10 @@ find_package(xxHash 0.8.2 MODULE)
|
|||
find_package(zlib-ng 2.2.0 MODULE)
|
||||
find_package(Zydis 4.1.0 CONFIG)
|
||||
|
||||
if (APPLE)
|
||||
find_package(date 3.0.1 CONFIG)
|
||||
endif()
|
||||
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(pthread_mutex_timedlock "pthread.h" HAVE_PTHREAD_MUTEX_TIMEDLOCK)
|
||||
# Windows always has the function through winpthreads
|
||||
|
@ -554,7 +557,7 @@ endif()
|
|||
|
||||
create_target_directory_groups(shadps4)
|
||||
|
||||
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient date::date-tz)
|
||||
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient)
|
||||
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::SPIRV glslang::glslang SDL3::SDL3)
|
||||
|
||||
if (APPLE)
|
||||
|
@ -564,6 +567,9 @@ if (APPLE)
|
|||
# Link MoltenVK for Vulkan support
|
||||
find_library(MOLTENVK MoltenVK REQUIRED)
|
||||
target_link_libraries(shadps4 PRIVATE ${MOLTENVK})
|
||||
|
||||
# Replacement for std::chrono::time_zone
|
||||
target_link_libraries(shadps4 PRIVATE date::date-tz)
|
||||
endif()
|
||||
|
||||
if (NOT ENABLE_QT_GUI)
|
||||
|
|
2
externals/CMakeLists.txt
vendored
2
externals/CMakeLists.txt
vendored
|
@ -135,7 +135,7 @@ if (WIN32)
|
|||
endif()
|
||||
|
||||
# date
|
||||
if (NOT TARGET date::date-tz)
|
||||
if (APPLE AND NOT TARGET date::date-tz)
|
||||
option(BUILD_TZ_LIB "" ON)
|
||||
option(USE_SYSTEM_TZ_DB "" ON)
|
||||
add_subdirectory(date)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <date/tz.h>
|
||||
|
||||
#include <boost/asio/io_context.hpp>
|
||||
|
||||
|
@ -33,6 +32,9 @@
|
|||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/mman.h>
|
||||
#ifdef __APPLE__
|
||||
#include <date/tz.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
@ -182,7 +184,12 @@ s64 PS4_SYSV_ABI ps4__write(int d, const void* buf, std::size_t nbytes) {
|
|||
int PS4_SYSV_ABI sceKernelConvertUtcToLocaltime(time_t time, time_t* local_time,
|
||||
struct OrbisTimesec* st, unsigned long* dst_sec) {
|
||||
LOG_TRACE(Kernel, "Called");
|
||||
#ifdef __APPLE__
|
||||
// std::chrono::current_zone() not available yet.
|
||||
const auto* time_zone = date::current_zone();
|
||||
#else
|
||||
const auto* time_zone = std::chrono::current_zone();
|
||||
#endif
|
||||
auto info = time_zone->get_info(std::chrono::system_clock::now());
|
||||
|
||||
*local_time = info.offset.count() + info.save.count() * 60 + time;
|
||||
|
|
Loading…
Reference in a new issue