Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 3.5KB

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