Page MenuHomePhabricator

[SECP256K1] CMake: allow to select field and scalar implementation
ClosedPublic

Authored by Fabien on Jan 28 2020, 12:21.

Details

Summary

This adds 2 new options, USE_FIELD and USE_SCALAR which can be
32bit or 64bit to force the implementation. If not set (or set to
any other value) the implementation is autodetected.
This is a port of the autotools --with-field and --with-scalar
configure options.

Test Plan

Run the Travis build (see
https://travis-ci.org/Fabcien/secp256k1/builds/642847130).

cmake -GNinja .. \
  -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/Linux32.cmake \
  -DUSE_FIELD=64bit

Check that cmake outputs an error:

64 finite field requested but the compiler does not support __int128 or
inline assembly
cmake -GNinja .. \
  -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/Linux32.cmake \
  -DUSE_SCALAR=64bit

Check that cmake outputs an error:

64 scalar requested but the compiler does not support __int128

Diff Detail

Repository
rABC Bitcoin ABC
Branch
secp256k1_cmake_field_scalar
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 9171
Build 16296: Default Diff Build & Tests
Build 16295: arc lint + arc unit