# Test if PyArc is available. This requires that (a) we build with python
# bindings enabled and that (b) PyArc be in our python module path.
set(PYARC_BINDINGS_STATUS FALSE)

if (ENABLE_PYTHON_WRAPPING)

  add_subdirectory(pybind11)
  add_subdirectory(proteus)

  # Test for PyArc module
  execute_process(
    COMMAND
    ${PYTHON_EXECUTABLE}
    -c "try:\n  import PyArc\n  print(\"TRUE\")\nexcept Exception:\n  print(\"FALSE\")"
    RESULT_VARIABLE rv
    OUTPUT_VARIABLE PYARC_BINDINGS_STATUS
    ERROR_VARIABLE err
    OUTPUT_STRIP_TRAILING_WHITESPACE
    ERROR_STRIP_TRAILING_WHITESPACE
    )

  if (NOT rv EQUAL 0)
    message(FATAL_ERROR "Could not query for PyArc; return value was ${rv} and error was ${err}.")
  endif()

endif()
if (ENABLE_PYARC_BINDINGS AND NOT PYARC_BINDINGS_STATUS)
  message(FATAL_ERROR "PyARC binding is enabled, but its python path is not set up.")
endif()

add_subdirectory(pyarc)

if (ENABLE_TESTING)
  add_subdirectory(testing)
endif()
