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.
This commit is contained in:
Renz Christian Bagaporo 2019-06-15 11:17:16 +08:00
parent 4397627b5b
commit 8424822150
4 changed files with 7 additions and 7 deletions

View file

@ -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(

View file

@ -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}

View file

@ -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.

View file

@ -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)