msys2: fix build (#3818)

* cmake: fix mingw-w64 build

* time.cpp: fix build with Clang on Windows

* tls.h: include malloc.h for alloca
This commit is contained in:
oltolm
2025-11-22 09:32:29 +01:00
committed by GitHub
parent 56109a1331
commit 4922d526fe
4 changed files with 35 additions and 11 deletions

View File

@@ -228,8 +228,10 @@ find_package(half 1.12.0 MODULE)
find_package(magic_enum 0.9.7 CONFIG) find_package(magic_enum 0.9.7 CONFIG)
find_package(PNG 1.6 MODULE) find_package(PNG 1.6 MODULE)
find_package(RenderDoc 1.6.0 MODULE) find_package(RenderDoc 1.6.0 MODULE)
find_package(SDL3 3.1.2 CONFIG)
find_package(SDL3_mixer 2.8.1 CONFIG) find_package(SDL3_mixer 2.8.1 CONFIG)
if (SDL3_mixer_FOUND)
find_package(SDL3 3.1.2 CONFIG)
endif()
find_package(stb MODULE) find_package(stb MODULE)
find_package(toml11 4.2.0 CONFIG) find_package(toml11 4.2.0 CONFIG)
find_package(tsl-robin-map 1.3.0 CONFIG) find_package(tsl-robin-map 1.3.0 CONFIG)
@@ -554,6 +556,8 @@ set(FIBER_LIB src/core/libraries/fiber/fiber_context.s
src/core/libraries/fiber/fiber_error.h src/core/libraries/fiber/fiber_error.h
) )
set_source_files_properties(src/core/libraries/fiber/fiber_context.s PROPERTIES COMPILE_OPTIONS -Wno-unused-command-line-argument)
set(VDEC_LIB src/core/libraries/videodec/videodec2_impl.cpp set(VDEC_LIB src/core/libraries/videodec/videodec2_impl.cpp
src/core/libraries/videodec/videodec2_impl.h src/core/libraries/videodec/videodec2_impl.h
src/core/libraries/videodec/videodec2.cpp src/core/libraries/videodec/videodec2.cpp
@@ -1122,22 +1126,22 @@ if (APPLE)
endif() endif()
if (WIN32) if (WIN32)
target_link_libraries(shadps4 PRIVATE mincore wepoll) target_link_libraries(shadps4 PRIVATE mincore wepoll wbemuuid)
if (MSVC) if (MSVC)
# MSVC likes putting opinions on what people can use, disable: # MSVC likes putting opinions on what people can use, disable:
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) add_compile_definitions(_CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE _SCL_SECURE_NO_WARNINGS)
endif() endif()
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) add_compile_definitions(NOMINMAX WIN32_LEAN_AND_MEAN)
if (MSVC) if (MSVC)
# Needed for conflicts with time.h of windows.h # Needed for conflicts with time.h of windows.h
add_definitions(-D_TIMESPEC_DEFINED) add_compile_definitions(_TIMESPEC_DEFINED)
endif() endif()
# Target Windows 10 RS5 # Target Windows 10 RS5
add_definitions(-DNTDDI_VERSION=0x0A000006 -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00) add_compile_definitions(NTDDI_VERSION=0x0A000006 _WIN32_WINNT=0x0A00 WINVER=0x0A00)
if (MSVC) if (MSVC)
target_link_libraries(shadps4 PRIVATE clang_rt.builtins-x86_64.lib) target_link_libraries(shadps4 PRIVATE clang_rt.builtins-x86_64.lib)
@@ -1169,7 +1173,7 @@ if (WIN32)
target_sources(shadps4 PRIVATE src/shadps4.rc) target_sources(shadps4 PRIVATE src/shadps4.rc)
endif() endif()
add_definitions(-DBOOST_ASIO_STANDALONE) add_compile_definitions(BOOST_ASIO_STANDALONE)
target_include_directories(shadps4 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(shadps4 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -152,7 +152,7 @@ endif()
# sirit # sirit
add_subdirectory(sirit) add_subdirectory(sirit)
if (WIN32) if (WIN32)
target_compile_options(sirit PUBLIC "-Wno-error=unused-command-line-argument") target_compile_options(sirit PRIVATE "-Wno-error=unused-command-line-argument")
endif() endif()
# half # half

View File

@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <ctime>
#include <thread> #include <thread>
#include "common/assert.h" #include "common/assert.h"
@@ -485,25 +486,41 @@ Common::NativeClock* GetClock() {
s32 PS4_SYSV_ABI sceKernelConvertUtcToLocaltime(time_t time, time_t* local_time, s32 PS4_SYSV_ABI sceKernelConvertUtcToLocaltime(time_t time, time_t* local_time,
struct OrbisTimesec* st, u64* dst_sec) { struct OrbisTimesec* st, u64* dst_sec) {
LOG_TRACE(Kernel, "Called"); LOG_TRACE(Kernel, "Called");
#ifdef _WIN32
TIME_ZONE_INFORMATION tz{};
DWORD res = GetTimeZoneInformation(&tz);
*local_time = time - tz.Bias;
if (st != nullptr) {
st->t = time;
st->west_sec = -tz.Bias * 60;
st->dst_sec = res == TIME_ZONE_ID_DAYLIGHT ? -_dstbias : 0;
}
if (dst_sec != nullptr) {
*dst_sec = res == TIME_ZONE_ID_DAYLIGHT ? -_dstbias : 0;
}
#else
#ifdef __APPLE__ #ifdef __APPLE__
// std::chrono::current_zone() not available yet. // std::chrono::current_zone() not available yet.
const auto* time_zone = date::current_zone(); const auto* time_zone = date::current_zone();
#else #else
const auto* time_zone = std::chrono::current_zone(); const auto* time_zone = std::chrono::current_zone();
#endif #endif // __APPLE__
auto info = time_zone->get_info(std::chrono::system_clock::now()); auto info = time_zone->get_info(std::chrono::system_clock::now());
*local_time = info.offset.count() + info.save.count() * 60 + time; *local_time = info.offset.count() + info.save.count() * 60 + time;
if (st != nullptr) { if (st != nullptr) {
st->t = time; st->t = time;
st->west_sec = info.offset.count() * 60; st->west_sec = info.offset.count();
st->dst_sec = info.save.count() * 60; st->dst_sec = info.save.count() * 60;
} }
if (dst_sec != nullptr) { if (dst_sec != nullptr) {
*dst_sec = info.save.count() * 60; *dst_sec = info.save.count() * 60;
} }
#endif // _WIN32
return ORBIS_OK; return ORBIS_OK;
} }
@@ -565,4 +582,4 @@ void RegisterTime(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("-o5uEDpN+oY", "libkernel", 1, "libkernel", sceKernelConvertUtcToLocaltime); LIB_FUNCTION("-o5uEDpN+oY", "libkernel", 1, "libkernel", sceKernelConvertUtcToLocaltime);
} }
} // namespace Libraries::Kernel } // namespace Libraries::Kernel

View File

@@ -5,6 +5,9 @@
#include <cstring> #include <cstring>
#include "common/types.h" #include "common/types.h"
#ifdef _WIN32
#include <malloc.h>
#endif
namespace Xbyak { namespace Xbyak {
class CodeGenerator; class CodeGenerator;