|
1 | | -cmake_minimum_required(VERSION 3.15...3.27) |
| 1 | +cmake_minimum_required(VERSION 3.18...3.27) |
2 | 2 |
|
| 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) |
3 | 35 | # 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) |
5 | 37 | find_package(pybind11 CONFIG REQUIRED) |
6 | | -set(PYBIND11_FINDPYTHON ON) |
7 | 38 |
|
8 | 39 | # Set up ccache if available |
9 | 40 | find_program(CCACHE_PROGRAM ccache) |
@@ -269,7 +300,7 @@ endfunction() |
269 | 300 | collect_sources() |
270 | 301 |
|
271 | 302 | # Create the Python module |
272 | | -pybind11_add_module(pedalboard_native ${ALL_SOURCES}) |
| 303 | +pybind11_add_module(pedalboard_native MODULE ${ALL_SOURCES}) |
273 | 304 |
|
274 | 305 | # Add include directories |
275 | 306 | target_include_directories(pedalboard_native PRIVATE ${ALL_INCLUDES}) |
|
0 commit comments