Skip to content

Commit 1112481

Browse files
Merge pull request #3794 from raspberrypi/sdk-toolchain-updates
Improved adoc compilation process
2 parents f884e48 + 1567084 commit 1112481

16 files changed

+409
-893
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
python-version: 3.9
3030
- name: Install Python dependencies
3131
uses: py-actions/py-dependency-install@v4
32+
- name: Install Python libs
33+
run: pip3 install -r ./requirements.txt
3234
- uses: ruby/setup-ruby@v1
3335
with:
3436
ruby-version: 3.2

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@
66
path = lib/pico-examples
77
url = https://github.com/raspberrypi/pico-examples.git
88
branch = master
9+
10+
[submodule "doxygentoasciidoc"]
11+
path = doxygentoasciidoc
12+
url = https://github.com/raspberrypi/doxygentoasciidoc.git

Makefile

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ PICO_SDK_DIR = lib/pico-sdk
1818
PICO_EXAMPLES_DIR = lib/pico-examples
1919
ALL_SUBMODULE_CMAKELISTS = $(PICO_SDK_DIR)/CMakeLists.txt $(PICO_EXAMPLES_DIR)/CMakeLists.txt
2020
DOXYGEN_PICO_SDK_BUILD_DIR = build-pico-sdk-docs
21-
DOXYGEN_HTML_DIR = $(DOXYGEN_PICO_SDK_BUILD_DIR)/docs/doxygen/html
21+
DOXYGEN_XML_DIR = $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined/docs/doxygen/xml
2222
# The pico-sdk here needs to match up with the "from_json" entry in index.json
2323
ASCIIDOC_DOXYGEN_DIR = $(ASCIIDOC_DIR)/pico-sdk
2424

@@ -50,33 +50,42 @@ $(PICO_SDK_DIR)/CMakeLists.txt $(PICO_SDK_DIR)/docs/index.h: | $(PICO_SDK_DIR)
5050
$(PICO_EXAMPLES_DIR)/CMakeLists.txt: | $(PICO_SDK_DIR)/CMakeLists.txt $(PICO_EXAMPLES_DIR)
5151
git submodule update --init $(PICO_EXAMPLES_DIR)
5252

53+
# Initialise doxygentoasciidoc submodule
54+
doxygentoasciidoc/__main__.py:
55+
git submodule update --init doxygentoasciidoc
56+
5357
fetch_submodules: $(ALL_SUBMODULE_CMAKELISTS)
5458

5559
# Get rid of the submodules
5660
clean_submodules:
5761
git submodule deinit --all
5862

