Skip to content

Commit c272751

Browse files
committed
Try to fix Windows build by adding more to CMakeLists.
1 parent 996b39e commit c272751

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

.github/workflows/all.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,11 @@ jobs:
468468
- { os: ubuntu-24.04, python-version: "3.11", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }
469469
- { os: ubuntu-24.04, python-version: "3.12", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }
470470
- { os: ubuntu-24.04, python-version: "3.13.0-rc.1", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }
471-
# # - { os: windows-latest, python-version: "3.8", compiler: "msvc", cc: "msvc", cxx: "msvc" }
472-
# # - { os: windows-latest, python-version: "3.9", compiler: "msvc", cc: "msvc", cxx: "msvc" }
473-
# # - { os: windows-latest, python-version: "3.10", compiler: "msvc", cc: "msvc", cxx: "msvc" }
474-
# # - { os: windows-latest, python-version: "3.11", compiler: "msvc", cc: "msvc", cxx: "msvc" }
475-
# - { os: windows-latest, python-version: "3.12", compiler: "msvc", cc: "msvc", cxx: "msvc" }
471+
# - { os: windows-latest, python-version: "3.8", compiler: "msvc", cc: "msvc", cxx: "msvc" }
472+
# - { os: windows-latest, python-version: "3.9", compiler: "msvc", cc: "msvc", cxx: "msvc" }
473+
# - { os: windows-latest, python-version: "3.10", compiler: "msvc", cc: "msvc", cxx: "msvc" }
474+
# - { os: windows-latest, python-version: "3.11", compiler: "msvc", cc: "msvc", cxx: "msvc" }
475+
- { os: windows-latest, python-version: "3.12", compiler: "msvc", cc: "msvc", cxx: "msvc" }
476476
# - { os: windows-latest, python-version: "3.13.0-rc.1", compiler: "msvc", cc: "msvc", cxx: "msvc" }
477477
name: Test with Python ${{ matrix.python-version }} on ${{ matrix.os }}
478478
steps:

CMakeLists.txt

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,40 @@
1-
cmake_minimum_required(VERSION 3.15...3.27)
1+
cmake_minimum_required(VERSION 3.18...3.27)
22

3+
# Warn if the user invokes CMake directly
4+
if (NOT SKBUILD)
5+
message(WARNING "\
6+
This CMake file is meant to be executed using 'scikit-build-core'.
7+
Running it directly will almost certainly not produce the desired
8+
result. If you are a user trying to install this package, use the
9+
command below, which will install all necessary build dependencies,
10+
compile the package in an isolated environment, and then install it.
11+
=====================================================================
12+
$ pip install .
13+
=====================================================================
14+
If you are a software developer, and this is your own package, then
15+
it is usually much more efficient to install the build dependencies
16+
in your environment once and use the following command that avoids
17+
a costly creation of a new virtual environment at every compilation:
18+
=====================================================================
19+
$ pip install pybind11 scikit-build-core[pyproject]
20+
$ pip install --no-build-isolation -ve .
21+
=====================================================================
22+
You may optionally add -Ceditable.rebuild=true to auto-rebuild when
23+
the package is imported. Otherwise, you need to rerun the above
24+
after editing C++ files.")
25+
endif()
26+
27+
if (CMAKE_VERSION VERSION_LESS 3.18)
28+
set(DEV_MODULE Development)
29+
else()
30+
set(DEV_MODULE Development.Module)
31+
endif()
32+
33+
34+
set(PYBIND11_FINDPYTHON ON)
335
# Find Python and pybind11 first, as we need the interpreter
4-
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
36+
find_package(Python 3.8 COMPONENTS Interpreter ${DEV_MODULE} REQUIRED)
537
find_package(pybind11 CONFIG REQUIRED)
6-
set(PYBIND11_FINDPYTHON ON)
738

839
# Set up ccache if available
940
find_program(CCACHE_PROGRAM ccache)
@@ -269,7 +300,7 @@ endfunction()
269300
collect_sources()
270301

271302
# Create the Python module
272-
pybind11_add_module(pedalboard_native ${ALL_SOURCES})
303+
pybind11_add_module(pedalboard_native MODULE ${ALL_SOURCES})
273304

274305
# Add include directories
275306
target_include_directories(pedalboard_native PRIVATE ${ALL_INCLUDES})

0 commit comments

Comments
 (0)