-
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
Showing
32 changed files
with
1,334 additions
and
167 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,68 @@ | ||
name: Build example | ||
on: [push] | ||
jobs: | ||
windows: | ||
runs-on: windows-2022 | ||
env: | ||
# Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/25936 | ||
TRANSMISSION_PREFIX: ${{ github.workspace }}/transmission-prefix | ||
VCPKG_MANIFEST_DIR: ${{ github.workspace }}/example | ||
defaults: | ||
run: | ||
working-directory: ./example | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Set up vcpkg | ||
uses: lukka/run-vcpkg@v11 | ||
with: | ||
vcpkgDirectory: ${{ github.workspace }}/example/vcpkg | ||
- name: Set up Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
channel: stable | ||
- run: flutter build windows | ||
linux: | ||
runs-on: ubuntu-24.04 | ||
defaults: | ||
run: | ||
working-directory: ./example | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y ninja-build libgtk-3-dev libcurl4-openssl-dev | ||
- name: Set up Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
channel: stable | ||
- run: flutter build linux | ||
android: | ||
runs-on: ubuntu-24.04 | ||
env: | ||
VCPKG_MANIFEST_DIR: ${{ github.workspace }}/example | ||
defaults: | ||
run: | ||
working-directory: ./example | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y ninja-build | ||
- name: Set up vcpkg | ||
uses: lukka/run-vcpkg@v11 | ||
with: | ||
vcpkgDirectory: ${{ github.workspace }}/example/vcpkg | ||
- name: Set up Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
channel: stable | ||
- run: flutter build apk |
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,3 @@ | ||
[submodule "example/vcpkg"] | ||
path = example/vcpkg | ||
url = [email protected]:microsoft/vcpkg.git |
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
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
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
File renamed without changes.
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 @@ | ||
flutter/ephemeral/ | ||
|
||
# Visual Studio user-specific files. | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# Visual Studio build-related files. | ||
x64/ | ||
x86/ | ||
|
||
# Visual Studio cache files | ||
# files ending in .cache can be ignored | ||
*.[Cc]ache | ||
# but keep track of directories ending in .cache | ||
!*.[Cc]ache/ |
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,114 @@ | ||
# Project-level configuration. | ||
cmake_minimum_required(VERSION 3.14) | ||
if (DEFINED ENV{VCPKG_MANIFEST_DIR}) | ||
set(VCPKG_MANIFEST_DIR $ENV{VCPKG_MANIFEST_DIR}) | ||
endif() | ||
set(VCPKG_TARGET_TRIPLET x64-windows-static) | ||
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) | ||
project(flutter_libtransmission_example 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 "flutter_libtransmission_example") | ||
|
||
# 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 /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() | ||
|
||
# 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) | ||
|
Oops, something went wrong.