59-
# Create the pico-sdk Doxygen HTML files
60-
$(DOXYGEN_HTML_DIR): | $(ALL_SUBMODULE_CMAKELISTS) $(DOXYGEN_PICO_SDK_BUILD_DIR)
61-
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR) -DPICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR)
62-
$(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR) docs
63-
test -d "$@"
63+
# Create the pico-sdk Doxygen XML files
64+
$(DOXYGEN_XML_DIR) $(DOXYGEN_XML_DIR)/index.xml: | $(ALL_SUBMODULE_CMAKELISTS) $(DOXYGEN_PICO_SDK_BUILD_DIR)
65+
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=combined-docs
66+
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2040
67+
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2350
68+
$(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined docs
69+
$(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 docs
70+
$(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 docs
71+
python3 $(SCRIPTS_DIR)/postprocess_doxygen_xml.py $(DOXYGEN_PICO_SDK_BUILD_DIR)
6472

65-
$(DOXYGEN_PICO_SDK_BUILD_DIR)/docs/Doxyfile: | $(DOXYGEN_HTML_DIR)
73+
$(DOXYGEN_PICO_SDK_BUILD_DIR)/combined/docs/Doxyfile: | $(DOXYGEN_XML_DIR)
6674

67-
build_doxygen_html: | $(DOXYGEN_HTML_DIR)
75+
build_doxygen_xml: | $(DOXYGEN_XML_DIR)
6876

6977
# Clean all the Doxygen HTML files
70-
clean_doxygen_html:
78+
clean_doxygen_xml:
7179
rm -rf $(DOXYGEN_PICO_SDK_BUILD_DIR)
7280

73-
# Create the Doxygen asciidoc files
74-
# Also need to move index.adoc to a different name, because it conflicts with the autogenerated index.adoc
75-
$(ASCIIDOC_DOXYGEN_DIR)/picosdk_index.json $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc: $(SCRIPTS_DIR)/transform_doxygen_html.py $(PICO_SDK_DIR)/docs/index.h $(DOXYGEN_PICO_SDK_BUILD_DIR)/docs/Doxyfile | $(DOXYGEN_HTML_DIR) $(ASCIIDOC_DOXYGEN_DIR)
81+
# create the sdk adoc and the json file
82+
$(ASCIIDOC_DOXYGEN_DIR)/picosdk_index.json $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc: $(ASCIIDOC_DOXYGEN_DIR) $(DOXYGEN_XML_DIR)/index.xml doxygentoasciidoc/__main__.py doxygentoasciidoc/cli.py doxygentoasciidoc/nodes.py doxygentoasciidoc/helpers.py | $(BUILD_DIR)
7683
$(MAKE) clean_ninja
77-
$< $(DOXYGEN_HTML_DIR) $(ASCIIDOC_DOXYGEN_DIR) $(PICO_SDK_DIR)/docs/index.h $(ASCIIDOC_DOXYGEN_DIR)/picosdk_index.json
78-
cp $(DOXYGEN_HTML_DIR)/*.png $(ASCIIDOC_DOXYGEN_DIR)
79-
mv $(ASCIIDOC_DOXYGEN_DIR)/index.adoc $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc
84+
python3 -m doxygentoasciidoc -f $(DOXYGEN_XML_DIR)/index.xml > $(ASCIIDOC_DOXYGEN_DIR)/all_groups.adoc
85+
python3 -m doxygentoasciidoc -f $(DOXYGEN_XML_DIR)/indexpage.xml -c > $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc
86+
python3 -m doxygentoasciidoc -f $(DOXYGEN_XML_DIR)/examples_page.xml -c > $(ASCIIDOC_DOXYGEN_DIR)/examples_page.adoc
87+
python3 $(SCRIPTS_DIR)/postprocess_doxygen_adoc.py $(ASCIIDOC_DOXYGEN_DIR)
88+
-cp $(DOXYGEN_XML_DIR)/*.png $(ASCIIDOC_DOXYGEN_DIR)
8089

8190
build_doxygen_adoc: $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc
8291

doxygentoasciidoc

Submodule doxygentoasciidoc added at b771d54

jekyll-assets/css/style.css

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,53 @@ div.videoblock iframe {
707707

708708
/* DOXYGEN ELEMENTS */
709709

710+
.contexttag {
711+
display: inline-block;
712+
font-size: 0.8em;
713+
line-height: 1em;
714+
font-weight: bold;
715+
background-color: orange;
716+
color: #ffffff;
717+
border-radius: 0.5em;
718+
padding-left: 0.5em;
719+
padding-right: 0.5em;
720+
padding-top: 1px;
721+
padding-bottom: 1px;
722+
}
723+
724+
.contexttag.RP2040 {
725+
background-color: #50C878;
726+
}
727+
728+
div.listingblock pre.highlight {
729+
margin-top: 0px;
730+
margin-bottom: 0px;
731+
}
732+
733+
#content div.listingblock table.linenotable {
734+
margin-bottom: 0px;
735+
}
736+
737+
#content td.hdlist1 {
738+
line-height: 1.5em;
739+
}
740+
741+
#content td.hdlist2 > p {
742+
margin-bottom: 0px;
743+
}
744+
745+
#content td.linenos {
746+
padding-right: 10px;
747+
}
748+
749+
.highlight td.code pre {
750+
background-color: transparent;
751+
margin-top: 0px;
752+
margin-bottom: 0px;
753+
}
754+
755+
/* OLD DOXYGEN ELEMENTS */
756+
710757
div.memproto {
711758
background-color: #dedede;
712759
padding: 7px;

jekyll-assets/scripts/copy-to-clipboard.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var hideTooltip = function() {
2828
};
2929

3030
var extractDoxygenCode = function(node) {
31-
var lines = node.querySelectorAll("div.line");
31+
var lines = node.querySelectorAll("div.code");
3232
var preText = "";
3333
for (var i = 0; i < lines.length; i++) {
3434
var myText = lines[i].textContent;
@@ -45,8 +45,9 @@ for (var i = 0; i < buttons.length; i++) {
4545
window.addEventListener('load', function() {
4646
var clipboard = new ClipboardJS('.copy-button', {
4747
text: function(trigger) {
48-
if (trigger.parentNode.querySelector('div.line')) {
49-
var text = extractDoxygenCode(trigger.parentNode);
48+
if (trigger.parentNode.querySelector('td.code')) {
49+
// var text = extractDoxygenCode(trigger.parentNode);
50+
var text = trigger.parentNode.querySelector('td.code pre').textContent;
5051
} else {
5152
var text = trigger.parentNode.querySelector('pre').textContent;
5253

lib/pico-examples

Submodule pico-examples updated 230 files

lib/pico-sdk

Submodule pico-sdk updated 977 files

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pyyaml == 6.0.1
22
lxml
3+
beautifulsoup4

scripts/create_auto_ninjabuild.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def add_entire_directory(tab_dir, dir_path, pages_set, src_images, dest_images):
136136
ninja.variable('documentation_index', index_json)
137137
ninja.variable('output_index', os.path.join(output_dir, "_data", "index.json"))
138138
ninja.variable('site_config', config_yaml)
139-
ninja.variable('doxyfile', os.path.join(doxygen_pico_sdk_build_dir, "docs", "Doxyfile"))
139+
ninja.variable('doxyfile', os.path.join(doxygen_pico_sdk_build_dir, "combined", "docs", "Doxyfile"))
140140
ninja.newline()
141141

142142
targets = []

0 commit comments

Comments
 (0)