-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export src dir via cargo #580
Conversation
@@ -3,6 +3,8 @@ name = "c2a-core" | |||
version = "3.9.0-beta.6" | |||
edition = "2021" | |||
|
|||
links = "c2a-core" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
元来はコンパイルした後にリンクするときの識別子.
C2A coreは(今は)linkできない(=libビルドできない)ので,build.rsでの識別子としてしか使ってない
@@ -6,6 +6,8 @@ use semver::Version; | |||
use clang::{token::TokenKind::Punctuation, Clang, Index}; | |||
|
|||
fn main() { | |||
println!("cargo:source_dir={}", env!("CARGO_MANIFEST_DIR")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env!("CARGO_MANIFEST_DIR")
がc2a-core本体がいるpath(で,これは予測不可能(cargoがcrateをあつめてbuildフォルダ?(まあ,ざっくりcrateがおいてある場所)に集める場所なので)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
で,そのディレクトリを cargo:source_dir
(これはuser定義変数)として取得したい.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println!("cargo:hoge= ...
は,cargoにhoge optionを ... として伝える機能
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hogeがcargoの知ってる変数であれば,cargoの挙動が変わる.
一方で,source_dirはcargoは知らない変数であり,かつ,この変数をcrateつかいたい側がこの変数をみたいことがある.
そのときにlinksがないと,参照できない
参照の仕方はこう
env::var("DEP_C2A_CORE_SOURCE_DIR").unwrap();
DEP_${links}_変数名
なのは仕様
概要
Cargo を経由して
c2a-core
crate のソースファイルのディレクトリを依存先の crate に公開するIssue/PR
詳細
影響範囲
c2a-core
crate のユーザー補足
リリースしたい