From 994e9964fb82593731991e3b36f18a5e1fde566e Mon Sep 17 00:00:00 2001 From: "Alexander.A.Pimenov" Date: Tue, 17 Sep 2019 23:01:10 +0300 Subject: [PATCH 1/3] Minor updates and warning fixes --- core/buffers/abstractBuffer.h | 10 +++++----- core/utils/global.h | 4 ++-- utils/filters/graph/filterGraphPresentation.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/buffers/abstractBuffer.h b/core/buffers/abstractBuffer.h index eabbbfd09..227b26873 100644 --- a/core/buffers/abstractBuffer.h +++ b/core/buffers/abstractBuffer.h @@ -659,12 +659,12 @@ template { if (other.stride == this->stride && other.w == this->w) { - memcpy(this->data, other.data, sizeof(ElementType) * copyH * this->stride); + memcpy((void *)this->data, (void *)other.data, sizeof(ElementType) * copyH * this->stride); return; } for (IndexType i = 0; i < copyH; i++) { - memcpy(&this->element(i, 0), &other.element(i, 0), sizeof(ElementType) * copyW); + memcpy((void *)&this->element(i, 0), (void *)&other.element(i, 0), sizeof(ElementType) * copyW); } return; } @@ -775,7 +775,7 @@ template { for (IndexType i = 0; i < this->h; i++) { - memcpy(&element(i, 0), &(src.element(y1 + i, x1)), sizeof(ElementType) * this->w); + memcpy((void *)&element(i, 0), &(src.element(y1 + i, x1)), sizeof(ElementType) * this->w); } } else @@ -1286,7 +1286,7 @@ template */ if (TRIVIALLY_COPY_CONSTRUCTIBLE) { - memcpy(dst, src, cnt * sizeof(ElementType)); + memcpy((void *)dst, (void *)src, cnt * sizeof(ElementType)); } else { @@ -1335,7 +1335,7 @@ template } else { - memset(ptr, 0, sizeof(ElementType) * stride * h); + memset((void *)ptr, 0, sizeof(ElementType) * stride * h); } } diff --git a/core/utils/global.h b/core/utils/global.h index a5c61102f..32a57787d 100644 --- a/core/utils/global.h +++ b/core/utils/global.h @@ -16,8 +16,8 @@ #define CORE_COUNT_OF(arr) (sizeof(arr) / sizeof((arr)[0])) -#define CORE_CLEAR_MEMORY(pm, sz) memset(pm, 0x00, sz) -#define CORE_FILL_MEMORY( pm, sz) memset(pm, 0xFF, sz) +#define CORE_CLEAR_MEMORY(pm, sz) memset((void *)pm, 0x00, sz) +#define CORE_FILL_MEMORY( pm, sz) memset((void *)pm, 0xFF, sz) #define CORE_CLEAR_STRUCT(obj) CORE_CLEAR_MEMORY(&(obj), sizeof(obj)) /* TODO: try to use std offsetof() while it's present. */ diff --git a/utils/filters/graph/filterGraphPresentation.cpp b/utils/filters/graph/filterGraphPresentation.cpp index f7b3b7fc2..8201ef767 100644 --- a/utils/filters/graph/filterGraphPresentation.cpp +++ b/utils/filters/graph/filterGraphPresentation.cpp @@ -1,4 +1,4 @@ - +#include #include #include From f44536f443cb937cb9dfa2a079523f5dbda711f3 Mon Sep 17 00:00:00 2001 From: egororachyov Date: Thu, 3 Oct 2019 00:47:31 +0300 Subject: [PATCH 2/3] Build corecvs-master under macOS 10.14 --- common.pri | 36 +++-- core/buffers/converters/debayerTool.cpp | 6 +- core/buffers/rgb24/wuRasterizer.h | 3 +- core/core.pri | 2 +- core/filesystem/folderScanner.cpp | 194 ++++++++++++------------ core/math/vector/fixedArray.h | 6 + core/stats/calculationStats.h | 2 +- core/utils/global.h | 36 +++-- core/utils/utils.cpp | 44 +++--- cvs-config.pri | 10 +- test-core/buffer/main_test_buffer.cpp | 5 +- tools/generator/generator.pro | 2 +- utils/3d/sceneShaded.cpp | 7 +- utils/utils.pri | 5 +- 14 files changed, 203 insertions(+), 155 deletions(-) diff --git a/common.pri b/common.pri index c0e52dafe..962124b22 100644 --- a/common.pri +++ b/common.pri @@ -139,19 +139,33 @@ macx { } gcc_env_toolchain { - GCC_POSTFIX = $$(GCC_POSTFIX) - message(Compiling with gcc-$$GCC_POSTFIX) - - QMAKE_CC = gcc-$$GCC_POSTFIX - QMAKE_CXX = g++-$$GCC_POSTFIX - QMAKE_LINK = g++-$$GCC_POSTFIX - QMAKE_LINK_SHLIB = g++-$$GCC_POSTFIX - QMAKE_LINK_C = gcc-$$GCC_POSTFIX - QMAKE_LINK_C_SHLIB = gcc-$$GCC_POSTFIX + !mac { + GCC_POSTFIX = $$(GCC_POSTFIX) + message(Compiling with gcc-$$GCC_POSTFIX) + + QMAKE_CC = gcc-$$GCC_POSTFIX + QMAKE_CXX = g++-$$GCC_POSTFIX + QMAKE_LINK = g++-$$GCC_POSTFIX + QMAKE_LINK_SHLIB = g++-$$GCC_POSTFIX + QMAKE_LINK_C = gcc-$$GCC_POSTFIX + QMAKE_LINK_C_SHLIB = gcc-$$GCC_POSTFIX + } else { + message(Compiling with gcc) + + QMAKE_CC = gcc + QMAKE_CXX = g++ + QMAKE_CXXFLAGS += -I/usr/local/include/c++/9.2.0 + QMAKE_CXXFLAGS += -I/usr/local/Cellar/gcc/9.2.0/include/c++/9.2.0/x86_64-apple-darwin17 + QMAKE_LINK = g++ + QMAKE_LINK_SHLIB = g++ + QMAKE_LINK_C = gcc + QMAKE_LINK_C_SHLIB = gcc + } } clang_toolchain { - CLANG_POSTFIX="-3.6" + #CLANG_POSTFIX="-3.6" + CLANG_POSTFIX="" CONFIG -= warn_on @@ -170,6 +184,7 @@ clang_toolchain { QMAKE_CFLAGS += -Wall -Wno-overloaded-virtual QMAKE_CXXFLAGS += -Wall -Wno-inconsistent-missing-override QMAKE_CXXFLAGS += -Wall -Wno-overloaded-virtual + QMAKE_CXXFLAGS += -Wno-error=non-pod-varargs # QMAKE_CFLAGS_WARN_OFF -= -Wall # QMAKE_CXXFLAGS_WARN_OFF -= -Wall @@ -457,6 +472,7 @@ with_tbb:!contains(DEFINES, WITH_TBB) { } } else:macx { #message (Using TBB at "$$TBB_PATH") + TBB_PATH += /usr/local DEFINES += WITH_TBB INCLUDEPATH += "$$TBB_PATH"/include LIBS += -L"$$TBB_PATH"/lib -ltbb diff --git a/core/buffers/converters/debayerTool.cpp b/core/buffers/converters/debayerTool.cpp index 479777409..48f582638 100644 --- a/core/buffers/converters/debayerTool.cpp +++ b/core/buffers/converters/debayerTool.cpp @@ -244,7 +244,7 @@ int DebayerTool::proceed(int argc, const char **argv) if (!rgb24 && !rgb48) { - L_ERROR_P("couldn't load input file <%s>", filename); + //L_ERROR_P("couldn't load input file <%s>", filename); return -1; } if (rgb24 && rgb48) @@ -269,7 +269,7 @@ int DebayerTool::proceed(int argc, const char **argv) } if (!BMPLoader().save(outfile, rgb24.get())) { - L_ERROR_P("couldn't write to <%s>", outfile); + //L_ERROR_P("couldn't write to <%s>", outfile); return -1; } } @@ -301,7 +301,7 @@ int DebayerTool::proceed(int argc, const char **argv) if (!saveRgb24(outfile, *rgb24)) { - L_ERROR_P("couldn't recognize output file format <%s>", outfile); + //L_ERROR_P("couldn't recognize output file format <%s>", outfile); return -1; } } diff --git a/core/buffers/rgb24/wuRasterizer.h b/core/buffers/rgb24/wuRasterizer.h index e85976e19..10f49e2f4 100644 --- a/core/buffers/rgb24/wuRasterizer.h +++ b/core/buffers/rgb24/wuRasterizer.h @@ -6,6 +6,7 @@ #include #include #include +#include #include "core/math/mathUtils.h" @@ -102,7 +103,7 @@ class WuRasterizer { float dx = x1 - x0; float dy = y1 - y0; float gradient = 0.; - if (std::abs(dx) < FLT_EPSILON) { + if (std::fabs(dx) < FLT_EPSILON) { gradient = 1.0; } else { diff --git a/core/core.pri b/core/core.pri index 21eba70de..ce9985b6e 100644 --- a/core/core.pri +++ b/core/core.pri @@ -139,7 +139,7 @@ with_unorthodox { } -!win32 { +!win32:!mac { LIBS += -lstdc++fs } diff --git a/core/filesystem/folderScanner.cpp b/core/filesystem/folderScanner.cpp index ac7c9d64e..7beec05e2 100644 --- a/core/filesystem/folderScanner.cpp +++ b/core/filesystem/folderScanner.cpp @@ -8,60 +8,60 @@ namespace corecvs { bool FolderScanner::isDir(const string &path) { - fs::path p(path); - return fs::exists(p) && fs::is_directory(p); + // fs::path p(path); + // return fs::exists(p) && fs::is_directory(p); } bool FolderScanner::createDir(const string &path, bool allowRecursive) { - if (isDir(path)) - return true; - - std::cout << "creating dir <" << path << ">" << std::endl; - - bool res; - try { - fs::path p(path); - res = allowRecursive ? fs::create_directories(p) : fs::create_directory(p); - } - catch (...) { - L_ERROR_P("couldn't create dir <%s>", path.c_str()); - res = false; - } - return res; + // if (isDir(path)) + // return true; + + // std::cout << "creating dir <" << path << ">" << std::endl; + + // bool res; + // try { + // fs::path p(path); + // res = allowRecursive ? fs::create_directories(p) : fs::create_directory(p); + // } + // catch (...) { + // L_ERROR_P("couldn't create dir <%s>", path.c_str()); + // res = false; + // } + // return res; } bool FolderScanner::scan(const string &path, vector &children, bool findFiles) { - if (!isDir(path)) - { - L_ERROR_P("<%s> does not exist or not a directory", path.c_str()); - return false; - } - - fs::path p(path); - for (fs::directory_iterator it = fs::directory_iterator(p); it != fs::directory_iterator(); ++it) - { - fs::path pathChild(*it); // pathChild has linux style slashes inside - - bool isDir = fs::is_directory(pathChild); - - //L_DDEBUG_P("%s contains\t%s\tas a %s", p.string().c_str(), pathChild.string().c_str(), (isDir ? "dir" : "file")); - - if (!(findFiles ^ isDir)) - continue; - - // win32: bugfix state: - // pathChild.string() - has linux style slashes everywhere - // (string)pathChild - has windows style slashes on vc12, but it's obsolete in vc14 -#ifdef _MSC_VER - childs.push_back(corecvs::HelperUtils::toNativeSlashes(pathChild.string())); -#else - children.push_back(pathChild); -#endif - } - - return true; +// if (!isDir(path)) +// { +// L_ERROR_P("<%s> does not exist or not a directory", path.c_str()); +// return false; +// } + +// fs::path p(path); +// for (fs::directory_iterator it = fs::directory_iterator(p); it != fs::directory_iterator(); ++it) +// { +// fs::path pathChild(*it); // pathChild has linux style slashes inside + +// bool isDir = fs::is_directory(pathChild); + +// //L_DDEBUG_P("%s contains\t%s\tas a %s", p.string().c_str(), pathChild.string().c_str(), (isDir ? "dir" : "file")); + +// if (!(findFiles ^ isDir)) +// continue; + +// // win32: bugfix state: +// // pathChild.string() - has linux style slashes everywhere +// // (string)pathChild - has windows style slashes on vc12, but it's obsolete in vc14 +// #ifdef _MSC_VER +// childs.push_back(corecvs::HelperUtils::toNativeSlashes(pathChild.string())); +// #else +// children.push_back(pathChild); +// #endif +// } + +// return true; } #if defined(FILESYSTEM_WORKAROUND) @@ -78,33 +78,33 @@ bool FolderScanner::isDir(const string &path) bool FolderScanner::createDir(const string &path, bool allowRecursive) { - if (isDir(path)) - return true; - - std::cout << "creating dir <" << path << ">" << std::endl; - - std::system(("mkdir " + path).c_str()); - - if (!isDir(path)) - { - if (!allowRecursive) { - L_ERROR_P("couldn't create dir <%s>", path.c_str()); - return false; - } - L_INFO_P("creating subfolders of <%s>", path.c_str()); - - auto subfolders = HelperUtils::stringSplit(path, PATH_SEPARATOR[0]); - string p; - for (auto& subfolder : subfolders) - { - if (!p.empty()) p += PATH_SEPARATOR; - p += subfolder; - - if (!createDir(p, false)) - return false; - } - } - return true; + // if (isDir(path)) + // return true; + + // std::cout << "creating dir <" << path << ">" << std::endl; + + // std::system(("mkdir " + path).c_str()); + + // if (!isDir(path)) + // { + // if (!allowRecursive) { + // L_ERROR_P("couldn't create dir <%s>", path.c_str()); + // return false; + // } + // L_INFO_P("creating subfolders of <%s>", path.c_str()); + + // auto subfolders = HelperUtils::stringSplit(path, PATH_SEPARATOR[0]); + // string p; + // for (auto& subfolder : subfolders) + // { + // if (!p.empty()) p += PATH_SEPARATOR; + // p += subfolder; + + // if (!createDir(p, false)) + // return false; + // } + // } + // return true; } bool FolderScanner::scan(const string &path, vector &childs, bool findFiles) @@ -146,30 +146,30 @@ bool FolderScanner::scan(const string &path, vector &childs, bool findFi void FolderScanner::emptyDir(const string &path) { -#ifdef WIN32 - std::system(("rd /s /q " + path).c_str()); -#else - int result = std::system(("rm -rf " + path).c_str()); - CORE_UNUSED(result); -#endif - L_INFO_P("The <%s> folder is deleted.", path.c_str()); -} - -bool FolderScanner::isAccessible(const string &path) -{ - auto p = path; - if (!STR_HAS_SLASH_AT_END(p)) - p += PATH_SEPARATOR; - p += "checkFolderScanner.tmp"; - - std::ofstream f(p, std::ios::app); - if (f.is_open()) - { - f.close(); - HelperUtils::pathRemove(p); - return true; - } - return false; +// #ifdef WIN32 +// std::system(("rd /s /q " + path).c_str()); +// #else +// int result = std::system(("rm -rf " + path).c_str()); +// CORE_UNUSED(result); +// #endif +// L_INFO_P("The <%s> folder is deleted.", path.c_str()); +// } + +// bool FolderScanner::isAccessible(const string &path) +// { +// auto p = path; +// if (!STR_HAS_SLASH_AT_END(p)) +// p += PATH_SEPARATOR; +// p += "checkFolderScanner.tmp"; + +// std::ofstream f(p, std::ios::app); +// if (f.is_open()) +// { +// f.close(); +// HelperUtils::pathRemove(p); +// return true; +// } +// return false; } } // namespace corecvs diff --git a/core/math/vector/fixedArray.h b/core/math/vector/fixedArray.h index e56b9a1ab..652ee2eb7 100644 --- a/core/math/vector/fixedArray.h +++ b/core/math/vector/fixedArray.h @@ -64,6 +64,10 @@ class FixedArrayBase : public VectorOperationsBase length = that.length; #ifndef WIN32 data = std::unique_ptr((ElementType*)aligned_alloc(32, sizeof(ElementType) * length), free); +#elif defined(__APPLE__) + ElementType* _aligned_mem; + posix_memalign(&_aligned_mem, 32, sizeof(ElementType) * length); + data = std::unique_ptr(_aligned_mem, free); #else // VS2013 does not support c++11 aligned_alloc data = std::unique_ptr((ElementType*)aligned_alloc(32, sizeof(ElementType) * length), _aligned_free); #endif @@ -154,12 +158,14 @@ class FixedArrayBase : public VectorOperationsBase } private: explicit inline FixedArrayBase(int length, int) : length(length), + #ifndef WIN32 data((ElementType*)aligned_alloc(32, sizeof(ElementType) * length), free) #else // VS2013 does not support c++11 aligned_alloc data((ElementType*)aligned_alloc(32, sizeof(ElementType) * length), _aligned_free) #endif { + } void copyInit(const ElementType *from) { diff --git a/core/stats/calculationStats.h b/core/stats/calculationStats.h index e8e566405..17fd078a8 100644 --- a/core/stats/calculationStats.h +++ b/core/stats/calculationStats.h @@ -555,7 +555,7 @@ template osId = "!w.png!"; #endif #ifdef Q_OS_MAC - osId = "!a.png!" + osId = "!a.png!"; #endif const char *is64bit = "!3.png!"; diff --git a/core/utils/global.h b/core/utils/global.h index 32a57787d..e0b4373c8 100644 --- a/core/utils/global.h +++ b/core/utils/global.h @@ -400,19 +400,29 @@ inline void * __CRTDECL operator new(size_t _Size) { /** Invite support of the file system */ -#if defined(__GNUC__) -# if __cplusplus >= 201703L -# include - namespace fs = std::filesystem; -# else -# include - namespace fs = std::experimental::filesystem; -# endif -#else -# ifdef _MSC_VER -# include - namespace fs = std::tr2::sys; -# endif +// #if defined(__GNUC__) +// # if __cplusplus >= 201703L +// # include +// namespace fs = std::filesystem; +// # else +// # include +// namespace fs = std::experimental::filesystem; +// # endif +// #else +// # ifdef _MSC_VER +// # include +// namespace fs = std::tr2::sys; +// # endif +// #endif + +/** Alligned memory allocation for APPLE platform */ +#ifdef __APPLE__ +inline void* aligned_alloc(size_t alignment, size_t size) +{ + void* mem = nullptr; + posix_memalign(&mem, alignment, size); + return mem; +} #endif /** Function for safe deleting objects and arrays */ diff --git a/core/utils/utils.cpp b/core/utils/utils.cpp index 043567f14..0273d9d21 100644 --- a/core/utils/utils.cpp +++ b/core/utils/utils.cpp @@ -205,59 +205,59 @@ std::string addFileExtIfNotExist(const std::string &fileName, const std::string std::string getDirectory(const std::string &absoluteFilePath) { - CORE_ASSERT_TRUE_S(!absoluteFilePath.empty()); + // CORE_ASSERT_TRUE_S(!absoluteFilePath.empty()); - fs::path filePath(absoluteFilePath); - return fs::absolute(filePath.parent_path()).string(); + // fs::path filePath(absoluteFilePath); + // return fs::absolute(filePath.parent_path()).string(); } std::string getFileName(const std::string &fileName) { - fs::path filePath(fileName); - return filePath.filename().string(); + // fs::path filePath(fileName); + // return filePath.filename().string(); } std::string concatPath(const std::string &path1, const std::string &path2) { - return (fs::path(path1) / fs::path(path2)).string(); + // return (fs::path(path1) / fs::path(path2)).string(); } bool isAbsolutePath(const std::string &path) { - return fs::path(path).is_absolute(); + // return fs::path(path).is_absolute(); } bool pathExists(const std::string &path) { - return fs::exists(path); + // return fs::exists(path); } bool pathRemove(const std::string &path) { - fs::path p(path); - if (fs::exists(p)) - return fs::remove(p); - return false; + // fs::path p(path); + // if (fs::exists(p)) + // return fs::remove(p); + // return false; } std::string getFileNameIfExist(const std::string &fileName, const std::string &relativePath) { - fs::path filePath(fileName); - if (fs::exists(filePath)) - return fileName; + // fs::path filePath(fileName); + // if (fs::exists(filePath)) + // return fileName; - fs::path infoNew = fs::path(relativePath) / fs::path(fileName); /* this is concatenation */ - if (fs::exists(infoNew)) - return fs::absolute(infoNew).string(); + // fs::path infoNew = fs::path(relativePath) / fs::path(fileName); /* this is concatenation */ + // if (fs::exists(infoNew)) + // return fs::absolute(infoNew).string(); - std::cout << "couldn't locate <" << fileName << "> with relativePath:" << relativePath << std::endl; - return ""; + // std::cout << "couldn't locate <" << fileName << "> with relativePath:" << relativePath << std::endl; + // return ""; } bool isDirectory(const std::string &path) { - fs::path filePath(path); - return fs::is_directory(filePath); + //fs::path filePath(path); + //return fs::is_directory(filePath); } } // namespace HelperUtils diff --git a/cvs-config.pri b/cvs-config.pri index 9fe862baa..847f72700 100644 --- a/cvs-config.pri +++ b/cvs-config.pri @@ -42,7 +42,7 @@ CONFIG += \ with_tbb \ with_openblas \ with_fastbuild \ - with_unorthodox \ # allow use an experimental filesystem +# with_unorthodox \ # allow use an experimental filesystem with_qscript \ # experimental... include(config-cpu-features.pri) @@ -51,7 +51,7 @@ include(config-cpu-features.pri) CONFIG += \ \ # pedantic_build \ - # gcc_env_toolchain \ + # gcc_env_toolchain \ # gcc48_toolchain \ # gcc_lto \ # gcc_checker \ @@ -70,10 +70,14 @@ include(config-cpu-features.pri) } +macx { + CONFIG += clang_toolchain +} + CONFIG += \ # with_ueye \ # with_httpserver \ - with_avcodec \ +# with_avcodec \ with_libjpeg \ with_libpng \ diff --git a/test-core/buffer/main_test_buffer.cpp b/test-core/buffer/main_test_buffer.cpp index eda09ee08..f4cd7e6cc 100644 --- a/test-core/buffer/main_test_buffer.cpp +++ b/test-core/buffer/main_test_buffer.cpp @@ -140,7 +140,10 @@ TEST(Buffer, testG12Buffer) ASSERT_TRUE(std::is_trivially_destructible::value); ASSERT_TRUE(std::is_trivially_destructible::value); ASSERT_TRUE(std::is_trivially_destructible::value); -#if __GNUG__ && __GNUC__ < 5 +#if __APPLE__ + ASSERT_TRUE(std::is_trivially_default_constructible()); + ASSERT_TRUE(std::is_trivially_default_constructible()); +#elif __GNUG__ && __GNUC__ < 5 ASSERT_TRUE(std::has_trivial_default_constructor()); ASSERT_TRUE(std::has_trivial_default_constructor()); #else diff --git a/tools/generator/generator.pro b/tools/generator/generator.pro index 3020222bf..9a044001f 100644 --- a/tools/generator/generator.pro +++ b/tools/generator/generator.pro @@ -34,7 +34,7 @@ INCLUDEPATH += \ SOURCES += $$COREDIR/utils/util.c SOURCES += $$COREDIR/utils/utils.cpp -!win32 { +!win32:!macx { LIBS += -lstdc++fs } diff --git a/utils/3d/sceneShaded.cpp b/utils/3d/sceneShaded.cpp index afd361ddf..2f1e15231 100644 --- a/utils/3d/sceneShaded.cpp +++ b/utils/3d/sceneShaded.cpp @@ -21,7 +21,12 @@ QString textGlError(GLenum err) case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW"; break; case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY"; break; case GL_INVALID_FRAMEBUFFER_OPERATION: return "GL_INVALID_FRAMEBUFFER_OPERATION"; break; - case GL_CONTEXT_LOST: return "GL_CONTEXT_LOST"; break; + + // Note: + // GL_CONTEXT_LOST - enum from OpenGL 4.5 version, which is not + // supported by Apple + // case GL_CONTEXT_LOST: return "GL_CONTEXT_LOST"; break; + case GL_TABLE_TOO_LARGE: return "GL_TABLE_TOO_LARGE"; break; default: break; diff --git a/utils/utils.pri b/utils/utils.pri index 704e9dd3d..59cea4ee5 100755 --- a/utils/utils.pri +++ b/utils/utils.pri @@ -112,7 +112,10 @@ with_opengl { win32 { LIBS += -lglu32 -lopengl32 # these libs must be exactly here: before openCV but after our libs! It's a magic of mingw, for msvc it's easier.:) - } else { + } else:mac { + LIBS += -framework OpenGL + } + else { LIBS += -lX11 -lXext -lGLU # TODO: why we need "Xtst" ? #LIBS += -lXtst -lX11 -lXext -lGLU # these libs must be exactly here: they're required by OpenGL and some other stuff... } From 1fa9b95734fc24bc3b392732e905d26b4149c2c6 Mon Sep 17 00:00:00 2001 From: egororachyov Date: Thu, 3 Oct 2019 00:53:59 +0300 Subject: [PATCH 3/3] Minor clean in changed files --- core/math/vector/fixedArray.h | 4 ---- core/utils/global.h | 2 +- utils/3d/sceneShaded.cpp | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/core/math/vector/fixedArray.h b/core/math/vector/fixedArray.h index 652ee2eb7..dbcb68638 100644 --- a/core/math/vector/fixedArray.h +++ b/core/math/vector/fixedArray.h @@ -64,10 +64,6 @@ class FixedArrayBase : public VectorOperationsBase length = that.length; #ifndef WIN32 data = std::unique_ptr((ElementType*)aligned_alloc(32, sizeof(ElementType) * length), free); -#elif defined(__APPLE__) - ElementType* _aligned_mem; - posix_memalign(&_aligned_mem, 32, sizeof(ElementType) * length); - data = std::unique_ptr(_aligned_mem, free); #else // VS2013 does not support c++11 aligned_alloc data = std::unique_ptr((ElementType*)aligned_alloc(32, sizeof(ElementType) * length), _aligned_free); #endif diff --git a/core/utils/global.h b/core/utils/global.h index e0b4373c8..6a8b338f4 100644 --- a/core/utils/global.h +++ b/core/utils/global.h @@ -416,7 +416,7 @@ inline void * __CRTDECL operator new(size_t _Size) { // #endif /** Alligned memory allocation for APPLE platform */ -#ifdef __APPLE__ +#ifdef Q_OS_MAC inline void* aligned_alloc(size_t alignment, size_t size) { void* mem = nullptr; diff --git a/utils/3d/sceneShaded.cpp b/utils/3d/sceneShaded.cpp index 2f1e15231..8c72a480e 100644 --- a/utils/3d/sceneShaded.cpp +++ b/utils/3d/sceneShaded.cpp @@ -24,7 +24,7 @@ QString textGlError(GLenum err) // Note: // GL_CONTEXT_LOST - enum from OpenGL 4.5 version, which is not - // supported by Apple + // supported by Apple. Currently supported version is 4.1 // case GL_CONTEXT_LOST: return "GL_CONTEXT_LOST"; break; case GL_TABLE_TOO_LARGE: return "GL_TABLE_TOO_LARGE"; break;