Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac OS X 10.5 compiler fixes #1523

Merged
merged 4 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/CoreLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set(CoreLib_SOURCES
plLoadMask.cpp
plProduct.cpp
plViewTransform.cpp
hsWindows.cpp
$<$<PLATFORM_ID:Windows>:hsWindows.cpp>
dpogue marked this conversation as resolved.
Show resolved Hide resolved
)

if(CMAKE_USE_WIN32_THREADS_INIT)
Expand Down
4 changes: 0 additions & 4 deletions Sources/Plasma/CoreLib/hsWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ You can contact Cyan Worlds, Inc. by email [email protected]
*==LICENSE==*/

#ifdef HS_BUILD_FOR_WIN32

#include "HeadSpin.h"
#include "hsWindows.h"
#include <combaseapi.h>
Expand Down Expand Up @@ -93,5 +91,3 @@ const RTL_OSVERSIONINFOEXW& hsGetWindowsVersion()
}
return s_WinVer;
}

#endif
4 changes: 4 additions & 0 deletions Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
24 changes: 20 additions & 4 deletions Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ You can contact Cyan Worlds, Inc. by email [email protected]
#include <cmath>
#include <string_theory/format>

#ifdef HS_BUILD_FOR_APPLE
# include <AvailabilityMacros.h>
# include <sys/time.h>
#endif

#include "plUnifiedTime.h"

#include "hsStream.h"
Expand Down Expand Up @@ -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");
Expand Down