# CMakeLists.txt

# 查找 Python
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)

# --- 引入 pybind11（通过 pip 安装，自带 CMake 配置）---
find_package(pybind11 REQUIRED)

# -------------------------------
# 本地引入 nlohmann/json
# -------------------------------

# 设置本地路径（可根据实际情况调整）
set(NLOHMANN_JSON_ROOT "${CMAKE_SOURCE_DIR}/third_party/nlohmann_json")

# 检查头文件是否存在
if(NOT EXISTS "${NLOHMANN_JSON_ROOT}/include/nlohmann/json.hpp")
  message(FATAL_ERROR "nlohmann/json.hpp not found at ${NLOHMANN_JSON_ROOT}/include/nlohmann/json.hpp. Please check the path or download the library.")
endif()

# 创建 INTERFACE 库
add_library(nlohmann_json INTERFACE)

# 设置 include 目录
target_include_directories(nlohmann_json INTERFACE
  "${NLOHMANN_JSON_ROOT}/include"
)

# 创建别名
add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json)

# 设置所需 C++ 标准
target_compile_features(nlohmann_json INTERFACE cxx_std_11)

add_subdirectory(lib)

# 测试目标默认关闭（CUDA 链接需额外配置）
option(MINIFLOOD_BUILD_TESTS "Build test executables" OFF)
if(MINIFLOOD_BUILD_TESTS)
    add_subdirectory(tests)
endif()
