(RFC) Have CMake generate vector.h files for test vectors #1723

issue josibake openend this issue on August 12, 2025
  1. josibake commented at 10:43 am on August 12, 2025: member

    Opening this as a follow-up to #1698 (review)


    Currently, test vector headers are generated from python files automatically as part of the make build system. It’s particularly nice when developing, as you can just modify the python script and the vector.h file gets regenerated automatically.

    I was curious how hard this would be in CMake, so tried to hack something together here: https://github.com/josibake/secp256k1/commit/953953d1f44b08b8ce75525c86eaa7091c3af15b

    This works-ish, in that I was able to generate the test vector files in the build directory and verified that changing the python scripts automatically regenerates the files. The main issue is CMake generates the header files out of tree, whereas the makefile generates them in tree. I don’t see a clear way to support both? The natural thing in mind would be to have these files be stubs and have generated header files in the build directory (the way that CMake is doing it).

    I do think it would be nice to have the build systems consistent, but curious if others thing this is wanted/needed before I spend more time refining it. As mentioned in #1698 (review), another perhaps even simpler approach would be to decouple the test vector generation from the build system entirely.

  2. real-or-random commented at 10:57 am on August 12, 2025: contributor

    Concept NACK

    I do think it would be nice to have the build systems consistent,

    Hm yes, in a world with infinite resources, yes. But I think if we’re pragmatic, then this just isn’t worth the effort. I claim it’s fine if you are required to use autotools if you are a developer changing the test vectors. (And it’s not even true: You can still use CMake and run the scripts manually.)

  3. real-or-random added the label feature on Aug 12, 2025
  4. real-or-random added the label build on Aug 12, 2025
  5. josibake commented at 8:13 am on August 13, 2025: member

    But I think if we’re pragmatic, then this just isn’t worth the effort.

    Agree, especially since I don’t see a clean way to support both when autotools wants to modify the files in place, but CMake would want to have the generated files out of the source tree. Thanks for chiming in!

  6. josibake closed this on Aug 13, 2025

  7. real-or-random commented at 11:07 am on August 13, 2025: contributor

    But I think if we’re pragmatic, then this just isn’t worth the effort.

    Agree, especially since I don’t see a clean way to support both when autotools wants to modify the files in place, but CMake would want to have the generated files out of the source tree. Thanks for chiming in!

    Sorry for the off-topic comment, but you may be surprised to learn that autotools support out-of-tree builds as well: https://www.gnu.org/software/automake/manual/html_node/VPATH-Builds.html


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-08-30 22:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me