cmake_minimum_required(VERSION 3.24)

project(video_shader LANGUAGES C CXX RC)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/apps/LoopThroughWithOpenGLCompositing")
set(SLANG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/slang-2026.8-windows-x86_64" CACHE PATH "Path to a Slang binary release containing bin/slangc.exe")

if(NOT EXISTS "${APP_DIR}/LoopThroughWithOpenGLCompositing.cpp")
	message(FATAL_ERROR "Imported app sources were not found under ${APP_DIR}")
endif()

set(SLANG_RUNTIME_FILES
	"${SLANG_ROOT}/bin/slangc.exe"
	"${SLANG_ROOT}/bin/slang-compiler.dll"
	"${SLANG_ROOT}/bin/slang-glslang.dll"
)

foreach(SLANG_RUNTIME_FILE IN LISTS SLANG_RUNTIME_FILES)
	if(NOT EXISTS "${SLANG_RUNTIME_FILE}")
		message(FATAL_ERROR "Required Slang runtime file not found: ${SLANG_RUNTIME_FILE}")
	endif()
endforeach()

set(SLANG_LICENSE_FILE "${SLANG_ROOT}/LICENSE")
if(NOT EXISTS "${SLANG_LICENSE_FILE}")
	message(FATAL_ERROR "Slang license file not found: ${SLANG_LICENSE_FILE}")
endif()

set(APP_SOURCES
	"${APP_DIR}/videoio/decklink/DeckLinkAPI_i.c"
	"${APP_DIR}/control/ControlServer.cpp"
	"${APP_DIR}/control/ControlServer.h"
	"${APP_DIR}/control/ControlServices.cpp"
	"${APP_DIR}/control/ControlServices.h"
	"${APP_DIR}/control/OscServer.cpp"
	"${APP_DIR}/control/OscServer.h"
	"${APP_DIR}/control/RuntimeControlBridge.cpp"
	"${APP_DIR}/control/RuntimeControlBridge.h"
	"${APP_DIR}/control/RuntimeServiceLiveBridge.cpp"
	"${APP_DIR}/control/RuntimeServiceLiveBridge.h"
	"${APP_DIR}/control/RuntimeServices.cpp"
	"${APP_DIR}/control/RuntimeServices.h"
	"${APP_DIR}/videoio/decklink/DeckLinkAPI_h.h"
	"${APP_DIR}/videoio/decklink/DeckLinkDisplayMode.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkDisplayMode.h"
	"${APP_DIR}/videoio/decklink/DeckLinkFrameTransfer.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkFrameTransfer.h"
	"${APP_DIR}/videoio/decklink/DeckLinkSession.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkSession.h"
	"${APP_DIR}/videoio/decklink/DeckLinkVideoIOFormat.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkVideoIOFormat.h"
	"${APP_DIR}/gl/renderer/GLExtensions.cpp"
	"${APP_DIR}/gl/renderer/GLExtensions.h"
	"${APP_DIR}/gl/shader/GlobalParamsBuffer.cpp"
	"${APP_DIR}/gl/shader/GlobalParamsBuffer.h"
	"${APP_DIR}/gl/renderer/GlRenderConstants.h"
	"${APP_DIR}/gl/renderer/GlScopedObjects.h"
	"${APP_DIR}/gl/shader/GlShaderSources.cpp"
	"${APP_DIR}/gl/shader/GlShaderSources.h"
	"${APP_DIR}/gl/composite/OpenGLComposite.cpp"
	"${APP_DIR}/gl/composite/OpenGLComposite.h"
	"${APP_DIR}/gl/composite/OpenGLCompositeRuntimeControls.cpp"
	"${APP_DIR}/gl/threading/RenderCommandQueue.cpp"
	"${APP_DIR}/gl/threading/RenderCommandQueue.h"
	"${APP_DIR}/gl/RenderEngine.cpp"
	"${APP_DIR}/gl/RenderEngine.h"
	"${APP_DIR}/gl/frame/RenderFrameState.h"
	"${APP_DIR}/gl/frame/RenderFrameStateResolver.cpp"
	"${APP_DIR}/gl/frame/RenderFrameStateResolver.h"
	"${APP_DIR}/gl/frame/RuntimeUpdateController.cpp"
	"${APP_DIR}/gl/frame/RuntimeUpdateController.h"
	"${APP_DIR}/gl/pipeline/OpenGLRenderPass.cpp"
	"${APP_DIR}/gl/pipeline/OpenGLRenderPass.h"
	"${APP_DIR}/gl/pipeline/OpenGLRenderPipeline.cpp"
	"${APP_DIR}/gl/pipeline/OpenGLRenderPipeline.h"
	"${APP_DIR}/gl/pipeline/RenderPassDescriptor.h"
	"${APP_DIR}/gl/pipeline/ShaderFeedbackBuffers.cpp"
	"${APP_DIR}/gl/pipeline/ShaderFeedbackBuffers.h"
	"${APP_DIR}/gl/renderer/OpenGLRenderer.cpp"
	"${APP_DIR}/gl/renderer/OpenGLRenderer.h"
	"${APP_DIR}/gl/renderer/RenderTargetPool.cpp"
	"${APP_DIR}/gl/renderer/RenderTargetPool.h"
	"${APP_DIR}/gl/pipeline/OpenGLVideoIOBridge.cpp"
	"${APP_DIR}/gl/pipeline/OpenGLVideoIOBridge.h"
	"${APP_DIR}/gl/shader/OpenGLShaderPrograms.cpp"
	"${APP_DIR}/gl/shader/OpenGLShaderPrograms.h"
	"${APP_DIR}/gl/pipeline/PngScreenshotWriter.cpp"
	"${APP_DIR}/gl/pipeline/PngScreenshotWriter.h"
	"${APP_DIR}/gl/shader/ShaderProgramCompiler.cpp"
	"${APP_DIR}/gl/shader/ShaderProgramCompiler.h"
	"${APP_DIR}/gl/shader/ShaderBuildQueue.cpp"
	"${APP_DIR}/gl/shader/ShaderBuildQueue.h"
	"${APP_DIR}/gl/shader/ShaderTextureBindings.cpp"
	"${APP_DIR}/gl/shader/ShaderTextureBindings.h"
	"${APP_DIR}/gl/shader/Std140Buffer.h"
	"${APP_DIR}/gl/shader/TextRasterizer.cpp"
	"${APP_DIR}/gl/shader/TextRasterizer.h"
	"${APP_DIR}/gl/shader/TextureAssetLoader.cpp"
	"${APP_DIR}/gl/shader/TextureAssetLoader.h"
	"${APP_DIR}/gl/pipeline/TemporalHistoryBuffers.cpp"
	"${APP_DIR}/gl/pipeline/TemporalHistoryBuffers.h"
	"${APP_DIR}/LoopThroughWithOpenGLCompositing.cpp"
	"${APP_DIR}/LoopThroughWithOpenGLCompositing.h"
	"${APP_DIR}/LoopThroughWithOpenGLCompositing.rc"
	"${APP_DIR}/platform/NativeHandles.h"
	"${APP_DIR}/platform/NativeSockets.h"
	"${APP_DIR}/resource.h"
	"${APP_DIR}/runtime/coordination/RuntimeCoordinator.cpp"
	"${APP_DIR}/runtime/coordination/RuntimeCoordinator.h"
	"${APP_DIR}/runtime/events/RuntimeEventCoalescingQueue.h"
	"${APP_DIR}/runtime/events/RuntimeEventDispatcher.h"
	"${APP_DIR}/runtime/events/RuntimeEvent.h"
	"${APP_DIR}/runtime/events/RuntimeEventPayloads.h"
	"${APP_DIR}/runtime/events/RuntimeEventQueue.h"
	"${APP_DIR}/runtime/events/RuntimeEventType.h"
	"${APP_DIR}/runtime/live/CommittedLiveState.cpp"
	"${APP_DIR}/runtime/live/CommittedLiveState.h"
	"${APP_DIR}/runtime/live/RenderStateComposer.cpp"
	"${APP_DIR}/runtime/live/RenderStateComposer.h"
	"${APP_DIR}/runtime/live/RuntimeStateLayerModel.cpp"
	"${APP_DIR}/runtime/live/RuntimeStateLayerModel.h"
	"${APP_DIR}/runtime/live/RuntimeLiveState.cpp"
	"${APP_DIR}/runtime/live/RuntimeLiveState.h"
	"${APP_DIR}/runtime/persistence/PersistenceRequest.h"
	"${APP_DIR}/runtime/persistence/PersistenceWriter.cpp"
	"${APP_DIR}/runtime/persistence/PersistenceWriter.h"
	"${APP_DIR}/runtime/presentation/RuntimeStateJson.cpp"
	"${APP_DIR}/runtime/presentation/RuntimeStateJson.h"
	"${APP_DIR}/runtime/presentation/RuntimeStatePresenter.cpp"
	"${APP_DIR}/runtime/presentation/RuntimeStatePresenter.h"
	"${APP_DIR}/runtime/snapshot/RenderSnapshotBuilder.cpp"
	"${APP_DIR}/runtime/snapshot/RenderSnapshotBuilder.h"
	"${APP_DIR}/runtime/snapshot/RuntimeSnapshotProvider.cpp"
	"${APP_DIR}/runtime/snapshot/RuntimeSnapshotProvider.h"
	"${APP_DIR}/runtime/store/LayerStackStore.cpp"
	"${APP_DIR}/runtime/store/LayerStackStore.h"
	"${APP_DIR}/runtime/store/RuntimeConfigStore.cpp"
	"${APP_DIR}/runtime/store/RuntimeConfigStore.h"
	"${APP_DIR}/runtime/store/RuntimeStore.cpp"
	"${APP_DIR}/runtime/store/RuntimeStore.h"
	"${APP_DIR}/runtime/store/RuntimeStoreReadModels.h"
	"${APP_DIR}/runtime/store/ShaderPackageCatalog.cpp"
	"${APP_DIR}/runtime/store/ShaderPackageCatalog.h"
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${APP_DIR}/runtime/support/RuntimeJson.h"
	"${APP_DIR}/runtime/support/RuntimeParameterUtils.cpp"
	"${APP_DIR}/runtime/support/RuntimeParameterUtils.h"
	"${APP_DIR}/runtime/telemetry/HealthTelemetry.cpp"
	"${APP_DIR}/runtime/telemetry/HealthTelemetry.h"
	"${APP_DIR}/runtime/telemetry/RuntimeClock.cpp"
	"${APP_DIR}/runtime/telemetry/RuntimeClock.h"
	"${APP_DIR}/shader/ShaderCompiler.cpp"
	"${APP_DIR}/shader/ShaderCompiler.h"
	"${APP_DIR}/shader/ShaderPackageRegistry.cpp"
	"${APP_DIR}/shader/ShaderPackageRegistry.h"
	"${APP_DIR}/shader/ShaderTypes.h"
	"${APP_DIR}/stdafx.cpp"
	"${APP_DIR}/stdafx.h"
	"${APP_DIR}/targetver.h"
	"${APP_DIR}/videoio/VideoIOFormat.cpp"
	"${APP_DIR}/videoio/VideoIOFormat.h"
	"${APP_DIR}/videoio/VideoBackend.cpp"
	"${APP_DIR}/videoio/VideoBackend.h"
	"${APP_DIR}/videoio/VideoBackendLifecycle.cpp"
	"${APP_DIR}/videoio/VideoBackendLifecycle.h"
	"${APP_DIR}/videoio/VideoIOTypes.h"
	"${APP_DIR}/videoio/OutputProductionController.cpp"
	"${APP_DIR}/videoio/OutputProductionController.h"
	"${APP_DIR}/videoio/RenderCadenceController.cpp"
	"${APP_DIR}/videoio/RenderCadenceController.h"
	"${APP_DIR}/videoio/RenderOutputQueue.cpp"
	"${APP_DIR}/videoio/RenderOutputQueue.h"
	"${APP_DIR}/videoio/SystemOutputFramePool.cpp"
	"${APP_DIR}/videoio/SystemOutputFramePool.h"
	"${APP_DIR}/videoio/VideoPlayoutPolicy.h"
	"${APP_DIR}/videoio/VideoPlayoutScheduler.cpp"
	"${APP_DIR}/videoio/VideoPlayoutScheduler.h"
)

add_executable(LoopThroughWithOpenGLCompositing WIN32 ${APP_SOURCES})

target_include_directories(LoopThroughWithOpenGLCompositing PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/control"
	"${APP_DIR}/gl"
	"${APP_DIR}/gl/composite"
	"${APP_DIR}/gl/frame"
	"${APP_DIR}/gl/pipeline"
	"${APP_DIR}/gl/renderer"
	"${APP_DIR}/gl/shader"
	"${APP_DIR}/gl/threading"
	"${APP_DIR}/platform"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/coordination"
	"${APP_DIR}/runtime/events"
	"${APP_DIR}/runtime/live"
	"${APP_DIR}/runtime/persistence"
	"${APP_DIR}/runtime/presentation"
	"${APP_DIR}/runtime/snapshot"
	"${APP_DIR}/runtime/store"
	"${APP_DIR}/runtime/support"
	"${APP_DIR}/runtime/telemetry"
	"${APP_DIR}/shader"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
)

target_link_libraries(LoopThroughWithOpenGLCompositing PRIVATE
	opengl32
	glu32
	Ws2_32
	Crypt32
	Advapi32
	Gdiplus
	Ole32
	Windowscodecs
)

target_compile_definitions(LoopThroughWithOpenGLCompositing PRIVATE
	_UNICODE
	UNICODE
)

if(MSVC)
	target_compile_options(LoopThroughWithOpenGLCompositing PRIVATE /W3)
endif()

set(PROBE_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/apps/DeckLinkRenderCadenceProbe")

add_executable(DeckLinkRenderCadenceProbe
	"${APP_DIR}/videoio/decklink/DeckLinkAPI_i.c"
	"${APP_DIR}/videoio/decklink/DeckLinkDisplayMode.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkDisplayMode.h"
	"${APP_DIR}/videoio/decklink/DeckLinkFrameTransfer.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkFrameTransfer.h"
	"${APP_DIR}/videoio/decklink/DeckLinkSession.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkSession.h"
	"${APP_DIR}/videoio/decklink/DeckLinkVideoIOFormat.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkVideoIOFormat.h"
	"${APP_DIR}/gl/renderer/GLExtensions.cpp"
	"${APP_DIR}/gl/renderer/GLExtensions.h"
	"${APP_DIR}/videoio/VideoIOFormat.cpp"
	"${APP_DIR}/videoio/VideoIOFormat.h"
	"${APP_DIR}/videoio/VideoIOTypes.h"
	"${APP_DIR}/videoio/VideoPlayoutPolicy.h"
	"${APP_DIR}/videoio/VideoPlayoutScheduler.cpp"
	"${APP_DIR}/videoio/VideoPlayoutScheduler.h"
	"${PROBE_APP_DIR}/DeckLinkRenderCadenceProbe.cpp"
)

target_include_directories(DeckLinkRenderCadenceProbe PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/gl/renderer"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
)

target_link_libraries(DeckLinkRenderCadenceProbe PRIVATE
	opengl32
	Ole32
)

target_compile_definitions(DeckLinkRenderCadenceProbe PRIVATE
	_UNICODE
	UNICODE
)

if(MSVC)
	target_compile_options(DeckLinkRenderCadenceProbe PRIVATE /W3)
endif()

set(RENDER_CADENCE_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/apps/RenderCadenceCompositor")

set(RENDER_CADENCE_APP_SOURCES
	"${APP_DIR}/videoio/decklink/DeckLinkAPI_i.c"
	"${APP_DIR}/videoio/decklink/DeckLinkDisplayMode.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkDisplayMode.h"
	"${APP_DIR}/videoio/decklink/DeckLinkFrameTransfer.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkFrameTransfer.h"
	"${APP_DIR}/videoio/decklink/DeckLinkSession.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkSession.h"
	"${APP_DIR}/videoio/decklink/DeckLinkVideoIOFormat.cpp"
	"${APP_DIR}/videoio/decklink/DeckLinkVideoIOFormat.h"
	"${APP_DIR}/gl/renderer/GLExtensions.cpp"
	"${APP_DIR}/gl/renderer/GLExtensions.h"
	"${APP_DIR}/gl/shader/Std140Buffer.h"
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${APP_DIR}/runtime/support/RuntimeJson.h"
	"${APP_DIR}/shader/ShaderCompiler.cpp"
	"${APP_DIR}/shader/ShaderCompiler.h"
	"${APP_DIR}/shader/ShaderPackageRegistry.cpp"
	"${APP_DIR}/shader/ShaderPackageRegistry.h"
	"${APP_DIR}/shader/ShaderTypes.h"
	"${APP_DIR}/videoio/VideoIOFormat.cpp"
	"${APP_DIR}/videoio/VideoIOFormat.h"
	"${APP_DIR}/videoio/VideoIOTypes.h"
	"${APP_DIR}/videoio/VideoPlayoutPolicy.h"
	"${APP_DIR}/videoio/VideoPlayoutScheduler.cpp"
	"${APP_DIR}/videoio/VideoPlayoutScheduler.h"
	"${RENDER_CADENCE_APP_DIR}/RenderCadenceCompositor.cpp"
	"${RENDER_CADENCE_APP_DIR}/app/AppConfig.cpp"
	"${RENDER_CADENCE_APP_DIR}/app/AppConfig.h"
	"${RENDER_CADENCE_APP_DIR}/app/AppConfigProvider.cpp"
	"${RENDER_CADENCE_APP_DIR}/app/AppConfigProvider.h"
	"${RENDER_CADENCE_APP_DIR}/app/RenderCadenceApp.h"
	"${RENDER_CADENCE_APP_DIR}/control/HttpControlServer.cpp"
	"${RENDER_CADENCE_APP_DIR}/control/HttpControlServer.h"
	"${RENDER_CADENCE_APP_DIR}/control/RuntimeStateJson.h"
	"${RENDER_CADENCE_APP_DIR}/frames/SystemFrameExchange.cpp"
	"${RENDER_CADENCE_APP_DIR}/frames/SystemFrameExchange.h"
	"${RENDER_CADENCE_APP_DIR}/frames/SystemFrameTypes.h"
	"${RENDER_CADENCE_APP_DIR}/json/JsonWriter.cpp"
	"${RENDER_CADENCE_APP_DIR}/json/JsonWriter.h"
	"${RENDER_CADENCE_APP_DIR}/logging/Logger.cpp"
	"${RENDER_CADENCE_APP_DIR}/logging/Logger.h"
	"${RENDER_CADENCE_APP_DIR}/platform/HiddenGlWindow.cpp"
	"${RENDER_CADENCE_APP_DIR}/platform/HiddenGlWindow.h"
	"${RENDER_CADENCE_APP_DIR}/render/Bgra8ReadbackPipeline.cpp"
	"${RENDER_CADENCE_APP_DIR}/render/Bgra8ReadbackPipeline.h"
	"${RENDER_CADENCE_APP_DIR}/render/PboReadbackRing.cpp"
	"${RENDER_CADENCE_APP_DIR}/render/PboReadbackRing.h"
	"${RENDER_CADENCE_APP_DIR}/render/RenderCadenceClock.cpp"
	"${RENDER_CADENCE_APP_DIR}/render/RenderCadenceClock.h"
	"${RENDER_CADENCE_APP_DIR}/render/RenderThread.cpp"
	"${RENDER_CADENCE_APP_DIR}/render/RenderThread.h"
	"${RENDER_CADENCE_APP_DIR}/render/RuntimeShaderRenderer.cpp"
	"${RENDER_CADENCE_APP_DIR}/render/RuntimeShaderRenderer.h"
	"${RENDER_CADENCE_APP_DIR}/render/RuntimeShaderParams.cpp"
	"${RENDER_CADENCE_APP_DIR}/render/RuntimeShaderParams.h"
	"${RENDER_CADENCE_APP_DIR}/render/RuntimeRenderScene.cpp"
	"${RENDER_CADENCE_APP_DIR}/render/RuntimeRenderScene.h"
	"${RENDER_CADENCE_APP_DIR}/render/SimpleMotionRenderer.cpp"
	"${RENDER_CADENCE_APP_DIR}/render/SimpleMotionRenderer.h"
	"${RENDER_CADENCE_APP_DIR}/runtime/RuntimeLayerModel.cpp"
	"${RENDER_CADENCE_APP_DIR}/runtime/RuntimeLayerModel.h"
	"${RENDER_CADENCE_APP_DIR}/runtime/RuntimeShaderBridge.cpp"
	"${RENDER_CADENCE_APP_DIR}/runtime/RuntimeShaderBridge.h"
	"${RENDER_CADENCE_APP_DIR}/runtime/RuntimeSlangShaderCompiler.cpp"
	"${RENDER_CADENCE_APP_DIR}/runtime/RuntimeSlangShaderCompiler.h"
	"${RENDER_CADENCE_APP_DIR}/runtime/SupportedShaderCatalog.cpp"
	"${RENDER_CADENCE_APP_DIR}/runtime/SupportedShaderCatalog.h"
	"${RENDER_CADENCE_APP_DIR}/telemetry/CadenceTelemetryJson.h"
	"${RENDER_CADENCE_APP_DIR}/telemetry/CadenceTelemetry.h"
	"${RENDER_CADENCE_APP_DIR}/telemetry/TelemetryHealthMonitor.h"
	"${RENDER_CADENCE_APP_DIR}/video/DeckLinkOutput.cpp"
	"${RENDER_CADENCE_APP_DIR}/video/DeckLinkOutput.h"
	"${RENDER_CADENCE_APP_DIR}/video/DeckLinkOutputThread.h"
)

add_executable(RenderCadenceCompositor ${RENDER_CADENCE_APP_SOURCES})

target_include_directories(RenderCadenceCompositor PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/gl/renderer"
	"${APP_DIR}/gl/shader"
	"${APP_DIR}/platform"
	"${APP_DIR}/runtime/support"
	"${APP_DIR}/shader"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
	"${RENDER_CADENCE_APP_DIR}"
	"${RENDER_CADENCE_APP_DIR}/app"
	"${RENDER_CADENCE_APP_DIR}/control"
	"${RENDER_CADENCE_APP_DIR}/frames"
	"${RENDER_CADENCE_APP_DIR}/json"
	"${RENDER_CADENCE_APP_DIR}/logging"
	"${RENDER_CADENCE_APP_DIR}/platform"
	"${RENDER_CADENCE_APP_DIR}/render"
	"${RENDER_CADENCE_APP_DIR}/runtime"
	"${RENDER_CADENCE_APP_DIR}/telemetry"
	"${RENDER_CADENCE_APP_DIR}/video"
)

target_link_libraries(RenderCadenceCompositor PRIVATE
	opengl32
	Ole32
	Ws2_32
)

target_compile_definitions(RenderCadenceCompositor PRIVATE
	_UNICODE
	UNICODE
)

if(MSVC)
	target_compile_options(RenderCadenceCompositor PRIVATE /W3)
endif()

add_executable(RuntimeJsonTests
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RuntimeJsonTests.cpp"
)

target_include_directories(RuntimeJsonTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/support"
)

if(MSVC)
	target_compile_options(RuntimeJsonTests PRIVATE /W3)
endif()

enable_testing()
add_test(NAME RuntimeJsonTests COMMAND RuntimeJsonTests)

add_executable(RuntimeClockTests
	"${APP_DIR}/runtime/telemetry/RuntimeClock.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RuntimeClockTests.cpp"
)

target_include_directories(RuntimeClockTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/telemetry"
)

if(MSVC)
	target_compile_options(RuntimeClockTests PRIVATE /W3)
endif()

add_test(NAME RuntimeClockTests COMMAND RuntimeClockTests)

add_executable(HealthTelemetryTests
	"${APP_DIR}/runtime/telemetry/HealthTelemetry.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/HealthTelemetryTests.cpp"
)

target_include_directories(HealthTelemetryTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/telemetry"
)

if(MSVC)
	target_compile_options(HealthTelemetryTests PRIVATE /W3)
endif()

add_test(NAME HealthTelemetryTests COMMAND HealthTelemetryTests)

add_executable(RuntimeParameterUtilsTests
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${APP_DIR}/runtime/support/RuntimeParameterUtils.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RuntimeParameterUtilsTests.cpp"
)

target_include_directories(RuntimeParameterUtilsTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/support"
	"${APP_DIR}/shader"
)

if(MSVC)
	target_compile_options(RuntimeParameterUtilsTests PRIVATE /W3)
endif()

add_test(NAME RuntimeParameterUtilsTests COMMAND RuntimeParameterUtilsTests)

add_executable(RuntimeEventTypeTests
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RuntimeEventTypeTests.cpp"
)

target_include_directories(RuntimeEventTypeTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/events"
	"${APP_DIR}/runtime/persistence"
)

if(MSVC)
	target_compile_options(RuntimeEventTypeTests PRIVATE /W3)
endif()

add_test(NAME RuntimeEventTypeTests COMMAND RuntimeEventTypeTests)

add_executable(RuntimeLiveStateTests
	"${APP_DIR}/runtime/live/RenderStateComposer.cpp"
	"${APP_DIR}/runtime/live/RuntimeLiveState.cpp"
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${APP_DIR}/runtime/support/RuntimeParameterUtils.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RuntimeLiveStateTests.cpp"
)

target_include_directories(RuntimeLiveStateTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/live"
	"${APP_DIR}/runtime/support"
	"${APP_DIR}/shader"
)

if(MSVC)
	target_compile_options(RuntimeLiveStateTests PRIVATE /W3)
endif()

add_test(NAME RuntimeLiveStateTests COMMAND RuntimeLiveStateTests)

add_executable(RuntimeStateLayerModelTests
	"${APP_DIR}/runtime/live/RuntimeStateLayerModel.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RuntimeStateLayerModelTests.cpp"
)

target_include_directories(RuntimeStateLayerModelTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/live"
)

if(MSVC)
	target_compile_options(RuntimeStateLayerModelTests PRIVATE /W3)
endif()

add_test(NAME RuntimeStateLayerModelTests COMMAND RuntimeStateLayerModelTests)

add_executable(PersistenceWriterTests
	"${APP_DIR}/runtime/persistence/PersistenceWriter.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/PersistenceWriterTests.cpp"
)

target_include_directories(PersistenceWriterTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/persistence"
)

if(MSVC)
	target_compile_options(PersistenceWriterTests PRIVATE /W3)
endif()

add_test(NAME PersistenceWriterTests COMMAND PersistenceWriterTests)

add_executable(RuntimeSubsystemTests
	"${APP_DIR}/runtime/coordination/RuntimeCoordinator.cpp"
	"${APP_DIR}/runtime/live/CommittedLiveState.cpp"
	"${APP_DIR}/runtime/snapshot/RenderSnapshotBuilder.cpp"
	"${APP_DIR}/runtime/persistence/PersistenceWriter.cpp"
	"${APP_DIR}/runtime/store/LayerStackStore.cpp"
	"${APP_DIR}/runtime/store/RuntimeConfigStore.cpp"
	"${APP_DIR}/runtime/store/RuntimeStore.cpp"
	"${APP_DIR}/runtime/store/ShaderPackageCatalog.cpp"
	"${APP_DIR}/runtime/presentation/RuntimeStateJson.cpp"
	"${APP_DIR}/runtime/presentation/RuntimeStatePresenter.cpp"
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${APP_DIR}/runtime/support/RuntimeParameterUtils.cpp"
	"${APP_DIR}/runtime/telemetry/HealthTelemetry.cpp"
	"${APP_DIR}/runtime/telemetry/RuntimeClock.cpp"
	"${APP_DIR}/shader/ShaderCompiler.cpp"
	"${APP_DIR}/shader/ShaderPackageRegistry.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RuntimeSubsystemTests.cpp"
)

target_include_directories(RuntimeSubsystemTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/platform"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/coordination"
	"${APP_DIR}/runtime/events"
	"${APP_DIR}/runtime/live"
	"${APP_DIR}/runtime/persistence"
	"${APP_DIR}/runtime/presentation"
	"${APP_DIR}/runtime/snapshot"
	"${APP_DIR}/runtime/store"
	"${APP_DIR}/runtime/support"
	"${APP_DIR}/runtime/telemetry"
	"${APP_DIR}/shader"
)

if(MSVC)
	target_compile_options(RuntimeSubsystemTests PRIVATE /W3)
endif()

add_test(NAME RuntimeSubsystemTests COMMAND RuntimeSubsystemTests)

add_executable(Std140BufferTests
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/Std140BufferTests.cpp"
)

target_include_directories(Std140BufferTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/gl"
	"${APP_DIR}/gl/shader"
)

if(MSVC)
	target_compile_options(Std140BufferTests PRIVATE /W3)
endif()

add_test(NAME Std140BufferTests COMMAND Std140BufferTests)

add_executable(RenderCommandQueueTests
	"${APP_DIR}/gl/threading/RenderCommandQueue.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCommandQueueTests.cpp"
)

target_include_directories(RenderCommandQueueTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/gl"
	"${APP_DIR}/gl/threading"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
)

if(MSVC)
	target_compile_options(RenderCommandQueueTests PRIVATE /W3)
endif()

add_test(NAME RenderCommandQueueTests COMMAND RenderCommandQueueTests)

add_executable(ShaderPackageRegistryTests
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${APP_DIR}/shader/ShaderPackageRegistry.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/ShaderPackageRegistryTests.cpp"
)

target_include_directories(ShaderPackageRegistryTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/support"
	"${APP_DIR}/shader"
)

if(MSVC)
	target_compile_options(ShaderPackageRegistryTests PRIVATE /W3)
endif()

add_test(NAME ShaderPackageRegistryTests COMMAND ShaderPackageRegistryTests)

add_executable(ShaderSlangValidationTests
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${APP_DIR}/shader/ShaderCompiler.cpp"
	"${APP_DIR}/shader/ShaderPackageRegistry.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/ShaderSlangValidationTests.cpp"
)

target_include_directories(ShaderSlangValidationTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/platform"
	"${APP_DIR}/runtime"
	"${APP_DIR}/runtime/support"
	"${APP_DIR}/shader"
)

if(MSVC)
	target_compile_options(ShaderSlangValidationTests PRIVATE /W3)
endif()

add_test(NAME ShaderSlangValidationTests COMMAND ShaderSlangValidationTests)
set_tests_properties(ShaderSlangValidationTests PROPERTIES
	ENVIRONMENT "SLANG_ROOT=${SLANG_ROOT}"
)

add_executable(OscServerTests
	"${APP_DIR}/control/OscServer.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/OscServerTests.cpp"
)

target_include_directories(OscServerTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/control"
	"${APP_DIR}/platform"
)

target_link_libraries(OscServerTests PRIVATE
	Ws2_32
)

if(MSVC)
	target_compile_options(OscServerTests PRIVATE /W3)
endif()

add_test(NAME OscServerTests COMMAND OscServerTests)

add_executable(VideoIOFormatTests
	"${APP_DIR}/videoio/decklink/DeckLinkVideoIOFormat.cpp"
	"${APP_DIR}/videoio/VideoIOFormat.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/VideoIOFormatTests.cpp"
)

target_include_directories(VideoIOFormatTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
)

if(MSVC)
	target_compile_options(VideoIOFormatTests PRIVATE /W3)
endif()

add_test(NAME VideoIOFormatTests COMMAND VideoIOFormatTests)

add_executable(VideoPlayoutSchedulerTests
	"${APP_DIR}/videoio/VideoPlayoutScheduler.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/VideoPlayoutSchedulerTests.cpp"
)

target_include_directories(VideoPlayoutSchedulerTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
)

if(MSVC)
	target_compile_options(VideoPlayoutSchedulerTests PRIVATE /W3)
endif()

add_test(NAME VideoPlayoutSchedulerTests COMMAND VideoPlayoutSchedulerTests)

add_executable(OutputProductionControllerTests
	"${APP_DIR}/videoio/OutputProductionController.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/OutputProductionControllerTests.cpp"
)

target_include_directories(OutputProductionControllerTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/videoio"
)

if(MSVC)
	target_compile_options(OutputProductionControllerTests PRIVATE /W3)
endif()

add_test(NAME OutputProductionControllerTests COMMAND OutputProductionControllerTests)

add_executable(RenderOutputQueueTests
	"${APP_DIR}/videoio/RenderOutputQueue.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderOutputQueueTests.cpp"
)

target_include_directories(RenderOutputQueueTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
)

if(MSVC)
	target_compile_options(RenderOutputQueueTests PRIVATE /W3)
endif()

add_test(NAME RenderOutputQueueTests COMMAND RenderOutputQueueTests)

add_executable(RenderCadenceControllerTests
	"${APP_DIR}/videoio/RenderCadenceController.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceControllerTests.cpp"
)

target_include_directories(RenderCadenceControllerTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/videoio"
)

if(MSVC)
	target_compile_options(RenderCadenceControllerTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceControllerTests COMMAND RenderCadenceControllerTests)

add_executable(RenderCadenceCompositorFrameExchangeTests
	"${APP_DIR}/videoio/VideoIOFormat.cpp"
	"${RENDER_CADENCE_APP_DIR}/frames/SystemFrameExchange.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorFrameExchangeTests.cpp"
)

target_include_directories(RenderCadenceCompositorFrameExchangeTests PRIVATE
	"${APP_DIR}/videoio"
	"${RENDER_CADENCE_APP_DIR}/frames"
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorFrameExchangeTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorFrameExchangeTests COMMAND RenderCadenceCompositorFrameExchangeTests)

add_executable(RenderCadenceCompositorClockTests
	"${RENDER_CADENCE_APP_DIR}/render/RenderCadenceClock.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorClockTests.cpp"
)

target_include_directories(RenderCadenceCompositorClockTests PRIVATE
	"${RENDER_CADENCE_APP_DIR}/render"
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorClockTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorClockTests COMMAND RenderCadenceCompositorClockTests)

add_executable(RenderCadenceCompositorTelemetryTests
	"${RENDER_CADENCE_APP_DIR}/json/JsonWriter.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorTelemetryTests.cpp"
)

target_include_directories(RenderCadenceCompositorTelemetryTests PRIVATE
	"${RENDER_CADENCE_APP_DIR}/json"
	"${RENDER_CADENCE_APP_DIR}/telemetry"
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorTelemetryTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorTelemetryTests COMMAND RenderCadenceCompositorTelemetryTests)

add_executable(RenderCadenceCompositorRuntimeShaderParamsTests
	"${RENDER_CADENCE_APP_DIR}/render/RuntimeShaderParams.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorRuntimeShaderParamsTests.cpp"
)

target_include_directories(RenderCadenceCompositorRuntimeShaderParamsTests PRIVATE
	"${APP_DIR}/gl/shader"
	"${APP_DIR}/shader"
	"${RENDER_CADENCE_APP_DIR}/render"
	"${RENDER_CADENCE_APP_DIR}/runtime"
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorRuntimeShaderParamsTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorRuntimeShaderParamsTests COMMAND RenderCadenceCompositorRuntimeShaderParamsTests)

add_executable(RenderCadenceCompositorRuntimeLayerModelTests
	"${RENDER_CADENCE_APP_DIR}/runtime/RuntimeLayerModel.cpp"
	"${RENDER_CADENCE_APP_DIR}/runtime/SupportedShaderCatalog.cpp"
	"${APP_DIR}/shader/ShaderPackageRegistry.cpp"
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorRuntimeLayerModelTests.cpp"
)

target_include_directories(RenderCadenceCompositorRuntimeLayerModelTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime/support"
	"${APP_DIR}/shader"
	"${RENDER_CADENCE_APP_DIR}/runtime"
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorRuntimeLayerModelTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorRuntimeLayerModelTests COMMAND RenderCadenceCompositorRuntimeLayerModelTests)

add_executable(RenderCadenceCompositorSupportedShaderCatalogTests
	"${APP_DIR}/shader/ShaderPackageRegistry.cpp"
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${RENDER_CADENCE_APP_DIR}/runtime/SupportedShaderCatalog.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorSupportedShaderCatalogTests.cpp"
)

target_include_directories(RenderCadenceCompositorSupportedShaderCatalogTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime/support"
	"${APP_DIR}/shader"
	"${RENDER_CADENCE_APP_DIR}/runtime"
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorSupportedShaderCatalogTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorSupportedShaderCatalogTests COMMAND RenderCadenceCompositorSupportedShaderCatalogTests)

add_executable(RenderCadenceCompositorLoggerTests
	"${RENDER_CADENCE_APP_DIR}/logging/Logger.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorLoggerTests.cpp"
)

target_include_directories(RenderCadenceCompositorLoggerTests PRIVATE
	"${RENDER_CADENCE_APP_DIR}/logging"
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorLoggerTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorLoggerTests COMMAND RenderCadenceCompositorLoggerTests)

add_executable(RenderCadenceCompositorJsonWriterTests
	"${RENDER_CADENCE_APP_DIR}/json/JsonWriter.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorJsonWriterTests.cpp"
)

target_include_directories(RenderCadenceCompositorJsonWriterTests PRIVATE
	"${RENDER_CADENCE_APP_DIR}/json"
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorJsonWriterTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorJsonWriterTests COMMAND RenderCadenceCompositorJsonWriterTests)

add_executable(RenderCadenceCompositorRuntimeStateJsonTests
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${APP_DIR}/shader/ShaderPackageRegistry.cpp"
	"${RENDER_CADENCE_APP_DIR}/app/AppConfig.cpp"
	"${RENDER_CADENCE_APP_DIR}/app/AppConfigProvider.cpp"
	"${RENDER_CADENCE_APP_DIR}/json/JsonWriter.cpp"
	"${RENDER_CADENCE_APP_DIR}/runtime/RuntimeLayerModel.cpp"
	"${RENDER_CADENCE_APP_DIR}/runtime/SupportedShaderCatalog.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorRuntimeStateJsonTests.cpp"
)

target_include_directories(RenderCadenceCompositorRuntimeStateJsonTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime/support"
	"${APP_DIR}/shader"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
	"${RENDER_CADENCE_APP_DIR}/app"
	"${RENDER_CADENCE_APP_DIR}/control"
	"${RENDER_CADENCE_APP_DIR}/json"
	"${RENDER_CADENCE_APP_DIR}/logging"
	"${RENDER_CADENCE_APP_DIR}/runtime"
	"${RENDER_CADENCE_APP_DIR}/telemetry"
	"${RENDER_CADENCE_APP_DIR}/video"
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorRuntimeStateJsonTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorRuntimeStateJsonTests COMMAND RenderCadenceCompositorRuntimeStateJsonTests)

add_executable(RenderCadenceCompositorHttpControlServerTests
	"${RENDER_CADENCE_APP_DIR}/control/HttpControlServer.cpp"
	"${RENDER_CADENCE_APP_DIR}/json/JsonWriter.cpp"
	"${RENDER_CADENCE_APP_DIR}/logging/Logger.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorHttpControlServerTests.cpp"
)

target_include_directories(RenderCadenceCompositorHttpControlServerTests PRIVATE
	"${RENDER_CADENCE_APP_DIR}/control"
	"${RENDER_CADENCE_APP_DIR}/json"
	"${RENDER_CADENCE_APP_DIR}/logging"
)

target_link_libraries(RenderCadenceCompositorHttpControlServerTests PRIVATE
	Ws2_32
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorHttpControlServerTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorHttpControlServerTests COMMAND RenderCadenceCompositorHttpControlServerTests)

add_executable(RenderCadenceCompositorAppConfigProviderTests
	"${APP_DIR}/runtime/support/RuntimeJson.cpp"
	"${RENDER_CADENCE_APP_DIR}/app/AppConfig.cpp"
	"${RENDER_CADENCE_APP_DIR}/app/AppConfigProvider.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/RenderCadenceCompositorAppConfigProviderTests.cpp"
)

target_include_directories(RenderCadenceCompositorAppConfigProviderTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/runtime/support"
	"${RENDER_CADENCE_APP_DIR}/app"
	"${RENDER_CADENCE_APP_DIR}/control"
	"${RENDER_CADENCE_APP_DIR}/logging"
	"${RENDER_CADENCE_APP_DIR}/telemetry"
	"${RENDER_CADENCE_APP_DIR}/video"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
)

target_link_libraries(RenderCadenceCompositorAppConfigProviderTests PRIVATE
	Ws2_32
)

if(MSVC)
	target_compile_options(RenderCadenceCompositorAppConfigProviderTests PRIVATE /W3)
endif()

add_test(NAME RenderCadenceCompositorAppConfigProviderTests COMMAND RenderCadenceCompositorAppConfigProviderTests)

add_executable(SystemOutputFramePoolTests
	"${APP_DIR}/videoio/SystemOutputFramePool.cpp"
	"${APP_DIR}/videoio/VideoIOFormat.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/SystemOutputFramePoolTests.cpp"
)

target_include_directories(SystemOutputFramePoolTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
)

if(MSVC)
	target_compile_options(SystemOutputFramePoolTests PRIVATE /W3)
endif()

add_test(NAME SystemOutputFramePoolTests COMMAND SystemOutputFramePoolTests)

add_executable(VideoBackendLifecycleTests
	"${APP_DIR}/videoio/VideoBackendLifecycle.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/VideoBackendLifecycleTests.cpp"
)

target_include_directories(VideoBackendLifecycleTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/videoio"
)

if(MSVC)
	target_compile_options(VideoBackendLifecycleTests PRIVATE /W3)
endif()

add_test(NAME VideoBackendLifecycleTests COMMAND VideoBackendLifecycleTests)

add_executable(VideoIODeviceFakeTests
	"${APP_DIR}/videoio/VideoIOFormat.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/tests/VideoIODeviceFakeTests.cpp"
)

target_include_directories(VideoIODeviceFakeTests PRIVATE
	"${APP_DIR}"
	"${APP_DIR}/videoio"
	"${APP_DIR}/videoio/decklink"
)

if(MSVC)
	target_compile_options(VideoIODeviceFakeTests PRIVATE /W3)
endif()

add_test(NAME VideoIODeviceFakeTests COMMAND VideoIODeviceFakeTests)

install(TARGETS LoopThroughWithOpenGLCompositing
	RUNTIME DESTINATION "."
)

install(FILES ${SLANG_RUNTIME_FILES}
	DESTINATION "3rdParty/slang/bin"
)

install(FILES "${SLANG_LICENSE_FILE}"
	DESTINATION "third_party_notices"
	RENAME "SLANG_LICENSE.txt"
)

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/shaders/SHADER_CONTRACT.md"
	DESTINATION "."
)

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/config/"
	DESTINATION "config"
)

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/shaders/"
	DESTINATION "shaders"
)

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/runtime/templates/"
	DESTINATION "runtime/templates"
)

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/runtime/README.md"
	DESTINATION "runtime"
)

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ui/dist/"
	DESTINATION "ui/dist"
	OPTIONAL
)

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/docs/"
	DESTINATION "docs"
	OPTIONAL
)

source_group(TREE "${APP_DIR}" FILES ${APP_SOURCES})
