Files
spark/src/lib_python_md/CMakeLists.txt
T
2025-06-09 05:58:37 +00:00

20 lines
872 B
CMake

cmake_minimum_required(VERSION 3.23)
project(python_md)
include(${CMAKE_SOURCE_DIR}/cmake/InitLibrary.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/InitPythonModule.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/InitPythonPlugin.cmake)
# Find Python from the virtual environment
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
find_package(pybind11 REQUIRED)
# Shared lib (for c++ to link)
init_library(SHARED)
target_include_directories(${PROJECT_NAME} PUBLIC ${Python3_INCLUDE_DIRS})
target_link_directories(${PROJECT_NAME} PUBLIC ${Python3_LIBRARY_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC spark python_core pybind11::embed
${Python3_LIBRARIES})
# CPython module (for .py files to import)
init_python_module()
# Py plugin (for sparkd to load at runtime)
init_python_plugin(PLUGIN_NAME python_md_providers)