successfully allocating with VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT working copying vulkan texture successfully passing D3D texture back to Flutter chore: Dart/Windows sample project: remove unnnecessary InvalidateRect from update() chore: Dart/Windows sample project: add generated bindings successfully blitting from Vulkan swapchain to D3D texture working Vulkan texture integration with Flutter refactor to allow disposal of resources in destructors handle destroyTexture correctly correctly implement surface resizing/destruction move Windows engine to Vulkan backend and flush after creating swapchain add vulkan + vkshaders to Windows libs update materials with Vulkan move Vulkan implementation to thermion_Dart remove extras folder thermion_flutter plugin updates update build hook to copy .lib file to output directory and use -vulkan lib zip file thermion_flutter cleanup reinstate stereoscopic on Windows add dxgi and d3d11.lib to windows header pragma update cli_windows sample project copy filament/vulkan headers to output directory. This was originally added to facilitate linking on Windows (where thermion_flutter_plugin.cpp needs the Vulkan-related headers), but this doesn't actually solve the problem because there's no way that I've found to get the directory structure correct in the Dart native_assets build directory unless you explicitly address each inidivual file. The current approach is therefore to just keep a permanent copy of the headers in the thermion_filament directory (meaning these will need to be updated manually if the Filament version changes). However, I decided to keep the changes to build.dart because it doesn't have much negative impact and may be helpful in future. disable stereoscopic on Windows and disable handle use after free checks use filament headers for thermion_flutter throw Exception for MSAA on Windows (note that passing msaa:true for setAntiAliasing doesn't actually set MSAA on other platforms, but at least it won't cause the engine to crash) change header include path for Windows/Vulkan change header include path for Windows/Vulkan add filament/vulkan headers for flutter (Windows) ensure destroyTexture platform methods accept an integer rather than a list handle Android/Windows swapchain creation separately
109 lines
4.1 KiB
CMake
109 lines
4.1 KiB
CMake
# Project-level configuration.
|
|
cmake_minimum_required(VERSION 3.14)
|
|
project(quickstart LANGUAGES CXX)
|
|
|
|
# The name of the executable created for the application. Change this to change
|
|
# the on-disk name of your application.
|
|
set(BINARY_NAME "quickstart")
|
|
|
|
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
|
# versions of CMake.
|
|
cmake_policy(VERSION 3.14...3.25)
|
|
|
|
# Define build configuration option.
|
|
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()
|
|
# Define settings for the Profile build mode.
|
|
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.
|
|
#
|
|
# Be cautious about adding new options here, as plugins use this function by
|
|
# default. In most cases, you should add new options to specific targets instead
|
|
# of modifying this function.
|
|
function(APPLY_STANDARD_SETTINGS TARGET)
|
|
target_compile_features(${TARGET} PUBLIC cxx_std_17)
|
|
target_compile_options(${TARGET} PRIVATE /W4 /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()
|
|
|
|
# Flutter library and tool build rules.
|
|
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
|
|
add_subdirectory(${FLUTTER_MANAGED_DIR})
|
|
|
|
# Application build; see runner/CMakeLists.txt.
|
|
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()
|
|
|
|
# Copy the native assets provided by the build.dart from all packages.
|
|
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/")
|
|
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
|
|
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
|
COMPONENT Runtime)
|
|
|
|
# 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)
|