creek
The AI Image Editor of 2030git clone https://github.com/maydayv7/creek
windows/flutter/CMakeLists.txt (3970B)
1# This file controls Flutter-level build steps. It should not be edited.
2cmake_minimum_required(VERSION 3.14)
3
4set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5
6# Configuration provided via flutter tool.
7include("${EPHEMERAL_DIR}/generated_config.cmake" OPTIONAL RESULT_VARIABLE _generated_config_included)
8if(NOT _generated_config_included)
9 message(STATUS "generated_config.cmake not found at ${EPHEMERAL_DIR}; run 'flutter pub get' or 'flutter build' to generate it.")
10endif()
11
12# TODO: Move the rest of this into files in ephemeral. See
13# https://github.com/flutter/flutter/issues/57146.
14set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
15
16# Set fallback configurations for older versions of the flutter tool.
17if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
18 set(FLUTTER_TARGET_PLATFORM "windows-x64")
19endif()
20
21# === Flutter Library ===
22set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
23
24# Published to parent scope for install step.
25set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
26set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
27set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
28set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
29
30list(APPEND FLUTTER_LIBRARY_HEADERS
31 "flutter_export.h"
32 "flutter_windows.h"
33 "flutter_messenger.h"
34 "flutter_plugin_registrar.h"
35 "flutter_texture_registrar.h"
36)
37list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
38add_library(flutter INTERFACE)
39target_include_directories(flutter INTERFACE
40 "${EPHEMERAL_DIR}"
41)
42target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
43add_dependencies(flutter flutter_assemble)
44
45# === Wrapper ===
46list(APPEND CPP_WRAPPER_SOURCES_CORE
47 "core_implementations.cc"
48 "standard_codec.cc"
49)
50list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
51list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
52 "plugin_registrar.cc"
53)
54list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
55list(APPEND CPP_WRAPPER_SOURCES_APP
56 "flutter_engine.cc"
57 "flutter_view_controller.cc"
58)
59list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
60
61# Wrapper sources needed for a plugin.
62add_library(flutter_wrapper_plugin STATIC
63 ${CPP_WRAPPER_SOURCES_CORE}
64 ${CPP_WRAPPER_SOURCES_PLUGIN}
65)
66apply_standard_settings(flutter_wrapper_plugin)
67set_target_properties(flutter_wrapper_plugin PROPERTIES
68 POSITION_INDEPENDENT_CODE ON)
69set_target_properties(flutter_wrapper_plugin PROPERTIES
70 CXX_VISIBILITY_PRESET hidden)
71target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
72target_include_directories(flutter_wrapper_plugin PUBLIC
73 "${WRAPPER_ROOT}/include"
74)
75add_dependencies(flutter_wrapper_plugin flutter_assemble)
76
77# Wrapper sources needed for the runner.
78add_library(flutter_wrapper_app STATIC
79 ${CPP_WRAPPER_SOURCES_CORE}
80 ${CPP_WRAPPER_SOURCES_APP}
81)
82apply_standard_settings(flutter_wrapper_app)
83target_link_libraries(flutter_wrapper_app PUBLIC flutter)
84target_include_directories(flutter_wrapper_app PUBLIC
85 "${WRAPPER_ROOT}/include"
86)
87add_dependencies(flutter_wrapper_app flutter_assemble)
88
89# === Flutter tool backend ===
90# _phony_ is a non-existent file to force this command to run every time,
91# since currently there's no way to get a full input/output list from the
92# flutter tool.
93set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
94set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
95add_custom_command(
96 OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
97 ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
98 ${CPP_WRAPPER_SOURCES_APP}
99 ${PHONY_OUTPUT}
100 COMMAND ${CMAKE_COMMAND} -E env
101 ${FLUTTER_TOOL_ENVIRONMENT}
102 "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
103 ${FLUTTER_TARGET_PLATFORM} $<CONFIG>
104 VERBATIM
105)
106add_custom_target(flutter_assemble DEPENDS
107 "${FLUTTER_LIBRARY}"
108 ${FLUTTER_LIBRARY_HEADERS}
109 ${CPP_WRAPPER_SOURCES_CORE}
110 ${CPP_WRAPPER_SOURCES_PLUGIN}
111 ${CPP_WRAPPER_SOURCES_APP}
112)