From 0d646b70e5042bf2d04bdc2af66cc649fc916e99 Mon Sep 17 00:00:00 2001 From: Chris Hold Date: Tue, 6 Feb 2024 18:30:25 +0200 Subject: [PATCH] Enable build on Windows --- safpy_build.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/safpy_build.py b/safpy_build.py index 597b964..2774236 100644 --- a/safpy_build.py +++ b/safpy_build.py @@ -19,22 +19,45 @@ # Sensible default, please adjust if needed. # In case of doubt, you can also check numpy.show_config() for its BLAS +print("Detected platform: " + sys.platform) if sys.platform == "darwin": print("SAFPY using default Apple Accelerate") extra_link_args.extend(['-Wl,-framework', '-Wl,Accelerate']) -else: +elif sys.platform == "linux": print("SAFPY using default OpenBLAS/LAPACKE") saf_performance_lib.extend(["openblas", "lapacke"]) - +elif sys.platform == "win32": + print("SAFPY using default OpenBLAS/LAPACKE") + saf_performance_lib.extend(["libopenblas"]) # should include lapacke +else: + print("No defaults.") # cdef() expects a single string declaring the C types, functions and # globals needed to use the shared object. It must be in valid C syntax. ffibuilder.cdef(""" #define SAF_VERSION ... + +""") + +if sys.platform != "win32": + ffibuilder.cdef(""" -typedef float _Complex float_complex; -typedef double _Complex double_complex; + typedef float _Complex float_complex; + typedef double _Complex double_complex; + + """) +else: + ffibuilder.cdef(""" + + typedef struct + { + float _Val[2]; + } float_complex; + + """) + +ffibuilder.cdef(""" typedef enum _AFSTFT_FDDATA_FORMAT{ AFSTFT_BANDS_CH_TIME, /**< nBands x nChannels x nTimeHops */ @@ -42,7 +65,6 @@ }AFSTFT_FDDATA_FORMAT; - void *malloc(size_t size); void free(void *ptr); @@ -201,6 +223,9 @@ libraries.extend(saf_performance_lib) +library_dirs.extend([this_dir, saf_path]) + + print("Compiling _safpy with:") print(f"C_Header_Source: {c_header_source}") print(f"include_dirs: {include_dirs}")