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

Commit 6880157

Browse files
authored
fixed glfw example for arm64 (#38426)
* fixed glfw example for arm64 * jenn feedback
1 parent c01465a commit 6880157

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

examples/glfw/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
cmake_minimum_required(VERSION 3.15)
22
project(FlutterEmbedderGLFW)
33
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
4+
set(FLUTTER_ENGINE_VARIANT "host_debug_unopt" CACHE STRING "")
45

56
add_executable(flutter_glfw FlutterEmbedderGLFW.cc)
67

@@ -21,7 +22,7 @@ include_directories(${CMAKE_SOURCE_DIR}/../../../third_party/glfw/include)
2122
# This is assuming you've built a local version of the Flutter Engine. If you
2223
# downloaded yours is from the internet you'll have to change this.
2324
include_directories(${CMAKE_SOURCE_DIR}/../../shell/platform/embedder)
24-
find_library(FLUTTER_LIB flutter_engine PATHS ${CMAKE_SOURCE_DIR}/../../../out/host_debug_unopt)
25+
find_library(FLUTTER_LIB flutter_engine PATHS ${CMAKE_SOURCE_DIR}/../../../out/${FLUTTER_ENGINE_VARIANT})
2526
target_link_libraries(flutter_glfw ${FLUTTER_LIB})
2627

2728
# Copy the flutter library here since the shared library

examples/glfw/run.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
#!/bin/bash
22
set -e # Exit if any program returns an error.
33

4+
if uname -m | grep "arm64"; then
5+
variant="host_debug_unopt_arm64"
6+
else
7+
variant="host_debug_unopt"
8+
fi
9+
410
#################################################################
511
# Make the host C++ project.
612
#################################################################
713
if [ ! -d debug ]; then
814
mkdir debug
915
fi
1016
cd debug
11-
cmake -DCMAKE_BUILD_TYPE=Debug ..
17+
cmake -DCMAKE_BUILD_TYPE=Debug -DFLUTTER_ENGINE_VARIANT=$variant ..
1218
make
1319

1420
#################################################################
@@ -17,11 +23,12 @@ make
1723
if [ ! -d myapp ]; then
1824
flutter create myapp
1925
fi
26+
2027
cd myapp
2128
cp ../../main.dart lib/main.dart
2229
flutter build bundle \
2330
--local-engine-src-path ../../../../../ \
24-
--local-engine=host_debug_unopt
31+
--local-engine=$variant
2532
cd -
2633

2734
#################################################################

0 commit comments

Comments
 (0)