123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- cmake_minimum_required(VERSION 3.5)
- include($ENV{IDF_PATH}/tools/cmake/project.cmake)
- set(PROJECT_VER $ENV{PROJECT_VER})
- add_definitions(-DMODEL_NAME=SqueezeESP32)
- if(NOT DEFINED DEPTH)
- set(DEPTH "16")
- endif()
- add_definitions(-DSTATE_MACHINE_LOGGER=1)
- add_definitions(-DHIERARCHICAL_STATES=1)
- function(build_size target_name)
- set(target_elf ${target_name}.elf)
- set(target_map ${target_name}.map)
- set(idf_size ${python} ${IDF_PATH}/tools/idf_size.py)
-
- if(DEFINED OUTPUT_JSON AND OUTPUT_JSON)
- list(APPEND idf_size "--json")
- endif()
-
- add_custom_target(size-${target_name} ALL
- DEPENDS ${target_elf}
- COMMAND ${idf_size} ${target_map} -o "size-${target_name}"
- )
- add_custom_target(size-files-${target_name} ALL
- DEPENDS ${target_elf}
- COMMAND ${idf_size} --files ${target_map}
- )
- add_custom_target(size-components-${target_name} ALL
- DEPENDS ${target_elf}
- COMMAND ${idf_size} --archives ${target_map}
- )
- endfunction()
- set(EXTRA_COMPONENT_DIRS components/platform_console/app_recovery components/platform_console/app_squeezelite )
- project(recovery)
- add_custom_command(
- TARGET recovery.elf
- PRE_LINK
- COMMAND xtensa-esp32-elf-objcopy --weaken-symbol esp_app_desc ${BUILD_DIR}/esp-idf/app_update/libapp_update.a
- VERBATIM
- )
- get_target_property(BCA recovery.elf LINK_LIBRARIES)
- list(REMOVE_ITEM BCA "idf::app_squeezelite" "idf::app_recovery" "-Wl,--Map=${BUILD_DIR}/recovery.map")
- set_target_properties(recovery.elf PROPERTIES LINK_LIBRARIES "${BCA};idf::app_recovery;-Wl,--Map=${BUILD_DIR}/recovery.map")
- add_executable(squeezelite.elf "CMakeLists.txt")
- add_dependencies(squeezelite.elf recovery.elf)
- set_target_properties(squeezelite.elf PROPERTIES LINK_LIBRARIES "${BCA};idf::app_squeezelite;-Wl,--Map=${BUILD_DIR}/squeezelite.map")
- add_custom_command(
- TARGET squeezelite.elf
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E echo "Generating ${BUILD_DIR}/squeezelite.bin"
- COMMAND ${ESPTOOLPY} elf2image ${ESPTOOLPY_FLASH_OPTIONS} ${ESPTOOLPY_ELF2IMAGE_OPTIONS} -o "squeezelite.bin" "squeezelite.elf"
- VERBATIM
- )
-
- set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- APPEND PROPERTY
- ADDITIONAL_MAKE_CLEAN_FILES "${BUILD_DIR}/squeezelite.elf" "${BUILD_DIR}/squeezelite.map"
- )
- partition_table_get_partition_info(otaapp_offset "--partition-type app --partition-subtype ota_0" "offset")
- idf_component_get_property(main_args esptool_py FLASH_ARGS)
- idf_component_get_property(sub_args esptool_py FLASH_SUB_ARGS)
- esptool_py_flash_target(squeezelite-flash "${main_args}" "${sub_args}")
- esptool_py_flash_target_image(squeezelite-flash squeezelite "${otaapp_offset}" "${BUILD_DIR}/squeezelite.bin")
- esptool_py_flash_target_image(flash squeezelite "${otaapp_offset}" "${BUILD_DIR}/squeezelite.bin")
- add_custom_target(_jtag_scripts ALL
- BYPRODUCTS "flash_dbg_project_args"
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_SOURCE_DIR}/generate_debug_scripts.cmake"
- )
- if(CMAKE_HOST_UNIX)
-
- add_custom_target(set_cspot_permissions
- COMMAND ${CMAKE_COMMAND} -E echo "************************************************************************************************"
- COMMAND ${CMAKE_COMMAND} -E echo "**** Setting permissions for required files"
- COMMAND ${CMAKE_COMMAND} -E echo "**** ${CMAKE_SOURCE_DIR}/components/spotify/cspot/bell/external/nanopb/generator/protoc-gen-nanopb"
- COMMAND ${CMAKE_COMMAND} -E echo "**** ${CMAKE_SOURCE_DIR}/components/spotify/cspot/bell/external/nanopb/generator/*.py"
- COMMAND ${CMAKE_COMMAND} -E echo "**** ${CMAKE_SOURCE_DIR}/components/spotify/cspot/bell/external/nanopb/generator/*.py2"
- COMMAND ${CMAKE_COMMAND} -E echo "**** ${CMAKE_SOURCE_DIR}/components/spotify/cspot/bell/external/nanopb/generator/proto/*.py"
- COMMAND ${CMAKE_COMMAND} -E echo "**** ${CMAKE_SOURCE_DIR}/components/spotify/cspot/bell/external/nanopb/generator/protoc"
- COMMAND chmod +x ${CMAKE_SOURCE_DIR}/components/spotify/cspot/bell/external/nanopb/generator/protoc-gen-nanopb
- COMMAND chmod +x ${CMAKE_SOURCE_DIR}/components/spotify/cspot/bell/external/nanopb/generator/*.py
- COMMAND chmod +x ${CMAKE_SOURCE_DIR}/components/spotify/cspot/bell/external/nanopb/generator/*.py2
- COMMAND chmod +x ${CMAKE_SOURCE_DIR}/components/spotify/cspot/bell/external/nanopb/generator/proto/*.py
- COMMAND chmod +x ${CMAKE_SOURCE_DIR}/components/spotify/cspot/bell/external/nanopb/generator/protoc
- COMMAND ${CMAKE_COMMAND} -E echo "************************************************************************************************"
- )
-
- add_dependencies(__idf_spotify set_cspot_permissions)
- endif()
|