Skip to content

Add a CMake build system beside configure/make - #966

Open
DiamonDinoia wants to merge 2 commits into
flame:masterfrom
DiamonDinoia:cmake-port
Open

DiamonDinoia wants to merge 2 commits into
flame:masterfrom
DiamonDinoia:cmake-port

Conversation

@DiamonDinoia

Copy link
Copy Markdown

Hi Devin,

I would like to make contributions to blis but all my editors require cmake for linting to work. I asked AI to port all the options and features from the current build system in cmake. And I asked them to verify that the compile commands are the same flag per flag, file per file object per object.

After a few rounds of review, modularization I ended up with something I understand seems reasonable. I re-wrote the docs as they were full of em dashes. The performance on my machine is the same as other other build system. And in my tests it does what I expect. This does not need to be mainteined for others. You can mark it as experimental dev only. I only need this to be able to make other changes, mainly by hand.

Cheers,
Marco

The CMake build supports the configure options, environment variables, make target names, compiler flags and install layout of the configure/make build. It adds per-config flag tables, the testsuite, blastest and examples in dual mode, documentation in docs/BuildSystemCMake.md, and GitHub Actions CI for Linux, macOS and Windows.

Assisted-by: XiaomiMiMo/MiMo-V2.6-Pro-MOPD
Assisted-by: claude-sonnet-5-5
Assisted-by: Qwen/Qwen3.8-27B-FP8
Assisted-by: claude-opus-5-5
Assisted-by: mistralai/Mistral-Medium-3.5-128B

The CMake build supports the configure options, environment variables, make target names, compiler flags and install layout of the configure/make build. It adds per-config flag tables, the testsuite, blastest and examples in dual mode, documentation in docs/BuildSystemCMake.md, and GitHub Actions CI for Linux, macOS and Windows.

Squashed from:
- Add CMake per-config flag tables (translation of config/*/make_defs.mk)
- Add CMake build system (configs, threading, BLAS/CBLAS, install, packaging)
- Port testsuite, blastest, and examples to dual-mode CMake
- Document the CMake build (option mapping, plugin flow)
- Audit fixes: memkind link parity, sde emulator path, f2c flags, changelog guard, pc serialization
- Add GitHub Actions CI for the CMake build (parallel to CircleCI make flow)
- Link consumers of openmp builds against OpenMP::OpenMP_C for static linking
- CI: add macOS (firestorm, single/pthreads) and Windows (ucrt64) CMake legs

Assisted-by: XiaomiMiMo/MiMo-V2.6-Pro-MOPD
Assisted-by: claude-sonnet-5-5
Assisted-by: Qwen/Qwen3.8-27B-FP8
Assisted-by: claude-opus-5-5
Assisted-by: mistralai/Mistral-Medium-3.5-128B
@jeffhammond

Copy link
Copy Markdown
Member

I'm concerned that you did not use enough AI models to generate this PR 😆

@DiamonDinoia

Copy link
Copy Markdown
Author

Put them against each other so the keep themselves in check

@devinamatthews

Copy link
Copy Markdown
Member

CMake is definitely overdue, so thanks for the PR. I'll review shortly.

@devinamatthews

Copy link
Copy Markdown
Member

One quick thing I noted: I really would rather not add Github Actions, but I would be OK with moving all of the CircleCI tests to CMake. Given a full working CMake the next release would have the traditional configure script deprecated and then eventually replaced with a CMake wrapper.

@DiamonDinoia

Copy link
Copy Markdown
Author

Happy to do so.

@DiamonDinoia

Copy link
Copy Markdown
Author

I cannot see why it failed so I cannot fix :(

@devinamatthews

Copy link
Copy Markdown
Member

/usr/bin/bash: line 1: pacman: command not found

The CMake build matches configure/make on every checked surface.
Compile commands match make on the checked configs.
The generated blis.pc and config.mk match make apart from prefix
lines.
Every make target name exists as a CMake target.
The install layout matches make, with and without DESTDIR.

Correctness fixes close the wrong-result rows found in review.
Assembly sources compile in the assembler dialect configure uses.
The uninstall targets remove the Windows DLL and import library.
Tests fail on a nonzero exit code or on a FAILURE line in the
output.

The modules split into files with one concern each in cmake/.
The per-config flag tables are generated from the make tables.
The CMake files drop from 7,217 lines to under 3,700.
The top CMakeLists.txt is at most 300 lines.

The minimum version is CMake 3.20...4.4.
The build supports MSVC, clang-cl, the clang GNU frontend and
MinGW.
A CI workflow builds and tests Linux, Windows, MSVC and s390x.
The CMake files are formatted with gersemi.

Assisted-by: Hermes Agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants