Skip to content

Need to filter cargo rerun-if-changed directives #39

Description

@yongqli

Currently running cargo build -vv in highs-sys dir outputs lines such as:

[highs-sys 1.11.0] cargo:rerun-if-changed=/Users/username/Projects/highs-sys/target/debug/build/highs-sys-1c83f0054887d3e0/out/include/highs/interfaces/highs_c_api.h
[highs-sys 1.11.0] cargo:rerun-if-changed=/Users/username/Projects/highs-sys/target/debug/build/highs-sys-1c83f0054887d3e0/out/include/highs/lp_data/HighsCallbackStruct.h
[highs-sys 1.11.0] cargo:rerun-if-changed=/Users/username/Projects/highs-sys/target/debug/build/highs-sys-1c83f0054887d3e0/out/include/highs/util/HighsInt.h
[highs-sys 1.11.0] cargo:rerun-if-changed=/Users/username/Projects/highs-sys/target/debug/build/highs-sys-1c83f0054887d3e0/out/include/highs/HConfig.h
[highs-sys 1.11.0] cargo:rustc-link-search=native=/Users/username/Projects/highs-sys/target/debug/build/highs-sys-1c83f0054887d3e0/out/lib
[highs-sys 1.11.0] cargo:rustc-link-search=native=/Users/username/Projects/highs-sys/target/debug/build/highs-sys-1c83f0054887d3e0/out/lib64

The named files are in the output directory itself, so it will trigger further rebuilds.

The culprit is that autogenerated header files are parsed by bindgen, which will them print the rerun directives due to .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())). As a quick hack commenting out that line fixes the issue, confirming that it is the cause.

I propose that we create a custom version of CargoCallbacks that filters out header files in the output directory itself. I can create pull request if interested.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions