Make the cmake GLFW embedder example easier to use (flutter/engine#34113)

This commit is contained in:
Brandon DeRosier
2022-06-16 15:19:49 -07:00
committed by GitHub
parent 16d78b482c
commit 0e98421276
4 changed files with 16 additions and 12 deletions

View File

@@ -7,13 +7,13 @@ add_executable(flutter_glfw FlutterEmbedderGLFW.cc)
############################################################
# GLFW
############################################################
find_path(GLFW_INCLUDE_PATH "glfw3.h"
/usr/local/Cellar/glfw/3.3/include/GLFW/
/usr/local/include/include/GLFW/
/usr/include/GLFW)
include_directories(${GLFW_INCLUDE_PATH})
find_library(GLFW_LIB glfw /usr/local/Cellar/glfw/3.3/lib)
target_link_libraries(flutter_glfw ${GLFW_LIB})
option(GLFW_BUILD_EXAMPLES "" OFF)
option(GLFW_BUILD_TESTS "" OFF)
option(GLFW_BUILD_DOCS "" OFF)
option(GLFW_INSTALL "" OFF)
add_subdirectory(${CMAKE_SOURCE_DIR}/../../../third_party/glfw glfw)
target_link_libraries(flutter_glfw glfw)
include_directories(${CMAKE_SOURCE_DIR}/../../../third_party/glfw/include)
############################################################
# Flutter Engine

View File

@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <embedder.h>
#include <glfw3.h>
#include <cassert>
#include <chrono>
#include <iostream>
#include "GLFW/glfw3.h"
#include "embedder.h"
// This value is calculated after the window is created.
static double g_pixelRatio = 1.0;
static const size_t kInitialWindowWidth = 800;

View File

@@ -19,7 +19,9 @@ if [ ! -d myapp ]; then
fi
cd myapp
cp ../../main.dart lib/main.dart
flutter build bundle
flutter build bundle \
--local-engine-src-path ../../../../../ \
--local-engine=host_debug_unopt
cd -
#################################################################

View File

@@ -16,7 +16,9 @@ if [ ! -d myapp ]; then
fi
pushd myapp > /dev/null
#cp ../../main.dart lib/main.dart
flutter build bundle
flutter build bundle \
--local-engine-src-path ../../../../../ \
--local-engine=host_debug_unopt
popd > /dev/null
#################################################################