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

fixed glfw example for arm64 #38426

Merged
merged 2 commits into from
Jan 12, 2023
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
3 changes: 2 additions & 1 deletion examples/glfw/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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
Expand Down
11 changes: 9 additions & 2 deletions examples/glfw/run.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#!/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.
#################################################################
if [ ! -d debug ]; then
mkdir debug
fi
cd debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake -DCMAKE_BUILD_TYPE=Debug -DFLUTTER_ENGINE_VARIANT=$variant ..
make

#################################################################
Expand All @@ -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 -

#################################################################
Expand Down