cmake_minimum_required(VERSION 3.20)

project(PyWrap
  VERSION 0.1.0
  DESCRIPTION "Wrap Python classifiers."
  HOMEPAGE_URL "https://github.com/rmontanana/pywrap"
  LANGUAGES CXX
)

# Global CMake variables
# ----------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

# CMakes modules
# --------------
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
include(AddGitSubmodule)

# Libraries
# ---------
find_package(Python3 3.11...3.11.9 COMPONENTS Interpreter Development REQUIRED)
find_package(Torch REQUIRED)
find_package(Boost REQUIRED COMPONENTS python3 numpy3)
# find_package(xgboost REQUIRED)

# Temporary patch while find_package(Torch) is not fixed
file(
        GLOB
        LIBTORCH_PYTHON
        "${TORCH_INSTALL_PREFIX}/lib/libtorch_python.so"
        "${TORCH_INSTALL_PREFIX}/lib/libtorch_python.dylib"
)
message(STATUS "TORCH Libraries: ${LIBTORCH_PYTHON}")

# External libraries - dependencies of BayesNet
# ---------------------------------------------
add_git_submodule("lib/json")
add_subdirectory(lib/Files)

# Include directories
# -------------------
add_subdirectory(src)
add_subdirectory(example)