{"id":13418245,"url":"https://github.com/KDAB/codebrowser","last_synced_at":"2025-03-15T03:30:46.151Z","repository":{"id":5163461,"uuid":"6333751","full_name":"KDAB/codebrowser","owner":"KDAB","description":"Woboq CodeBrowser","archived":false,"fork":false,"pushed_at":"2023-11-17T07:48:40.000Z","size":1127,"stargazers_count":1096,"open_issues_count":28,"forks_count":161,"subscribers_count":54,"default_branch":"master","last_synced_at":"2024-10-29T17:31:54.834Z","etag":null,"topics":["clang","llvm","woboq"],"latest_commit_sha":null,"homepage":"http://woboq.com/codebrowser.html","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"linkeddata/rdflib.js","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KDAB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-10-22T11:19:03.000Z","updated_at":"2024-10-24T08:49:36.000Z","dependencies_parsed_at":"2023-02-19T07:15:53.213Z","dependency_job_id":"33b63fb8-a286-44bd-8525-eee97885a6b3","html_url":"https://github.com/KDAB/codebrowser","commit_stats":{"total_commits":458,"total_committers":25,"mean_commits":18.32,"dds":"0.24454148471615722","last_synced_commit":"0263378402633b3c2a860950f376c00159c720bd"},"previous_names":["woboq/woboq_codebrowser"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDAB%2Fcodebrowser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDAB%2Fcodebrowser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDAB%2Fcodebrowser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDAB%2Fcodebrowser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KDAB","download_url":"https://codeload.github.com/KDAB/codebrowser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242420013,"owners_count":20125156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clang","llvm","woboq"],"created_at":"2024-07-30T22:01:00.086Z","updated_at":"2025-03-15T03:30:46.142Z","avatar_url":"https://github.com/KDAB.png","language":"C++","funding_links":[],"categories":["TODO scan for Android support in followings","C++"],"sub_categories":[],"readme":"# \u003ca name=\"title\"\u003e\u003c/a\u003e [![Logo](https://codebrowser.dev/img/webp/codebrowserLogo.webp)](https://codebrowser.dev)\n\nThis is the generator for Code Browser, formerly created and maintained by [Woboq](https://woboq.com/), \n[KDAB](https://kdab.com) wants to thank Woboq to have made available such a great tool to the community in the first place. See https://codebrowser.dev/ for an example.\n\nThe announcement blog: https://woboq.com/blog/codebrowser-introduction.html\n\nIntroduction and Design\n=======================\n\nThere is a pre-processing step on your code that generates static html and\nreference database. The output of this phase is just a set of static files that\ncan be uploaded on any web hoster. No software is required on the server other\nthan the most basic web server that can serve files.\n\nWhile generating the code, you will give to the generator an output directory.\nThe files reference themselves using relative path. The layout in the output\ndirectory will look like this:\n(Assuming the output directory is `~/public_html/mycode`)\n\n`$OUTPUTDIR/../data/`  or `~/public_html/data/`\n  is where all javascript and css files are located. Those are static files shipped with the code browser, they are not generated.\n\n`$OUTPUTDIR/projectname`  or `~/public_html/mycode/projectname`\n  contains the generated html files for your project\n\n`$OUTPUTDIR/refs`  or `~/public_html/mycode/refs`\n  contains the generated \"database\" used for the tooltips\n\n`$OUTPUTDIR/include`  or `~/public_html/mycode/include`\n  contains the generated html files for the files in /usr/include\n\n\nThe idea is that you can have several project sharing the same output\ndirectory. In that case they will also share references and use searches will\nwork between them.\n\nInstall via Arch User Repository (AUR)\n======================================\n\nExecute these commands in Arch Linux:\n```bash\ngit clone https://aur.archlinux.org/woboq_codebrowser-git.git\ncd woboq_codebrowser-git\nmakepkg -si\n```\n\n\nCompiling the generator on Linux\n================================\n\nLLVM+Clang version 16 or higher is required to build the generator.\n \nExample:\n```bash\nmkdir build \u0026\u0026 cd build\ncmake  -DCMAKE_BUILD_TYPE=Release ..\nmake\n```\n\nCompiling the generator on macOS\n==============================================\n\nInstall XCode and then the command line tools:\n```bash\nxcode-select --install\n```\n\nInstall the clang libraries via [homebrew](http://brew.sh/):\n```bash\nbrew install llvm --with-clang --rtti\n```\n\nThen compile the generator:\n```bash\ncmake . -DCMAKE_PREFIX_PATH=/usr/local/Cellar/llvm/\u003cyour_llvm_version\u003e -DCMAKE_BUILD_TYPE=Release\nmake\n```\n\nUsing the generator\n===================\n\n### Step 1: Generate the compile_commands.json (see chapter \"Compilation Database\" below) for your project\n\nThe code browser is built around the clang tooling infrastructure that uses compile_commands.json\nhttp://clang.llvm.org/docs/JSONCompilationDatabase.html\n\nSee the section \"Compilation Database (compile_commands.json)\" below.\n\n### Step 2: Create code HTML using codebrowser_generator\n\nBefore generating, make sure the output directory is empty or does not contains\nstale files from a previous generation.\n\nCall the `codebrowser_generator`. See later for argument specification\n\n### Step 3: Generate the directory index HTML files using codebrowser_indexgenerator\n\nBy running the `codebrowser_indexgenerator` with the output directory as an argument\n\n### Step 4: Copy the static data/ directory one level above the generated html\n\n### Step 5: Open it in a browser or upload it to your webserver\n\n**Note**: By default, browsers do not allow AJAX on `file://` for security reasons. \nYou need to upload the output directory on a web server, or serve your files with a local apache or nginx server. \nAlternatively, you can disable that security in Firefox by setting `security.fileuri.strict_origin_policy` to `false` in about:config (http://kb.mozillazine.org/Security.fileuri.strict_origin_policy) or start Chrome with the [--allow-file-access-from-files](http://www.chrome-allow-file-access-from-file.com/) option.\n\nFull usage example\n==================\n\nLet's be meta in this example and try to generate the HTML files for the code browser itself.\nAssuming you are in the cloned directory:\n\n```bash\nOUTPUT_DIRECTORY=~/public_html/codebrowser\nDATA_DIRECTORY=$OUTPUT_DIRECTORY/../data\nBUILD_DIRECTORY=$PWD\nSOURCE_DIRECTORY=$PWD\nVERSION=`git describe --always --tags`\ncmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON\n./generator/codebrowser_generator -b $BUILD_DIRECTORY -a -o $OUTPUT_DIRECTORY -p codebrowser:$SOURCE_DIRECTORY:$VERSION\n./indexgenerator/codebrowser_indexgenerator $OUTPUT_DIRECTORY\ncp -rv ./data $DATA_DIRECTORY\n```\n\nYou can adjust the variables and try similar commands to generate other projects.\n\n\nArguments to codebrowser_generator\n==================================\n\nCompiles sources into HTML files\n\n```bash\ncodebrowser_generator -a -o \u003coutput_dir\u003e -b \u003cbuld_dir\u003e -p \u003cprojectname\u003e:\u003csource_dir\u003e[:\u003crevision\u003e] [-d \u003cdata_url\u003e] [-e \u003cremote_path\u003e:\u003csource_dir\u003e:\u003cremote_url\u003e]\n```\n\n - `-a` process all files from the compile_commands.json.  If this argument is not\n    passed, the list of files to process need to be passed\n - `-o` with the output directory where the generated files will be put\n - `-b` the \"build directory\" containing the compile_commands.json If this argument\n    is not passed, the compilation arguments can be passed on the command line\n    after  `--`\n - `-p` (one or more) with project specification. That is the name of the project,\n    the absolute path of the source code, and the revision separated by colons\n    example: `-p projectname:/path/to/source/code:0.3beta`\n - `-d` specify the data url where all the javascript and css files are found.\n    default to ../data relative to the output dir\n    example: `-d https://codebrowser.dev/data/``\n - `-e` reference to an external project.\n    example:`-e clang/include/clang:/opt/llvm/include/clang/:https://codebrowser.dev/llvm`\n\n\nArguments to codebrowser_indexgenerator\n=======================================\n\nGenerates index HTML files for each directory for the generated HTML files\n\n```bash\ncodebrowser_indexgenerator \u003coutput_dir\u003e [-d data_url] [-p project_definition]\n```\n\n- `-p` (one or more) with project specification. That is the name of the project,\n    the absolute path of the source code, and the revision separated by colons\n    example: `-p projectname:/path/to/source/code:0.3beta`\n- `-d` specify the data url where all the javascript and css files are found.\n    default to ../data relative to the output dir\n    example: `-d https://codebrowser.dev/data/`\n\n\nCompilation Database (compile_commands.json)\n============================================\nThe generator is a tool which uses clang's LibTooling. It needs either a\ncompile_commands.json or the arguments to be passed after '--' if they are\nthe same for every file.\n\nTo generate the compile_commands.json:\n* For cmake, pass `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` as a cmake parameter\n* For qmake, configure/autoconf and others, follow the instructions in `scripts/fake_compiler.sh` or `scripts/woboq_cc.js`.\nThese are fake compilers that append the compiler invocation to the json file and forward to the real compiler.\nYour real compiler is overriden using the CC/CXX environment variables\nMake sure to have the json file properly terminated.\n* If you use ninja, you can use `ninja -t compdb`\n* If you use qbs, you can use `qbs generate --generator clangdb`\n* There is also a project called Build EAR [Bear](https://github.com/rizsotto/Bear) that achieves a similar thing as our fake compilers\nbut is using `LD_PRELOAD` to inject itself into the build process to catch how the compiler is invoked.\n\n\nThere is also some further information on https://sarcasm.github.io/notes/dev/compilation-database.html#clang\n\n\nGetting help\n============\nNo matter if you are a licensee or are just curious and evaulating, we'd love to help you.\nAsk us via e-mail on info@kdab.com\n\nIf you find a bug or incompatibility, please file a github issue:\nhttps://github.com/kdab/codebrowser/issues\n\n\nLicence information\n====================\nLicensees holding valid commercial licenses provided by Woboq may use\nthis software in accordance with the terms contained in a written agreement\nbetween the licensee and Woboq.\n\nAlternatively, this work may be used under a Creative Commons\nAttribution-NonCommercial-ShareAlike 3.0 (CC-BY-NC-SA 3.0) License.\nhttp://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US\n\nThis license does not allow you to use the code browser to assist the\ndevelopment of your commercial software. If you intent to do so, consider\npurchasing a commercial licence.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKDAB%2Fcodebrowser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKDAB%2Fcodebrowser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKDAB%2Fcodebrowser/lists"}