-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20923ca
commit e7e14c6
Showing
21 changed files
with
1,180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" /> | ||
<excludeFolder url="file://$MODULE_DIR$/.idea" /> | ||
<excludeFolder url="file://$MODULE_DIR$/.pub" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build" /> | ||
</content> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="Dart SDK" level="project" /> | ||
<orderEntry type="library" name="Flutter Plugins" level="project" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: arwaykit_flutter_demo | ||
description: ARwayKit integration with Flutter. | ||
|
||
# The following line prevents the package from being accidentally published to | ||
# pub.dev using `pub publish`. This is preferred for private packages. | ||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev | ||
|
||
# The following defines the version and build number for your application. | ||
# A version number is three numbers separated by dots, like 1.2.43 | ||
# followed by an optional build number separated by a +. | ||
# Both the version and the builder number may be overridden in flutter | ||
# build by specifying --build-name and --build-number, respectively. | ||
# In Android, build-name is used as versionName while build-number used as versionCode. | ||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning | ||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. | ||
# Read more about iOS versioning at | ||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html | ||
version: 1.0.0+1 | ||
|
||
environment: | ||
sdk: ">=2.7.0 <3.0.0" | ||
|
||
dependencies: | ||
flutter: | ||
sdk: flutter | ||
flutter_unity_widget: ^3.0.3 | ||
|
||
# The following adds the Cupertino Icons font to your application. | ||
# Use with the CupertinoIcons class for iOS style icons. | ||
cupertino_icons: ^1.0.2 | ||
|
||
dev_dependencies: | ||
flutter_test: | ||
sdk: flutter | ||
|
||
# For information on the generic Dart part of this file, see the | ||
# following page: https://dart.dev/tools/pub/pubspec | ||
|
||
# The following section is specific to Flutter. | ||
flutter: | ||
|
||
# The following line ensures that the Material Icons font is | ||
# included with your application, so that you can use the icons in | ||
# the material Icons class. | ||
uses-material-design: true | ||
|
||
# To add assets to your application, add an assets section, like this: | ||
# assets: | ||
# - images/a_dot_burr.jpeg | ||
# - images/a_dot_ham.jpeg | ||
|
||
# An image asset can refer to one or more resolution-specific "variants", see | ||
# https://flutter.dev/assets-and-images/#resolution-aware. | ||
|
||
# For details regarding adding assets from package dependencies, see | ||
# https://flutter.dev/assets-and-images/#from-packages | ||
|
||
# To add custom fonts to your application, add a fonts section here, | ||
# in this "flutter" section. Each entry in this list should have a | ||
# "family" key with the font family name, and a "fonts" key with a | ||
# list giving the asset and other descriptors for the font. For | ||
# example: | ||
# fonts: | ||
# - family: Schyler | ||
# fonts: | ||
# - asset: fonts/Schyler-Regular.ttf | ||
# - asset: fonts/Schyler-Italic.ttf | ||
# style: italic | ||
# - family: Trajan Pro | ||
# fonts: | ||
# - asset: fonts/TrajanPro.ttf | ||
# - asset: fonts/TrajanPro_Bold.ttf | ||
# weight: 700 | ||
# | ||
# For details regarding fonts from package dependencies, | ||
# see https://flutter.dev/custom-fonts/#from-packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(arwaykit_flutter_demo LANGUAGES CXX) | ||
|
||
set(BINARY_NAME "arwaykit_flutter_demo") | ||
|
||
cmake_policy(SET CMP0063 NEW) | ||
|
||
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") | ||
|
||
# Configure build options. | ||
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) | ||
if(IS_MULTICONFIG) | ||
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" | ||
CACHE STRING "" FORCE) | ||
else() | ||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
set(CMAKE_BUILD_TYPE "Debug" CACHE | ||
STRING "Flutter build mode" FORCE) | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS | ||
"Debug" "Profile" "Release") | ||
endif() | ||
endif() | ||
|
||
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") | ||
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") | ||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") | ||
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") | ||
|
||
# Use Unicode for all projects. | ||
add_definitions(-DUNICODE -D_UNICODE) | ||
|
||
# Compilation settings that should be applied to most targets. | ||
function(APPLY_STANDARD_SETTINGS TARGET) | ||
target_compile_features(${TARGET} PUBLIC cxx_std_17) | ||
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") | ||
target_compile_options(${TARGET} PRIVATE /EHsc) | ||
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") | ||
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>") | ||
endfunction() | ||
|
||
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") | ||
|
||
# Flutter library and tool build rules. | ||
add_subdirectory(${FLUTTER_MANAGED_DIR}) | ||
|
||
# Application build | ||
add_subdirectory("runner") | ||
|
||
# Generated plugin build rules, which manage building the plugins and adding | ||
# them to the application. | ||
include(flutter/generated_plugins.cmake) | ||
|
||
|
||
# === Installation === | ||
# Support files are copied into place next to the executable, so that it can | ||
# run in place. This is done instead of making a separate bundle (as on Linux) | ||
# so that building and running from within Visual Studio will work. | ||
set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>") | ||
# Make the "install" step default, as it's required to run. | ||
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) | ||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) | ||
endif() | ||
|
||
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") | ||
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") | ||
|
||
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" | ||
COMPONENT Runtime) | ||
|
||
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" | ||
COMPONENT Runtime) | ||
|
||
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
COMPONENT Runtime) | ||
|
||
if(PLUGIN_BUNDLED_LIBRARIES) | ||
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" | ||
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
COMPONENT Runtime) | ||
endif() | ||
|
||
# Fully re-copy the assets directory on each build to avoid having stale files | ||
# from a previous install. | ||
set(FLUTTER_ASSET_DIR_NAME "flutter_assets") | ||
install(CODE " | ||
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") | ||
" COMPONENT Runtime) | ||
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" | ||
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) | ||
|
||
# Install the AOT library on non-Debug builds only. | ||
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" | ||
CONFIGURATIONS Profile;Release | ||
COMPONENT Runtime) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") | ||
|
||
# Configuration provided via flutter tool. | ||
include(${EPHEMERAL_DIR}/generated_config.cmake) | ||
|
||
# TODO: Move the rest of this into files in ephemeral. See | ||
# https://github.com/flutter/flutter/issues/57146. | ||
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") | ||
|
||
# === Flutter Library === | ||
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") | ||
|
||
# Published to parent scope for install step. | ||
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) | ||
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) | ||
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) | ||
set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) | ||
|
||
list(APPEND FLUTTER_LIBRARY_HEADERS | ||
"flutter_export.h" | ||
"flutter_windows.h" | ||
"flutter_messenger.h" | ||
"flutter_plugin_registrar.h" | ||
"flutter_texture_registrar.h" | ||
) | ||
list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") | ||
add_library(flutter INTERFACE) | ||
target_include_directories(flutter INTERFACE | ||
"${EPHEMERAL_DIR}" | ||
) | ||
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") | ||
add_dependencies(flutter flutter_assemble) | ||
|
||
# === Wrapper === | ||
list(APPEND CPP_WRAPPER_SOURCES_CORE | ||
"core_implementations.cc" | ||
"standard_codec.cc" | ||
) | ||
list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") | ||
list(APPEND CPP_WRAPPER_SOURCES_PLUGIN | ||
"plugin_registrar.cc" | ||
) | ||
list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") | ||
list(APPEND CPP_WRAPPER_SOURCES_APP | ||
"flutter_engine.cc" | ||
"flutter_view_controller.cc" | ||
) | ||
list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") | ||
|
||
# Wrapper sources needed for a plugin. | ||
add_library(flutter_wrapper_plugin STATIC | ||
${CPP_WRAPPER_SOURCES_CORE} | ||
${CPP_WRAPPER_SOURCES_PLUGIN} | ||
) | ||
apply_standard_settings(flutter_wrapper_plugin) | ||
set_target_properties(flutter_wrapper_plugin PROPERTIES | ||
POSITION_INDEPENDENT_CODE ON) | ||
set_target_properties(flutter_wrapper_plugin PROPERTIES | ||
CXX_VISIBILITY_PRESET hidden) | ||
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) | ||
target_include_directories(flutter_wrapper_plugin PUBLIC | ||
"${WRAPPER_ROOT}/include" | ||
) | ||
add_dependencies(flutter_wrapper_plugin flutter_assemble) | ||
|
||
# Wrapper sources needed for the runner. | ||
add_library(flutter_wrapper_app STATIC | ||
${CPP_WRAPPER_SOURCES_CORE} | ||
${CPP_WRAPPER_SOURCES_APP} | ||
) | ||
apply_standard_settings(flutter_wrapper_app) | ||
target_link_libraries(flutter_wrapper_app PUBLIC flutter) | ||
target_include_directories(flutter_wrapper_app PUBLIC | ||
"${WRAPPER_ROOT}/include" | ||
) | ||
add_dependencies(flutter_wrapper_app flutter_assemble) | ||
|
||
# === Flutter tool backend === | ||
# _phony_ is a non-existent file to force this command to run every time, | ||
# since currently there's no way to get a full input/output list from the | ||
# flutter tool. | ||
set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") | ||
set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) | ||
add_custom_command( | ||
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} | ||
${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} | ||
${CPP_WRAPPER_SOURCES_APP} | ||
${PHONY_OUTPUT} | ||
COMMAND ${CMAKE_COMMAND} -E env | ||
${FLUTTER_TOOL_ENVIRONMENT} | ||
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" | ||
windows-x64 $<CONFIG> | ||
VERBATIM | ||
) | ||
add_custom_target(flutter_assemble DEPENDS | ||
"${FLUTTER_LIBRARY}" | ||
${FLUTTER_LIBRARY_HEADERS} | ||
${CPP_WRAPPER_SOURCES_CORE} | ||
${CPP_WRAPPER_SOURCES_PLUGIN} | ||
${CPP_WRAPPER_SOURCES_APP} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// | ||
// Generated file. Do not edit. | ||
// | ||
|
||
#include "generated_plugin_registrant.h" | ||
|
||
|
||
void RegisterPlugins(flutter::PluginRegistry* registry) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Generated file. Do not edit. | ||
// | ||
|
||
#ifndef GENERATED_PLUGIN_REGISTRANT_ | ||
#define GENERATED_PLUGIN_REGISTRANT_ | ||
|
||
#include <flutter/plugin_registry.h> | ||
|
||
// Registers Flutter plugins. | ||
void RegisterPlugins(flutter::PluginRegistry* registry); | ||
|
||
#endif // GENERATED_PLUGIN_REGISTRANT_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Generated file, do not edit. | ||
# | ||
|
||
list(APPEND FLUTTER_PLUGIN_LIST | ||
) | ||
|
||
set(PLUGIN_BUNDLED_LIBRARIES) | ||
|
||
foreach(plugin ${FLUTTER_PLUGIN_LIST}) | ||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) | ||
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) | ||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) | ||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) | ||
endforeach(plugin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(runner LANGUAGES CXX) | ||
|
||
add_executable(${BINARY_NAME} WIN32 | ||
"flutter_window.cpp" | ||
"main.cpp" | ||
"run_loop.cpp" | ||
"utils.cpp" | ||
"win32_window.cpp" | ||
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" | ||
"Runner.rc" | ||
"runner.exe.manifest" | ||
) | ||
apply_standard_settings(${BINARY_NAME}) | ||
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") | ||
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) | ||
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") | ||
add_dependencies(${BINARY_NAME} flutter_assemble) |
Oops, something went wrong.