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

Selecting library entrypoint over binary entrypoint #864

Open
9SMTM6 opened this issue Sep 5, 2024 · 2 comments
Open

Selecting library entrypoint over binary entrypoint #864

9SMTM6 opened this issue Sep 5, 2024 · 2 comments

Comments

@9SMTM6
Copy link
Contributor

9SMTM6 commented Sep 5, 2024

I might be missing something, but it appears to me that we're unable to select the library entrypoint if there are any binary entrypoints.

I've tried to rename my binary entrypoint and use data-target-name to select the library, but to no avail. The moment there is a binary entrypoint, whether implicitly via an existing main.rs, or explicitly with a different name declared in Cargo.toml, it seems trunk wants to compile that entrypoint.

@9SMTM6
Copy link
Contributor Author

9SMTM6 commented Sep 5, 2024

I have an issue with that since I want to use embassy-executor - yes, I'll likely have both that async executor and wasm_thread in my webpage in the end 😓 - , which comes with the #[embassy_executor::main] macro, and I can't make that work on a binary entrypoint on wasm. I might be able to work around that, but frankly I'd prefer not to do it that way.

If I didnt overlook something, I could try and make a PR for that. I'm uncertain about the API you would prefer. I think an explicit data-lib attribute to select the library would make for the easiest discovery and best errors, but alternatively I could also try and fix the selection of the compilation target. However then, from my understanding, people will always have to have specifically named binary entrypoint when they also want to target native as well, because AFAIK both the library and default binary entrypoint take their name from package.name

@9SMTM6
Copy link
Contributor Author

9SMTM6 commented Sep 5, 2024

My need for this is gone after all. Still happy to help, if you want this.

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

No branches or pull requests

1 participant