diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 3a67131e..b322b396 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -4,13 +4,14 @@ project(pylibremidi) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL 1) +set(LIBREMIDI_PYTHON 1) set(LIBREMIDI_FIND_BOOST 1) set(LIBREMIDI_HEADER_ONLY 1) set(LIBREMIDI_NEEDS_READERWRITERQUEUE 1) add_subdirectory(../.. libremidi-src) -find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED) +find_package(Python 3.9 COMPONENTS Interpreter Development.Module REQUIRED) if(NOT readerwriterqueue_FOUND AND NOT TARGET readerwriterqueue) FetchContent_Declare( @@ -30,6 +31,6 @@ FetchContent_Declare( FetchContent_MakeAvailable(nanobind) nanobind_add_module(pylibremidi pylibremidi.cpp) -target_link_libraries(pylibremidi PUBLIC libremidi readerwriterqueue Boost::headers) +target_link_libraries(pylibremidi PUBLIC libremidi readerwriterqueue Boost::headers Boost::variant2 Boost::container) -install(TARGETS pylibremidi LIBRARY DESTINATION .) \ No newline at end of file +install(TARGETS pylibremidi LIBRARY DESTINATION .) diff --git a/cmake/libremidi.deps.cmake b/cmake/libremidi.deps.cmake index ba31880c..56845e96 100644 --- a/cmake/libremidi.deps.cmake +++ b/cmake/libremidi.deps.cmake @@ -34,19 +34,25 @@ if(LIBREMIDI_NO_BOOST AND LIBREMIDI_FIND_BOOST) endif() if(LIBREMIDI_FIND_BOOST) - find_package(Boost OPTIONAL_COMPONENTS cobalt) + set(BOOST_INCLUDE_LIBRARIES headers container) + if(NOT LIBREMIDI_NO_NETWORK) + list(APPEND BOOST_INCLUDE_LIBRARIES asio) + endif() + if(LIBREMIDI_EXAMPLES) + list(APPEND BOOST_INCLUDE_LIBRARIES cobalt) + endif() + if(LIBREMIDI_PYTHON) + list(APPEND BOOST_INCLUDE_LIBRARIES variant2) + endif() + find_package(Boost 1.90 OPTIONAL_COMPONENTS ${BOOST_INCLUDE_LIBRARIES}) if(NOT Boost_FOUND) set(BOOST_ENABLE_CMAKE ON) - set(BOOST_INCLUDE_LIBRARIES container asio variant2 cobalt) FetchContent_Declare( Boost - GIT_REPOSITORY https://github.com/boostorg/boost.git - GIT_TAG boost-1.89.0 - GIT_PROGRESS ON - GIT_SHALLOW TRUE OVERRIDE_FIND_PACKAGE TRUE + URL "https://github.com/boostorg/boost/releases/download/boost-1.90.0/boost-1.90.0-cmake.tar.xz" ) FetchContent_MakeAvailable(Boost) diff --git a/include/libremidi/backends/net/config.hpp b/include/libremidi/backends/net/config.hpp index 6817c598..f4415571 100644 --- a/include/libremidi/backends/net/config.hpp +++ b/include/libremidi/backends/net/config.hpp @@ -2,10 +2,13 @@ #include #include + +#if !defined(BOOST_ASIO_IO_CONTEXT_HPP) namespace boost::asio { struct io_context; } +#endif NAMESPACE_LIBREMIDI::net { diff --git a/pyproject.toml b/pyproject.toml index 9bdd227b..968e62f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -115,6 +115,3 @@ build-dir = "build/{wheel_tag}" # Build stable ABI wheels for CPython 3.10+ wheel.py-api = "cp310" - -[tool.cibuildwheel] -before-all = "yum install -y boost-devel || apt-get update && apt-get install -y libboost-all-dev || apk add boost-dev"