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(GPUDIRECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/Blackmagic DeckLink SDK 16.0/Win/Samples/NVIDIA_GPUDirect" CACHE PATH "Path to the NVIDIA_GPUDirect sample directory from the Blackmagic DeckLink SDK") if(NOT EXISTS "${APP_DIR}/LoopThroughWithOpenGLCompositing.cpp") message(FATAL_ERROR "Imported app sources were not found under ${APP_DIR}") endif() if(NOT EXISTS "${GPUDIRECT_DIR}/lib/x64/dvp.lib") message(FATAL_ERROR "NVIDIA GPUDirect library not found under ${GPUDIRECT_DIR}") endif() set(APP_SOURCES "${APP_DIR}/AudioSupport.cpp" "${APP_DIR}/AudioSupport.h" "${APP_DIR}/ControlServer.cpp" "${APP_DIR}/ControlServer.h" "${APP_DIR}/DeckLinkAPI_i.c" "${APP_DIR}/GLExtensions.cpp" "${APP_DIR}/GLExtensions.h" "${APP_DIR}/LoopThroughWithOpenGLCompositing.cpp" "${APP_DIR}/LoopThroughWithOpenGLCompositing.h" "${APP_DIR}/LoopThroughWithOpenGLCompositing.rc" "${APP_DIR}/NativeHandles.h" "${APP_DIR}/NativeSockets.h" "${APP_DIR}/OpenGLComposite.cpp" "${APP_DIR}/OpenGLComposite.h" "${APP_DIR}/OscServer.cpp" "${APP_DIR}/OscServer.h" "${APP_DIR}/resource.h" "${APP_DIR}/RuntimeHost.cpp" "${APP_DIR}/RuntimeHost.h" "${APP_DIR}/RuntimeJson.cpp" "${APP_DIR}/RuntimeJson.h" "${APP_DIR}/RuntimeParameterUtils.cpp" "${APP_DIR}/RuntimeParameterUtils.h" "${APP_DIR}/ShaderCompiler.cpp" "${APP_DIR}/ShaderCompiler.h" "${APP_DIR}/ShaderPackageRegistry.cpp" "${APP_DIR}/ShaderPackageRegistry.h" "${APP_DIR}/ShaderTypes.h" "${APP_DIR}/stdafx.cpp" "${APP_DIR}/stdafx.h" "${APP_DIR}/targetver.h" "${APP_DIR}/VideoFrameTransfer.cpp" "${APP_DIR}/VideoFrameTransfer.h" ) add_executable(LoopThroughWithOpenGLCompositing WIN32 ${APP_SOURCES}) target_include_directories(LoopThroughWithOpenGLCompositing PRIVATE "${APP_DIR}" "${GPUDIRECT_DIR}/include" ) target_link_directories(LoopThroughWithOpenGLCompositing PRIVATE "${GPUDIRECT_DIR}/lib/x64" ) target_link_libraries(LoopThroughWithOpenGLCompositing PRIVATE dvp.lib opengl32 glu32 Ws2_32 Crypt32 Advapi32 ) target_compile_definitions(LoopThroughWithOpenGLCompositing PRIVATE _UNICODE UNICODE ) if(MSVC) target_compile_options(LoopThroughWithOpenGLCompositing PRIVATE /W3) endif() add_executable(RuntimeJsonTests "${APP_DIR}/RuntimeJson.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/tests/RuntimeJsonTests.cpp" ) target_include_directories(RuntimeJsonTests PRIVATE "${APP_DIR}" ) if(MSVC) target_compile_options(RuntimeJsonTests PRIVATE /W3) endif() enable_testing() add_test(NAME RuntimeJsonTests COMMAND RuntimeJsonTests) add_executable(RuntimeParameterUtilsTests "${APP_DIR}/RuntimeJson.cpp" "${APP_DIR}/RuntimeParameterUtils.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/tests/RuntimeParameterUtilsTests.cpp" ) target_include_directories(RuntimeParameterUtilsTests PRIVATE "${APP_DIR}" ) if(MSVC) target_compile_options(RuntimeParameterUtilsTests PRIVATE /W3) endif() add_test(NAME RuntimeParameterUtilsTests COMMAND RuntimeParameterUtilsTests) add_executable(ShaderPackageRegistryTests "${APP_DIR}/RuntimeJson.cpp" "${APP_DIR}/ShaderPackageRegistry.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/tests/ShaderPackageRegistryTests.cpp" ) target_include_directories(ShaderPackageRegistryTests PRIVATE "${APP_DIR}" ) if(MSVC) target_compile_options(ShaderPackageRegistryTests PRIVATE /W3) endif() add_test(NAME ShaderPackageRegistryTests COMMAND ShaderPackageRegistryTests) add_executable(OscServerTests "${APP_DIR}/OscServer.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/tests/OscServerTests.cpp" ) target_include_directories(OscServerTests PRIVATE "${APP_DIR}" ) target_link_libraries(OscServerTests PRIVATE Ws2_32 ) if(MSVC) target_compile_options(OscServerTests PRIVATE /W3) endif() add_test(NAME OscServerTests COMMAND OscServerTests) add_executable(AudioSupportTests "${APP_DIR}/AudioSupport.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/tests/AudioSupportTests.cpp" ) target_include_directories(AudioSupportTests PRIVATE "${APP_DIR}" ) if(MSVC) target_compile_options(AudioSupportTests PRIVATE /W3) endif() add_test(NAME AudioSupportTests COMMAND AudioSupportTests) add_custom_command(TARGET LoopThroughWithOpenGLCompositing POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${GPUDIRECT_DIR}/bin/x64/dvp.dll" "$/dvp.dll" ) install(TARGETS LoopThroughWithOpenGLCompositing RUNTIME DESTINATION "." ) install(FILES "${GPUDIRECT_DIR}/bin/x64/dvp.dll" 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})