|
27 | 27 | FRAMEWORK_DIR = platform.get_package_dir("framework-arduinopico") |
28 | 28 | assert os.path.isdir(FRAMEWORK_DIR) |
29 | 29 |
|
| 30 | +# read includes from this file to add them into CPPPATH later |
| 31 | +includes_file = os.path.join(FRAMEWORK_DIR, "lib", "platform_inc.txt") |
| 32 | +file_lines = [] |
| 33 | +includes = [] |
| 34 | +with open(includes_file, "r") as fp: |
| 35 | + file_lines = fp.readlines() |
| 36 | +for l in file_lines: |
| 37 | + path = l.strip().replace("-iwithprefixbefore/", "").replace("/", os.sep) |
| 38 | + # emulate -iprefix <framework path>. |
| 39 | + path = os.path.join(FRAMEWORK_DIR, path) |
| 40 | + # prevent non-existent paths from being added |
| 41 | + # looking at you here, pico-extras/src/common/pico_audio and co. |
| 42 | + if os.path.isdir(path): |
| 43 | + includes.append(path) |
| 44 | + |
30 | 45 | # update progsize expression to also check for bootloader. |
31 | 46 | env.Replace( |
32 | 47 | SIZEPROGREGEXP=r"^(?:\.boot2|\.text|\.data|\.rodata|\.text.align|\.ARM.exidx)\s+(\d+).*" |
|
42 | 57 | "-mthumb", |
43 | 58 | "-ffunction-sections", |
44 | 59 | "-fdata-sections", |
45 | | - "-iprefix" + os.path.join(FRAMEWORK_DIR), |
46 | | - "@%s" % os.path.join(FRAMEWORK_DIR, "lib", "platform_inc.txt") |
| 60 | + # use explicit include (-I) paths, otherwise it's |
| 61 | + # not visible in the IDE's intellisense. |
| 62 | + #"-iprefix" + os.path.join(FRAMEWORK_DIR), |
| 63 | + #"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "platform_inc.txt") |
47 | 64 | ], |
48 | 65 |
|
49 | 66 | CFLAGS=[ |
|
98 | 115 | File(os.path.join(FRAMEWORK_DIR, "lib", "libpico.a")), |
99 | 116 | "m", "c", "stdc++", "c"] |
100 | 117 | ) |
101 | | - |
| 118 | +# expand with read includes |
| 119 | +env.Append(CPPPATH=includes) |
102 | 120 |
|
103 | 121 | def configure_usb_flags(cpp_defines): |
104 | 122 | global ram_size |
|
0 commit comments