Giter VIP home page Giter VIP logo

Comments (2)

pablosichert avatar pablosichert commented on July 24, 2024

@ealmloff pointed me to the following locations of interest where dioxus sets the rustflags:

.set_rust_flags(rust_flags)

static CLIENT_RUST_FLAGS: &str = "-C debuginfo=none -C strip=debuginfo";
// The `opt-level=2` increases build times, but can noticeably decrease time
// between saving changes and being able to interact with an app. The "overall"
// time difference (between having and not having the optimization) can be
// almost imperceptible (~1 s) but also can be very noticeable (~6 s) β€” depends
// on setup (hardware, OS, browser, idle load).
static SERVER_RUST_FLAGS: &str = "-C opt-level=2";
static DEBUG_RUST_FLAG: &str = "-C debug-assertions";
fn rust_flags(build: &ConfigOptsBuild, base_flags: &str) -> String {
let mut rust_flags = base_flags.to_string();
if !build.release {
rust_flags += " ";
rust_flags += DEBUG_RUST_FLAG;
};
rust_flags
}
pub fn client_rust_flags(build: &ConfigOptsBuild) -> String {
rust_flags(build, CLIENT_RUST_FLAGS)
}
pub fn server_rust_flags(build: &ConfigOptsBuild) -> String {
rust_flags(build, SERVER_RUST_FLAGS)
}

The Cargo Book states on build.rustflags:

There are four mutually exclusive sources of extra flags. They are checked in order, with the first one being used:

  1. CARGO_ENCODED_RUSTFLAGS environment variable.
  2. RUSTFLAGS environment variable.
  3. All matching target.<triple>.rustflags and target.<cfg>.rustflags config entries joined together.
  4. build.rustflags config value.

So this behavior is not entirely unsurprising.

I don't know of any obvious solution, but one (rather elaborate) approach would be to search the hierarchy for config.toml and read the files in Dioxus itself: https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure.

from dioxus.

pablosichert avatar pablosichert commented on July 24, 2024

#2259 seems to be somewhat related.

from dioxus.

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.