Add iOS clang-tidy job
This commit is contained in:
parent
b99a4e341e
commit
3d63de9a21
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -239,6 +239,7 @@ jobs:
|
|||||||
- { name: Linux, os: ubuntu-22.04 }
|
- { name: Linux, os: ubuntu-22.04 }
|
||||||
- { name: Linux DRM, os: ubuntu-22.04, flags: -DSFML_USE_DRM=TRUE }
|
- { name: Linux DRM, os: ubuntu-22.04, flags: -DSFML_USE_DRM=TRUE }
|
||||||
- { name: macOS, os: macos-12 }
|
- { name: macOS, os: macos-12 }
|
||||||
|
- { name: iOS, os: macos-12, flags: -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 }
|
||||||
- { name: Android, os: ubuntu-22.04, flags: -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 }
|
- { name: Android, os: ubuntu-22.04, flags: -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 }
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -118,7 +118,7 @@ unsigned int RenderTextureImplFBO::getMaximumAntialiasingLevel()
|
|||||||
{
|
{
|
||||||
const TransientContextLock lock;
|
const TransientContextLock lock;
|
||||||
|
|
||||||
GLint samples = 0;
|
GLint samples = 0; // NOLINT(misc-const-correctness)
|
||||||
|
|
||||||
#ifndef SFML_OPENGL_ES
|
#ifndef SFML_OPENGL_ES
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ namespace sf::priv
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
String ClipboardImpl::getString()
|
String ClipboardImpl::getString()
|
||||||
{
|
{
|
||||||
UIPasteboard* pboard = [UIPasteboard generalPasteboard];
|
UIPasteboard* const pboard = [UIPasteboard generalPasteboard];
|
||||||
if (pboard.hasStrings)
|
if (pboard.hasStrings)
|
||||||
{
|
{
|
||||||
NSString* data = pboard.string;
|
const NSString* const data = pboard.string;
|
||||||
|
|
||||||
const char* utf8 = [data cStringUsingEncoding:NSUTF8StringEncoding];
|
const char* utf8 = [data cStringUsingEncoding:NSUTF8StringEncoding];
|
||||||
NSUInteger length = [data lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
const NSUInteger length = [data lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
return String::fromUtf8(utf8, utf8 + length);
|
return String::fromUtf8(utf8, utf8 + length);
|
||||||
}
|
}
|
||||||
@ -58,10 +58,13 @@ String ClipboardImpl::getString()
|
|||||||
void ClipboardImpl::setString(const String& text)
|
void ClipboardImpl::setString(const String& text)
|
||||||
{
|
{
|
||||||
std::basic_string<std::uint8_t> utf8 = text.toUtf8();
|
std::basic_string<std::uint8_t> utf8 = text.toUtf8();
|
||||||
NSString* data = [[NSString alloc] initWithBytes:utf8.data() length:utf8.length() encoding:NSUTF8StringEncoding];
|
NSString* const data = [[NSString alloc]
|
||||||
|
initWithBytes:utf8.data()
|
||||||
|
length:utf8.length()
|
||||||
|
encoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
UIPasteboard* pboard = [UIPasteboard generalPasteboard];
|
UIPasteboard* const pboard = [UIPasteboard generalPasteboard];
|
||||||
pboard.string = data;
|
pboard.string = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sf::priv
|
} // namespace sf::priv
|
||||||
|
@ -85,7 +85,7 @@ public:
|
|||||||
/// \brief Destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
~EaglContext();
|
~EaglContext() override;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the address of an OpenGL function
|
/// \brief Get the address of an OpenGL function
|
||||||
|
@ -45,16 +45,16 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
PFNGLBINDFRAMEBUFFEROESPROC glBindFramebufferOESFunc = 0;
|
PFNGLBINDFRAMEBUFFEROESPROC glBindFramebufferOESFunc = nullptr;
|
||||||
PFNGLBINDRENDERBUFFEROESPROC glBindRenderbufferOESFunc = 0;
|
PFNGLBINDRENDERBUFFEROESPROC glBindRenderbufferOESFunc = nullptr;
|
||||||
PFNGLCHECKFRAMEBUFFERSTATUSOESPROC glCheckFramebufferStatusOESFunc = 0;
|
PFNGLCHECKFRAMEBUFFERSTATUSOESPROC glCheckFramebufferStatusOESFunc = nullptr;
|
||||||
PFNGLDELETEFRAMEBUFFERSOESPROC glDeleteFramebuffersOESFunc = 0;
|
PFNGLDELETEFRAMEBUFFERSOESPROC glDeleteFramebuffersOESFunc = nullptr;
|
||||||
PFNGLDELETERENDERBUFFERSOESPROC glDeleteRenderbuffersOESFunc = 0;
|
PFNGLDELETERENDERBUFFERSOESPROC glDeleteRenderbuffersOESFunc = nullptr;
|
||||||
PFNGLFRAMEBUFFERRENDERBUFFEROESPROC glFramebufferRenderbufferOESFunc = 0;
|
PFNGLFRAMEBUFFERRENDERBUFFEROESPROC glFramebufferRenderbufferOESFunc = nullptr;
|
||||||
PFNGLGENFRAMEBUFFERSOESPROC glGenFramebuffersOESFunc = 0;
|
PFNGLGENFRAMEBUFFERSOESPROC glGenFramebuffersOESFunc = nullptr;
|
||||||
PFNGLGENRENDERBUFFERSOESPROC glGenRenderbuffersOESFunc = 0;
|
PFNGLGENRENDERBUFFERSOESPROC glGenRenderbuffersOESFunc = nullptr;
|
||||||
PFNGLGETRENDERBUFFERPARAMETERIVOESPROC glGetRenderbufferParameterivOESFunc = 0;
|
PFNGLGETRENDERBUFFERPARAMETERIVOESPROC glGetRenderbufferParameterivOESFunc = nullptr;
|
||||||
PFNGLRENDERBUFFERSTORAGEOESPROC glRenderbufferStorageOESFunc = 0;
|
PFNGLRENDERBUFFERSTORAGEOESPROC glRenderbufferStorageOESFunc = nullptr;
|
||||||
|
|
||||||
|
|
||||||
void ensureInit()
|
void ensureInit()
|
||||||
@ -137,7 +137,7 @@ EaglContext::~EaglContext()
|
|||||||
if (m_context)
|
if (m_context)
|
||||||
{
|
{
|
||||||
// Activate the context, so that we can destroy the buffers
|
// Activate the context, so that we can destroy the buffers
|
||||||
EAGLContext* previousContext = [EAGLContext currentContext];
|
EAGLContext* const previousContext = [EAGLContext currentContext];
|
||||||
[EAGLContext setCurrentContext:m_context];
|
[EAGLContext setCurrentContext:m_context];
|
||||||
|
|
||||||
// Destroy the buffers
|
// Destroy the buffers
|
||||||
@ -160,23 +160,23 @@ EaglContext::~EaglContext()
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
GlFunctionPointer EaglContext::getFunction(const char* name)
|
GlFunctionPointer EaglContext::getFunction(const char* name)
|
||||||
{
|
{
|
||||||
static void* module = 0;
|
static void* module = nullptr;
|
||||||
|
|
||||||
const int libCount = 3;
|
const int libCount = 3;
|
||||||
const char* libs[libCount] = {"libGLESv1_CM.dylib",
|
const char* libs[libCount] = {"libGLESv1_CM.dylib",
|
||||||
"/System/Library/Frameworks/OpenGLES.framework/OpenGLES",
|
"/System/Library/Frameworks/OpenGLES.framework/OpenGLES",
|
||||||
"OpenGLES.framework/OpenGLES"};
|
"OpenGLES.framework/OpenGLES"};
|
||||||
|
|
||||||
for (int i = 0; i < libCount; ++i)
|
for (auto& lib : libs)
|
||||||
{
|
{
|
||||||
if (!module)
|
if (!module)
|
||||||
module = dlopen(libs[i], RTLD_LAZY | RTLD_LOCAL);
|
module = dlopen(lib, RTLD_LAZY | RTLD_LOCAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (module)
|
if (module)
|
||||||
return reinterpret_cast<GlFunctionPointer>(reinterpret_cast<uintptr_t>(dlsym(module, name)));
|
return reinterpret_cast<GlFunctionPointer>(reinterpret_cast<uintptr_t>(dlsym(module, name)));
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ GlFunctionPointer EaglContext::getFunction(const char* name)
|
|||||||
void EaglContext::recreateRenderBuffers(SFView* glView)
|
void EaglContext::recreateRenderBuffers(SFView* glView)
|
||||||
{
|
{
|
||||||
// Activate the context
|
// Activate the context
|
||||||
EAGLContext* previousContext = [EAGLContext currentContext];
|
EAGLContext* const previousContext = [EAGLContext currentContext];
|
||||||
[EAGLContext setCurrentContext:m_context];
|
[EAGLContext setCurrentContext:m_context];
|
||||||
|
|
||||||
// Bind the frame buffer
|
// Bind the frame buffer
|
||||||
@ -207,12 +207,13 @@ void EaglContext::recreateRenderBuffers(SFView* glView)
|
|||||||
if (m_settings.depthBits > 0)
|
if (m_settings.depthBits > 0)
|
||||||
{
|
{
|
||||||
// Find the best internal format
|
// Find the best internal format
|
||||||
GLenum format = m_settings.depthBits > 16
|
const GLenum format = m_settings.depthBits > 16
|
||||||
? (m_settings.stencilBits == 0 ? GL_DEPTH_COMPONENT24_OES : GL_DEPTH24_STENCIL8_OES)
|
? (m_settings.stencilBits == 0 ? GL_DEPTH_COMPONENT24_OES : GL_DEPTH24_STENCIL8_OES)
|
||||||
: GL_DEPTH_COMPONENT16_OES;
|
: GL_DEPTH_COMPONENT16_OES;
|
||||||
|
|
||||||
// Get the size of the color-buffer (which fits the current size of the GL view)
|
// Get the size of the color-buffer (which fits the current size of the GL view)
|
||||||
GLint width, height;
|
GLint width;
|
||||||
|
GLint height;
|
||||||
glGetRenderbufferParameterivOESFunc(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &width);
|
glGetRenderbufferParameterivOESFunc(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &width);
|
||||||
glGetRenderbufferParameterivOESFunc(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &height);
|
glGetRenderbufferParameterivOESFunc(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &height);
|
||||||
|
|
||||||
@ -226,7 +227,7 @@ void EaglContext::recreateRenderBuffers(SFView* glView)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that everything's ok
|
// Make sure that everything's ok
|
||||||
GLenum status = glCheckFramebufferStatusOESFunc(GL_FRAMEBUFFER_OES);
|
const GLenum status = glCheckFramebufferStatusOESFunc(GL_FRAMEBUFFER_OES);
|
||||||
if (status != GL_FRAMEBUFFER_COMPLETE_OES)
|
if (status != GL_FRAMEBUFFER_COMPLETE_OES)
|
||||||
err() << "Failed to create a valid frame buffer (error code: " << status << ")" << std::endl;
|
err() << "Failed to create a valid frame buffer (error code: " << status << ")" << std::endl;
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@
|
|||||||
self.touches = [NSMutableArray array];
|
self.touches = [NSMutableArray array];
|
||||||
|
|
||||||
// Configure the EAGL layer
|
// Configure the EAGL layer
|
||||||
CAEAGLLayer* eaglLayer = static_cast<CAEAGLLayer*>(self.layer);
|
auto* eaglLayer = static_cast<CAEAGLLayer*>(self.layer);
|
||||||
eaglLayer.opaque = YES;
|
eaglLayer.opaque = YES;
|
||||||
eaglLayer.drawableProperties = [NSDictionary
|
eaglLayer.drawableProperties = [NSDictionary
|
||||||
dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE],
|
dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE],
|
||||||
|
@ -132,8 +132,8 @@ void SensorImpl::close()
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Vector3f SensorImpl::update()
|
Vector3f SensorImpl::update()
|
||||||
{
|
{
|
||||||
Vector3f value;
|
Vector3f value;
|
||||||
CMMotionManager* manager = [SFAppDelegate getInstance].motionManager;
|
CMMotionManager* const manager = [SFAppDelegate getInstance].motionManager;
|
||||||
|
|
||||||
switch (m_sensor)
|
switch (m_sensor)
|
||||||
{
|
{
|
||||||
|
@ -45,8 +45,8 @@ std::vector<VideoMode> VideoModeImpl::getFullscreenModes()
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VideoMode VideoModeImpl::getDesktopMode()
|
VideoMode VideoModeImpl::getDesktopMode()
|
||||||
{
|
{
|
||||||
CGRect bounds = [[UIScreen mainScreen] bounds];
|
const CGRect bounds = [[UIScreen mainScreen] bounds];
|
||||||
double backingScale = [SFAppDelegate getInstance].backingScaleFactor;
|
const double backingScale = [SFAppDelegate getInstance].backingScaleFactor;
|
||||||
return VideoMode({static_cast<unsigned int>(bounds.size.width * backingScale),
|
return VideoMode({static_cast<unsigned int>(bounds.size.width * backingScale),
|
||||||
static_cast<unsigned int>(bounds.size.height * backingScale)});
|
static_cast<unsigned int>(bounds.size.height * backingScale)});
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,6 @@ public:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool hasFocus() const override;
|
bool hasFocus() const override;
|
||||||
|
|
||||||
public:
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Notify an event
|
/// \brief Notify an event
|
||||||
///
|
///
|
||||||
|
@ -61,14 +61,14 @@ WindowImplUIKit::WindowImplUIKit(VideoMode mode, const String& /* title */, unsi
|
|||||||
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
|
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
|
||||||
|
|
||||||
// Create the window
|
// Create the window
|
||||||
CGRect frame = [UIScreen mainScreen].bounds; // Ignore user size, it wouldn't make sense to use something else
|
const CGRect frame = [UIScreen mainScreen].bounds; // Ignore user size, it wouldn't make sense to use something else
|
||||||
m_window = [[UIWindow alloc] initWithFrame:frame];
|
m_window = [[UIWindow alloc] initWithFrame:frame];
|
||||||
m_hasFocus = true;
|
m_hasFocus = true;
|
||||||
|
|
||||||
// Assign it to the application delegate
|
// Assign it to the application delegate
|
||||||
[SFAppDelegate getInstance].sfWindow = this;
|
[SFAppDelegate getInstance].sfWindow = this;
|
||||||
|
|
||||||
CGRect viewRect = frame;
|
const CGRect viewRect = frame;
|
||||||
|
|
||||||
// Create the view
|
// Create the view
|
||||||
m_view = [[SFView alloc] initWithFrame:viewRect andContentScaleFactor:(static_cast<double>(m_backingScale))];
|
m_view = [[SFView alloc] initWithFrame:viewRect andContentScaleFactor:(static_cast<double>(m_backingScale))];
|
||||||
@ -108,7 +108,7 @@ WindowHandle WindowImplUIKit::getSystemHandle() const
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Vector2i WindowImplUIKit::getPosition() const
|
Vector2i WindowImplUIKit::getPosition() const
|
||||||
{
|
{
|
||||||
CGPoint origin = m_window.frame.origin;
|
const CGPoint origin = m_window.frame.origin;
|
||||||
return Vector2i(static_cast<int>(origin.x * static_cast<double>(m_backingScale)),
|
return Vector2i(static_cast<int>(origin.x * static_cast<double>(m_backingScale)),
|
||||||
static_cast<int>(origin.y * static_cast<double>(m_backingScale)));
|
static_cast<int>(origin.y * static_cast<double>(m_backingScale)));
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ void WindowImplUIKit::setPosition(const Vector2i& /* position */)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Vector2u WindowImplUIKit::getSize() const
|
Vector2u WindowImplUIKit::getSize() const
|
||||||
{
|
{
|
||||||
CGRect physicalFrame = m_window.frame;
|
const CGRect physicalFrame = m_window.frame;
|
||||||
return Vector2u(static_cast<unsigned int>(physicalFrame.size.width * static_cast<double>(m_backingScale)),
|
return Vector2u(static_cast<unsigned int>(physicalFrame.size.width * static_cast<double>(m_backingScale)),
|
||||||
static_cast<unsigned int>(physicalFrame.size.height * static_cast<double>(m_backingScale)));
|
static_cast<unsigned int>(physicalFrame.size.height * static_cast<double>(m_backingScale)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user