Skip to content
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

C APIのstaticlibもビルドされるようにする (and リリースに含める?) #948

Open
3 tasks done
qryxip opened this issue Jan 26, 2025 · 1 comment
Open
3 tasks done

Comments

@qryxip
Copy link
Member

qryxip commented Jan 26, 2025

内容

次のようにして、.a/.libもビルドされるようにします。

--- a/crates/voicevox_core_c_api/Cargo.toml
+++ b/crates/voicevox_core_c_api/Cargo.toml
@@ -9,3 +9,3 @@
 [lib]
-crate-type = ["cdylib"]
+crate-type = ["cdylib", "staticlib"]
 name = "voicevox_core"

ビルド時間ですが、感覚的にはcdylibstaticlib両方をビルドするようにしても、秒単位で増えることはない感じです。コンパイルがどういう仕組みになっているかはあまり理解しきれていませんが、大部分が共通化できてる感じなんでしょうか?

Pros 良くなる点

  • バインディングとかを作るときとかに利便性が上がる…かも?

Cons 悪くなる点

  • (もしリリースまでする場合)配布物のサイズ増加はあると思います。手元のビルドを見たら、libvoicevox_core.soが5MBなのに対してlibvoicevox_core.aは15MBでした。

実現方法

VOICEVOXのバージョン

OSの種類/ディストリ/バージョン

  • Windows
  • macOS
  • Linux

その他

@Hiroshiba
Copy link
Member

Hiroshiba commented Jan 26, 2025

作るとサポートする必要があり、かつあまり静的ライブラリに知識がないので、後々大変になりそうな可能性もあるかもな〜と感じました!
パッと思いつくのだと、特殊な環境向け(android?やios?やweb?など)にはどうするのが正しいのかとか知らないなぁと。
もちろん他にも考えることは数多ありそう。、

別にdllしかないならdllだけ使えばよく、.aがあればそちらを使う人もいるというだけで、特に便利にはならない気がするので、あえて増やさない選択もありかも。
あった方が嬉しいという需要を聞いてから、あるいはあった方が嬉しいあるあるな事情を思い付いてからにしたいかも。

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

No branches or pull requests

2 participants