Skip to content

Commit

Permalink
latest shit
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhrisca committed Dec 17, 2024
1 parent e1bd008 commit 3b5ae90
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 432 deletions.
33 changes: 20 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
cmake_minimum_required(VERSION 3.15...3.26)

project(
${SKBUILD_PROJECT_NAME}
LANGUAGES C
VERSION ${SKBUILD_PROJECT_VERSION})
cmake_minimum_required(VERSION 3.26...3.29)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C VERSION ${SKBUILD_PROJECT_VERSION})

find_package(
Python
REQUIRED
COMPONENTS
Interpreter
Development.Module
${SKBUILD_SABI_COMPONENT}
NumPy
REQUIRED)
)

python_add_library(cutils MODULE WITH_SOABI USE_SABI 3.11 src/asammdf/blocks/cutils.c)

if(DEFINED ENV{LIBDEFLATE_PREFIX})
message(STATUS "Finding libdeflate in $ENV{LIBDEFLATE_PREFIX}")
target_include_directories(_deflate PUBLIC "$ENV{LIBDEFLATE_PREFIX}/include")
target_link_directories(_deflate PUBLIC "$ENV{LIBDEFLATE_PREFIX}/lib")
target_link_libraries(_deflate PRIVATE deflate)
else()
message(STATUS "Building and linking bundled libdeflate222222")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(LIBDEFLATE_BUILD_SHARED_LIB OFF)
add_subdirectory(libdeflate EXCLUDE_FROM_ALL)
target_link_libraries(cutils PRIVATE libdeflate_static)
endif()

python_add_library(cutils
MODULE
src/asammdf/blocks/cutils.c
WITH_SOABI USE_SABI 3.9)

target_link_libraries(cutils PRIVATE Python::NumPy)

install(TARGETS cutils DESTINATION "asammdf/blocks")
install(TARGETS cutils LIBRARY DESTINATION "asammdf/blocks")
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ metadata.version.provider = "scikit_build_core.metadata.regex"
metadata.version.input = "src/asammdf/version.py"
wheel.packages = ["src/asammdf"]
wheel.py-api = "cp39"
sdist.include = [
"src/asammdf/blocks/isa-l/*"
]

[tool.black]
line-length = 120
Expand Down
9 changes: 4 additions & 5 deletions src/asammdf/blocks/cutils.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define NPY_NO_DEPRECATED_API NPY_1_22_API_VERSION

#define PY_SSIZE_T_CLEAN 1
#include <Python.h>
#include "numpy/arrayobject.h"
Expand All @@ -8,7 +7,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <time.h>
#define MAX_THREADS 12
#include "miniz.h"
#include "miniz.c"
#include <libdeflate.h>
Expand Down Expand Up @@ -1996,9 +1994,10 @@ void * get_channel_raw_bytes_complete_C(void *lpParam )
struct libdeflate_decompressor *decompressor = libdeflate_alloc_decompressor();
libdeflate_zlib_decompress(decompressor,
inptr, compressed_size,
pUncomp original_size,
NULL)

pUncomp, original_size,
NULL);


libdeflate_free_decompressor(decompressor);
}
else {
Expand Down
Binary file removed src/asammdf/blocks/libdeflate.dll
Binary file not shown.
Loading

0 comments on commit 3b5ae90

Please sign in to comment.