{"id":20137155,"url":"https://github.com/devkitpro/catnip","last_synced_at":"2026-03-08T04:32:07.626Z","repository":{"id":236612801,"uuid":"791411058","full_name":"devkitPro/catnip","owner":"devkitPro","description":"devkitPro CMake helper tool","archived":false,"fork":false,"pushed_at":"2026-02-03T21:02:18.000Z","size":35,"stargazers_count":12,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-04T09:59:46.589Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"CMake","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/devkitPro.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["WinterMute","fincs"],"patreon":"devkitPro","custom":"https://devkitpro.org/support-devkitpro"}},"created_at":"2024-04-24T17:08:42.000Z","updated_at":"2026-02-03T21:02:22.000Z","dependencies_parsed_at":"2026-02-03T23:10:34.974Z","dependency_job_id":null,"html_url":"https://github.com/devkitPro/catnip","commit_stats":null,"previous_names":["devkitpro/catnip"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/devkitPro/catnip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devkitPro%2Fcatnip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devkitPro%2Fcatnip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devkitPro%2Fcatnip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devkitPro%2Fcatnip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devkitPro","download_url":"https://codeload.github.com/devkitPro/catnip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devkitPro%2Fcatnip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30245224,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-13T21:25:38.131Z","updated_at":"2026-03-08T04:32:07.602Z","avatar_url":"https://github.com/devkitPro.png","language":"CMake","funding_links":["https://github.com/sponsors/WinterMute","https://github.com/sponsors/fincs","https://patreon.com/devkitPro","https://devkitpro.org/support-devkitpro"],"categories":[],"sub_categories":[],"readme":"# `catnip` Manual\n\n\u003e *\"We homebrew developers are programmer cats 🐱.\n\u003e As such, we need some kind of recreational substance that alleviates the pain\n\u003e of using/invoking CMake, as well as managing multiple closely linked components.\n\u003e In other words, we need a Magic™ build tool that orchestrates everything.\"*\n\u003e\n\u003e -- from the Book of Lenny, 10:30\n\nCatnip is a command-line tool designed to improve the workflow around\nCMake-based projects, especially when using devkitPro tools.\n\n## Concepts\n\nCatnip can be used to automate development tasks with pure CMake projects.\nIt also supports *Catnip-laced* projects containing one or more *packages*, each\ndefining one or more *presets* specifying how to configure and build the package.\nPackages and presets in Catnip-laced projects are defined with a custom CMake-based API.\nPure CMake projects are considered to contain a single `main` package, with `release` (*default*) and `debug` presets.\n\nCatnip needs to know the path to the top level folder of the project, which is known as the *source root directory*.\nThis can be specified in the command line (`-S \u003cpath\u003e`), as an environment variable (`CATNIP_ROOT`), or\ndetected automatically. In the latter case, Catnip uses the current working directory, or the closest parent\ndirectory containing a `.catnip_root` file.\n\nCatnip creates and manages a *build folder*, where all generated files and compilation outputs will be stored.\nBy default (and also traditionally) this is `\u003ccatnip-root\u003e/build`, although it can be explicitly set in\nthe command line (`-B \u003cpath\u003e`) or with an environment variable (`CATNIP_BUILD_DIR`).\nThe build folder contains multiple subfolders named `\u003cpackage\u003e.\u003cpreset\u003e`, one for each configured preset of each package.\nThe build folder also keeps a default CMake cache, populated using user-provided command line arguments, whose values\nwill be forwarded to CMake by default when configuring presets. This makes it possible to set custom flags once and\nhave them be used in subsequent runs, persisting even after cleaning build subfolders. In addition, Catnip is capable\nof managing a dependency graph between packages/presets, which can be leveraged to ensure that certain required\ncomponents are built before others are allowed to be built.\n\nCatnip is designed with support for cross compilation and devkitPro CMake as a first class feature. For this reason, it introduces the concept of\na *Catnip toolset*, which is inspired by the eponymous concept some CMake generators use (Visual Studio, Xcode).\nIn Catnip's case it is the bare name of a toolchain file (case-insensitive without extension), which is searched within\n`CMAKE_MODULE_PATH`. This makes it easy to specify the devkitPro platform a given project targets directly by name,\ne.g. `3DS`, `Switch`, `WiiU`, etc.\n\nCatnip-laced projects declare their own layout and contents using CMake scripts processed in *script mode*.\nThe root directory of the project must contain a Catnip script, as well as every subdirectory that is added by it.\nThe Catnip script can be a file called `Catnip.cmake`, or alternatively `CMakeLists.txt` can be reused for this purpose.\nIn order to allow the directory to be detected as a Catnip-laced project instead of a pure CMake project, a call to the\n`catnip_package` command must appear somewhere within `CMakeLists.txt`. For example:\n\n```cmake\ncmake_minimum_required(VERSION 3.13)\n\nif(CATNIP) # CATNIP is defined/true if and only if this file is being processed as a Catnip script\n\tcatnip_package(MyPackage)\n\t# ... etc ...\n\n\treturn() # Stop processing this file and ignore everything after this point\nendif()\n\n# The rest of the CMake code of the project goes here\nproject(MyProject)\n# ... etc ...\n```\n\n## Command-line usage\n\n```bash\ncatnip [\u003coptions\u003e] [\u003cverb\u003e] [\u003cselector1\u003e \u003cselector2\u003e...]\n```\n\n### Verbs\n\n- `build` *(Default)*: Builds the project. This operation corresponds to `make`. The `-f` option can be specified to trigger a rebuild (similar to `make clean \u0026\u0026 make`).\n- `clean`: Cleans built intermediate files and artifacts. This operation corresponds to `make clean`. Note that the buildsystems generated by CMake aren't deleted by default -- use the `-f` option to remove them as well.\n- `install`: Builds the project and installs artifacts. This operation corresponds to `make install`. Dependencies of the specified selectors are built as well, but not installed. The `-f` option is supported, as in `build`.\n\n### Options\n\n- `-S \u003cpath-to-root\u003e`: Manually specifies the path to the Catnip source root directory.\n- `-B \u003cpath-to-build\u003e`: Manually specifies the path to the Catnip build folder.\n- `-D \u003cvar\u003e:\u003ctype\u003e=\u003cvalue\u003e, -D \u003cvar\u003e=\u003cvalue\u003e`: Adds a CMake cache entry to the current Catnip build folder.\n- `-U \u003cvar\u003e`: Removes a CMake cache entry from the current Catnip build folder. Note: unlike the corresponding CMake command line argument, Catnip does not support globbing.\n- `-T \u003ctoolset\u003e`: Specifies the default toolset used to configure and build projects. This option is saved in the Catnip build folder's default CMake cache, which means it only needs to be specified during the first build of a project.\n- `-p`: Enables package selector mode -- see below for more information.\n- `-v`: Enables verbose mode. When this option is specified; CMake configuration logs, as well as the full command line used to invoke tools, will be displayed on screen.\n- `-f`: Enables forceful mode -- see the Verbs section.\n\n### Selectors\n\nBy default, *selectors* specified in the command line refer to presets (e.g. `release`, `debug`) belonging to\nthe package defined in the current working directory (or the `main` package in the case of pure CMake projects).\nSpecify one or more preset names, or `all` to operate on all presets of the current package. If no presets are selected,\nCatnip will automatically choose the default preset(s) of the current package.\n\nIf package selector mode (`-p`) is enabled, *selectors* will instead have the following format, which allows for selecting any\npresets belonging to any arbitrary packages. Unlike in the default mode, at least one selector must be specified in the command line.\nThe following selector formats are supported:\n\n- `all`:                Selects all presets from all packages\n- `\u003cpackage\u003e`:          Selects a given package's default preset(s)\n- `\u003cpackage\u003e.all`:      Selects all presets from a given package\n- `\u003cpackage\u003e.\u003cpreset\u003e`: Selects a specific preset from a given package\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevkitpro%2Fcatnip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevkitpro%2Fcatnip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevkitpro%2Fcatnip/lists"}