diff --git a/examples/glfw/CMakeLists.txt b/examples/glfw/CMakeLists.txt index 53bca275dc673..ec0c0ed11aba9 100644 --- a/examples/glfw/CMakeLists.txt +++ b/examples/glfw/CMakeLists.txt @@ -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 diff --git a/examples/glfw/run.sh b/examples/glfw/run.sh index 70a4f41fafc0d..9c3cd344b37aa 100755 --- a/examples/glfw/run.sh +++ b/examples/glfw/run.sh @@ -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 - #################################################################