cmake_minimum_required(VERSION 3.31)
project(bshell C)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

if (NOT DEFINED bshell_interactive)
	set(bshell_interactive 1)
endif ()

if (NOT DEFINED bshell_verbose)
	set(bshell_verbose 0)
endif ()

if (NOT DEFINED bshell_enable_floating_point)
	set(bshell_enable_floating_point 1)
endif ()

set(required_fx_assemblies fx.runtime fx.collections fx.io fx.diagnostics)

if (bshell_interactive)
	set(required_fx_assemblies ${required_fx_assemblies} fx.term)
endif ()

find_package(Python COMPONENTS Interpreter REQUIRED)
find_package(FX REQUIRED COMPONENTS ${required_fx_assemblies})

execute_process(
	COMMAND ${Python_EXECUTABLE}
		${CMAKE_CURRENT_SOURCE_DIR}/tools/build-id.py
		--source-dir "${CMAKE_CURRENT_SOURCE_DIR}"
	OUTPUT_VARIABLE bshell_version)
message(STATUS "B Shell version: ${bshell_version}")

add_subdirectory(bshell)
add_subdirectory(bshell.runtime)
add_subdirectory(bshell.core)
