cmake: make use of ccache opt-in
This commit is contained in:
parent
39a5fbdfee
commit
72a5762525
3 changed files with 23 additions and 11 deletions
|
@ -428,11 +428,14 @@ endmenu\n" >> ${IDF_PATH}/Kconfig;
|
||||||
print_status "Confserver can be invoked by idf.py"
|
print_status "Confserver can be invoked by idf.py"
|
||||||
echo '{"version": 1}' | idf.py confserver || failure "Couldn't load confserver"
|
echo '{"version": 1}' | idf.py confserver || failure "Couldn't load confserver"
|
||||||
|
|
||||||
print_status "Check ccache is used to build when present"
|
print_status "Check ccache is used to build"
|
||||||
touch ccache && chmod +x ccache # make sure that ccache is present for this test
|
touch ccache && chmod +x ccache # make sure that ccache is present for this test
|
||||||
(export PATH=$PWD:$PATH && idf.py reconfigure | grep "ccache will be used for faster builds") || failure "ccache should be used when present"
|
(export PATH=$PWD:$PATH && idf.py --ccache reconfigure | grep "ccache will be used for faster builds") || failure "ccache should be used when --cache is specified"
|
||||||
|
idf.py fullclean
|
||||||
|
(export PATH=$PWD:$PATH && idf.py reconfigure| grep -c "ccache will be used for faster builds" | grep -wq 0) \
|
||||||
|
|| failure "ccache should not be used even when present if --ccache is not specified"
|
||||||
(export PATH=$PWD:$PATH && idf.py --no-ccache reconfigure| grep -c "ccache will be used for faster builds" | grep -wq 0) \
|
(export PATH=$PWD:$PATH && idf.py --no-ccache reconfigure| grep -c "ccache will be used for faster builds" | grep -wq 0) \
|
||||||
|| failure "ccache should not be used even when present if --no-ccache is specified"
|
|| failure "--no-ccache causes no issue for backward compatibility"
|
||||||
rm -f ccache
|
rm -f ccache
|
||||||
|
|
||||||
print_status "Custom bootloader overrides original"
|
print_status "Custom bootloader overrides original"
|
||||||
|
|
|
@ -244,12 +244,13 @@ macro(project project_name)
|
||||||
|
|
||||||
__target_set_toolchain()
|
__target_set_toolchain()
|
||||||
|
|
||||||
# Enable ccache if it's on the path
|
if(CCACHE_ENABLE)
|
||||||
if(NOT CCACHE_DISABLE)
|
|
||||||
find_program(CCACHE_FOUND ccache)
|
find_program(CCACHE_FOUND ccache)
|
||||||
if(CCACHE_FOUND)
|
if(CCACHE_FOUND)
|
||||||
message(STATUS "ccache will be used for faster builds")
|
message(STATUS "ccache will be used for faster builds")
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
||||||
|
else()
|
||||||
|
message(WARNING "enabled ccache in build but ccache program not found")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
18
tools/idf.py
18
tools/idf.py
|
@ -235,8 +235,8 @@ def _ensure_build_directory(args, always_run_cmake=False):
|
||||||
]
|
]
|
||||||
if not args.no_warnings:
|
if not args.no_warnings:
|
||||||
cmake_args += ["--warn-uninitialized"]
|
cmake_args += ["--warn-uninitialized"]
|
||||||
if args.no_ccache:
|
if args.ccache:
|
||||||
cmake_args += ["-DCCACHE_DISABLE=1"]
|
cmake_args += ["-DCCACHE_ENABLE=1"]
|
||||||
if args.define_cache_entry:
|
if args.define_cache_entry:
|
||||||
cmake_args += ["-D" + d for d in args.define_cache_entry]
|
cmake_args += ["-D" + d for d in args.define_cache_entry]
|
||||||
cmake_args += [project_dir]
|
cmake_args += [project_dir]
|
||||||
|
@ -305,7 +305,7 @@ def build_target(target_name, ctx, args):
|
||||||
_ensure_build_directory(args)
|
_ensure_build_directory(args)
|
||||||
generator_cmd = GENERATOR_CMDS[args.generator]
|
generator_cmd = GENERATOR_CMDS[args.generator]
|
||||||
|
|
||||||
if not args.no_ccache:
|
if args.ccache:
|
||||||
# Setting CCACHE_BASEDIR & CCACHE_NO_HASHDIR ensures that project paths aren't stored in the ccache entries
|
# Setting CCACHE_BASEDIR & CCACHE_NO_HASHDIR ensures that project paths aren't stored in the ccache entries
|
||||||
# (this means ccache hits can be shared between different projects. It may mean that some debug information
|
# (this means ccache hits can be shared between different projects. It may mean that some debug information
|
||||||
# will point to files in another project, if these files are perfect duplicates of each other.)
|
# will point to files in another project, if these files are perfect duplicates of each other.)
|
||||||
|
@ -960,11 +960,19 @@ def init_cli():
|
||||||
"default": False,
|
"default": False,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"names": ["--no-ccache"],
|
"names": ["--ccache"],
|
||||||
"help": "Disable ccache. Otherwise, if ccache is available on the PATH then it will be used for faster builds.",
|
"help": "Use ccache in build",
|
||||||
"is_flag": True,
|
"is_flag": True,
|
||||||
"default": False,
|
"default": False,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
# This is unused/ignored argument, as ccache use was originally opt-out.
|
||||||
|
# Use of ccache has been made opt-in using --cache arg.
|
||||||
|
"names": ["--no-ccache"],
|
||||||
|
"default": True,
|
||||||
|
"is_flag": True,
|
||||||
|
"hidden": True,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"names": ["-G", "--generator"],
|
"names": ["-G", "--generator"],
|
||||||
"help": "CMake generator.",
|
"help": "CMake generator.",
|
||||||
|
|
Loading…
Reference in a new issue