Git Product home page Git Product logo

Comments (3)

est31 avatar est31 commented on August 18, 2024

One hack (mentioned in the Cargo issue and in the u128 tracking issue) is to use a #[cfg]s in a build script to emit feature selections for the main crate.

build.rs gets always compiled for the host platform but has to create programs for the target platform. If the two platforms are different (in a cross compilation scenario), the platform build.rs gets built for is different from the platform it has to build stuff for. So don't use #[cfg] or cfg! in build.rs for that purpose. Instead, build.rs has the TARGET env var.

from curve25519-dalek.

hdevalence avatar hdevalence commented on August 18, 2024

It seems like the "optimal" thing to do would be something like the following:

  • Allow explicit backend selection with u32, u64, avx2 features;
  • If no backend feature is specified, build.rs looks at the TARGET env var and makes a best-guess about which backend to use, then emits that feature for the main compilation.

However, because we load the entire crate into the build.rs already in order to generate constants using crate-private code, we need to have already selected the target backend before compiling the build script. So the approach above won't work. But this seems like the only way to access crate-private code without exposing it to the public.

from curve25519-dalek.

hdevalence avatar hdevalence commented on August 18, 2024

The current status is that the u64 backend is used by default, and that all backends are selectable with features.

Ideally we would auto-select the backend, but for the reasons described above we can't currently do this.

from curve25519-dalek.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.