{"id":20177809,"url":"https://github.com/tfc/cmake_cpp_example","last_synced_at":"2025-04-10T04:31:04.058Z","repository":{"id":43040534,"uuid":"197813853","full_name":"tfc/cmake_cpp_example","owner":"tfc","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-04T19:15:01.000Z","size":41,"stargazers_count":14,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T05:43:53.333Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Nix","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/tfc.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}},"created_at":"2019-07-19T17:09:26.000Z","updated_at":"2025-03-14T19:41:44.000Z","dependencies_parsed_at":"2024-12-04T20:21:58.380Z","dependency_job_id":"82e5eaf7-e5ea-47f6-808f-25c558514fa3","html_url":"https://github.com/tfc/cmake_cpp_example","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/tfc%2Fcmake_cpp_example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfc%2Fcmake_cpp_example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfc%2Fcmake_cpp_example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfc%2Fcmake_cpp_example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tfc","download_url":"https://codeload.github.com/tfc/cmake_cpp_example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248157379,"owners_count":21056999,"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":[],"created_at":"2024-11-14T02:17:30.633Z","updated_at":"2025-04-10T04:31:04.022Z","avatar_url":"https://github.com/tfc.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cmake monorepo example with optional package manager dependency management\n\nThis project consists of five individual repos in one big monorepo:\n\n- `a/`\n- `b/`\n- `c/`\n- `d/`\n- `app/`\n\nThese have the following dependency tree:\n\n![The modules in this repo depend on each other](deptree.png)\n\nThe whole idea of this example repository is to show that this whole repo\ncan be used in two different scenarios:\n\n1. Using legacy package management or one large docker image, the whole project\n   and its libraries can be built in one large step using the workflow:\n\n   ```bash\n   mkdir build \u0026\u0026 cd build\n   cmake ..\n   make\n   ```\n2. Using `nix`, individual packages can be built as packages in a way that they\n   can be cached individually and reference each other:\n\n   ```bash\n   nix-build release.nix -A myapp # other attributes to build are a, b, c, and d\n   ```\n\n# Workflow PROs and CONs\n\nLet's compare what each workflow buys us\n\n## Legacy workflow\n\n### PRO Legacy\n\n- Fine-granular rebuilds: If one file is touched, the build system will find out\n  itself what the minimal rebuild set is. Incremental builds are faster during\n  development.\n- Legacy workflow is what people are used to:\n  Either install all needed packages globally, or run a docker image as\n  developer shell and be able to edit anything in the monorepo\n\n### CON Legacy\n\n- The dependency closure is the superset of all modules. All modules see all\n  dependencies.\n- If the repository is checked out, everything in this folder that is not a\n  globally available dependency, must be rebuilt.\n  Although the libraries in this repo are libraries like the globally installed\n  ones, there is an artificial difference between them.\n\n## Nix workflow\n\n### Pro Nix\n\n- Fine granular dependency closures: For every module, the right minimal\n  closure can be instantiated without unneeded dependencies. This enforces\n  structure.\n- Libraries can be cached by external machines.\n- There is no difference between globally available system libraries and local\n  libraries any longer. Both can be substituted by locally patched versions\n  without putting the burden on the developer to manage include/link settings.\n- As it makes no difference if a library is in this repository or anywhere else,\n  libraries can easily be \"outsourced\" to other repos.\n\n### Contra Nix\n\n- It may look alien to users of legacy systems that another shell has to be\n  started for development in every module of this project.\n- If something is changed in e.g. library `D`, then `A` and `MyApp` have to be\n  not only relinked but rebuilt. The smaller the individual packages are, the\n  lesser is this a problem.\n\n# References\n\nThe `find_package`-NOP macro idea originates from Daniel Pfeifer's talk about\nCMake at the C++Now 2017 conference:\nhttps://www.youtube.com/watch?v=bsXLMQ6WgIk\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftfc%2Fcmake_cpp_example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftfc%2Fcmake_cpp_example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftfc%2Fcmake_cpp_example/lists"}