CMakeLists.txt 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. set( WEBPACK_DIR webapp/webpack/dist )
  2. # for the forgetful, REQUIRES cannot use CONFIG_XXX due to parsing order
  3. if(IDF_TARGET STREQUAL "esp32")
  4. set(target_requires "driver_bt")
  5. endif()
  6. idf_component_register( SRC_DIRS . UML-State-Machine-in-C/src
  7. INCLUDE_DIRS . UML-State-Machine-in-C/src
  8. REQUIRES squeezelite-ota json mdns
  9. PRIV_REQUIRES tools services platform_config esp_common json newlib freertos spi_flash nvs_flash mdns pthread wpa_supplicant platform_console esp_http_server console ${target_requires}
  10. )
  11. # Define the source and destination directories
  12. set(WEBAPP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/webapp/dist")
  13. set(WEBAPP_DEST_DIR "${CMAKE_SOURCE_DIR}/spiffs/www")
  14. # Collect all .gz and .png files in the source directory
  15. file(GLOB_RECURSE WEBAPP_FILES
  16. "${WEBAPP_SOURCE_DIR}/*.gz"
  17. "${WEBAPP_SOURCE_DIR}/*.png")
  18. # # Custom command to copy files, preserving the directory structure
  19. # foreach(FILE_PATH ${WEBAPP_FILES})
  20. # # Get the relative path from the source directory
  21. # file(RELATIVE_PATH REL_PATH "${WEBAPP_SOURCE_DIR}" "${FILE_PATH}")
  22. # # Compute the destination file path
  23. # set(DEST_PATH "${WEBAPP_DEST_DIR}/${REL_PATH}")
  24. # # Create a custom command to copy each file
  25. # add_custom_command(
  26. # OUTPUT "${DEST_PATH}"
  27. # COMMAND ${CMAKE_COMMAND} -E copy "${FILE_PATH}" "${DEST_PATH}"
  28. # DEPENDS "${FILE_PATH}"
  29. # )
  30. # # Add the destination path to a list of outputs
  31. # list(APPEND WEBAPP_OUTPUT_FILES "${DEST_PATH}")
  32. # endforeach()
  33. # # Custom target that depends on all copied files
  34. # add_custom_target(copy_webapp DEPENDS ${WEBAPP_OUTPUT_FILES} )
  35. # # Ensure the destination directory exists
  36. # add_custom_command(TARGET copy_webapp PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${WEBAPP_DEST_DIR}" )
  37. # add_dependencies(${COMPONENT_LIB} copy_webapp)