{"id":23009554,"url":"https://github.com/devolutions/cbake","last_synced_at":"2026-03-09T12:33:32.669Z","repository":{"id":34729088,"uuid":"183070177","full_name":"Devolutions/CBake","owner":"Devolutions","description":"Baking CMake toolchain files like they were cookies","archived":false,"fork":false,"pushed_at":"2026-01-15T15:32:07.000Z","size":87,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-01-15T19:03:26.014Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Devolutions.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-04-23T18:06:51.000Z","updated_at":"2026-01-15T15:15:39.000Z","dependencies_parsed_at":"2024-02-21T18:48:12.515Z","dependency_job_id":"d2e0e2eb-b929-4104-8bc6-823a9ca33adc","html_url":"https://github.com/Devolutions/CBake","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/Devolutions/CBake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devolutions%2FCBake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devolutions%2FCBake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devolutions%2FCBake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devolutions%2FCBake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Devolutions","download_url":"https://codeload.github.com/Devolutions/CBake/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Devolutions%2FCBake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30295219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T11:12:22.024Z","status":"ssl_error","status_checked_at":"2026-03-09T11:10:54.577Z","response_time":61,"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":[],"created_at":"2024-12-15T09:14:56.046Z","updated_at":"2026-03-09T12:33:32.632Z","avatar_url":"https://github.com/Devolutions.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CBake\n\nCBake (cross-bake) is a project meant to simplify the creation of cross-compilation environments between major platforms using a combination of [clang+llvm](https://llvm.org/) and common developer tools.\n\n## Prerequisites\n\n * [PowerShell 7](https://github.com/PowerShell/PowerShell#get-powershell)\n * [Docker buildx](https://docs.docker.com/buildx/working-with-buildx)\n * [CMake (latest)](https://cmake.org/download/)\n * [Ninja build](https://github.com/ninja-build/ninja/releases)\n * [clang+llvm (12+)](https://github.com/llvm/llvm-project/releases)\n\n Clone this repository anywhere you like, and then set the CBAKE_HOME environment variable to point to it.\n\n## Linux sysroot creation\n\nThe first step is to create cross-compilation sysroots for major Linux distributions using Docker buildx. This part should be done on a Linux filesystem, so either use a Linux host or WSL2 on Windows. The recipes are nothing more than Dockerfiles installing the packages you want to be part of the target sysroot.\n\n```powershell\nImport-Module $Env:CBAKE_HOME/cbake.psm1 -Force\n$distros = Get-ChildItem $(Get-CbakePath 'recipes') | Select-Object -ExpandProperty Name\n$distros | ForEach-Object { New-CBakeSysroot -Distro $_ -Arch 'arm64' }\n$distros | ForEach-Object { Import-CBakeSysroot -Distro $_ -Arch 'arm64' }\n```\n\nThe packaged sysroots are packaged in the \"packages\" directory, after which they can be reused without having to rebuild them from source. The sysroots are imported under the \"sysroots\" directory for cross-compilation.\n\n## Linux cross-compilation\n\nOnce you have built and imported a few sysroots, you can try cross-compiling the [Ninja build system](https://ninja-build.org/) executable to all targets using the provided Linux [CMake](https://cmake.org/) toolchain file. Clone the ninja sources and then move into the directory:\n\n```bash\ngit clone https://github.com/ninja-build/ninja.git\ncd \"ninja\"\n```\n\nIn a Linux environment, one can generate makefiles for a given target (Ubuntu 18.04 arm64) using CMake:\n\n```bash\nexport CMAKE_TOOLCHAIN_FILE=\"$CBAKE_HOME/cmake/linux.toolchain.cmake\"\nmkdir build-cross \u0026\u0026 cd build-cross\ncmake -DCMAKE_TOOLCHAIN_FILE=\"$CMAKE_TOOLCHAIN_FILE\" -DSYSROOT_NAME=\"ubuntu-18.04-arm64\" ..\nmake\n```\n\nIf the project generation and compilation succeeded, you can then verify that the `ninja` executable is indeed cross-compiled to ARM64:\n\n```bash\n$ file ninja\nninja: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, not stripped\n````\n\nCongratulations! You have successfully cross-compiled your first project. The CMAKE_TOOLCHAIN_FILE command-line parameter is not required with CMake 3.21 or later if the [CMAKE_TOOLCHAIN_FILE environment variable](https://cmake.org/cmake/help/latest/envvar/CMAKE_TOOLCHAIN_FILE.html) is set - this can save a lot of typing.\n\nYou can go a step further and automate the cross-compilation of to all targets in PowerShell with this more elaborate sample:\n\n```powershell\nNew-Item -Path \"build\" -ItemType 'Directory' -ErrorAction 'SilentlyContinue' | Out-Null\nSet-Location \"build\"\n$SysrootNames = Get-ChildItem $(Get-CbakePath 'sysroots') | Select-Object -ExpandProperty Name\nforeach ($SysrootName in $SysrootNames) {\n    New-Item -Path $SysrootName -ItemType 'Directory' -ErrorAction 'SilentlyContinue' | Out-Null\n    Set-Location $SysrootName\n    $ToolchainFile = Join-Path $(Get-CBakePath 'cmake') \"linux.toolchain.cmake\"\n    $CMakeOptions = @(\"-G\", \"Ninja\",\n        \"-DCMAKE_TOOLCHAIN_FILE=\\\"$ToolchainFile\\\"\",\n        \"-DSYSROOT_NAME=$SysrootName\",\n        \"-DCMAKE_BUILD_TYPE=Release\")\n    Write-Host 'cmake' $CMakeOptions \"../..\"\n    \u0026 'cmake' $CMakeOptions \"../..\"\n    \u0026 'cmake' '--build' '.'\n    Set-Location \"..\"\n}\nSet-Location \"..\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevolutions%2Fcbake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevolutions%2Fcbake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevolutions%2Fcbake/lists"}