Skip to content

Commit

Permalink
treewide: Update pcode docs generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Jul 24, 2024
1 parent 895cc98 commit 89d90ff
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ else()
)
endif()

add_custom_target(patchestry-doc)

include(AddPatchestry)
add_library(patchestry_settings INTERFACE)

target_include_directories(patchestry_settings INTERFACE
Expand Down
18 changes: 18 additions & 0 deletions cmake/AddPatchestry.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function(add_patchestry_doc doc_filename output_file output_directory command)
set(VAST_TARGET_DEFINITIONS ${doc_filename}.td)
mlir_tablegen(${output_file}.md ${command} ${ARGN})
set(GEN_DOC_FILE ${PATCHESTRY_BINARY_DIR}/docs/${output_directory}${output_file}.md)
add_custom_command(
OUTPUT ${GEN_DOC_FILE}
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/${output_file}.md
${GEN_DOC_FILE}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${output_file}.md)
add_custom_target(${output_file}DocGen DEPENDS ${GEN_DOC_FILE})
add_dependencies(patchestry-doc ${output_file}DocGen)
endfunction(add_patchestry_doc)

function(add_patchestry_dialect_with_doc dialect dialect_namespace)
add_mlir_dialect(${dialect} ${dialect_namespace})
add_patchestry_doc(${dialect} ${dialect}Dialect Dialects/ -gen-dialect-doc -dialect=${dialect_namespace})
endfunction(add_patchestry_dialect_with_doc)
12 changes: 11 additions & 1 deletion include/patchestry/Dialect/Pcode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@
# in the root directory of this source tree.

add_mlir_dialect(Pcode pc)
add_mlir_doc(Pcode PcodeDialect Dialects/ -gen-dialect-doc -dialect=pc)

if (DEFINED MLIR_BINARY_DIR)
set(MLIR_OLD_ROOT ${MLIR_BINARY_DIR})
endif()

set(MLIR_BINARY_DIR ${PATCHESTRY_BINARY_DIR})
add_mlir_doc(Pcode Pcode Dialects/ -gen-dialect-doc -dialect=pc)

if (DEFINED MLIR_OLD_ROOT)
set(MLIR_BINARY_DIR ${MLIR_OLD_ROOT})
endif()
5 changes: 2 additions & 3 deletions www/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
site_name: "Patchestry: MLIR-based binary patching framework"
site_name: "Patchestry"
repo_url: https://github.com/lifting-bits/patchestry
nav:
- Introduction: README.md
Expand All @@ -7,8 +7,7 @@ nav:
- Ghidra Integration: GettingStarted/ghidra.md
- How to contribute: CONTRIBUTING.md
- Dialects:
- Pcode: dialects/Pcode/Pcode.md
- Benchmarks:
- Pcode: Dialects/Pcode.md
- About:
- 'License': 'statement.md'

Expand Down
2 changes: 1 addition & 1 deletion www/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ cp -rv $(pwd)/LICENSE $dst/docs
cp -rv $(pwd)/CONTRIBUTING.md $dst/docs

# Setup auto-generated docs
cp -rv $build/docs $dst/docs/dialects
cp -rv $build/docs $dst

# Setup site assets
cp -rv $(pwd)/www/assets $dst
Expand Down

0 comments on commit 89d90ff

Please sign in to comment.