1# Codec common sources 2add_subdirectory(apigen-codec-common) 3add_subdirectory(compressedTextureFormats) 4 5# Vulkan 6add_subdirectory(vulkan) 7 8# GLES translator 9add_subdirectory(glestranslator) 10add_subdirectory(libGLSnapshot) 11 12# GLES decoder 13add_subdirectory(gles1_dec) 14add_subdirectory(gles2_dec) 15 16# GLES dispatch based on Translator 17add_subdirectory(OpenGLESDispatch) 18 19# RenderControl decoder 20add_subdirectory(renderControl_dec) 21 22# Stream server core 23set(stream-server-core-sources 24 GfxStreamAgents.cpp 25 VirtioGpuTimelines.cpp 26 ChannelStream.cpp 27 ColorBuffer.cpp 28 CompositorVk.cpp 29 Debug.cpp 30 DisplayVk.cpp 31 FbConfig.cpp 32 FenceSync.cpp 33 GLESVersionDetector.cpp 34 PostWorker.cpp 35 ReadbackWorker.cpp 36 ReadBuffer.cpp 37 render_api.cpp 38 RenderChannelImpl.cpp 39 RenderThreadInfo.cpp 40 RingStream.cpp 41 SwapChainStateVk.cpp 42 SyncThread.cpp 43 TextureDraw.cpp 44 TextureResize.cpp 45 WindowSurface.cpp 46 YUVConverter.cpp 47 RenderThread.cpp 48 RenderContext.cpp 49 RenderControl.cpp 50 RenderWindow.cpp 51 RenderLibImpl.cpp 52 RendererImpl.cpp 53 FrameBuffer.cpp 54 vulkan/vk_util.cpp) 55if (APPLE) 56 set(stream-server-core-platform-sources NativeSubWindow_cocoa.m) 57elseif (WIN32) 58 set(stream-server-core-platform-sources NativeSubWindow_win32.cpp) 59else() 60 set(stream-server-core-platform-sources NativeSubWindow_x11.cpp) 61endif() 62 63# Compile everything as a static library first so that unit tests can call non-exported functions 64add_library( 65 gfxstream_backend_static 66 STATIC 67 ${stream-server-core-sources} 68 ${stream-server-core-platform-sources} 69) 70target_link_libraries( 71 gfxstream_backend_static 72 PUBLIC 73 gfxstream-host-common 74 gfxstream-base 75 OpenGLESDispatch 76 gles1_dec 77 gles2_dec 78 renderControl_dec 79 gfxstream-vulkan-server 80 gfxstream-snapshot 81 apigen-codec-common 82 perfetto-tracing-only) 83 84target_include_directories( 85 gfxstream_backend_static 86 PUBLIC 87 ${GFXSTREAM_REPO_ROOT} 88 ${GFXSTREAM_REPO_ROOT}/include 89 ${GFXSTREAM_REPO_ROOT}/stream-servers 90 ${GFXSTREAM_REPO_ROOT}/stream-servers/apigen-codec-common 91 ${GFXSTREAM_REPO_ROOT}/stream-servers/vulkan) 92 93if (WIN32) 94 target_link_libraries(gfxstream_backend_static PRIVATE D3d9.lib) 95endif() 96 97# gfxstream_backend.dll 98add_library( 99 gfxstream_backend 100 SHARED 101 GfxStreamBackend.cpp 102 virtio-gpu-gfxstream-renderer.cpp) 103 104target_link_libraries( 105 gfxstream_backend 106 PUBLIC 107 gfxstream_backend_static) 108 109if (WIN32) 110 target_link_options(gfxstream_backend PRIVATE /DEBUG) 111endif() 112 113android_install_shared(gfxstream_backend) 114 115# Testing libraries 116add_subdirectory(testlibs) 117 118# Backend unit tests 119add_executable( 120 gfxstream_backend_unittests 121 gfxstream_unittest.cpp) 122target_link_libraries( 123 gfxstream_backend_unittests 124 PRIVATE 125 OSWindow 126 gfxstream_backend 127 gfxstream-base 128 gtest_main) 129gtest_discover_tests(gfxstream_backend_unittests) 130 131# More functional tests######################################################### 132 133# Common testing support library################################################ 134# This includes the server core and testing sources 135add_library( 136 stream-server-testing-support 137 tests/SampleApplication.cpp 138 tests/GLSnapshotTesting.cpp 139 tests/OpenGLTestContext.cpp 140 tests/GLTestUtils.cpp 141 tests/ShaderUtils.cpp 142 tests/GLSnapshotTestDispatch.cpp 143 tests/GLSnapshotTestStateUtils.cpp 144 tests/HelloTriangleImp.cpp) 145target_include_directories( 146 stream-server-testing-support 147 PUBLIC 148 ${GFXSTREAM_REPO_ROOT} 149 ${GFXSTREAM_REPO_ROOT}/base/testing 150 ${GFXSTREAM_REPO_ROOT}/include 151 ${GFXSTREAM_REPO_ROOT}/stream-servers 152 ${GFXSTREAM_REPO_ROOT}/stream-servers/apigen-codec-common 153 ${GFXSTREAM_REPO_ROOT}/stream-servers/vulkan) 154target_link_libraries( 155 stream-server-testing-support 156 PUBLIC 157 gfxstream_backend_static 158 OSWindow 159 gtest) 160 161if (LINUX) 162add_library( 163 x11_testing_support 164 tests/X11TestingSupport.cpp) 165target_link_libraries( 166 x11_testing_support 167 gfxstream-base) 168endif() 169 170# Basic opengl rendering tests################################################## 171add_executable( 172 OpenglRender_unittests 173 tests/FrameBuffer_unittest.cpp 174 tests/DefaultFramebufferBlit_unittest.cpp 175 tests/TextureDraw_unittest.cpp 176 tests/StalePtrRegistry_unittest.cpp) 177target_link_libraries( 178 OpenglRender_unittests 179 PRIVATE 180 gfxstream_backend_static 181 stream-server-testing-support 182 gfxstream-base-testing-support 183 gfxstream-host-common-testing-support 184 gtest_main) 185if (LINUX) 186 target_link_libraries( 187 OpenglRender_unittests 188 PRIVATE x11_testing_support) 189endif() 190gtest_discover_tests(OpenglRender_unittests) 191 192# Snapshot tests################################################################ 193add_executable( 194 OpenglRender_snapshot_unittests 195 tests/GLSnapshotBuffers_unittest.cpp 196 tests/GLSnapshotFramebufferControl_unittest.cpp 197 tests/GLSnapshotFramebuffers_unittest.cpp 198 tests/GLSnapshotMultisampling_unittest.cpp 199 tests/GLSnapshotPixelOperations_unittest.cpp 200 tests/GLSnapshotPixels_unittest.cpp 201 tests/GLSnapshotPrograms_unittest.cpp 202 tests/GLSnapshotRasterization_unittest.cpp 203 tests/GLSnapshotRenderbuffers_unittest.cpp 204 tests/GLSnapshotRendering_unittest.cpp 205 tests/GLSnapshotShaders_unittest.cpp 206 tests/GLSnapshotTextures_unittest.cpp 207 tests/GLSnapshotTransformation_unittest.cpp 208 tests/GLSnapshotVertexAttributes_unittest.cpp 209 tests/GLSnapshot_unittest.cpp) 210target_link_libraries( 211 OpenglRender_snapshot_unittests 212 PRIVATE 213 gfxstream_backend_static 214 stream-server-testing-support 215 gfxstream-base-testing-support 216 gfxstream-host-common-testing-support 217 gtest_main) 218gtest_discover_tests(OpenglRender_snapshot_unittests) 219 220# Vulkan tests################################################################## 221add_executable( 222 Vulkan_unittests 223 tests/Vulkan_unittest.cpp 224 tests/CompositorVk_unittest.cpp 225 tests/SwapChainStateVk_unittest.cpp 226 tests/DisplayVk_unittest.cpp 227 tests/VirtioGpuTimelines_unittest.cpp 228 vulkan/vk_util_unittest.cpp 229 vulkan/VkQsriTimeline_unittest.cpp 230) 231target_link_libraries( 232 Vulkan_unittests 233 PRIVATE 234 gfxstream_backend_static 235 stream-server-testing-support 236 gfxstream-base-testing-support 237 gfxstream-host-common-testing-support 238 gtest 239 gtest_main 240 gmock) 241gtest_discover_tests(Vulkan_unittests) 242 243set_test_include_files() 244