It was just too hard trying to make it work with separate libs. The main issue was getting the python md and execution modules to recognize PySecurityList and other types defined in the core module.
20 lines
868 B
CMake
20 lines
868 B
CMake
cmake_minimum_required(VERSION 3.23)
|
|
project(python_interop)
|
|
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 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_interop_plugins)
|