{"id":21077072,"url":"https://github.com/mrtrizer/mojito-reflection","last_synced_at":"2026-05-03T07:39:25.623Z","repository":{"id":86464579,"uuid":"166687115","full_name":"mrtrizer/mojito-reflection","owner":"mrtrizer","description":"Reflection generator for C++17","archived":false,"fork":false,"pushed_at":"2024-02-10T04:25:06.000Z","size":209,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-06T01:14:44.744Z","etag":null,"topics":["cpp17","generator","reflection"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrtrizer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2019-01-20T17:08:58.000Z","updated_at":"2024-02-10T04:25:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"26702a0b-65b2-4778-be67-ee05ca7bdd38","html_url":"https://github.com/mrtrizer/mojito-reflection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtrizer%2Fmojito-reflection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtrizer%2Fmojito-reflection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtrizer%2Fmojito-reflection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtrizer%2Fmojito-reflection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrtrizer","download_url":"https://codeload.github.com/mrtrizer/mojito-reflection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243521281,"owners_count":20304186,"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":["cpp17","generator","reflection"],"created_at":"2024-11-19T19:34:56.766Z","updated_at":"2026-05-03T07:39:20.590Z","avatar_url":"https://github.com/mrtrizer.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/mrtrizer/mojito-reflection.svg?branch=master)](https://travis-ci.org/mrtrizer/mojito-reflection)\n\n# C++ Reflection generator\n\nThe repo includes a reflection library for C++17 and a generator for it.\nThe root idea was to make reflection generation transparent by replacing the compiler with a reflection generator, that calls the compiler under the hood. This was the main concept and it comes with a huge drawback, the generator is hard to integrate into the project. So, I stopped developing once I got this issue. \nMaybe it could become more universal if I made more effort.\n\n## About library\nReflection library features:\n- No macro usage\n- No injections into code\n- Compact implementation (thanks to C++17)\n- No global variables (reflected items are stored in the Reflection object)\n- Dynamic library friendly\n\nCurrently supported:\n- Function\n- Classes\n- Constructor/destructor\n- Allocation on stack/heap/inplace\n- Methods (including pure inline)\n- Pointers (adress-of and dereference operations support)\n\nPlanned:\n- Inheritance\n- Enums\n\n## Usage\nThe library is laying in `reflection/ ` folder. You can use pure sources from `src` dir, or connect it to your cmake project like this:\n```\n# Link reflection\nadd_subdirectory(\"../reflection\" \"MojitoReflection/\")\ntarget_link_libraries(${PROJECT_NAME} MojitoReflection)\n```\nAlso, see examples in `demo` and `tests` folders\n\n## About generator\nThe generator works as a wrapper for a compiler and mimics the compiler's behavior. This works similarly to ccache or emscripten. Generated reflection will be injected into the final binary (executable or shared library)\n\nThe generator is proven to work CMake with XCode and Ninja generators. It also should be easily integrated with Qt Creator and CLion (not tested).\n\nFeatures:\n- C++ friendly and correct (thanks to clang in core)\n- Reflected classes can be placed in cpp files or headers\n- Attributes used to mark reflected classes\n\nLimitations:\n- Currently support only clang compiler (and possibly gcc, not tested)\n- Can be easily built only for Linux and Mac, building for Windows is possible but tricky \n- Requires support of changing compiler from build system and sometimes from IDE\n\n\n## Building generator\n### MacOS\nExample with usage brew\n```\nbrew install llvm boost ninja cmake\ncd generator\nmkdir build\ncd build\ncmake -G \"Ninja\" ..\nninja\n```\nCMake may ask you to point to LLVM search path. If it does, feed him an argument similar to this:\n`-DLLVM_DIR=/usr/local/Cellar/llvm/5.0.0/lib/cmake/llvm`\n\n### Linux\nInstall llvm \u003e= 7, boost \u003e 1.6, ninja, cmake with your package manager\n```\ncd generator\nmkdir build\ncd build\ncmake -G \"Ninja\" ..\nninja\n```\n\n## Using generator\nHonestly, this part is a bit tricky. Let's try just to run the generator first. (Expected that you have built it with the instructions above)\n```\necho \"int main() { }\" \u003e test.cpp\n./reflection_generator --reflection-name=Experiment --compiller=c++ --reflection-includes=\"../../reflection/src/\" --reflection-out=./reflection test.cpp\n```\nYou will get a binary `unknown` in the folder if everything is done right.\n\nAs you see, a minimal pack of parameters for the generator is:\n- `--reflection-name` - Name of subfolder in `--reflection-out` folder\n- `--compiller` - Compiller command\n- `--reflection-includes` - Path to reflection library\n- `--reflection-out` - Out folder\n\nYou can pass these parameters as additional compiler flags or make a wrapper with bash scripts as I did.\n\nExamples can be built with Xcode and Ninja generators. Like:\n```\ncd demo\nmkdir build\ncd build\ncmake -G \"XCode\" .. \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtrizer%2Fmojito-reflection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrtrizer%2Fmojito-reflection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtrizer%2Fmojito-reflection/lists"}