{"id":37141532,"url":"https://github.com/measurement-kit/mkbuild","last_synced_at":"2026-01-14T16:37:00.571Z","repository":{"id":81494215,"uuid":"167992317","full_name":"measurement-kit/mkbuild","owner":"measurement-kit","description":"Updates CMake and scripts for running docker","archived":true,"fork":false,"pushed_at":"2020-02-26T14:13:03.000Z","size":114,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-19T04:16:29.903Z","etag":null,"topics":["cmake","code-generators","docker"],"latest_commit_sha":null,"homepage":"https://measurement-kit.github.io/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/measurement-kit.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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-28T16:13:16.000Z","updated_at":"2023-01-28T10:16:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea945436-5f87-460f-a699-4e8f10ec5267","html_url":"https://github.com/measurement-kit/mkbuild","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/measurement-kit/mkbuild","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/measurement-kit%2Fmkbuild","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/measurement-kit%2Fmkbuild/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/measurement-kit%2Fmkbuild/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/measurement-kit%2Fmkbuild/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/measurement-kit","download_url":"https://codeload.github.com/measurement-kit/mkbuild/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/measurement-kit%2Fmkbuild/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28426109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:32:27.303Z","status":"ssl_error","status_checked_at":"2026-01-14T16:28:36.419Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cmake","code-generators","docker"],"created_at":"2026-01-14T16:36:59.969Z","updated_at":"2026-01-14T16:37:00.562Z","avatar_url":"https://github.com/measurement-kit.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MKBuild\n\nMKBuild is a small utility to simplify managing Measurement\nKit builds. This tool performs two main tasks:\n\n1. generates or updates a `CMakeLists.txt` that downloads\n   required dependencies, configures strict compiler flags,\n   builds libraries and executables, and run tests;\n\n2. generates or updates the `docker.sh` that runs a CMake\n   based build inside a specific Docker container, with\n   specific compiler flags (e.g. for `asan`).\n\nMKBuild is driven by the configuration contained in the\n`MKBuild.yml` YAML file. Read on for more info.\n\n## Getting MKBuild\n\n```\ngo get -v github.com/measurement-kit/mkbuild\n```\n\n## Converting a repository to use MKBuild\n\nCreate `MKBuild.yaml` in the toplevel directory of your project. This\nfile should look like this:\n\n```YAML\nname: mkcurl\n\ndocker: bassosimone/mk-debian\n\ndependencies:\n- curl.haxx.se/ca\n- github.com/adishavit/argh\n- github.com/catchorg/catch2\n- github.com/curl/curl\n- github.com/measurement-kit/mkmock\n\ntargets:\n  libraries:\n    mkcurl:\n      compile: [mkcurl.cpp]\n  executables:\n    mkcurl-client:\n      compile: [mkcurl-client.cpp]\n      link: [mkcurl]\n    tests:\n      compile: [tests.cpp]\n    integration-tests:\n      compile: [integration-tests.cpp]\n      link: [mkcurl]\n\ntests:\n  mocked_tests:\n    command: tests\n  integration_tests:\n    command: integration-tests\n  redirect_test:\n    command: mkcurl-client --follow-redirect http://google.com\n```\n\nWhere `name` is the name of the project, `docker` is the name of the\ndocker container to use, `dependencies` lists the IDs of the dependencies\nyou want to download and install, `targets` tells us what artifacts you\nwant to build, and `tests` what tests to executed.\n\nSee `cmake/deps/deps.go` for all the available deps IDs. Dependencies\nthat compile to static/shared libraries (e.g. `libcurl`) will be downloaded\nautomatically on Windows, and must be already installed on Unix systems. If a\ndependency is not already installed on Unix, the related `cmake` check will\nfail when running `cmake` later on. The build flags will be automatically\nadjusted to account for a dependency (e.g. `CXXFLAGS` and `LDFLAGS` will be\nupdated to use cURL's headers and libraries).\n\nThe `libraries` key specifies what libraries to build and the\n`executables` key what executables to build. Both contain maps where the\ntarget name maps to build information. Depending on the system, proper\nfile extensions and prefixes will be added. In the above example, the\ninstructions require us to build a library called `mkcurl`, which will\nbecome `libmkcurl.a` on Unix and `mkcurl.lib` on Windows. (This is\ndone for us by CMake and is actually how CMake works.)\n\nThe build information is composed of two keys, `compile`, which indicates which\nsources to compile, and `link`, which indicates which libraries to link. You\ndo not need to list here the dependencies, since they're already added\nautomatically, as mentioned above. But you can list here libraries built as part\nof the current build. In the above example, the `integration-tests` binary\nwill link with the (static) library called `mkcurl`, in addition to linking\nto all the libraries implied by the declared dependencies.\n\nThe `tests` key indicates what test to run. Each key inside `tests` is the name\nof a test. The `command` key indicates what command to execute. Of course, the\ncommand line arguments can be quoted, if required.\n\n## (Re)Generating CMakeLists.txt and docker.sh\n\nOne you've written (or updated) `MKBuild.yaml`, just run\n\n```\nmkbuild\n```\n\nThis will generate (or update) `CMakeLists.txt` and `docker.sh`.\n\nYou should commit these files to the repository.\n\n## Build instructions\n\nSince `mkbuild` generates a `CMakeLists.txt` and we suggest to commit\nit to your repository, the build instructions are the standard build\ninstructions of any CMake based software project (we tend to use\n`ninja`, so the following instructions use `ninja`):\n\n```\nmkdir build\ncd build\ncmake -GNinja ..\ncmake --build .\nctest -a -j8 --output-on-failure\n```\n\n## Running a build using Docker\n\nProvided that you have Docker installed, running a docker based\nbuild is as simple as running:\n\n```\n./docker.sh \u003cbuild-type\u003e\n```\n\nRun `docker.sh` without arguments to see the available build types. The\nnames of the build types should be self explanatory.\n\n## Travis CI\n\nThe `.travis.yml` file should look like:\n\n```YAML\nlanguage: c++\nservices:\n  - docker\nsudo: required\nmatrix:\n  include:\n    - env: BUILD_TYPE=\"asan\"\n    - env: BUILD_TYPE=\"clang\"\n    - env: BUILD_TYPE=\"coverage\"\n    - env: BUILD_TYPE=\"ubsan\"\n    - env: BUILD_TYPE=\"vanilla\"\nscript:\n  - ./docker.sh $BUILD_TYPE\n```\n\nThis is equal to what we have now, _except_ that the name of the script\nto run docker is now different.\n\n## AppVeyor\n\nThe `.appveyor.yml` is quite like the one that we use now:\n\n```YAML\nimage: Visual Studio 2017\nenvironment:\n  matrix:\n    - CMAKE_GENERATOR: \"Visual Studio 15 2017 Win64\"\n    - CMAKE_GENERATOR: \"Visual Studio 15 2017\"\nbuild_script:\n  - cmd: cmake -G \"%CMAKE_GENERATOR%\" .\n  - cmd: cmake --build . -- /nologo /property:Configuration=Release\n  - cmd: ctest --output-on-failure -C Release -a\n```\n\nThe main difference is that we don't need to force `git` to update\nthe subrepos anymore.\n\n## Rationale\n\nThis software is meant to replace the [github.com/measurement-kit/cmake-utils](\nhttps://github.com/measurement-kit/cmake-utils) and\n[github.com/measurement-kit/ci-common](\ngithub.com/measurement-kit/ci-common) subrepositories. Rather than\nhaving to keep the submodules up to date, we automatically generate files\nand scripts implementing the same functionality.\n\nBecause this tool generates standalone `CMakeLists.txt` and `docker.sh`, it\nmeans that it can easily be replaced with better tools, or no tools. Yet, the\nburden of keeping in sync the subrepos is gone and it is replaced with the\nmuch lower burden of running `mkbuild` from time to time to sync.\n\nAn earlier design of this tool was such that `CMakeLists.txt` and\n`docker.sh` were not committed to the repository. Yet, this is probably\nnot advisable since it may lead to non reproducible builds, because\nthe newly generated `CMakeLists.txt` and/or `docker.sh` may differ. In\nany case, should we decided that _not committing_ these files into\nthe repository is instead better, we just need to update the build\ninstructions to mention to compile and run `mkbuild` as the first step.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeasurement-kit%2Fmkbuild","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeasurement-kit%2Fmkbuild","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeasurement-kit%2Fmkbuild/lists"}