# Declare the minimum version of CMake that can be used
# To understand and build the project
cmake_minimum_required(VERSION 3.4...3.18)

# Set the project name to node_alphazero and set the version to 1.0
project(node_alphazero VERSION 1.0)

# Find and get the details of Python package
# This is required for embedding Python in the project
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)

# Add pybind11 as a subdirectory,
# so that its build files are generated alongside the current project.
# This is necessary because the current project depends on pybind11
add_subdirectory(pybind11)
pybind11_add_module(node_alphazero node_alphazero.cpp)

# Add the Python header file paths to the include paths
# of the node_alphazero library. This is necessary for the
# project to find the Python header files it needs to include
target_include_directories(node_alphazero PRIVATE ${Python3_INCLUDE_DIRS})

# Link the node_alphazero library with the pybind11::module target.
# This is necessary for the node_alphazero library to use the functions and classes defined by pybind11
target_link_libraries(node_alphazero PRIVATE pybind11::module)

# Set the Python standard to the version of Python found by find_package(Python3)
# This ensures that the code will be compiled against the correct version of Python
set_target_properties(node_alphazero PROPERTIES PYTHON_STANDARD ${Python3_VERSION})