Fixed some bugs to let it work in MinGW compilation

This commit is contained in:
Anne de Jong 2021-05-23 07:38:41 -07:00
parent 2d05019f61
commit 1678a0767a
3 changed files with 12 additions and 4 deletions

View File

@ -88,10 +88,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
link_directories(..\\rtaudio)
link_directories(C:\\Users\\User\\Miniconda3)
add_definitions(-DHAS_RTAUDIO_WIN_WASAPI_API)
else()
else() # Linux compile
set(win32 false)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c11 \
-Werror=incompatible-pointer-types")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fPIC")
include_directories(/usr/local/include/rtaudio)
include_directories(/usr/include/rtaudio)
link_directories(/usr/local/lib)
@ -136,7 +138,7 @@ set(CYTHON_EXTRA_C_FLAGS "-Wno-sign-compare -Wno-cpp -Wno-implicit-fallthrough -
set(CYTHON_EXTRA_CXX_FLAGS "-Wno-sign-compare -Wno-cpp -Wno-implicit-fallthrough -Wno-strict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11 -Wall -Wextra \
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra \
-Wno-type-limits")
# Debug make flags

View File

@ -22,7 +22,7 @@
* Function passed to Python to use for cleanup of
* foreignly obtained data.
**/
static inline void capsule_cleanup(void *capsule) {
static inline void capsule_cleanup(PyObject *capsule) {
void *memory = PyCapsule_GetPointer(capsule, NULL);
free(memory);
}
@ -67,7 +67,7 @@ static inline PyObject *data_to_ndarray(void *data, int n_rows, int n_cols,
// https://stackoverflow.com/questions/54269956/crash-of-jupyter-due-to-the-use-of-pyarray-enableflags/54278170#54278170
// Note that in general it was disadvised to build all C code with MinGW on
// Windows. We do it anyway, see if we find any problems on the way.
void *capsule = PyCapsule_New(mat->_data, NULL, capsule_cleanup);
PyObject *capsule = PyCapsule_New(data, "data destructor", capsule_cleanup);
PyArray_SetBaseObject(arr, capsule);
#endif
/* fprintf(stderr, "============Ownership transfer================\n"); */

View File

@ -4,6 +4,12 @@
#include <thread>
#include <cstring>
#include <cassert>
#if MS_WIN64
// #include <inttypes.h>
// #include <stdint.h>
typedef uint8_t u_int8_t;
#endif
using std::atomic;