Skip to content

Commit

Permalink
Merge pull request #1950 from minrk/lower-cmake
Browse files Browse the repository at this point in the history
lower minimum cmake version to 3.14
  • Loading branch information
minrk authored Feb 23, 2024
2 parents b3b3e62 + d9dd67d commit 4f85ce9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
28 changes: 24 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# 3.28 needed for EXCLUDE_FROM_ALL
cmake_minimum_required(VERSION 3.28)
cmake_minimum_required(VERSION 3.14...3.28)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C CXX)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)

Expand Down Expand Up @@ -273,14 +272,31 @@ if (ZMQ_PREFIX STREQUAL "bundled")
set(BUILD_TESTS OFF)
set(BUILD_SHARED OFF)
set(BUILD_STATIC ON)

if(NOT MSVC)
# backport check for kqueue, which is wrong in libzmq 4.3.5
# libzmq's cmake will proceed with the rest
# https://github.com/zeromq/libzmq/pull/4659
include(CheckCXXSymbolExists)
set(POLLER
""
CACHE STRING "Choose polling system for I/O threads. valid values are
kqueue, epoll, devpoll, pollset, poll or select [default=autodetect]")
if(POLLER STREQUAL "")
check_cxx_symbol_exists(kqueue "sys/types.h;sys/event.h;sys/time.h" HAVE_KQUEUE)
if(HAVE_KQUEUE)
set(POLLER "kqueue")
endif()
endif()
endif()

if(MSVC)
set(API_POLLER "select" CACHE STRING "Set API Poller (default: select)")
endif()

FetchContent_Declare(bundled_libzmq
URL ${PYZMQ_LIBZMQ_URL}
PREFIX ${BUNDLE_DIR}
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(bundled_libzmq)

Expand Down Expand Up @@ -364,4 +380,8 @@ else()
endif()

target_include_directories(${ZMQ_EXT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/zmq/utils")
install(TARGETS ${ZMQ_EXT_NAME} DESTINATION "${ZMQ_BACKEND_DEST}")
install(TARGETS ${ZMQ_EXT_NAME} DESTINATION "${ZMQ_BACKEND_DEST}" COMPONENT pyzmq)

# add custom target so we exclude bundled targets from installation
# only need this because the extension name is different for cff/cython
add_custom_target(pyzmq DEPENDS ${ZMQ_EXT_NAME})
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ readme = { file = "README.md" }

[tool.scikit-build]
wheel.packages = ["zmq"]
cmake.version = ">=3.28"
# 3.14 for FetchContent_MakeAvailable
cmake.version = ">=3.14"
# only build/install the pyzmq component
cmake.targets = ["pyzmq"]
install.components = ["pyzmq"]

[tool.autoflake]
ignore-init-module-imports = true
Expand Down

0 comments on commit 4f85ce9

Please sign in to comment.