Skip to content

Commit b6b16a8

Browse files
committed
Cleanup
1 parent 99f8fff commit b6b16a8

File tree

3 files changed

+19
-36
lines changed

3 files changed

+19
-36
lines changed

cmake/docs/docs.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@
2323

2424
LINE_RE = re.compile(r"^#{1,4} ?")
2525

26+
# Directories to exclude from doc generation
2627
EXCLUDED = [
2728
"test",
2829
"googletest-download",
2930
]
31+
# CURRENT_DIR tracks which directory docs are currently being generated for
3032
CURRENT_DIR = Path(".")
31-
CURRENT_OFFSET = 0
3233

3334

3435
class DocState(enum.IntEnum):
@@ -68,7 +69,7 @@ def main():
6869

6970
def process_file(file_name, outdir):
7071
"""Process a file"""
71-
global CURRENT_DIR, CURRENT_OFFSET
72+
global CURRENT_DIR
7273
if any([Path(x) in Path(file_name).parents for x in EXCLUDED]):
7374
return
7475
# Read a line, and output it
@@ -83,17 +84,17 @@ def process_file(file_name, outdir):
8384
relative_fn = out_fn
8485
out_fn = os.path.join(outdir, out_fn)
8586
os.makedirs(os.path.dirname(out_fn), exist_ok=True)
86-
# Open both files, and loop over all the lines reading and writing each
87+
# If parent is not current dir, change CURRENT_DIR and print section header
88+
# This conveniently works because os.walk is depth first (used in main())
8789
if Path(file_name).parent != CURRENT_DIR:
8890
CURRENT_DIR = Path(file_name).parent
89-
CURRENT_OFFSET = len(Path(file_name).relative_to(CURRENT_DIR).parents)
90-
print(f"## {CURRENT_DIR}")
91-
print(" " * CURRENT_OFFSET, end="")
91+
print(f"### {CURRENT_DIR}")
9292
print(
9393
"- [{}](../api/cmake/{})".format(
94-
os.path.basename(out_fn).replace(".md", ""), relative_fn
94+
os.path.basename(out_fn).replace(".md", ""), relative_fn.lstrip("./")
9595
)
9696
)
97+
# Open both files, and loop over all the lines reading and writing each
9798
with open(file_name, "r") as in_file_handle:
9899
with open(out_fn, "w") as out_file_handle:
99100
state = DocState.SEARCH

docs/UsersGuide/cmake/Targets.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,9 @@ For projects generating GNU make files, these targets can be executed with the `
1414
## Built-In Targets
1515

1616
The CMake system supplies several targets that are useful for all projects and thus are included
17-
as part of the CMake system. These targets are described in more detail below.
17+
as part of the CMake system. These targets are described in the [index](cmake-api.md)
1818

19-
### `<MODULE>_coverage` Targets
20-
21-
The coverage target works on systems where the `gcov` executable is available on the executable
22-
search path and the `CMAKE_BUILD_TYPE` variable has been set to `TESTING`. If these two conditions
23-
are met, then the user can build both the `<MODULE>_coverage` targets to run unit tests and generate
24-
coverage reports for the specified module.
25-
26-
See: [coverage.md](coverage.md)
27-
28-
### `dict` Target
29-
30-
The target system is also used to produce dictionaries. These dictionaries can be created using the
31-
top-level `dict` target. Dictionaries do not make use of module-specific targets in terms of user
32-
interaction.
3319

3420
## Adding Custom Targets
3521

36-
See [support/Target.md](../support/Target.md) for a description of adding custom targets.
22+
See the [Customization Guide](Customization.md) for a description of adding custom targets.

docs/UsersGuide/cmake/cmake-api.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
## User API Documentation
22

3-
These links point to documentation needed by average users of the CMake system. The API link
3+
These links point to documentation needed by most users of the CMake system. The API link
44
describes the module-level API for working with CMake. This is where users should look for the full
55
descriptions of module-level functions. Options describe the runtime options that the CMake system
66
takes. Users wanting to alter the build should look here.
77

8-
- [Options](../api/cmake/Options.md): Runtime build options
98
- [API](../api/cmake/API.md): Module API function documentation
9+
- [Options](../api/cmake/Options.md): Runtime build options
1010

1111
## Toolchain and Platform Documentation
1212

@@ -21,10 +21,10 @@ own toolchains for F´.
2121
Platform files are used to set up F´ for use on specific hardware platforms. This allows users to
2222
define types and headers needed for F´ for any embedded system they desire.
2323

24-
[Platform Template](../api/cmake/platform/platform-template.md): Platform file template documentation
25-
[Linux](../api/cmake/platform/Linux.md): Linux platform support
26-
[Darwin](../api/cmake/platform/Darwin.md): Darwin (macOS) platform support
27-
[rtems5](../api/cmake/platform/rtems5.md): RTEMS 5 initial support
24+
[Platform Template](../api/cmake/platform/platform-template.md): Platform file template documentation
25+
[Linux](../api/cmake/platform/Linux.md): Linux platform support
26+
[Darwin](../api/cmake/platform/Darwin.md): Darwin (macOS) platform support
27+
[rtems5](../api/cmake/platform/rtems5.md): RTEMS 5 initial support
2828

2929
## Target Documentation
3030

@@ -33,11 +33,7 @@ generically integrated to support both module-level and global targets building
3333
F´ "target". For example, the "dict" target may build local dictionary fragments and then roll
3434
them into a global dictionary.
3535

36-
[Target](../api/cmake/support/Target.md): target subsystem documentation
37-
[dict](../api/cmake/target/dict.md): `dict` target documentation
38-
[impl](../api/cmake/target/impl.md): `impl` target documentation
39-
[testimpl](../api/cmake/target/testimpl.md): `testimpl` target documentation
40-
[coverage](../api/cmake/target/coverage.md): `coverage` target documentation
36+
[Target](./Targets.md): target subsystem documentation
4137

4238

4339
## CMake Support Code Documentation
@@ -46,9 +42,9 @@ These links describe the internal CMake function references. These should be con
4642
improvements to the CMake are needed. Build system architects should consult this section.
4743

4844

49-
[FPrime Code](../api/cmake/FPrime-Code.md): F´ framework code inclusions
45+
[FPrime-Code](../api/cmake/FPrime-Code.md): F´ framework code inclusions
5046
[FPrime](../api/cmake/FPrime.md): F´ project support
5147

5248

53-
## CMake Documentation Table of Contents
49+
## CMake Documentation Index
5450

0 commit comments

Comments
 (0)