Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a308832

Browse files
authored
Make the cmake GLFW embedder example easier to use (#34113)
1 parent be8cb49 commit a308832

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

examples/glfw/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ add_executable(flutter_glfw FlutterEmbedderGLFW.cc)
77
############################################################
88
# GLFW
99
############################################################
10-
find_path(GLFW_INCLUDE_PATH "glfw3.h"
11-
/usr/local/Cellar/glfw/3.3/include/GLFW/
12-
/usr/local/include/include/GLFW/
13-
/usr/include/GLFW)
14-
include_directories(${GLFW_INCLUDE_PATH})
15-
find_library(GLFW_LIB glfw /usr/local/Cellar/glfw/3.3/lib)
16-
target_link_libraries(flutter_glfw ${GLFW_LIB})
10+
option(GLFW_BUILD_EXAMPLES "" OFF)
11+
option(GLFW_BUILD_TESTS "" OFF)
12+
option(GLFW_BUILD_DOCS "" OFF)
13+
option(GLFW_INSTALL "" OFF)
14+
add_subdirectory(${CMAKE_SOURCE_DIR}/../../../third_party/glfw glfw)
15+
target_link_libraries(flutter_glfw glfw)
16+
include_directories(${CMAKE_SOURCE_DIR}/../../../third_party/glfw/include)
1717

1818
############################################################
1919
# Flutter Engine

examples/glfw/FlutterEmbedderGLFW.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include <embedder.h>
6-
#include <glfw3.h>
7-
85
#include <cassert>
96
#include <chrono>
107
#include <iostream>
118

9+
#include "GLFW/glfw3.h"
10+
#include "embedder.h"
11+
1212
// This value is calculated after the window is created.
1313
static double g_pixelRatio = 1.0;
1414
static const size_t kInitialWindowWidth = 800;

examples/glfw/run.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ if [ ! -d myapp ]; then
1919
fi
2020
cd myapp
2121
cp ../../main.dart lib/main.dart
22-
flutter build bundle
22+
flutter build bundle \
23+
--local-engine-src-path ../../../../../ \
24+
--local-engine=host_debug_unopt
2325
cd -
2426

2527
#################################################################

examples/vulkan_glfw/run.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ if [ ! -d myapp ]; then
1616
fi
1717
pushd myapp > /dev/null
1818
#cp ../../main.dart lib/main.dart
19-
flutter build bundle
19+
flutter build bundle \
20+
--local-engine-src-path ../../../../../ \
21+
--local-engine=host_debug_unopt
2022
popd > /dev/null
2123

2224
#################################################################

0 commit comments

Comments
 (0)