From 92fa17df3de1635bca574c9b324ad23f4bc53c4b Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 23 Jul 2023 22:25:18 -0700 Subject: [PATCH 1/4] Fix CMake install rpath issues on Mac 10.5 --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9f5c6f215..69cbc039b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,10 @@ if(APPLE) if (PLASMA_MAC_UNIVERSAL) set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)") endif() + + if(CMAKE_SYSTEM_VERSION VERSION_LESS 10) # Darwin 10 == Mac OS X 10.6 + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + endif() endif(CMAKE_SYSTEM_NAME MATCHES "Darwin") endif(APPLE) From 2c8a326016453bf60d80938de74ab2df2782c3c3 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 23 Jul 2023 22:25:57 -0700 Subject: [PATCH 2/4] Define ALC_ALL_DEVICES_SPECIFIER if missing This is missing from older versions of Apple's OpenAL.framework headers. We check if it's supported before trying to use it, but it does need to be defined. --- Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp index 401001a7af..612716f878 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp @@ -79,6 +79,10 @@ ST::string kDefaultDeviceMagic = ST_LITERAL("(Default Device)"); #define MAX_NUM_SOURCES 128 #define UPDATE_TIME_MS 100 +#ifndef ALC_ALL_DEVICES_SPECIFIER +# define ALC_ALL_DEVICES_SPECIFIER 0x1013 +#endif + plProfile_CreateTimer("EAX Update", "Sound", SoundEAXUpdate); plProfile_CreateTimer("Soft Update", "Sound", SoundSoftUpdate); plProfile_CreateCounter("Max Sounds", "Sound", SoundMaxNum); From fd5115a54f0c7bf1c14a90feb5083a4aa95336a0 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 23 Jul 2023 22:26:54 -0700 Subject: [PATCH 3/4] Restore gettimeofday in plUnifiedTime for older Mac versions Co-Authored-By: dgelessus --- .../plUnifiedTime/plUnifiedTime.cpp | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp b/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp index 2935dce6da..69baa5cbae 100644 --- a/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp +++ b/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp @@ -43,6 +43,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include +#ifdef HS_BUILD_FOR_APPLE +# include +# include +#endif + #include "plUnifiedTime.h" #include "hsStream.h" @@ -107,10 +112,21 @@ void plUnifiedTime::ToCurrentTime() struct timespec ts; #if defined(HS_BUILD_FOR_APPLE) - // timespec_get is only supported since macOS 10.15, - // but clock_gettime exists since macOS 10.12. - int res = clock_gettime(CLOCK_REALTIME, &ts); - hsAssert(res == 0, "clock_gettime failed"); +#if defined(HAVE_BUILTIN_AVAILABLE) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 + if (__builtin_available(macOS 10.15, *)) { + // timespec_get is only supported since macOS 10.15 + int res = timespec_get(&ts, TIME_UTC); + hsAssert(res != 0, "timespec_get failed"); + } else +#endif + { + struct timeval tv; + int res = gettimeofday(&tv, nullptr); + hsAssert(res == 0, "gettimeofday failed"); + + ts.tv_sec = tv.tv_sec; + ts.tv_nsec = tv.tv_usec * 1000; + } #else int res = timespec_get(&ts, TIME_UTC); hsAssert(res != 0, "timespec_get failed"); From cba28619eef08f3643066c87f35ff8d6a0e93aae Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 4 Nov 2023 21:31:10 -0700 Subject: [PATCH 4/4] Only compile hsWindows.cpp on Windows The file was ifdef'ed out on non-Windows platforms, but it sometimes causes linker warnings about the file having no symbols. Better to just avoid compiling/linking it entirely on non-Windows platforms. --- Sources/Plasma/CoreLib/CMakeLists.txt | 2 +- Sources/Plasma/CoreLib/hsWindows.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Sources/Plasma/CoreLib/CMakeLists.txt b/Sources/Plasma/CoreLib/CMakeLists.txt index e300eede33..bf6b0e1464 100644 --- a/Sources/Plasma/CoreLib/CMakeLists.txt +++ b/Sources/Plasma/CoreLib/CMakeLists.txt @@ -21,7 +21,7 @@ set(CoreLib_SOURCES plLoadMask.cpp plProduct.cpp plViewTransform.cpp - hsWindows.cpp + $<$:hsWindows.cpp> ) if(CMAKE_USE_WIN32_THREADS_INIT) diff --git a/Sources/Plasma/CoreLib/hsWindows.cpp b/Sources/Plasma/CoreLib/hsWindows.cpp index 5b7bfc0c28..f6274bf91b 100644 --- a/Sources/Plasma/CoreLib/hsWindows.cpp +++ b/Sources/Plasma/CoreLib/hsWindows.cpp @@ -40,8 +40,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ -#ifdef HS_BUILD_FOR_WIN32 - #include "HeadSpin.h" #include "hsWindows.h" #include @@ -93,5 +91,3 @@ const RTL_OSVERSIONINFOEXW& hsGetWindowsVersion() } return s_WinVer; } - -#endif