Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 875cca8d authored by Henry Schreiner's avatar Henry Schreiner
Browse files

feat: use custom search path and normal pip package

parent 56405338
No related branches found
No related tags found
No related merge requests found
cmake_minimum_required(VERSION 3.7...3.18) cmake_minimum_required(VERSION 3.18)
project(scikit_build_example VERSION "0.0.1") project(scikit_build_example VERSION "0.0.1")
# Define CMAKE_INSTALL_xxx: LIBDIR, INCLUDEDIR # Define CMAKE_INSTALL_xxx: LIBDIR, INCLUDEDIR
include(GNUInstallDirs) include(GNUInstallDirs)
# Currently, Scikit-build does not support FindPython, so we convert the
# provided hints ourselves.
if(SKBUILD)
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
set(Python_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
set(Python_LIBRARY "${PYTHON_LIBRARY}")
endif()
set(Python_FIND_IMPLEMENTATIONS CPython PyPy)
find_package(Python REQUIRED COMPONENTS Interpreter Development)
# Scikit-Build does not add your site-packages to the search path automatically,
# so we need to add it here.
execute_process(
COMMAND
"${Python_EXECUTABLE}" -c
"import skbuild, os; print(os.path.dirname(os.path.dirname(skbuild.__file__)))"
OUTPUT_VARIABLE _tmp_sitepackages
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE)
list(APPEND CMAKE_PREFIX_PATH "${_tmp_sitepackages}")
# Now we can find pybind11
find_package(pybind11 CONFIG REQUIRED) find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(_core MODULE src/main.cpp) pybind11_add_module(_core MODULE src/main.cpp)
...@@ -12,6 +35,3 @@ pybind11_add_module(_core MODULE src/main.cpp) ...@@ -12,6 +35,3 @@ pybind11_add_module(_core MODULE src/main.cpp)
target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION}) target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION})
install(TARGETS _core DESTINATION .) install(TARGETS _core DESTINATION .)
# Quiet a warning, since this project is only valid with SKBUILD
set(ignoreMe "${SKBUILD}")
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
requires = [ requires = [
"setuptools>=42", "setuptools>=42",
"wheel", "wheel",
"pybind11-global", "pybind11==2.6.0.dev1",
"cmake", "cmake",
"scikit-build", "scikit-build",
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment