Skip to content

Commit

Permalink
🐛 fix wheel build
Browse files Browse the repository at this point in the history
Signed-off-by: burgholzer <burgholzer@me.com>
  • Loading branch information
burgholzer committed Jan 27, 2024
1 parent 3d0d0be commit 0d0c01b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ include(cmake/StandardProjectSettings.cmake)
include(cmake/PreventInSourceBuilds.cmake)
include(cmake/PackageAddTest.cmake)
include(cmake/Cache.cmake)
include(cmake/Python.cmake)

option(BUILD_MQT_CORE_BINDINGS "Build the MQT Core Python bindings" OFF)
if(BUILD_MQT_CORE_BINDINGS)
# ensure that the BINDINGS option is set
set(BINDINGS
ON
CACHE INTERNAL "Enable settings related to Python bindings")
include(cmake/Python.cmake)
find_python()
endif()

Expand Down
14 changes: 0 additions & 14 deletions cmake/ExternalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,5 @@ if(BUILD_MQT_CORE_TESTS)
endif()
endif()

if(BUILD_MQT_CORE_BINDINGS)
if(NOT SKBUILD)
# Manually detect the installed pybind11 package and import it into CMake.
execute_process(
COMMAND "${Python_EXECUTABLE}" -m pybind11 --cmakedir
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE pybind11_DIR)
list(APPEND CMAKE_PREFIX_PATH "${pybind11_DIR}")
endif()

# add pybind11 library
find_package(pybind11 CONFIG REQUIRED)
endif()

# Make all declared dependencies available.
FetchContent_MakeAvailable(${FETCH_PACKAGES})
16 changes: 16 additions & 0 deletions cmake/Python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,20 @@ function(find_python)
Python 3.8 REQUIRED
COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule)

if(BUILD_MQT_CORE_BINDINGS)
if(NOT SKBUILD)
# Manually detect the installed pybind11 package and import it into CMake.
execute_process(
COMMAND "${Python_EXECUTABLE}" -m pybind11 --cmakedir
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE pybind11_DIR)
list(APPEND CMAKE_PREFIX_PATH "${pybind11_DIR}")
endif()

message(STATUS "Python executable: ${Python_EXECUTABLE}")

# add pybind11 library
find_package(pybind11 CONFIG REQUIRED)
endif()
endfunction()

0 comments on commit 0d0c01b

Please sign in to comment.