Skip to content

Commit

Permalink
Allow VS to Generate the Project (#2)
Browse files Browse the repository at this point in the history
* Allow VS to Generate the Project

This PR allows scikit-build's CMake Generator to create a Visual Studio Solution (when opening the folder within Visual Studio).

This allows both Visual Studio and VSCode to see nanobind-related Intellisense when working with the example.  However, this probably won't let users bypass `pip install .` when building the project...
  • Loading branch information
zalo authored Apr 9, 2022
1 parent 2115d8f commit 882d998
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ nanobind_test.egg-info
_skbuild
/dist
__pycache__
build
*.pyd
*.egg-info
.vscode
.vs
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ project(nanobind_example)
cmake_minimum_required(VERSION 3.17...3.22)

if (NOT SKBUILD)
message(FATAL_ERROR "This CMake file should be executed via scikit-build. "
message(WARNING "This CMake file should be executed via scikit-build. "
"Please run\n$ pip install .")
endif()

Expand All @@ -16,6 +16,10 @@ if (SKBUILD)
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
set(Python_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
set(Python_LIBRARIES "${PYTHON_LIBRARY}")
elseif (MSVC)
# MSVC needs a little extra help finding the Python library
find_package(PythonInterp)
find_package(Python)
endif()
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)

Expand Down

0 comments on commit 882d998

Please sign in to comment.