diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e11533..6aee051 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,7 @@ set(Python_ADDITIONAL_VERSIONS "3.8") # General make flags set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall -Wextra -Wno-type-limits \ --Werror=implicit-function-declaration \ +-Werror=implicit-function-declaration -Wno-unused-parameter \ -Werror=return-type") if(CMAKE_SYSTEM_NAME STREQUAL "Windows") @@ -131,7 +131,7 @@ endif(LASP_DEBUG) # occures. ############################## 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") - +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 \ @@ -169,7 +169,6 @@ include_directories( lasp/c ) -set(cpp_daq_linklibs pthread) add_subdirectory(lasp) add_subdirectory(test) diff --git a/lasp/c/lasp_fft.c b/lasp/c/lasp_fft.c index b1673fd..6324010 100644 --- a/lasp/c/lasp_fft.c +++ b/lasp/c/lasp_fft.c @@ -15,16 +15,17 @@ typedef struct Fft_s { us nfft; vd fft_work; // Storage memory for fftpack -}; +} Fft_s; #elif defined LASP_FFT_BACKEND_FFTW #include + typedef struct Fft_s { us nfft; fftw_plan forward_plan; fftw_plan reverse_plan; c* complex_storage; d* real_storage; -}; +} Fft_s; #endif diff --git a/lasp/c/lasp_mat.h b/lasp/c/lasp_mat.h index aa536d0..a70c49d 100644 --- a/lasp/c/lasp_mat.h +++ b/lasp/c/lasp_mat.h @@ -131,7 +131,7 @@ static inline c* getvcval(const vc* vec,us row){ */ static inline void dmat_set(dmat* mat,const d value){ dbgassert(mat,NULLPTRDEREF); - if(likely(mat->n_cols * mat->n_rows > 0)) { + if(islikely(mat->n_cols * mat->n_rows > 0)) { for(us col=0;coln_cols;col++) { d_set(getdmatval(mat,0,col),value,mat->n_rows); } @@ -147,7 +147,7 @@ static inline void dmat_set(dmat* mat,const d value){ */ static inline void cmat_set(cmat* mat,const c value){ dbgassert(mat,NULLPTRDEREF); - if(likely(mat->n_cols * mat->n_rows > 0)) { + if(islikely(mat->n_cols * mat->n_rows > 0)) { for(us col=0;coln_cols;col++) { c_set(getcmatval(mat,0,col),value,mat->n_rows); } diff --git a/lasp/c/lasp_pyarray.h b/lasp/c/lasp_pyarray.h index 0d8c88a..8a0169a 100644 --- a/lasp/c/lasp_pyarray.h +++ b/lasp/c/lasp_pyarray.h @@ -9,8 +9,6 @@ #pragma once #ifndef LASP_PYARRAY_H #define LASP_PYARRAY_H - -#define TRACERPLUS (-10) #include #ifdef LASP_DOUBLE_PRECISION #define LASP_NUMPY_FLOAT_TYPE NPY_FLOAT64 diff --git a/lasp/c/lasp_python.h b/lasp/c/lasp_python.h index 71cdb15..4ae3ff4 100644 --- a/lasp/c/lasp_python.h +++ b/lasp/c/lasp_python.h @@ -8,7 +8,6 @@ #pragma once #ifndef LASP_PYTHON_H #define LASP_PYTHON_H -#define TRACERPLUS (-10) #include "lasp_pyarray.h" /** diff --git a/lasp/c/lasp_slm.c b/lasp/c/lasp_slm.c index ed69052..ccbdb82 100644 --- a/lasp/c/lasp_slm.c +++ b/lasp/c/lasp_slm.c @@ -209,7 +209,7 @@ dmat Slm_run(Slm *slm, vd *input_data) { } iVARTRACE(15, cur_offset); iVARTRACE(15, i); - dbgassert(i == (int) nsamples_output, "BUG"); + dbgassert(i == nsamples_output, "BUG"); vd_free(&power_filtered); vd_free(&chan); diff --git a/lasp/c/lasp_sosfilterbank.c b/lasp/c/lasp_sosfilterbank.c index c2fdab9..7e237cb 100644 --- a/lasp/c/lasp_sosfilterbank.c +++ b/lasp/c/lasp_sosfilterbank.c @@ -39,10 +39,10 @@ us Sosfilterbank_getFilterbankSize(const Sosfilterbank* fb) { int filter_single(void* worker_data,void* job); -static inline min(us a, us b){ +static inline us min(us a, us b){ return ab?a:b; } diff --git a/lasp/c/lasp_types.h b/lasp/c/lasp_types.h index 10b7371..c8b17be 100644 --- a/lasp/c/lasp_types.h +++ b/lasp/c/lasp_types.h @@ -11,15 +11,12 @@ #define LASP_TYPES_H #include // // Branch prediction performance improvement -#if !defined(likely) -#if defined(__GNUC__) && !defined(LASP_DEBUG) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) +#if !defined(islikely) && defined(__GNUC__) && !defined(LASP_DEBUG) +#define islikely(x) __builtin_expect(!!(x), 1) +#define isunlikely(x) __builtin_expect(!!(x), 0) #else -#define likely(x) (x) -#define unlikely(x) (x) -#endif // if defined(__GNUC__) && !defined(LASP_DEBUG) - +#define islikely(x) (x) +#define isunlikely(x) (x) #endif // !defined(likely) /// We often use boolean values diff --git a/lasp/device/CMakeLists.txt b/lasp/device/CMakeLists.txt index 7b026bc..3085508 100644 --- a/lasp/device/CMakeLists.txt +++ b/lasp/device/CMakeLists.txt @@ -1,22 +1,21 @@ set(cpp_daq_files lasp_cppdaq.cpp) -# set(cpp_daq_linklibs pthread) -# set(cpp_daq_linklibs PARENT_SCOPE) +set(mycpp_daq_linklibs pthread) if(LASP_RTAUDIO) include_directories(/usr/include/rtaudio) list(APPEND cpp_daq_files lasp_cpprtaudio.cpp) - list(PREPEND cpp_daq_linklibs rtaudio) + list(PREPEND mycpp_daq_linklibs rtaudio) endif() if(LASP_ULDAQ) list(APPEND cpp_daq_files lasp_cppuldaq.cpp) - list(PREPEND cpp_daq_linklibs uldaq) + list(PREPEND mycpp_daq_linklibs uldaq) endif() if(win32) - list(APPEND cpp_daq_linklibs python) + list(APPEND mycpp_daq_linklibs python) endif(win32) -message("Linklibs: ${cpp_daq_linklibs}") add_library(cpp_daq ${cpp_daq_files}) +target_link_libraries(cpp_daq ${mycpp_daq_linklibs}) foreach(cython_file lasp_daq lasp_deviceinfo lasp_daqconfig) @@ -28,7 +27,13 @@ foreach(cython_file lasp_daq lasp_deviceinfo lasp_daqconfig) cython_add_module(${cython_file} ${cython_file}.pyx) - target_link_libraries(${cython_file} ${cpp_daq_linklibs}) + target_link_libraries(${cython_file} ${mycpp_daq_linklibs}) endforeach() + +# This is the way to make this variable work in all CMakeLists files. It is +# also used in the testing directory. But better to already link cpp_daq with +# linklibs. + +# set(cpp_daq_linklibs "${mycpp_daq_linklibs}" CACHE INTERNAL "cpp_daq_linklibs") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 12219f5..15442c7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,9 +7,9 @@ add_executable(test_fft test_fft.c) add_executable(test_math test_math.c) target_link_libraries(test_bf lasp_lib) -target_link_libraries(test_fft lasp_lib pthread) -target_link_libraries(test_workers lasp_lib pthread) -target_link_libraries(test_math lasp_lib pthread) +target_link_libraries(test_fft lasp_lib) +target_link_libraries(test_workers lasp_lib) +target_link_libraries(test_math lasp_lib) add_executable(test_uldaq test_uldaq.cpp) -target_link_libraries(test_uldaq cpp_daq ${cpp_daq_linklibs}) +target_link_libraries(test_uldaq cpp_daq)