Skip to content
Open
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
36 changes: 26 additions & 10 deletions common.pri
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions core/buffers/abstractBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,12 +659,12 @@ template<typename ResultType>
{
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;
}
Expand Down Expand Up @@ -775,7 +775,7 @@ template<typename ResultType>
{
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
Expand Down Expand Up @@ -1286,7 +1286,7 @@ template<typename OtherType>
*/
if (TRIVIALLY_COPY_CONSTRUCTIBLE)
{
memcpy(dst, src, cnt * sizeof(ElementType));
memcpy((void *)dst, (void *)src, cnt * sizeof(ElementType));
}
else
{
Expand Down Expand Up @@ -1335,7 +1335,7 @@ template<typename OtherType>
}
else
{
memset(ptr, 0, sizeof(ElementType) * stride * h);
memset((void *)ptr, 0, sizeof(ElementType) * stride * h);
}
}

Expand Down
6 changes: 3 additions & 3 deletions core/buffers/converters/debayerTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/buffers/rgb24/wuRasterizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <algorithm>
#include <cfloat>
#include <iostream>
#include <cmath>

#include "core/math/mathUtils.h"

Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion core/core.pri
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ with_unorthodox {
}


!win32 {
!win32:!mac {
LIBS += -lstdc++fs
}

Expand Down
194 changes: 97 additions & 97 deletions core/filesystem/folderScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> &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)
Expand All @@ -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<string> &childs, bool findFiles)
Expand Down Expand Up @@ -146,30 +146,30 @@ bool FolderScanner::scan(const string &path, vector<string> &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
Expand Down
2 changes: 2 additions & 0 deletions core/math/vector/fixedArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ class FixedArrayBase : public VectorOperationsBase<RealType, ElementType>
}
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)
{
Expand Down
Loading