2019-04-26 05:42:10 +00:00
|
|
|
get_property(__idf_env_set GLOBAL PROPERTY __IDF_ENV_SET)
|
|
|
|
if(NOT __idf_env_set)
|
|
|
|
# Infer an IDF_PATH relative to the tools/cmake directory
|
2019-09-18 07:54:10 +00:00
|
|
|
get_filename_component(_idf_path "${CMAKE_CURRENT_LIST_DIR}/../.." REALPATH)
|
2019-04-26 05:42:10 +00:00
|
|
|
file(TO_CMAKE_PATH "${_idf_path}" _idf_path)
|
|
|
|
|
|
|
|
# Get the path set in environment
|
|
|
|
set(idf_path $ENV{IDF_PATH})
|
|
|
|
|
|
|
|
# Environment IDF_PATH should match the inferred IDF_PATH. If not, warn the user.
|
2019-09-18 07:54:10 +00:00
|
|
|
# (Note: REALPATH is needed in both above steps to account for case on case
|
|
|
|
# insensitive filesystems, or relative paths)
|
2019-04-26 05:42:10 +00:00
|
|
|
if(idf_path)
|
2019-09-18 07:54:10 +00:00
|
|
|
get_filename_component(idf_path "${idf_path}" REALPATH)
|
|
|
|
file(TO_CMAKE_PATH "${idf_path}" idf_path)
|
|
|
|
|
2019-04-26 05:42:10 +00:00
|
|
|
if(NOT idf_path STREQUAL _idf_path)
|
|
|
|
message(WARNING "IDF_PATH environment variable is different from inferred IDF_PATH.
|
|
|
|
Check if your project's top-level CMakeLists.txt includes the right
|
2019-09-18 07:54:10 +00:00
|
|
|
CMake files. Environment IDF_PATH will be used for the build:
|
|
|
|
${idf_path}")
|
2019-04-26 05:42:10 +00:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(WARNING "IDF_PATH environment variable not found. Setting IDF_PATH to '${_idf_path}'.")
|
|
|
|
set(idf_path ${_idf_path})
|
|
|
|
set(ENV{IDF_PATH} ${_idf_path})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Include other CMake modules required
|
|
|
|
set(CMAKE_MODULE_PATH
|
|
|
|
"${idf_path}/tools/cmake"
|
|
|
|
"${idf_path}/tools/cmake/third_party"
|
|
|
|
${CMAKE_MODULE_PATH})
|
|
|
|
include(build)
|
|
|
|
|
|
|
|
set(IDF_PATH ${idf_path})
|
|
|
|
|
|
|
|
include(GetGitRevisionDescription)
|
2022-06-03 13:28:31 +00:00
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
include(CheckCXXCompilerFlag)
|
2019-04-26 05:42:10 +00:00
|
|
|
include(git_submodules)
|
2022-08-31 20:59:15 +00:00
|
|
|
include(tool_version_check)
|
2019-04-26 05:42:10 +00:00
|
|
|
include(kconfig)
|
|
|
|
include(component)
|
|
|
|
include(utilities)
|
2021-12-01 22:00:01 +00:00
|
|
|
include(depgraph)
|
2019-04-26 05:42:10 +00:00
|
|
|
include(targets)
|
|
|
|
include(ldgen)
|
2020-04-06 14:41:44 +00:00
|
|
|
include(dfu)
|
2020-12-11 15:28:11 +00:00
|
|
|
include(uf2)
|
2019-03-22 04:40:12 +00:00
|
|
|
include(version)
|
2019-04-26 05:42:10 +00:00
|
|
|
|
|
|
|
__build_init("${idf_path}")
|
|
|
|
|
2021-08-19 06:54:11 +00:00
|
|
|
# Check if IDF_ENV_FPGA environment is set
|
|
|
|
set(env_idf_env_fpga $ENV{IDF_ENV_FPGA})
|
|
|
|
if(${env_idf_env_fpga})
|
|
|
|
idf_build_set_property(__IDF_ENV_FPGA "y")
|
|
|
|
message(NOTICE "IDF_ENV_FPGA is set, building for FPGA environment")
|
|
|
|
endif()
|
|
|
|
|
2019-04-26 05:42:10 +00:00
|
|
|
set_property(GLOBAL PROPERTY __IDF_ENV_SET 1)
|
2019-09-18 07:54:10 +00:00
|
|
|
endif()
|