mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
cmake kconfig: Pass environment variables to confgen.py via a file
Works around "command line too long" errors when using Windows and CMake < 3.11 Closes IDF-711
This commit is contained in:
parent
0c8192f3be
commit
26db058339
@ -123,15 +123,19 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults)
|
||||
string(REPLACE ";" " " kconfigs "${kconfigs}")
|
||||
string(REPLACE ";" " " kconfig_projbuilds "${kconfig_projbuilds}")
|
||||
|
||||
# Place the long environment arguments into an input file
|
||||
# to work around command line length limits for execute_process
|
||||
# on Windows & CMake < 3.11
|
||||
configure_file(
|
||||
"${idf_path}/tools/kconfig_new/confgen.env.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/confgen.env")
|
||||
|
||||
set(confgen_basecommand
|
||||
${python} ${idf_path}/tools/kconfig_new/confgen.py
|
||||
--kconfig ${root_kconfig}
|
||||
--config ${sdkconfig}
|
||||
${defaults_arg}
|
||||
--env "COMPONENT_KCONFIGS=${kconfigs}"
|
||||
--env "COMPONENT_KCONFIGS_PROJBUILD=${kconfig_projbuilds}"
|
||||
--env "IDF_CMAKE=y"
|
||||
--env "IDF_TARGET=${idf_target}")
|
||||
--env-file "${CMAKE_CURRENT_BINARY_DIR}/confgen.env")
|
||||
|
||||
idf_build_get_property(build_dir BUILD_DIR)
|
||||
set(config_dir ${build_dir}/config)
|
||||
|
6
tools/kconfig_new/confgen.env.in
Normal file
6
tools/kconfig_new/confgen.env.in
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"COMPONENT_KCONFIGS": "${kconfigs}",
|
||||
"COMPONENT_KCONFIGS_PROJBUILD": "${kconfig_projbuilds}",
|
||||
"IDF_CMAKE": "y",
|
||||
"IDF_TARGET": "${idf_target}"
|
||||
}
|
@ -198,6 +198,10 @@ def main():
|
||||
parser.add_argument('--env', action='append', default=[],
|
||||
help='Environment to set when evaluating the config file', metavar='NAME=VAL')
|
||||
|
||||
parser.add_argument('--env-file', type=argparse.FileType('r'),
|
||||
help='Optional file to load environment variables from. Contents '
|
||||
'should be a JSON object where each key/value pair is a variable.')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
for fmt, filename in args.output:
|
||||
@ -214,6 +218,10 @@ def main():
|
||||
for name, value in args.env:
|
||||
os.environ[name] = value
|
||||
|
||||
if args.env_file is not None:
|
||||
env = json.load(args.env_file)
|
||||
os.environ.update(env)
|
||||
|
||||
config = kconfiglib.Kconfig(args.kconfig)
|
||||
config.disable_redun_warnings()
|
||||
config.disable_override_warnings()
|
||||
|
Loading…
x
Reference in New Issue
Block a user