@@ -2,8 +2,8 @@ How to specify global build defines and options
2
2
===============================================
3
3
4
4
To create global defines for a Sketch, create a file with a name based
5
- on your sketch’s file name followed by ``.globals.h `` in the Sketch folder.
6
- For example, if the main Sketch file is named
5
+ on your sketch’s file name followed by ``.globals.h `` in the Sketch
6
+ folder. For example, if the main Sketch file is named
7
7
``LowWatermark.ino ``, its global defines file would be
8
8
``LowWatermark.ino.globals.h ``. This file will be implicitly included
9
9
with every module built for your Sketch. Do not directly include it in
@@ -21,9 +21,10 @@ command option.
21
21
Actions taken in processing comment block to create ``build.opt `` \* for
22
22
each line, white space is trimmed \* blank lines are skipped \* lines
23
23
starting with ``* ``, ``// ``, or ``# `` are skipped \* the remaining
24
- results are written to build tree\ ``/core/build.opt `` \* ``build.opt ``
25
- is finished with a ``-include ... `` command, which references the global
26
- .h its contents were extracted from.
24
+ results are written to build tree\ ``/core/build.opt `` \* multiple
25
+ ``/*@create-file:build.opt@ `` ``*/ `` comment blocks are not allowed \*
26
+ ``build.opt `` is finished with a ``-include ... `` command, which
27
+ references the global .h its contents were extracted from.
27
28
28
29
Example Sketch: ``LowWatermark.ino ``
29
30
@@ -72,7 +73,7 @@ Global ``.h`` file: ``LowWatermark.ino.globals.h``
72
73
#endif
73
74
74
75
#if defined(__cplusplus)
75
- // Defines kept private to .cpp modules
76
+ // Defines kept private to .cpp and .ino modules
76
77
//#pragma message("__cplusplus has been seen")
77
78
#define MYTITLE2 "Empty"
78
79
#endif
@@ -93,14 +94,14 @@ Aggressive Caching of ``core.a``
93
94
94
95
Using global defines or compiler command-line options will lead to bad
95
96
builds when the **Aggressively cache compiled core ** feature is enabled.
96
- When ``#define `` changes require ``core.a `` to be recompiled, and
97
- multiple Sketches are open, they can no longer reliably share one cached
97
+ When ``#define `` changes require rebuilding ``core.a `` and multiple
98
+ Sketches are open, they can no longer reliably share one cached
98
99
``core.a ``. In a simple case: The 1st Sketch to be built has its version
99
100
of ``core.a `` cached. Other sketches will use this cached version for
100
101
their builds.
101
102
102
103
To turn this off, you need to find the location of ``preferences.txt ``.
103
- Using the Arduino IDE, go to *File->Preferences *. Make note of the path
104
+ From the Arduino IDE, go to *File->Preferences *. Make note of the path
104
105
to ``prefereces.txt ``. You cannot edit the file while the Arduino IDE is
105
106
running. Close all Arduino IDE windows and edit the file
106
107
``preferences.txt ``. Change ``compiler.cache_core=true `` to
@@ -113,11 +114,12 @@ Sketch that uses global defines.
113
114
Other build confusion
114
115
=====================
115
116
116
- 1. Renaming files does not change the last modified timestamp, possibly
117
- causing issues when replacing files by renaming and rebuilding. A good
117
+ 1. Renaming a file does not change the last modified timestamp, possibly
118
+ causing issues when adding a file by renaming and rebuilding. A good
118
119
example of this problem would be to have then fixed a typo in file
119
120
name ``LowWatermark.ino.globals.h ``. You need to touch (update
120
121
timestamp) the file so a “rebuild all” is performed.
122
+
121
123
2. When a ``.h `` file is renamed in the sketch folder, a copy of the old
122
124
file remains in the build sketch folder. This can create confusion if
123
125
you missed an edit in updating an ``#include `` in one or more of your
0 commit comments