SL-17634 Replace deprecated carbon Gestalt calls
parent
b97aec0da2
commit
1167ea994c
|
|
@ -400,6 +400,7 @@ Cinder Roxley
|
|||
STORM-2127
|
||||
STORM-2144
|
||||
SL-3404
|
||||
SL-17634
|
||||
Clara Young
|
||||
Coaldust Numbers
|
||||
VWR-1095
|
||||
|
|
|
|||
|
|
@ -265,6 +265,11 @@ set(llcommon_HEADER_FILES
|
|||
workqueue.h
|
||||
StackWalker.h
|
||||
)
|
||||
|
||||
if (DARWIN)
|
||||
list(APPEND llcommon_HEADER_FILES llsys_objc.h)
|
||||
list(APPEND llcommon_SOURCE_FILES llsys_objc.mm)
|
||||
endif (DARWIN)
|
||||
|
||||
set_source_files_properties(${llcommon_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
|
@ -312,12 +317,6 @@ target_link_libraries(
|
|||
${TRACY_LIBRARY}
|
||||
)
|
||||
|
||||
if (DARWIN)
|
||||
include(CMakeFindFrameworks)
|
||||
find_library(CARBON_LIBRARY Carbon)
|
||||
target_link_libraries(llcommon ${CARBON_LIBRARY})
|
||||
endif (DARWIN)
|
||||
|
||||
add_dependencies(llcommon stage_third_party_libs)
|
||||
|
||||
if (LL_TESTS)
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ using namespace llsd;
|
|||
# include <psapi.h> // GetPerformanceInfo() et al.
|
||||
# include <VersionHelpers.h>
|
||||
#elif LL_DARWIN
|
||||
# include "llsys_objc.h"
|
||||
# include <errno.h>
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/utsname.h>
|
||||
|
|
@ -74,12 +75,6 @@ using namespace llsd;
|
|||
# include <mach/mach_host.h>
|
||||
# include <mach/task.h>
|
||||
# include <mach/task_info.h>
|
||||
|
||||
// disable warnings about Gestalt calls being deprecated
|
||||
// until Apple get's on the ball and provides an alternative
|
||||
//
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#elif LL_LINUX
|
||||
# include <errno.h>
|
||||
# include <sys/utsname.h>
|
||||
|
|
@ -278,12 +273,9 @@ LLOSInfo::LLOSInfo() :
|
|||
{
|
||||
const char * DARWIN_PRODUCT_NAME = "Mac OS X";
|
||||
|
||||
SInt32 major_version, minor_version, bugfix_version;
|
||||
OSErr r1 = Gestalt(gestaltSystemVersionMajor, &major_version);
|
||||
OSErr r2 = Gestalt(gestaltSystemVersionMinor, &minor_version);
|
||||
OSErr r3 = Gestalt(gestaltSystemVersionBugFix, &bugfix_version);
|
||||
S32 major_version, minor_version, bugfix_version = 0;
|
||||
|
||||
if((r1 == noErr) && (r2 == noErr) && (r3 == noErr))
|
||||
if (LLGetDarwinOSInfo(major_version, minor_version, bugfix_version))
|
||||
{
|
||||
mMajorVer = major_version;
|
||||
mMinorVer = minor_version;
|
||||
|
|
@ -1315,10 +1307,3 @@ BOOL gzip_file(const std::string& srcfile, const std::string& dstfile)
|
|||
if (dst != NULL) gzclose(dst);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if LL_DARWIN
|
||||
// disable warnings about Gestalt calls being deprecated
|
||||
// until Apple get's on the ball and provides an alternative
|
||||
//
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* @file llsys_objc.h
|
||||
* @brief Header file for llsys_objc.mm
|
||||
*
|
||||
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2022, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLSYS_OBJC_H
|
||||
#define LL_LLSYS_OBJC_H
|
||||
|
||||
bool LLGetDarwinOSInfo(int &major, int &minor, int &patch);
|
||||
|
||||
|
||||
#endif // LL_LLSYS_OBJC_H
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* @file llsys_objc.mm
|
||||
* @brief obj-c implementation of the system information functions
|
||||
*
|
||||
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2022, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#import "llsys_objc.h"
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
static int intAtStringIndex(NSArray *array, int index)
|
||||
{
|
||||
return [(NSString *)[array objectAtIndex:index] integerValue];
|
||||
}
|
||||
|
||||
bool LLGetDarwinOSInfo(int &major, int &minor, int &patch)
|
||||
{
|
||||
if (NSAppKitVersionNumber > NSAppKitVersionNumber10_8)
|
||||
{
|
||||
NSOperatingSystemVersion osVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
|
||||
major = osVersion.majorVersion;
|
||||
minor = osVersion.minorVersion;
|
||||
patch = osVersion.patchVersion;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString* versionString = [[NSDictionary dictionaryWithContentsOfFile:
|
||||
@"/System/Library/CoreServices/SystemVersion.plist"] objectForKey:@"ProductVersion"];
|
||||
NSArray* versions = [versionString componentsSeparatedByString:@"."];
|
||||
NSUInteger count = [versions count];
|
||||
if (count > 0)
|
||||
{
|
||||
major = intAtStringIndex(versions, 0);
|
||||
if (count > 1)
|
||||
{
|
||||
minor = intAtStringIndex(versions, 1);
|
||||
if (count > 2)
|
||||
{
|
||||
patch = intAtStringIndex(versions, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1413,12 +1413,14 @@ if (DARWIN)
|
|||
find_library(COCOA_LIBRARY Cocoa)
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
find_library(COREAUDIO_LIBRARY CoreAudio)
|
||||
find_library(CARBON_LIBRARY Carbon)
|
||||
|
||||
set(viewer_LIBRARIES
|
||||
${COCOA_LIBRARY}
|
||||
${AGL_LIBRARY}
|
||||
${IOKIT_LIBRARY}
|
||||
${COREAUDIO_LIBRARY}
|
||||
${CARBON_LIBRARY}
|
||||
)
|
||||
|
||||
if (USE_BUGSPLAT)
|
||||
|
|
|
|||
Loading…
Reference in New Issue