{"id":13730454,"url":"https://github.com/cpgf/cpgf","last_synced_at":"2025-05-08T03:30:39.064Z","repository":{"id":14023887,"uuid":"16725840","full_name":"cpgf/cpgf","owner":"cpgf","description":"cpgf library","archived":false,"fork":false,"pushed_at":"2022-05-22T06:47:25.000Z","size":6138,"stargazers_count":220,"open_issues_count":4,"forks_count":60,"subscribers_count":31,"default_branch":"master","last_synced_at":"2024-11-14T21:38:02.607Z","etag":null,"topics":["c-plus-plus","cpgf","lua-bindings","python-bindings","reflection"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cpgf.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog","contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-11T09:28:40.000Z","updated_at":"2024-10-26T09:48:23.000Z","dependencies_parsed_at":"2022-08-26T01:11:37.516Z","dependency_job_id":null,"html_url":"https://github.com/cpgf/cpgf","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpgf%2Fcpgf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpgf%2Fcpgf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpgf%2Fcpgf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpgf%2Fcpgf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cpgf","download_url":"https://codeload.github.com/cpgf/cpgf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252992791,"owners_count":21837174,"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":["c-plus-plus","cpgf","lua-bindings","python-bindings","reflection"],"created_at":"2024-08-03T02:01:15.081Z","updated_at":"2025-05-08T03:30:37.835Z","avatar_url":"https://github.com/cpgf.png","language":"C++","readme":"# cpgf library\r\n\r\ncpgf library is a cross platform C++ library for callback, reflection, serialization and script binding.\r\n\r\nIt's written in standard C++ and doesn't require any preprocessor or tools.\r\n\r\n## This project is NOT continued, it will be replaced by substitute projects\r\n\r\nThere will be substitute projects under development.  \r\nIf you are looking for C++ reflection library, please [check metapp](https://github.com/wqking/metapp), that's from the same developer of cpgf.  \r\nIf you are looking for the callback list feature in cpgf, please [check eventpp](https://github.com/wqking/eventpp), it's from the same develop of cpgf too.  \r\nA metapp based Lua binding project is under development as well.  \r\n\r\n### The problems in cpgf that it can't be continued\r\n\r\n**1, The project is too ambitious and is too large.**  \r\n\r\nIndeed cpgf is not a single library, it contains many libraries, such as,  \r\n\r\n- Callback and callback list\r\n- Variant\r\n- Reflection\r\n- Serialization\r\n- Lua script binding\r\n- Python script binding\r\n- V8 script binding\r\n- SpiderMonkey script binding\r\n- Meta data for various libraries\r\n- Meta data generating tool\r\n- Tweening library.\r\n\r\nEach component is already a very large library by itself. Putting them to a giant cpgf is not manageable even for big software companies.\r\n\r\n**2, I was too conservative on new technology.**  \r\n\r\nAt the time I started the cpgf project, the latest C++ standard was C++03. And C++11 was already drafted, and was partially usable in the compilers. Especially, TR1 was there already.  \r\nI chose to stick to C++03, because I wanted my libraries be able to be used in as many as compilers.  \r\nThat's another big mistake. The different between C++11 and pre-C++11 is nothing like C++03 and pre-03, or between C++14 and C++11. C++11 is a new era of C++.  \r\n\r\n### What will be in the substitute projects\r\n\r\n1. Each project will be small and only focus on one feature. For example, [metapp](https://github.com/wqking/metapp) will only focus on reflection feature, there will be no serialization, no script binding, under metapp.  \r\n2. All projects will be using at least C++11. Though C++11 is already old, I feel it's enough for most projects.  \r\n\r\n\r\n## Documentations  \r\n[Documentations](doc/index.md)\r\n\r\n## Version\r\n1.6.1\r\n\t\t\r\n## Libraries\r\n\r\n* cpgf reflection -- a library to add reflection feature to C++.\r\n\r\n* cpgf serialization -- a library to save C++ data and objects to persistent storage\r\n\tand then load back. It's based on the reflection library.\r\n\r\n* cpgf script binding -- a script binding engine to bind Lua (5.3, 5.2 and 5.1),\r\n\tGoogle V8 JavaScript, Python (2.7.3), and Mozilla SpiderMonkey JavaScript to C++.\r\n\tIt's based on the reflection library.\r\n\r\n* cpgf callback -- a callback library to implement signal/slot or callback in C++.\r\n\t\tIt's the primary library for other libraries.\r\n\r\n* cpgf meta data collection -- a library with built-in meta data support.\r\n\t\tNow there are meta data for C++ STL, OpenGL, OpenGLU, OpenGLUT,\r\n\t\tBox2D physical engine, SFML graphics and multimedia engine and Irrlicht\r\n\t\t3D render engine.\r\n\r\n* cpgf meta data generator tool -- a tool writen in Java to automatically generate\r\n\t\tmeta data from Doxygen XML files.\r\n\r\n* cpgf tweening -- a library to implement ease animation in C++.\r\n\t\r\n## License\r\nApache License, Version 2.0\r\nYou may obtain a copy of the License at\r\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\r\n\r\n## Author and owner\r\nWang Qi, in Beijing, China\r\n\r\n## Learning the library\r\nThough there are some documentations on the official website, they are far from good.\r\nYou may understand that developers like coding much more than documenting.\r\n\r\nThe fastest way to get start with the library is to read the sample code\r\nin the folder \"samples\".\r\nThe samples cover most features so it's\ta good kick off.\r\n\r\nIf you want to read more sample code, read the code in the folder \"test\".\r\nThey are for unit test. They are much more difficult to read and\r\nuse a lot of macros.\r\nHowever, they cover much more functions than the sample code.\r\n\r\n## A sister project using cpgf\r\nThere is a 2D game engine from the cpgf author,\r\n\r\n[https://github.com/wqking/gincu](https://github.com/wqking/gincu)\r\n\r\nThe game engine uses cpgf callback, tweening and script binding extensively.\r\n\t\r\n## Using the library\r\n* In the project setting, add an include path pointing to \"cpgf/include\".\r\n* Link the source code or link the library in your project.\t\r\n* All classes, functions and APIs are in the namespace \"cpgf\".\r\n\r\n## Link the source code\r\nTo using the library, the easiest way is to just link all .cpp source code\r\nunder the src and sub folder.\r\nHowever, a build script is also provide to build the code as static library.\r\n\r\n## Build the library\r\nThe library uses CMake as the build system.\r\nA makefile is provided to wrap the CMake build.\r\nTo build the library, open command line terminal, go to folder \"build\",\r\n\r\nThe library requires C++ exception and RTTI are enabled.\r\n\r\n```\t\r\nmake PLATFORM\r\n```\r\n\t\t\r\nPLATFORM can be one of\r\n\r\n\tnmake mingw linux vc05 vc08 vc10 cb_mingw cb_nmake cb_linux xcode\r\n\t\t\r\nFor detailed PLATFORM information, run \"make\" without parameter to see the help.\r\n\t\r\nIf you are using MSVC, run \"nmake\" instead of \"make\".\r\n\r\nTo build with Lua binding, you must change the variable HAS_LUA and LUA_DIR\r\nin build.config.txt to point to the source code of Lua.\r\n\t\r\nTo build with Google V8 Javascript binding, you must change the variable HAS_V8 and V8_DIR\r\nin build.config.txt to point to the source code of V8.\r\n\r\nTo build with Python binding, you must change the variable HAS_PYTHON and PYTHON_DIR\r\nin build.config.txt to point to the source code of Python.\r\n\t\r\nTo build with Mozilla SpiderMonkey binding, you must change the variable HAS_SPIDERMONKEY and SPIDERMONKEY_DIR\r\nin build.config.txt to point to the source code of Mozilla SpiderMonkey.\r\n\r\nTo build the unit test and sample code, feed a second parameter\r\n\r\n```\t\r\n\tmake PLATFORM TARGET=TheTarget\r\n```\r\n\r\n\tTheTarget can be,\r\n\tTARGET=lib                   Build the library. This is the default if TARGET is omitted.\r\n\tTARGET=tutorials             Build the tutorials.\r\n\tTARGET=tests                 Build the unit test.\r\n\tTARGET=samplereflection      Build the reflection sample application.\r\n\tTARGET=sampleserialization   Build the serialization sample application.\r\n\tTARGET=samplelua             Build the Lua binding sample application.\r\n\tTARGET=sampleopengl          Build the Opengl binding sample application.\r\n\tTARGET=samplebox2d           Build the Box2D binding sample application.\r\n\tTARGET=samplesfml            Build the SFML binding sample application.\r\n\tTARGET=sampleirrlicht        Build the Irrlicht binding sample application.\r\n\r\n## Compatibility -- Tested compilers and OSes\r\n* Linux (Ubuntu 18.04), GCC 7.3.0\r\n* Linux (Ubuntu 18.04, LLVM Clang 5.0.2\r\n* The below cases were based on the old 1.5 version. Since version 1.6, C++11 compiler is required, and VC 2015 and GCC 4.9.1 were tested.\r\n* Windows XP, Microsoft Visual C++ 2008 Express and Microsoft Visual C++ 2010 Professional\r\n* Windows XP, MingW GCC 3.4.2, 4.4.0 and 4.5.2\r\n* Windows XP, Embarcadero C++ Builder 2010\r\n* Linux (Ubuntu 11.04 in VirtualBox), GCC 4.5.2\r\n* Linux (Ubuntu 11.04 in VirtualBox), Intel C++ Compiler Composer XE\r\n* Mac 10.6.8, GCC 4.4.0\r\n\t\r\n## Required third party library -- None for the major libraries\r\n* For Lua binding, Lua library is required.\r\n* For Google V8 binding, V8 library is required.\r\n* For Python binding, Python library is required.\r\n* For Mozilla SpiderMonkey, Mozilla SpiderMonkey is required.\r\n* If you want to run the unit test, UnitTest++ is required.\r\n\tBut usually you don't need to do that.\r\n\r\n## Contribute to the library\r\nIf you like the library and want to contribute to it, here are some most\r\ndesired work to do\r\n* Help with the documentation. I'm not a native English speaker, and\r\n\tI also don't like to write documentation. \r\n* Test the library on more compilers and platforms.\r\n\r\n## What does cpgf mean?\r\nThe original cpgf means Cross Platform Game Framework.\r\nIt was intended\tto be game framework that can work on PC and smart phone.\r\nBut later the author decided to add more fun but non-game features to the library.\r\nSo now the library is neither for game nor a framework.\r\nIt's a cross platform library.\r\n\r\n","funding_links":[],"categories":["Reflection","映射","C++"],"sub_categories":["物理学"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpgf%2Fcpgf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpgf%2Fcpgf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpgf%2Fcpgf/lists"}