#
# $Id$
# $HeadURL$
# $Author$
#

cmake_minimum_required(VERSION 3.16)
project(LtsPlaceholder)
SET(DOXYGEN_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen_Lts)
if (EXISTS "${CMAKE_SOURCE_DIR}/doxygen/DoxyfileLts.in")
  ADD_DOXYGEN_TARGET(Lts ${CMAKE_SOURCE_DIR}/doxygen/DoxyfileLts.in ${CMAKE_BINARY_DIR}/DoxyfileLts
                             ${CMAKE_SOURCE_DIR}/doxygen/rheinmetall_defence_logo.jpg
                                                        ${DOXYGEN_OUT_DIR})
else()
  message(WARNING "Doxygen config ${CMAKE_SOURCE_DIR}/doxygen/DoxyfileLts.in not found; skipping ADD_DOXYGEN_TARGET(Lts)")
endif()

# Add only existing subdirectories to allow partial checkouts / incremental migration
# Release 2 scope: Tools, DDS, Common, Services (minimal), Proxies (TrainingAreaBase only), Plugins (Styles only for LtsWidgets dependency)
# Excluded: Application, Viewer, Projects, most Plugins (not in Release 2)
set(LTS_SUBDIRS Tools DDS Common Services Proxies Plugins)
foreach(dir IN LISTS LTS_SUBDIRS)
  if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
  # Use guarded add so top-level MIGRATE_MODULE can restrict which Lts subdirs are included
  NGL_ADD_SUBDIR_GUARDED(${dir})
else()
  message(STATUS "Skipping missing Lts subdirectory: ${dir}")
endif()

endforeach()

IF (BUILD_TESTING)
  if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Tests")
    ADD_SUBDIRECTORY(Tests)
  else()
    message(STATUS "Skipping missing Tests directory under Lts (BUILD_TESTING is ON)")
  endif()
ENDIF()

OPTION(BUILD_DOCS "Build documentation as html files from Lts/Documentation" OFF)
IF (BUILD_DOCS)
  ADD_SUBDIRECTORY(Documentation)
ENDIF()

# Ensure codegen macros are available before calling CODEGEN_* helpers
INCLUDE(MacroCodeGenIdl)

# Add stub headers for non-RTI/non-FilterManagement builds
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/AudioVideoManagement/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/NGLLogger/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/LtsSession/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/TopicEditorBase/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/OperatorManagement/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/LtsScriptTimeline/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/LtsUtilsGuiDds/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/Services/PresentationManagement/)

CODEGEN_WRITE_SERVICEFILE_INFO()
