setup_codebrowser
Setup KDAB/Woboq Codebrowser
Build and Install Codebrowser from source
Install dependencies (tested in Ubuntu 20)
sudo apt install cmake llvm clang libclang-dev
Clone source code
git clone https://github.com/KDAB/codebrowser.git
Compile source with Cmake
cmake . && make
Install the binaries
sudo make install
Install Codebrowser with Debian binaries
Pre-requisites
Install Bear tool to generate 'compile_commands.json' compilation database
sudo apt install bear
This will install couple of binaries in the system
codebrowser_generator
- Generate HTML version of the source codecodebrowser_indexgenerator
- Generate HTML index files
Setup with bear tool and compile_commands.json (recommended)
Generate
compile_commands.json
with bear toolGoto the project root directory and do
bear make
(or)bear -- <your-build-command>
. The output file calledcompile_commands.json
is saved in the current directory.
Create HTML version of your source code
codebrowser_generator -a -b ./compile_commands.json -p <project-name>:<project-path> -o ./output
Generate HTML index files
codebrowser_indexgenerator -p <project-name>:<project-path> ./output
Get Data directory and place it in parent directory of
./output
Start the web-server
python -m http.server 8000
Explore the source code at
http://localhost:8000
Setup without bear tool
This setup doesn't require compile_commands.json
file.
Create HTML version of your source code
codebrowser_generator -o ./output -p <project-name>:$PWD $PWD --
Generate HTML index files
codebrowser_indexgenerator -p <project>:$PWD ./output
Follow the steps 3 to 5 mentioned in the above section and explore code in the web-browser
Export to webserver
Export the output directory
output
to your webserversudo cp -rf ./output /var/www/html/
Copy the HTML assets
data
to the parent directorysudo cp /usr/share/woboq/data/ /var/www/html
Explore your project in browser at
http://localhost/output
Example
codebrowser_generator -o ./devcode -p MyProject:$PWD $PWD --
codebrowser_indexgenerator -p MyProject:$PWD ./devcode
Reference
https://woboq.com/codebrowser.html https://github.com/KDAB/codebrowser
Last updated