diff --git a/CMakeLists.txt b/CMakeLists.txt index f7c2342..8b3bb54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,13 +57,8 @@ elseif(LASP_FFT_BACKEND STREQUAL "FFTPack") add_subdirectory(fftpack) endif() - -# ##################### END Cmake variables converted to a macro -# set(Python_ADDITIONAL_VERSIONS "3.8") -# set(python_version_windll "38") -# #################### Setting definitions and debug-specific compilation flags - # General make flags +set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-type-limits \ -Werror=implicit-function-declaration -Wno-unused-parameter \ -Werror=return-type") @@ -99,7 +94,7 @@ else() # Linux compile # This should become optional later on, and be added to the windows list as # well. -endif(CMAKE_SYSTEM_NAME STREQUAL "Windows") +endif() set(CYTHON_FLAGS "--fast-fail") if(LASP_DEBUG) diff --git a/lasp/c/lasp_config.h.in b/lasp/c/lasp_config.h.in index a0d3840..ab55a71 100644 --- a/lasp/c/lasp_config.h.in +++ b/lasp/c/lasp_config.h.in @@ -31,9 +31,9 @@ /* Single / double precision */ #ifdef LASP_DOUBLE_PRECISION -#define LASP_FLOAT 64 +#define LASP_FLOAT_SIZE 64 #else -#define LASP_FLOAT 32 +#define LASP_FLOAT_SIZE 32 #endif /* Serial / parallel computation */ diff --git a/lasp/c/lasp_types.h b/lasp/c/lasp_types.h index bb29d90..4e58c6a 100644 --- a/lasp/c/lasp_types.h +++ b/lasp/c/lasp_types.h @@ -30,12 +30,12 @@ typedef size_t us; /* Size type I always use */ // To change the whole code to 32-bit floating points, change this to // float. -#if LASP_FLOAT == 32 +#if LASP_FLOAT_SIZE == 32 typedef float d; /* Shortcut for double */ -#elif LASP_FLOAT == 64 +#elif LASP_FLOAT_SIZE == 64 typedef double d; /* Shortcut for double */ #else -#error LASP_FLOAT should be either 32 or 64 +#error LASP_FLOAT_SIZE should be either 32 or 64 #endif @@ -43,7 +43,7 @@ typedef double d; /* Shortcut for double */ #ifdef __cplusplus typedef std::complex c; #else -#if LASP_FLOAT == 32 +#if LASP_FLOAT_SIZE == 32 typedef float complex c; #else typedef double complex c; diff --git a/lasp/config.pxi.in b/lasp/config.pxi.in index df2ce38..cc6bd92 100644 --- a/lasp/config.pxi.in +++ b/lasp/config.pxi.in @@ -4,7 +4,7 @@ cimport numpy as cnp # Do this, our segfaults will be your destination cnp.import_array() -DEF LASP_FLOAT = "@LASP_FLOAT@" -DEF LASP_DEBUG_CYTHON = "@LASP_DEBUG_CYTHON@" +DEF LASP_DOUBLE_PRECISION = "@LASP_DOUBLE_PRECISION@" +DEF LASP_DEBUG_CYTHON = "@LASP_DEBUG@" from libcpp cimport bool diff --git a/lasp/wrappers.pyx b/lasp/wrappers.pyx index 3c2698f..f7620c8 100644 --- a/lasp/wrappers.pyx +++ b/lasp/wrappers.pyx @@ -8,7 +8,7 @@ from numpy cimport import_array import_array() -IF LASP_FLOAT == "double": +IF LASP_DOUBLE_PRECISION == "ON": ctypedef double d ctypedef double complex c NUMPY_FLOAT_TYPE = np.float64 diff --git a/setup.py b/setup.py index 902c565..2ce4fda 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ setup( author='J.A. de Jong - ASCEE', author_email="j.a.dejong@ascee.nl", install_requires=['matplotlib>=1.0', - 'scipy>=1.0', 'numpy>=1.0', 'h5py==3.2.0', + 'scipy>=1.0', 'numpy>=1.0', 'h5py', 'dataclasses_json', 'cython', ], license='MIT',