1
+ # Project-level configuration.
1
2
cmake_minimum_required (VERSION 3.10)
2
3
project (runner LANGUAGES CXX)
3
4
5
+ # The name of the executable created for the application. Change this to change
6
+ # the on-disk name of your application.
4
7
set (BINARY_NAME "ServerBox" )
8
+ # The unique GTK application identifier for this application. See:
9
+ # https://wiki.gnome.org/HowDoI/ChooseApplicationID
5
10
set (APPLICATION_ID "tech.lolli.toolbox" )
6
11
12
+ # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
13
+ # versions of CMake.
7
14
cmake_policy (SET CMP0063 NEW)
8
15
16
+ # Load bundled libraries from the lib/ directory relative to the binary.
9
17
set (CMAKE_INSTALL_RPATH "$ORIGIN/lib" )
10
18
11
19
# Root filesystem for cross-building.
@@ -18,7 +26,7 @@ if(FLUTTER_TARGET_PLATFORM_SYSROOT)
18
26
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
19
27
endif ()
20
28
21
- # Configure build options.
29
+ # Define build configuration options.
22
30
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES )
23
31
set (CMAKE_BUILD_TYPE "Debug" CACHE
24
32
STRING "Flutter build mode" FORCE)
@@ -27,16 +35,19 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
27
35
endif ()
28
36
29
37
# Compilation settings that should be applied to most targets.
38
+ #
39
+ # Be cautious about adding new options here, as plugins use this function by
40
+ # default. In most cases, you should add new options to specific targets instead
41
+ # of modifying this function.
30
42
function (APPLY_STANDARD_SETTINGS TARGET )
31
43
target_compile_features (${TARGET} PUBLIC cxx_std_14)
32
44
target_compile_options (${TARGET} PRIVATE -Wall -Werror)
33
45
target_compile_options (${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>" )
34
46
target_compile_definitions (${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>" )
35
47
endfunction ()
36
48
37
- set (FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR} /flutter" )
38
-
39
49
# Flutter library and tool build rules.
50
+ set (FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR} /flutter" )
40
51
add_subdirectory (${FLUTTER_MANAGED_DIR} )
41
52
42
53
# System-level dependencies.
@@ -45,16 +56,27 @@ pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
45
56
46
57
add_definitions (-DAPPLICATION_ID="${APPLICATION_ID} " )
47
58
48
- # Application build
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.
49
63
add_executable (${BINARY_NAME}
50
64
"main.cc"
51
65
"my_application.cc"
52
66
"${FLUTTER_MANAGED_DIR} /generated_plugin_registrant.cc"
53
67
)
68
+
69
+ # Apply the standard set of build settings. This can be removed for applications
70
+ # that need different build settings.
54
71
apply_standard_settings(${BINARY_NAME} )
72
+
73
+ # Add dependency libraries. Add any application-specific dependencies here.
55
74
target_link_libraries (${BINARY_NAME} PRIVATE flutter)
56
75
target_link_libraries (${BINARY_NAME} PRIVATE PkgConfig::GTK)
76
+
77
+ # Run the Flutter tool portions of the build. This must not be removed.
57
78
add_dependencies (${BINARY_NAME} flutter_assemble)
79
+
58
80
# Only the install-generated bundle's copy of the executable will launch
59
81
# correctly, since the resources must in the right relative locations. To avoid
60
82
# people trying to run the unbundled copy, put it in a subdirectory instead of
@@ -64,6 +86,7 @@ set_target_properties(${BINARY_NAME}
64
86
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /intermediates_do_not_run"
65
87
)
66
88
89
+
67
90
# Generated plugin build rules, which manage building the plugins and adding
68
91
# them to the application.
69
92
include (flutter/generated_plugins.cmake)
@@ -94,11 +117,17 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}
94
117
install (FILES "${FLUTTER_LIBRARY} " DESTINATION "${INSTALL_BUNDLE_LIB_DIR} "
95
118
COMPONENT Runtime)
96
119
97
- if ( PLUGIN_BUNDLED_LIBRARIES)
98
- install (FILES "${PLUGIN_BUNDLED_LIBRARIES } "
120
+ foreach (bundled_library ${ PLUGIN_BUNDLED_LIBRARIES} )
121
+ install (FILES "${bundled_library } "
99
122
DESTINATION "${INSTALL_BUNDLE_LIB_DIR} "
100
123
COMPONENT Runtime)
101
- endif ()
124
+ endforeach (bundled_library)
125
+
126
+ # Copy the native assets provided by the build.dart from all packages.
127
+ set (NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR} native_assets/linux/" )
128
+ install (DIRECTORY "${NATIVE_ASSETS_DIR} "
129
+ DESTINATION "${INSTALL_BUNDLE_LIB_DIR} "
130
+ COMPONENT Runtime)
102
131
103
132
# Fully re-copy the assets directory on each build to avoid having stale files
104
133
# from a previous install.
0 commit comments