Compare commits
6 Commits
92144091b1
...
113696e525
Author | SHA1 | Date |
---|---|---|
Brett | 113696e525 | |
Brett | bd4f229a5d | |
Brett | fa383d42e1 | |
Brett | 9a9f9b25d1 | |
Brett | 8d468f82be | |
Brett | c488732d37 |
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
project(gl_doc_generator)
|
project(gl_doc_generator VERSION 0.0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
||||||
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
||||||
|
@ -7,6 +7,11 @@ option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||||
|
set(CMAKE_BUILD_TYPE "Release")
|
||||||
|
endif ()
|
||||||
|
message("Using ${CMAKE_BUILD_TYPE}")
|
||||||
|
|
||||||
add_subdirectory(libraries/BLT)
|
add_subdirectory(libraries/BLT)
|
||||||
|
|
||||||
file(COPY ${CMAKE_SOURCE_DIR}/gl_doc_generator.py DESTINATION ${CMAKE_BINARY_DIR}/)
|
file(COPY ${CMAKE_SOURCE_DIR}/gl_doc_generator.py DESTINATION ${CMAKE_BINARY_DIR}/)
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
# GL Doc Generator
|
||||||
|
### Automatic OpenGL Documentation Generation
|
||||||
|
|
||||||
|
---
|
||||||
|
Have you ever used an OpenGL bindings library and thought
|
||||||
|
"Wow this is great, but it could use some inline documentation!"?
|
||||||
|
Well this tool is for you! This C++ / Python program automatically scans, and parses C/C++
|
||||||
|
header files and generates C style block comments from the online OpenGL Reference. The
|
||||||
|
comments this program generates should work in most IDEs however it currently has only been tested on CLion.
|
||||||
|
|
||||||
|
## How To Use
|
||||||
|
### Requirements
|
||||||
|
CMake is required to build the C++ side, along with a compiler capable of C++17 or newer.
|
||||||
|
You also require a Python3 Interpreter. This has only been tested on Debian Stable with `GCC-12.2`
|
||||||
|
but should work as far back as `GCC-8.5` on any Linux distro. Windows is supported but not tested for.
|
||||||
|
(Please make an issue!)
|
||||||
|
### Building
|
||||||
|
Clone the repository:
|
||||||
|
```shell
|
||||||
|
git clone --recursive https://github.com/Tri11Paragon/OpenGL-Doc-Generator.git
|
||||||
|
cd OpenGL-Doc-Generator
|
||||||
|
```
|
||||||
|
Make a build directory:
|
||||||
|
```shell
|
||||||
|
mkdir build && cd build
|
||||||
|
```
|
||||||
|
Run CMake:
|
||||||
|
```shell
|
||||||
|
cmake ../ && make -j 16
|
||||||
|
```
|
||||||
|
You will now have an executable `gl_doc_generator`
|
||||||
|
### Usage
|
||||||
|
Assuming you have python in your path the program only requires one argument,
|
||||||
|
the path to the header file you want to generate for. You can specify the comment generator,
|
||||||
|
python path, output location along with level of detail via flags passed to the command line.
|
||||||
|
```
|
||||||
|
--generator # The python script used to generate the comments (Defaults to the one included in this project)
|
||||||
|
--python # Path to your python interpreter (Defaults to the python3 in your path)
|
||||||
|
--output, -o # Sets the path to the output file. By default this is the input file with _doc added
|
||||||
|
```
|
||||||
|
You can also specify detail flags which will cause certain sections to be removed from the comments.
|
||||||
|
This is useful because this program can easily bloat the file size to be tens of thousands of lines which some
|
||||||
|
IDEs do not like.
|
||||||
|
```
|
||||||
|
--no-see, -s # Don't include @see sections
|
||||||
|
--no-desc, -d # Don't include the @descrition section
|
||||||
|
--brief # Only include the @name and @code sections
|
||||||
|
```
|
||||||
|
#### Examples:
|
||||||
|
Generates a commented file at `../gl_doc.h`
|
||||||
|
```shell
|
||||||
|
./gl_doc_generator ../gl.h
|
||||||
|
```
|
||||||
|
---
|
||||||
|
Generates a commented file in the local directory called `gl.h` from a file of the same name in the parent directory.
|
||||||
|
```shell
|
||||||
|
./gl_doc_generator --output ./gl.h ../gl.h
|
||||||
|
```
|
||||||
|
---
|
||||||
|
Generates a commented file where comments are of the style:
|
||||||
|
```
|
||||||
|
/**
|
||||||
|
* @name glInvalidateTexSubImage - invalidate a region of a texture image
|
||||||
|
* @usage
|
||||||
|
* @code void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); @endcode
|
||||||
|
*/
|
||||||
|
```
|
||||||
|
in the local directory called `gl.h` from a file of the same name in the parent directory.
|
||||||
|
```shell
|
||||||
|
./gl_doc_generator -b --output ./gl.h ../gl.h
|
||||||
|
```
|
39390
gl_doc_full.h
39390
gl_doc_full.h
File diff suppressed because it is too large
Load Diff
27114
gl_doc_partial.h
27114
gl_doc_partial.h
File diff suppressed because it is too large
Load Diff
|
@ -4,11 +4,8 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "load_file.h"
|
#include "load_file.h"
|
||||||
|
|
||||||
#include "../gl_doc.h"
|
|
||||||
|
|
||||||
int main(int argc, const char** argv)
|
int main(int argc, const char** argv)
|
||||||
{
|
{
|
||||||
glBindBuffer(50, 10);
|
|
||||||
blt::arg_parse parser;
|
blt::arg_parse parser;
|
||||||
|
|
||||||
parser.addArgument(blt::arg_builder("--generator").setAction(blt::arg_action_t::STORE).setDefault("./gl_doc_generator.py")
|
parser.addArgument(blt::arg_builder("--generator").setAction(blt::arg_action_t::STORE).setDefault("./gl_doc_generator.py")
|
||||||
|
|
Loading…
Reference in New Issue