-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
25 lines (21 loc) · 1.03 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.26...3.29)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C)
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module ${SKBUILD_SABI_COMPONENT})
if("${SKBUILD_SABI_COMPONENT}" STREQUAL "")
python_add_library(_deflate MODULE WITH_SOABI src/_deflate.c)
else()
python_add_library(_deflate MODULE WITH_SOABI USE_SABI 3.11 src/_deflate.c)
endif()
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 libdeflate")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(LIBDEFLATE_BUILD_SHARED_LIB OFF)
add_subdirectory(libdeflate EXCLUDE_FROM_ALL)
target_link_libraries(_deflate PRIVATE libdeflate_static)
endif()
install(TARGETS _deflate LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})