Skip to content

Commit f64e3aa

Browse files
committed
Update ffigen_codelab
1 parent 2d8fc45 commit f64e3aa

File tree

41 files changed

+625
-517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+625
-517
lines changed

ffigen_codelab/step_03/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 54 additions & 54 deletions
Large diffs are not rendered by default.

ffigen_codelab/step_03/example/linux/CMakeLists.txt

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Project-level configuration.
2-
cmake_minimum_required(VERSION 3.10)
2+
cmake_minimum_required(VERSION 3.13)
33
project(runner LANGUAGES CXX)
44

55
# The name of the executable created for the application. Change this to change
@@ -54,25 +54,8 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
5454
find_package(PkgConfig REQUIRED)
5555
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
5656

57-
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58-
59-
# Define the application target. To change its name, change BINARY_NAME above,
60-
# not the value here, or `flutter run` will no longer work.
61-
#
62-
# Any new source files that you add to the application should be added here.
63-
add_executable(${BINARY_NAME}
64-
"main.cc"
65-
"my_application.cc"
66-
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67-
)
68-
69-
# Apply the standard set of build settings. This can be removed for applications
70-
# that need different build settings.
71-
apply_standard_settings(${BINARY_NAME})
72-
73-
# Add dependency libraries. Add any application-specific dependencies here.
74-
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75-
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
57+
# Application build; see runner/CMakeLists.txt.
58+
add_subdirectory("runner")
7659

7760
# Run the Flutter tool portions of the build. This must not be removed.
7861
add_dependencies(${BINARY_NAME} flutter_assemble)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
project(runner LANGUAGES CXX)
3+
4+
# Define the application target. To change its name, change BINARY_NAME in the
5+
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6+
# work.
7+
#
8+
# Any new source files that you add to the application should be added here.
9+
add_executable(${BINARY_NAME}
10+
"main.cc"
11+
"my_application.cc"
12+
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
13+
)
14+
15+
# Apply the standard set of build settings. This can be removed for applications
16+
# that need different build settings.
17+
apply_standard_settings(${BINARY_NAME})
18+
19+
# Add preprocessor definitions for the application ID.
20+
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
21+
22+
# Add dependency libraries. Add any application-specific dependencies here.
23+
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
24+
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
25+
26+
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")

ffigen_codelab/step_03/example/linux/my_application.cc renamed to ffigen_codelab/step_03/example/linux/runner/my_application.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ static void my_application_class_init(MyApplicationClass* klass) {
117117
static void my_application_init(MyApplication* self) {}
118118

119119
MyApplication* my_application_new() {
120+
// Set the program name to the application ID, which helps various systems
121+
// like GTK and desktop environments map this running application to its
122+
// corresponding .desktop file. This ensures better integration by allowing
123+
// the application to be recognized beyond its binary name.
124+
g_set_prgname(APPLICATION_ID);
125+
120126
return MY_APPLICATION(g_object_new(my_application_get_type(),
121127
"application-id", APPLICATION_ID,
122128
"flags", G_APPLICATION_NON_UNIQUE,

ffigen_codelab/step_03/example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 54 additions & 54 deletions
Large diffs are not rendered by default.

ffigen_codelab/step_03/macos/ffigen_app.podspec

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ A new Flutter FFI plugin project.
1919
# `../src/*` so that the C sources can be shared among all target platforms.
2020
s.source = { :path => '.' }
2121
s.source_files = 'Classes/**/*'
22+
23+
# If your plugin requires a privacy manifest, for example if it collects user
24+
# data, update the PrivacyInfo.xcprivacy file to describe your plugin's
25+
# privacy impact, and then uncomment this line. For more information,
26+
# see https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
27+
# s.resource_bundles = {'ffigen_app_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
28+
2229
s.dependency 'FlutterMacOS'
2330

2431
s.platform = :osx, '10.11'

ffigen_codelab/step_03/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414

1515
dev_dependencies:
1616
ffi: ^2.1.3
17-
ffigen: ^14.0.1
17+
ffigen: ^15.0.0
1818
flutter_test:
1919
sdk: flutter
2020
flutter_lints: ^5.0.0

ffigen_codelab/step_03/src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ set_target_properties(ffigen_app PROPERTIES
1515
)
1616

1717
target_compile_definitions(ffigen_app PUBLIC DART_SHARED_LIB)
18+
19+
if (ANDROID)
20+
# Support Android 15 16k page size
21+
target_link_options(ffigen_app PRIVATE "-Wl,-z,max-page-size=16384")
22+
endif()

0 commit comments

Comments
 (0)