From 84248221509670c132e96289dd9061b970499f00 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Sat, 15 Jun 2019 11:17:16 +0800 Subject: [PATCH] cmake: set CONFIG_DIR build property Add CONFIG_DIR as a build property, so that components don't have to derive it from one of the generated config files. --- components/esp32/CMakeLists.txt | 3 +-- components/esp_wifi/CMakeLists.txt | 3 ++- tools/cmake/component.cmake | 7 +++---- tools/cmake/kconfig.cmake | 1 + 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index abcc0ada1..9d763b41b 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -70,8 +70,7 @@ else() #symbols in it. target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_panic_highint_hdl") - idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) - get_filename_component(config_dir ${sdkconfig_header} DIRECTORY) + idf_build_get_property(config_dir CONFIG_DIR) # Preprocess esp32.ld linker script to include configuration, becomes esp32_out.ld set(LD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ld) add_custom_command( diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index e4ba2db06..5349e905a 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -44,11 +44,12 @@ if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION) # To get the phy_init_data.bin file, compile phy_init_data.h as a C file and then objcopy # the object file to a raw binary + idf_build_get_property(config_dir CONFIG_DIR) add_custom_command( OUTPUT ${phy_init_data_bin} DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${idf_target}/include/phy_init_data.h COMMAND ${CMAKE_C_COMPILER} -x c -c - -I ${esp_common_dir}/include -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${build_dir}/config + -I ${esp_common_dir}/include -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${config_dir} -o phy_init_data.obj ${CMAKE_CURRENT_LIST_DIR}/${idf_target}/include/phy_init_data.h COMMAND ${CMAKE_OBJCOPY} -O binary phy_init_data.obj ${phy_init_data_bin} diff --git a/tools/cmake/component.cmake b/tools/cmake/component.cmake index 22b3528ec..39b45a738 100644 --- a/tools/cmake/component.cmake +++ b/tools/cmake/component.cmake @@ -427,8 +427,7 @@ function(idf_component_register) list(REMOVE_ITEM common_reqs ${component_lib}) link_libraries(${common_reqs}) - idf_build_get_property(sdkconfig_h SDKCONFIG_HEADER) - get_filename_component(sdkconfig_h ${sdkconfig_h} DIRECTORY) + idf_build_get_property(config_dir CONFIG_DIR) # The contents of 'sources' is from the __component_add_sources call if(sources OR __EMBED_FILES OR __EMBED_TXTFILES) @@ -436,14 +435,14 @@ function(idf_component_register) __component_set_property(${component_target} COMPONENT_TYPE LIBRARY) target_include_directories(${component_lib} PUBLIC ${__INCLUDE_DIRS}) target_include_directories(${component_lib} PRIVATE ${__PRIV_INCLUDE_DIRS}) - target_include_directories(${component_lib} PUBLIC ${sdkconfig_h}) + target_include_directories(${component_lib} PUBLIC ${config_dir}) set_target_properties(${component_lib} PROPERTIES OUTPUT_NAME ${COMPONENT_NAME}) __ldgen_add_component(${component_lib}) else() add_library(${component_lib} INTERFACE) __component_set_property(${component_target} COMPONENT_TYPE CONFIG_ONLY) target_include_directories(${component_lib} INTERFACE ${__INCLUDE_DIRS}) - target_include_directories(${component_lib} INTERFACE ${sdkconfig_h}) + target_include_directories(${component_lib} INTERFACE ${config_dir}) endif() # Alias the static/interface library created for linking to external targets. diff --git a/tools/cmake/kconfig.cmake b/tools/cmake/kconfig.cmake index 28be99371..08344e78d 100644 --- a/tools/cmake/kconfig.cmake +++ b/tools/cmake/kconfig.cmake @@ -189,6 +189,7 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults) idf_build_set_property(SDKCONFIG_JSON ${sdkconfig_json}) idf_build_set_property(SDKCONFIG_CMAKE ${sdkconfig_cmake}) idf_build_set_property(SDKCONFIG_JSON_MENUS ${sdkconfig_json_menus}) + idf_build_set_property(CONFIG_DIR ${config_dir}) idf_build_get_property(menuconfig_depends __MENUCONFIG_DEPENDS)