Browse Source

Use #include for single source build (#2267)

* [1/2] use #include for single source

* [2/2] use #include for single source
mcspr-patch-1
Max Prokhorov 4 years ago
committed by GitHub
parent
commit
cb8443dfa3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions
  1. +2
    -3
      code/scripts/espurna_utils/release.py
  2. +1
    -1
      code/scripts/pio_pre.py

+ 2
- 3
code/scripts/espurna_utils/release.py View File

@ -39,9 +39,8 @@ def merge_cpp(sources, output):
tmp.write(b"// !!! Automatically generated file; DO NOT EDIT !!! \n") tmp.write(b"// !!! Automatically generated file; DO NOT EDIT !!! \n")
tmp.write(b'#include "espurna.h"\n') tmp.write(b'#include "espurna.h"\n')
for source in sources: for source in sources:
with open(source, "rb") as fobj:
tmp.write('# 1 "{}"\n'.format(source.replace("\\", "/")).encode('utf-8'));
shutil.copyfileobj(fobj, tmp)
src_include = '#include "{}"\n'.format(source)
tmp.write(src_include.encode('utf-8'))
tmp.seek(0) tmp.seek(0)


+ 1
- 1
code/scripts/pio_pre.py View File

@ -156,7 +156,7 @@ if os.environ.get("ESPURNA_BUILD_SINGLE_SOURCE"):
for name in filenames: for name in filenames:
if not name.endswith(".cpp"): if not name.endswith(".cpp"):
continue continue
path = os.path.join(root, name)
path = os.path.relpath(os.path.join(root, name), "espurna")
env.AddBuildMiddleware(lambda node: None, "*?/{}".format(path)) env.AddBuildMiddleware(lambda node: None, "*?/{}".format(path))
cpp_files.append(path) cpp_files.append(path)
merge_cpp(cpp_files, "espurna/espurna_single_source.cpp") merge_cpp(cpp_files, "espurna/espurna_single_source.cpp")

Loading…
Cancel
Save