Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lacasseio/sample-boost-asio
Demonstrate how to "hide" native dependencies with macro includes
https://github.com/lacasseio/sample-boost-asio
Last synced: 2 days ago
JSON representation
Demonstrate how to "hide" native dependencies with macro includes
- Host: GitHub
- URL: https://github.com/lacasseio/sample-boost-asio
- Owner: lacasseio
- Created: 2023-11-09T11:18:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-09T12:13:34.000Z (about 1 year ago)
- Last Synced: 2024-11-11T21:42:33.083Z (2 months ago)
- Language: C++
- Size: 66.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# How to "hide" dependencies containing macro includes?
In Gradle's native plugins, macro includes result in all header search paths being inputs for the compilation unit, potentially causing excessive recompilation.
This default behavior is evidenced in the info log: `Cannot locate header file for '#include MACRO' in source file 'file.hpp'. Assuming changed.`
This leads Gradle to consider every file in the include path as a dependency to prevent flaky builds.Gradle has an internal flag, activated via a system property (`org.gradle.internal.native.headers.unresolved.dependencies.ignore=true`), which allows it to disregard unresolved header dependencies.
While this could result in "missing" headers, in most real-life scenarios, such "missing" headers are unlikely to affect the compilation process.For stable and infrequently updated dependencies, leveraging separate dependency variants for headers and version markers allows Gradle to snapshot the header search paths, passed by arguments, by value.
This effectively shields the search paths from Gradle's header dependency discovery, focusing on the explicit paths provided.A/B testing should be conducted to confirm that this method indeed accelerates the build process.
While custom features can offer tailored solutions, it's generally preferable to utilize core Gradle features for build optimization, ensuring a balance between performance gains and maintainability.