Skip to content

Commit

Permalink
ESP32: Optimize the temperature-measurement-app for CMake (#6397)
Browse files Browse the repository at this point in the history
  • Loading branch information
sweetymhaiske authored and pull[bot] committed Jun 13, 2021
1 parent 8986153 commit 0043236
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,19 @@ macro(chip_gn_arg_append arg val)
string(APPEND chip_gn_args "${arg} = ${val}\n")
endmacro()

macro(chip_gn_arg_bool arg boolean)
if (${boolean})
string(APPEND chip_gn_args "${arg} = true\n")
else()
string(APPEND chip_gn_args "${arg} = false\n")
endif()
endmacro()

chip_gn_arg_append("esp32_ar" "\"${CMAKE_AR}\"")
chip_gn_arg_append("esp32_cc" "\"${CMAKE_C_COMPILER}\"")
chip_gn_arg_append("esp32_cxx" "\"${CMAKE_CXX_COMPILER}\"")
chip_gn_arg_append("esp32_cpu" "\"esp32\"")
chip_gn_arg_bool("is_debug" is_debug)

if(CONFIG_ENABLE_PW_RPC)
chip_gn_arg_append("chip_build_pw_rpc_lib" "true")
Expand Down
6 changes: 6 additions & 0 deletions examples/temperature-measurement-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

set(is_debug true CACHE BOOL "Optimization variable")
if(NOT is_debug)
set(SDKCONFIG_DEFAULTS "sdkconfig.optimize.defaults")
endif()

include($ENV{IDF_PATH}/tools/cmake/project.cmake)

# The list of extra component dirs must be in sync with that in temperature-measurement-app/esp32/Makefile
Expand Down
2 changes: 1 addition & 1 deletion examples/temperature-measurement-app/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,5 @@ Optimization related to WiFi, BLuetooth, Asserts etc are the part of this
example by default. To enable this option set is_debug=false from command-line.

```
idf make build flash monitor 'is_debug=false'
idf.py -Dis_debug=false build flash monitor
```

0 comments on commit 0043236

Please sign in to comment.