Bugfixes to hopefully let it run on Windows. Needs further testing

This commit is contained in:
Anne de Jong 2020-04-06 21:38:04 +02:00
parent 8e0b173fdf
commit c1d8fe97d4
7 changed files with 44 additions and 24 deletions

View File

@ -24,8 +24,8 @@ add_definitions(-DLASP_MAX_NFFT=33554432) # 2**25
add_definitions(-D_REENTRANT)
# ############### Choose an fft backend here
#set(LASP_FFT_BACKEND fftpack)
set(LASP_FFT_BACKEND "fftw")
set(LASP_FFT_BACKEND fftpack)
#set(LASP_FFT_BACKEND "fftw")
if(LASP_FFT_BACKEND STREQUAL "fftw")
find_library(FFTW_LIBRARY NAMES fftw3 fftw)
@ -55,6 +55,32 @@ endif(NOT DEFINED LASP_DEBUG)
set(Python_ADDITIONAL_VERSIONS "3")
# #################### Setting definitions and debug-specific compilation flags
# General make flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall -Wextra -Wno-type-limits \
-Werror=implicit-function-declaration \
-Werror=return-type")
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(win32 true)
message("Building for Windows")
include_directories(
..\\rtaudio
C:\\mingw\\include\\OpenBLAS
)
add_definitions(-DMS_WIN64)
link_directories(C:\\mingw\\lib)
link_directories(C:\\mingw\\bin)
link_directories(..\\rtaudio)
link_directories(C:\\Users\\librewin7\\Miniconda3)
else()
set(win32 false)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c11 \
-Werror=incompatible-pointer-types")
endif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
if(LASP_DEBUG)
set(TRACERNAME LASPTracer)
set(LASP_DEBUG_CYTHON=True)
@ -87,10 +113,7 @@ endif(LASP_DEBUG)
############################## General compilation flags (independent of debug mode, windows or linux)
set(CYTHON_EXTRA_C_FLAGS "-Wno-sign-compare -Wno-cpp -Wno-implicit-fallthrough -Wno-incompatible-pointer-types -Wno-strict-aliasing")
# General make flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c11 -Wall -Wextra -Wno-type-limits \
-Werror=implicit-function-declaration -Werror=incompatible-pointer-types \
-Werror=return-type")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11 -Wall -Wextra \
-Wno-type-limits")
@ -111,11 +134,7 @@ endif(LASP_USE_BLAS)
# ############################# End compilation flags
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(win32 true)
else()
set(win32 false)
endif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
find_package(PythonLibs REQUIRED )
find_package(PythonInterp REQUIRED)

View File

@ -15,4 +15,4 @@ add_subdirectory(device)
set_source_files_properties(wrappers.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${CYTHON_EXTRA_C_FLAGS}")
cython_add_module(wrappers wrappers.pyx)
target_link_libraries(wrappers lasp_lib )
target_link_libraries(wrappers lasp_lib python37)

View File

@ -18,7 +18,9 @@
#define _GNU_SOURCE
#include <sys/types.h>
#include <unistd.h>
#ifndef MS_WIN64
#include <sys/syscall.h>
#endif
/* #endif */
typedef struct {

View File

@ -11,17 +11,17 @@
#include "lasp_types.h"
#ifdef _REENTRANT
#include <stdatomic.h>
static _Thread_local us ASCEE_FN_LEVEL = 0;
static _Atomic(int) TRACERNAME = ATOMIC_VAR_INIT(DEFAULTTRACERLEVEL);
static __thread us ASCEE_FN_LEVEL = 0;
static int TRACERNAME = DEFAULTTRACERLEVEL;
void setTracerLevel(int level) {
atomic_store(&TRACERNAME,level);
__sync_lock_test_and_set(&TRACERNAME, level);
}
int getTracerLevel() {
return atomic_load(&TRACERNAME);
return __sync_fetch_and_add(&TRACERNAME, 0);
}
#else

View File

@ -26,7 +26,7 @@ typedef struct Workers_s {
us num_workers;
} Workers;
static void* threadfcn(void* data);
static void threadfcn(void* data);
Workers* Workers_create(const us num_workers,
JobQueue* jq,
@ -123,7 +123,7 @@ void Workers_free(Workers* w) {
}
static void* threadfcn(void* thread_global_data) {
static void threadfcn(void* thread_global_data) {
TRACE(15,"Started worker thread function");
dbgassert(thread_global_data,NULLPTRDEREF "thread_data in"

View File

@ -5,5 +5,4 @@ set_source_files_properties(lasp_rtaudio.cxx PROPERTIES COMPILE_FLAGS
cython_add_module(lasp_rtaudio lasp_rtaudio.pyx)
# target_link_libraries(lasp_portaudio portaudio) */
target_link_libraries(lasp_rtaudio pthread rtaudio)
target_link_libraries(lasp_rtaudio pthread rtaudio python37)

View File

@ -3,7 +3,7 @@
import os
import platform
import shelve
import sys
import appdirs
import numpy as np
@ -22,10 +22,10 @@ lasp_appdir = appdirs.user_data_dir('Lasp', 'ASCEE')
if not os.path.exists(lasp_appdir):
try:
os.mkdir(lasp_appdir)
os.makedirs(lasp_appdir, exist_ok=True)
except:
print('Fatal error: could not create application directory')
exit(1)
sys.exit(1)
class Shelve:
def load(self, key, default_value):