fixed glfw example for arm64 (flutter/engine#38426)

* fixed glfw example for arm64

* jenn feedback
This commit is contained in:
gaaclarke
2023-01-12 13:05:56 -08:00
committed by GitHub
parent 533519ff6e
commit 2bff9b8d85
2 changed files with 11 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.15)
project(FlutterEmbedderGLFW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
set(FLUTTER_ENGINE_VARIANT "host_debug_unopt" CACHE STRING "")
add_executable(flutter_glfw FlutterEmbedderGLFW.cc)
@@ -21,7 +22,7 @@ include_directories(${CMAKE_SOURCE_DIR}/../../../third_party/glfw/include)
# 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)
find_library(FLUTTER_LIB flutter_engine PATHS ${CMAKE_SOURCE_DIR}/../../../out/${FLUTTER_ENGINE_VARIANT})
target_link_libraries(flutter_glfw ${FLUTTER_LIB})
# Copy the flutter library here since the shared library

View File

@@ -1,6 +1,12 @@
#!/bin/bash
set -e # Exit if any program returns an error.
if uname -m | grep "arm64"; then
variant="host_debug_unopt_arm64"
else
variant="host_debug_unopt"
fi
#################################################################
# Make the host C++ project.
#################################################################
@@ -8,7 +14,7 @@ if [ ! -d debug ]; then
mkdir debug
fi
cd debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake -DCMAKE_BUILD_TYPE=Debug -DFLUTTER_ENGINE_VARIANT=$variant ..
make
#################################################################
@@ -17,11 +23,12 @@ make
if [ ! -d myapp ]; then
flutter create myapp
fi
cd myapp
cp ../../main.dart lib/main.dart
flutter build bundle \
--local-engine-src-path ../../../../../ \
--local-engine=host_debug_unopt
--local-engine=$variant
cd -
#################################################################