diff --git a/CMakeLists.txt b/CMakeLists.txt index f39059e52d8d19affa887e5c37d07a137ee5f758..85e8863022902ed063dec8927ad2ec3615d60a26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,8 +40,9 @@ if (GLOW_CMAKE_REPORT) message(STATUS " OpenGL : ${GLOW_OPENGL_SUPPORT}") endif() -if(MSVC) - set(GLOW_LINK_TYPE STATIC CACHE STRING "" FORCE) # unfortunately, we need to link statically here +if(MSVC OR APPLE) + # we need to link statically on Windows and OSX + set(GLOW_LINK_TYPE STATIC CACHE STRING "" FORCE) endif() if(APPLE) diff --git a/src/glow/common/file_watch.cc b/src/glow/common/file_watch.cc index ff57b5606a1729297d6b48835e890b7b3168a107..9a3a7575a420acc173690781bbdb1df4473b8d33 100644 --- a/src/glow/common/file_watch.cc +++ b/src/glow/common/file_watch.cc @@ -51,10 +51,10 @@ struct FileLocation const FileLocation getFileLocation(const std::string_view path) { - const auto predict = [](char character) { + const auto predict = [](char character) -> bool { #ifdef _WIN32 return character == _T('\\') || character == _T('/'); -#elif __unix__ +#elif __unix__ || __APPLE__ return character == '/'; #endif // __unix__ }; @@ -248,6 +248,8 @@ public: GLOW_RUNTIME_ASSERT(winDirectory != INVALID_HANDLE_VALUE, "Failed to create Win32 directory handle", return nullptr); return std::make_unique<Monitor>(path, winCloseEvent, winDirectory); +#elif defined __APPLE__ + return {}; #endif } diff --git a/src/glow/common/scoped_gl.hh b/src/glow/common/scoped_gl.hh index 1fed981183146b70e8ca330f44e077fd793519cb..c270d4c86b48d311fd15fbe8c6135a69e44082f2 100644 --- a/src/glow/common/scoped_gl.hh +++ b/src/glow/common/scoped_gl.hh @@ -7,6 +7,8 @@ #include <glow/common/traits.hh> #include <glow/gl.hh> +#include <glow/glow.hh> + #include <typed-geometry/types/color.hh> #include <typed-geometry/types/objects/aabb.hh> #include <typed-geometry/types/pos.hh> @@ -223,9 +225,20 @@ struct debugGroup { GLOW_NON_COPYABLE(debugGroup); - debugGroup(std::string const& name, GLuint id = 0) { glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, id, -1, name.c_str()); } + debugGroup(std::string const& name, GLuint id = 0) + { + if (glow::OGLVersion.total >= 43) + { + glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, id, -1, name.c_str()); + } + } - ~debugGroup() { glPopDebugGroup(); } + ~debugGroup() { + if (glow::OGLVersion.total >= 43) + { + glPopDebugGroup(); + } + } }; #define GLOW_SCOPED_ENUM_VALUED_GL_FUNC(name, func, getName) \ diff --git a/src/glow/objects/NamedObject.cc b/src/glow/objects/NamedObject.cc index 19e8a67955df964d670c18f489dfdf8bddd8ca47..83036a807719b4af8066994bfd2661f00eae0f9f 100644 --- a/src/glow/objects/NamedObject.cc +++ b/src/glow/objects/NamedObject.cc @@ -9,6 +9,10 @@ std::string glow::detail::getObjectLabel(GLenum glNamespace, GLuint objectName) { checkValidGLOW(); + // getObjectLabel requires OpenGL 4.3 or higher + if (glow::OGLVersion.total < 43) + return ""; + GLsizei len = 0; glGetObjectLabel(glNamespace, objectName, 0, &len, nullptr); @@ -23,6 +27,10 @@ void glow::detail::setObjectLabel(GLenum glNamespace, GLuint objectName, std::st { checkValidGLOW(); + // glObjectLabel requires OpenGL 4.3 or higher + if (glow::OGLVersion.total < 43) + return; + if (label.size() > maxLength) { auto s = std::string(label.substr(0, maxLength)) + "...";