The project root was set unconditionally as the variable ZEPHYR_BASE, but users developing a Zephyr application may wish to override the project root used by ECLAIR as the base directory of their projects, so that all paths processed by the tool are relative to that directory. - A new cmake variable ECLAIR_PROJECT_ROOT is introduced; - additional messages to output this information before the build starts. Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
39 lines
1.3 KiB
Plaintext
39 lines
1.3 KiB
Plaintext
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Copyright (c) 2024, Baumer (www.baumer.com)
|
|
|
|
# Everything before `--` are arguments for cmake invocation, those must be ignored.
|
|
# The first argument after `--` is the start of the compiler call, which is
|
|
# what we want to get to invoke ECLAIR with the compiler call which is used in the zephyr
|
|
# environment
|
|
foreach(i RANGE ${CMAKE_ARGC})
|
|
if("${CMAKE_ARGV${i}}" STREQUAL "--")
|
|
math(EXPR end_of_options "${i} + 1")
|
|
break()
|
|
endif()
|
|
endforeach()
|
|
|
|
foreach(i RANGE ${end_of_options} ${CMAKE_ARGC})
|
|
list(APPEND ZEPHYR_COMPILER_CALL ${CMAKE_ARGV${i}})
|
|
endforeach()
|
|
|
|
list(APPEND ECLAIR_ARGS +incremental
|
|
-project_name=@ECLAIR_PROJECT_NAME@
|
|
-project_root=@ECLAIR_PROJECT_ROOT@
|
|
-eval_file=@ECLAIR_ECL_DIR@/analysis.ecl
|
|
-eval_file=@ECLAIR_ANALYSIS_ECL_DIR@/analysis_@ECLAIR_RULESET@.ecl
|
|
@ECLAIR_ENV_ADDITIONAL_OPTIONS@)
|
|
|
|
execute_process(
|
|
COMMAND @CMAKE_COMMAND@ -E env
|
|
ECLAIR_DIAGNOSTICS_OUTPUT=@ECLAIR_DIAGNOSTICS_OUTPUT@
|
|
ECLAIR_DATA_DIR=@ECLAIR_ANALYSIS_DATA_DIR@
|
|
CC_ALIASES=@CC_ALIASES@
|
|
CXX_ALIASES=@CXX_ALIASES@
|
|
AS_ALIASES=@AS_ALIASES@
|
|
LD_ALIASES=@LD_ALIASES@
|
|
AR_ALIASES=@AR_ALIASES@
|
|
@ECLAIR_ENV@ ${ECLAIR_ARGS} -- ${ZEPHYR_COMPILER_CALL}
|
|
COMMAND_ERROR_IS_FATAL ANY
|
|
)
|