Skip to content

Extract documentation to its own CMakeLists.txt#37

Draft
ekohl wants to merge 1 commit intoteddych:masterfrom
ekohl:extract-docs-cmake
Draft

Extract documentation to its own CMakeLists.txt#37
ekohl wants to merge 1 commit intoteddych:masterfrom
ekohl:extract-docs-cmake

Conversation

@ekohl
Copy link
Contributor

@ekohl ekohl commented Feb 7, 2026

This is still incomplete and doesn't quite work, but it shows the concept.

The idea is that documentation building is contained to the Documentation directory. If pandoc is present, it builds the documentation unconditionally.

It's an alternative to #36.

This is still incomplete and doesn't quite work, but it shows the
concept.

The idea is that documentation building is contained to the
Documentation directory. If pandoc is present, it builds the
documentation unconditionally.
@ekohl ekohl force-pushed the extract-docs-cmake branch from fb56ad0 to 47cfd39 Compare February 7, 2026 14:51
Copy link
Contributor Author

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fuddl1 @teddych any thoughts over this over #36? It isn't split into smaller commits, but the overall steps I take are pretty much the same.

I like that the main CMakeLists.txt doesn't blow up in size too much.

@@ -0,0 +1,156 @@
cmake_minimum_required(VERSION 3.18)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this is 3.18 (unlike 3.10 in main) because find_program uses REQUIRED

DEPENDS doc
)

add_custom_command(TARGET doc-for-web POST_BUILD
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't had a good look at how to convert this, if needed at all.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ekohl doc-for-web creates a directory structure that is intended to replace the current documentation on the railcontrol.org web server, i.e., Teddy needs it.

No other target should depend on doc-for-web, but for transparency and keeping things together please keep it.

install(DIRECTORY ${OUTPUT_HTML}/ DESTINATION ${CMAKE_INSTALL_DOCDIR})

set(OUTPUT_CHUNKEDHTML ${CMAKE_CURRENT_BINARY_DIR}/chunkedhtml)
file(MAKE_DIRECTORY ${OUTPUT_CHUNKEDHTML})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably needs to be an install like above for regular docs, if we want to have this in the file install.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ekohl the "chunked html" documentation doesn't need to be installed as of today, but likely in the future. No other target should depend on it, yet.

The generated HTML documentation is intended to be integrated into the web interface, e.g., adding a 'Help' button to the switch configuration dialog window.

file(COPY ${DOCDATA} DESTINATION ${OUTPUT_HTML})
file(COPY ${DOCDATA} DESTINATION ${OUTPUT_CHUNKEDHTML})

# German
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the repetition I've been wondering if a macro could be written to iterate over every language, but that's a potential future optimization.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I consider it still an acceptable amount of repetition at the moment.

file(GLOB DOCDATA_DE de/*.png)
file(COPY ${DOCDATA_DE} DESTINATION ${OUTPUT_HTML_DE})

file(GLOB DOC_DE de/*.md)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't GLOB but keep the manual listing of markdown files for every language. The order matters and reflects the order of sections of documents pandoc produces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is something I wasn't sure about. Thanks for confirming my suspicion.

@teddych
Copy link
Owner

teddych commented Feb 9, 2026

I am not very familiar with cmake, therefore I am happy if you think about and improve everything around the documentation!
I personally would choose the way with the separate documentation CMakeLists.txt. But I think you have more experience.

@teddych
Copy link
Owner

teddych commented Feb 9, 2026

And what fuddl already mentioned: The plan is to replace the existing documentation on the web with the pandoc generated chunked output. So the idea is that the output has the same directory structure and the same filenames as what is now on the railcontrol.org site.

@ekohl
Copy link
Contributor Author

ekohl commented Feb 9, 2026

I personally would choose the way with the separate documentation CMakeLists.txt. But I think you have more experience.

Honestly, I didn't know cmake at all until I started to look at railcontrol and I've just been reading documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants