CMake: Add support for the OpenGL backend

Bug: dawn:333
Change-Id: Ic5386dc2fda3ba21f1437ee0b2c3f508ffb9dff7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15940
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/src/dawn_native/CMakeLists.txt b/src/dawn_native/CMakeLists.txt
index 004c00a..552b5ee 100644
--- a/src/dawn_native/CMakeLists.txt
+++ b/src/dawn_native/CMakeLists.txt
@@ -211,7 +211,50 @@
         RESULT_VARIABLE "DAWN_NATIVE_OPENGL_AUTOGEN_SOURCES"
     )
 
-    # TODO
+    target_sources(dawn_native PRIVATE
+        "${DAWN_INCLUDE_DIR}/dawn_native/OpenGLBackend.h"
+        ${DAWN_NATIVE_OPENGL_AUTOGEN_SOURCES}
+        "opengl/BackendGL.cpp"
+        "opengl/BackendGL.h"
+        "opengl/BufferGL.cpp"
+        "opengl/BufferGL.h"
+        "opengl/CommandBufferGL.cpp"
+        "opengl/CommandBufferGL.h"
+        "opengl/ComputePipelineGL.cpp"
+        "opengl/ComputePipelineGL.h"
+        "opengl/DeviceGL.cpp"
+        "opengl/DeviceGL.h"
+        "opengl/Forward.h"
+        "opengl/GLFormat.cpp"
+        "opengl/GLFormat.h"
+        "opengl/NativeSwapChainImplGL.cpp"
+        "opengl/NativeSwapChainImplGL.h"
+        "opengl/OpenGLFunctions.cpp"
+        "opengl/OpenGLFunctions.h"
+        "opengl/PersistentPipelineStateGL.cpp"
+        "opengl/PersistentPipelineStateGL.h"
+        "opengl/PipelineGL.cpp"
+        "opengl/PipelineGL.h"
+        "opengl/PipelineLayoutGL.cpp"
+        "opengl/PipelineLayoutGL.h"
+        "opengl/QueueGL.cpp"
+        "opengl/QueueGL.h"
+        "opengl/RenderPipelineGL.cpp"
+        "opengl/RenderPipelineGL.h"
+        "opengl/SamplerGL.cpp"
+        "opengl/SamplerGL.h"
+        "opengl/ShaderModuleGL.cpp"
+        "opengl/ShaderModuleGL.h"
+        "opengl/SwapChainGL.cpp"
+        "opengl/SwapChainGL.h"
+        "opengl/TextureGL.cpp"
+        "opengl/TextureGL.h"
+        "opengl/UtilsGL.cpp"
+        "opengl/UtilsGL.h"
+        "opengl/opengl_platform.h"
+    )
+
+    target_link_libraries(dawn_native PRIVATE dawn_khronos_platform)
 endif()
 
 if (DAWN_ENABLE_VULKAN)
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index 54484fa..56993a1 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -72,3 +72,8 @@
         add_subdirectory(${DAWN_GLM_DIR})
     endif()
 endif()
+
+# Header-only library for khrplatform.h
+add_library(dawn_khronos_platform INTERFACE)
+target_sources(dawn_khronos_platform INTERFACE "${DAWN_THIRD_PARTY_DIR}/khronos/KHR/khrplatform.h")
+target_include_directories(dawn_khronos_platform INTERFACE "${DAWN_THIRD_PARTY_DIR}/khronos")