find_package(Python 3.9 COMPONENTS Interpreter Development.Module REQUIRED)

find_package(nanobind CONFIG)

if(NOT nanobind_FOUND)
    include(FetchContent)
    FetchContent_Declare(
        nanobind
        GIT_REPOSITORY https://github.com/wjakob/nanobind.git
        GIT_TAG        v2.12.0
    )
    FetchContent_MakeAvailable(nanobind)
endif()

nanobind_add_module(_prisma_core
    NB_STATIC
    prisma_bindings.cpp
)

target_link_libraries(_prisma_core PRIVATE prisma)

# Install target — put the .so/.pyd in python/prisma/
install(TARGETS _prisma_core
    LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/python/prisma
)
