mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-22 08:07:06 +01:00
pio: even shorter suffix for .ipp files
remove .cpp from the resulting suffix, since .ipp already implies it is c++ update comments once again
This commit is contained in:
@@ -76,35 +76,27 @@ def app_add_target_build_and_copy(env):
|
||||
env.Alias("build-and-copy", target)
|
||||
|
||||
|
||||
# TODO: *could* be a Builder object, just the same it will detect targets via src_suffix & suffix properties
|
||||
# but, notice that:
|
||||
# - constantly re-generating files in $project_dir only useful in development, as we need already
|
||||
# 'compiled' .re.cpp.ipp in the source at commit time
|
||||
# - .cpp.re.ipp <-> .re dependency will be injected into the scons database of the *environment*,
|
||||
# which may accidentally cause a rebuild when using 2 envs at the same time
|
||||
# - .cpp file `#include`ing the .ipp file may be built before the file is actually generated by the re2c
|
||||
# (or, it may happen in a parallel job)
|
||||
# scons has a C source scanner that is tracking `#include` directives. but, file may *already* exist before the
|
||||
# scanning phase even starts and it may be assumed something static during the build
|
||||
# (since most include directives are for the system, sdk, and the build-tree headers)
|
||||
# NOTICE that .re <-> .re.ipp dependency is tricky, b/c we want these to exist *before* any source is built
|
||||
# (or, attempted to be built. `projenv` does not exist yet, and so there are no dependecies generated)
|
||||
|
||||
|
||||
def app_add_target_build_re2c(env):
|
||||
from SCons.Script import COMMAND_LINE_TARGETS
|
||||
|
||||
targets = [
|
||||
env.File(target) for target in COMMAND_LINE_TARGETS if ".re.cpp.ipp" in target
|
||||
]
|
||||
cmd = "re2c --no-generation-date --case-ranges -W -Werror -o {} {}"
|
||||
targets = []
|
||||
|
||||
for target in COMMAND_LINE_TARGETS:
|
||||
if target.endswith(".re.ipp"):
|
||||
targets.append(target)
|
||||
|
||||
if targets:
|
||||
sources = [
|
||||
target.File("{}".format(target.name.replace(".cpp.ipp", "")))
|
||||
for target in targets
|
||||
]
|
||||
for target, source in zip(targets, sources):
|
||||
env.Execute(
|
||||
env.VerboseAction(
|
||||
cmd.format(target, source), "Generating {}".format(target.name)
|
||||
)
|
||||
action = env.VerboseAction(
|
||||
"re2c --no-generation-date --case-ranges -W -Werror -o $TARGET $SOURCE",
|
||||
"Generating $TARGET",
|
||||
)
|
||||
|
||||
for target in targets:
|
||||
action(
|
||||
[env.File(target)], [env.File(target.replace(".re.ipp", ".re"))], env
|
||||
)
|
||||
env.Exit(0)
|
||||
|
||||
Reference in New Issue
Block a user