cmake_minimum_required(VERSION 3.15)
project(poreflow_changepoint)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Find Python and its associated components, natively including NumPy
find_package(Python 3.11 COMPONENTS Interpreter Development.Module NumPy REQUIRED)

# Use FetchContent to get Eigen
include(FetchContent)

FetchContent_Declare(
  Eigen3
  GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
  GIT_TAG 5.0.1
  GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(Eigen3)

# Define the extension module
python_add_library(_changepoint MODULE src/poreflow/steps/_changepoint.cpp)

# Include directories, utilizing the variable populated by FindPython
target_include_directories(_changepoint PRIVATE
    ${Python_NumPy_INCLUDE_DIRS}
    ${Eigen3_SOURCE_DIR}
)

# Install location
install(TARGETS _changepoint DESTINATION poreflow/steps)