cmake_minimum_required(VERSION 3.29)
project(Phoenix)

find_package(PhoenixCMake REQUIRED)

set(PROJECT_VERSION "0.2.1")

phoenix_base_project(
	"PhoenixCITestNanobind" "${PROJECT_VERSION}"
	"PhoenixCITestNanobind is an example project wrapping C++ to python with nanobind to test PhoenixCIToolkit CI/CD components"
	"https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/citoolkit/citestprojects/phoenixcitestnanobind"
)

# add other Phoenix dependencies with pull_extra_module (cmake function of phoenix_cmake) here

phoenix_include_directories(
	${CMAKE_CURRENT_SOURCE_DIR}
	${CMAKE_CURRENT_BINARY_DIR}
	${CMAKE_CURRENT_SOURCE_DIR}/src
	${CMAKE_CURRENT_BINARY_DIR}/src
)

phoenix_create_find(PhoenixCITestNanobind phoenixcitestnanobind ci_test_nanobind.h "" "")

phoenix_add_subdirectory(src)

add_custom_command(
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test.txt # dummy output that will never exist so pytest is run each time the test target is called
	COMMENT "running tests with pytest for project ${PROGRAM_NAME}"
	COMMAND pytest -v ${PYTEST_REPORT}
	WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_custom_target(test DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/test.txt)
