-
-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
38 lines (31 loc) · 1.24 KB
/
CMakeLists.txt
File metadata and controls
38 lines (31 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
cmake_minimum_required(VERSION 3.26...3.29)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C VERSION ${SKBUILD_PROJECT_VERSION})
# Ensure that option() calls in subdirectories respect normal variables
# set in this parent scope (e.g., disabling features in libdeflate).
# Without this, CMake would ignore values set via set(...) and always use
# the default provided in option(), which can lead to unexpected behavior.
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
option(WITH_SYSTEM_DEFLATE "Use system provided deflate library" OFF)
find_package(
Python
REQUIRED
COMPONENTS
Interpreter
Development.Module
${SKBUILD_SABI_COMPONENT}
NumPy
)
python_add_library(cutils MODULE WITH_SOABI USE_SABI 3.10 src/asammdf/blocks/cutils.c)
if (WITH_SYSTEM_DEFLATE)
find_package(libdeflate REQUIRED)
target_link_libraries(cutils PRIVATE Python::NumPy libdeflate::libdeflate_shared)
else()
# Add submodule libdeflate
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(LIBDEFLATE_COMPRESSION_SUPPORT OFF)
set(LIBDEFLATE_GZIP_SUPPORT OFF)
set(LIBDEFLATE_BUILD_GZIP OFF)
add_subdirectory(ext/libdeflate EXCLUDE_FROM_ALL)
target_link_libraries(cutils PRIVATE Python::NumPy libdeflate::libdeflate_static)
endif()
install(TARGETS cutils DESTINATION "asammdf/blocks")