Skip to content
Snippets Groups Projects
Commit 4590f742 authored by Andrews Sobral's avatar Andrews Sobral
Browse files

Some fixes for OS X

parent 560a10d1
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ message(STATUS "BGSLIBRARY WITH PYTHON SUPPORT: ${BGS_PYTHON_SUPPORT}")
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
set(CMAKE_MACOSX_RPATH 1)
endif(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
......
......@@ -2,6 +2,20 @@ cmake_minimum_required(VERSION 2.8.11)
project(bgslibrary_gui)
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
set(CMAKE_MACOSX_RPATH 1)
# add some standard warnings
ADD_DEFINITIONS(-Wno-variadic-macros -Wno-long-long -Wall -Wextra -Winit-self -Woverloaded-virtual -Wsign-promo -Wno-unused-parameter -pedantic -Woverloaded-virtual -Wno-unknown-pragmas)
# -ansi does not compile with sjn module
#ADD_DEFINITIONS(-ansi)
# if you like to have warinings about conversions, e.g. double->int or double->float etc., or float compare
#ADD_DEFINITIONS(-Wconversion -Wfloat-equal)
endif(UNIX)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
......
......@@ -79,8 +79,7 @@ static PyObject* failmsgp(const char *fmt, ...)
return 0;
}
#define OPENCV_3 0
#if OPENCV_3
#if CV_MAJOR_VERSION == 3
class NumpyAllocator : public MatAllocator
{
public:
......@@ -100,13 +99,13 @@ public:
return u;
}
UMatData* allocate(int dims0, const int* sizes, int type, void* data, size_t* step, int flags) const
UMatData* allocate(int dims0, const int* sizes, int type, void* data, size_t* step, int flags, UMatUsageFlags usageFlags=USAGE_DEFAULT) const
{
if( data != 0 )
{
CV_Error(Error::StsAssert, "The data should normally be NULL!");
// probably this is safe to do in such extreme case
return stdAllocator->allocate(dims0, sizes, type, data, step, flags);
return stdAllocator->allocate(dims0, sizes, type, data, step, flags, usageFlags);
}
PyEnsureGIL gil;
......@@ -129,9 +128,9 @@ public:
return allocate(o, dims0, sizes, type, step);
}
bool allocate(UMatData* u, int accessFlags) const
bool allocate(UMatData* u, int accessFlags, UMatUsageFlags usageFlags=USAGE_DEFAULT) const
{
return stdAllocator->allocate(u, accessFlags);
return stdAllocator->allocate(u, accessFlags, usageFlags);
}
void deallocate(UMatData* u) const
......@@ -294,7 +293,7 @@ cv::Mat NDArrayConverter::toMat(const PyObject *o)
if( m.data )
{
#if OPENCV_3
#if CV_MAJOR_VERSION == 3
m.addref();
Py_INCREF(o);
#else
......@@ -317,7 +316,7 @@ cv::Mat NDArrayConverter::toMat(const PyObject *o)
PyObject* NDArrayConverter::toNDArray(const cv::Mat& m)
{
#if OPENCV_3
#if CV_MAJOR_VERSION == 3
if( !m.data )
Py_RETURN_NONE;
Mat temp, *p = (Mat*)&m;
......
......@@ -21,7 +21,7 @@ along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>.
#include <Python.h>
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/core.hpp>
#include <numpy/ndarrayobject.h>
static PyObject* opencv_error = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment