{"id":20411455,"url":"https://github.com/sandordargo/cmake-project-creator","last_synced_at":"2025-04-12T16:25:43.085Z","repository":{"id":46310715,"uuid":"278570949","full_name":"sandordargo/cmake-project-creator","owner":"sandordargo","description":"cpp-project-creator","archived":false,"fork":false,"pushed_at":"2024-03-22T14:39:02.000Z","size":69,"stargazers_count":29,"open_issues_count":7,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T10:52:14.713Z","etag":null,"topics":["cmake","cpp","hacktoberfest","hacktoberfest2022"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandordargo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-10T07:41:03.000Z","updated_at":"2025-01-25T10:57:26.000Z","dependencies_parsed_at":"2023-01-20T00:15:13.119Z","dependency_job_id":null,"html_url":"https://github.com/sandordargo/cmake-project-creator","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/sandordargo%2Fcmake-project-creator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandordargo%2Fcmake-project-creator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandordargo%2Fcmake-project-creator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandordargo%2Fcmake-project-creator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandordargo","download_url":"https://codeload.github.com/sandordargo/cmake-project-creator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248595366,"owners_count":21130508,"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":["cmake","cpp","hacktoberfest","hacktoberfest2022"],"created_at":"2024-11-15T05:52:39.756Z","updated_at":"2025-04-12T16:25:43.062Z","avatar_url":"https://github.com/sandordargo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/sandordargo/cmake-project-creator/workflows/PythonCi/badge.svg)](https://github.com/sandordargo/cmake-project-creator/actions)\n\n## Cmake Project Creator\n\nCmake Project Creator helps you generate a new C++ project. Instead of writing the Cmakefiles and creating all the folders by hand, you can either\n* generate a project from an already existing description\n* write a new description file yourself\n\n## Requirements\nYou need the following software installed on your laptop\n- [Python 3.7 or higher](https://www.python.org/downloads/)\n- [CMake 3](https://cmake.org/download/)\n- [Conan](https://docs.conan.io/en/latest/installation.html)\n\n## How to use it?\n\nCall `./create_cmake_project.py --help` to print the help message.\n\nBriefly, you can call the `project_creator` with one of the predefined options, or you can pass in your own project description.\n\nYou should also pass in the path with `-o` or `--output` where your new project should be generated. If it's not passed then the project will be created under the generated_projects directory.\n\nOnce a project is generated, navigate to the root of the freshly created project and call `./runTest.sh` to launch the build and the unit tests - if any. Where a test directory is defined, a failing unit test is generated. \n\n### Supported unit testing frameworks\n\nEven though you can include any unit testing framework that is available through Conan, their won't be some default failing tests generated, unless the framework is listed in this section.\n\nThe following unit testing frameworks are supported:\n- [catch2](https://github.com/catchorg/Catch2)\n- [gtest](https://github.com/google/googletest)\n\n## Predefined schemas\n\nYou have the following predefined schemas shipped with `project_creator`. \n\n### The `single` directory project with Gtest as a unit testing framework\n\nInvoke this with `-d examples/single.json`. It will create a project with one include, one source and one test folder. GTest will be included for unit testing through Conan.\n\n```\nmyProject\n|_ include\n|_ src\n|_ test\n\n``` \n\n### The `single` directory project with Catch2 as a unit testing framework\n\nInvoke this with `-d examples/single.json`. It will create a project with one include, one source and one test folder. Catch2 will be included for unit testing through Conan.\n\n```\nmyProject\n|_ include\n|_ src\n|_ test\n\n``` \n### The `single` directory project with compiler options\n\nInvoke this with `-d examples/single_with_compiler_options.json`. Like the `single.json`, it will create a project with one include, one source and one test folder. More than that, it will define the following compiler options on a project level: `-Wall -Wextra -Wpedantic -Werror`.\n\n```\nmyProject\n|_ include\n|_ src\n|_ test\n\n``` \n\n### The `single` directory project with boost\n\nInvoke this with `-d examples/single_lib.json`. Like the `single.json`, it will create a project with one include, one source and one test folder. More than that, it doesn't only deliver an executable, but it also creates a shared library.\n\n```\nmyProject\n|_ include\n|_ src\n|_ test\n\n```\n\n### The `single` directory project with boost\n\nInvoke this with `-d examples/single_with_boost.json`. Like the `single.json`, it will create a project with one include, one source and one test folder. More than that, it includes `boost` as a dependency for the source directory and `gtest` for tests.\n\n```\nmyProject\n|_ include\n|_ src\n|_ test\n\n```\n\n### The `dual` directory project\n\nInvoke the tool with `-d examples/dual.json` and the following project will be generated:\n\n```\nmyProject\n|_ executable\n    |_ include\n    |_ src\n    |_ test\n|_ library\n    |_ include\n    |_ src\n    |_ test\n```\n\nThe `executable` sub-directory will include `library` sub-directory as a dependency and will also have a `main.cpp` as such an executable. The `library` is just a static library.\n\nGTest will be included for unit testing through Conan.\n\n### The `nested_dual` directory project\n\nInvoke the tool with `-d examples/nested_dual.json` and the following project will be generated:\n\n```\nmyProject\n|_ common_root\n    |_ executable\n        |_ include\n        |_ src\n        |_ test\n    |_ library\n        |_ include\n        |_ src\n        |_ test\n```\n\nThe `executable` sub-directory will include `library` sub-directory as a dependency and will also have a `main.cpp` as such an executable. The `library` is just a static library.\n\nSo what is the difference compared to the `dual` project? Not much, it's just that the subdirectories are nested in a new common root. This is more to show you an example, how it is possible. You can check the description in `examples/nested_dual.json`. \n\nGTest will be included for unit testing with the help of Conan.\n\n## How to write new project descriptions?\n\nFirst of all, project descriptions are written in JSON format.\n\nIn the root of the JSON, you'll have to specify the `projectName` attribute, which will be used both for the directory name where the project will be created and evidently it will be the name of the Cmake project.\nThen you have to specify an array of `directories`.\n\n### The root elements\n\nThere are two mandatory elements:\n- `projectName` setting the project name\n- `directories` describing the directory structure of the project\n\nThe following items are optional:\n- `c++Standard` setting the standard to compile against. If missing, it defaults to *17*. Possible values are: *98*, *11*, *14*, *17*, *20*.\n- `compilerOptions` setting extra compiler options. This field takes an array of strings, for example: `\"compilerOptions\": [\"-Wall\", \"-Wextra\", \"-Wpedantic\", \"-Werror\"]`.\n\n### Directory object\n\nEach object in the `directories` must specify a `name` attribute, a `type` attribute and/or subdirectories.\n\n#### Mandatory elements\n\nThe `name` attribute defines the directory name.\n\nThe `type` attribute can take the following values:\n- `source` indicating that it will contain implementation files\n- `header` indicating that it will contain header files\n- `test` indicating that it will contain unit test code\n- `intermediate` indicating that it will only contain other subdirectories  \n\nIn the subdirectories array, you can list the other `directory` objects to be put nested in the given `directory`.\n\n#### Optional elements\n\nA directory object can have the following optional elements:\n\n- `library` indicating whether a given component should be delivered as a library. Only `source` type directories should use this option. Its values can be `null`, `STATIC` or `SHARED`. Beware that if you decide to go with `null`, you want to be able to link it in unittests. I recommend delivering a library if you want to have tests. [More info on the topic here.](https://stackoverflow.com/a/52105591/3238101)\n- `executable` indicating whether a given component should have an executable, if set to `true`, a `main.cpp` will be generated. Only `source` type directories should use this option.\n- `include` indicating whether a given `source` component has a corresponding `include` counterpart or not. Only `source` type directories should use this option.\n- `dependencies` array containing all the dependencies of the given component\n\n### Dependency objects\n\nThe `dependency` object is to describe a dependency of the enclosing component. It has 2 mandatory attributes and 1 optional:\n\n#### Mandatory elements\n- `type` indicating whether the dependency is of another directory of the project (`internal`) or if it's an external one. Among external ones, for the time being, only `conan` is supported. \n- `name` indicating the name of the dependency, in case of internal ones it should be the relative path of the depended directory including the project root. (E.g. `common_root/executable/library`)\n\n#### Optional elements\n- `version` is optional and has no role for `internal` dependencies, but for `conan` type dependencies it indicates the version of the component we want to include and the format must follow the Conan syntax. You can both use specific versions or [version ranges](https://docs.conan.io/en/latest/versioning/version_ranges.html) \n\n## How to contribute?\n\nIn any case, please check the Github issues, maybe there is already an item, already a discussion concerning your idea. If that's not the case, open an issue and let's discuss it there.\n\nIn terms of coding guidelines, I follow the [PEP 8 Style guide for Pyhon](https://www.python.org/dev/peps/pep-0008/). Tests must be provided.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandordargo%2Fcmake-project-creator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandordargo%2Fcmake-project-creator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandordargo%2Fcmake-project-creator/lists"}