Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ group("flutter") {
"//flutter/examples/glfw",
"//flutter/examples/vulkan_glfw",
]

if (!is_mac) {
public_deps += [ "//flutter/examples/glfw_drm" ]
}
}

# If enbaled, compile the SDK / snapshot.
Expand Down
1 change: 1 addition & 0 deletions examples/glfw_drm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
debug/
20 changes: 20 additions & 0 deletions examples/glfw_drm/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//flutter/examples/examples.gni")

if (build_embedder_examples) {
executable("glfw_drm") {
output_name = "embedder_example_drm"

sources = [ "FlutterEmbedderGLFW.cc" ]

deps = [
"//flutter/shell/platform/embedder:embedder",
"//third_party/glfw",
]

libs = [ "EGL" ]
}
}
35 changes: 35 additions & 0 deletions examples/glfw_drm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.15)
project(FlutterEmbedderGLFW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )

add_executable(flutter_glfw FlutterEmbedderGLFW.cc)

############################################################
# GLFW
############################################################
option(GLFW_BUILD_EXAMPLES "" OFF)
option(GLFW_BUILD_TESTS "" OFF)
option(GLFW_BUILD_DOCS "" OFF)
option(GLFW_INSTALL "" OFF)
find_package(OpenGL REQUIRED COMPONENTS EGL)
include_directories(${OPENGL_INCLUDE_DIRS})
add_subdirectory(${CMAKE_SOURCE_DIR}/../../../third_party/glfw glfw)
target_link_libraries(flutter_glfw glfw OpenGL::EGL)
include_directories(${CMAKE_SOURCE_DIR}/../../../third_party/glfw/include)

############################################################
# Flutter Engine
############################################################
# This is assuming you've built a local version of the Flutter Engine. If you
# downloaded yours is from the internet you'll have to change this.
include_directories(${CMAKE_SOURCE_DIR}/../../shell/platform/embedder)
find_library(FLUTTER_LIB flutter_engine PATHS ${CMAKE_SOURCE_DIR}/../../../out/host_debug_unopt)
target_link_libraries(flutter_glfw ${FLUTTER_LIB})

# Copy the flutter library here since the shared library
# name is `./libflutter_engine.dylib`.
add_custom_command(
TARGET flutter_glfw POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${FLUTTER_LIB}
${CMAKE_CURRENT_BINARY_DIR})
Loading