Skip to content

add as_excutable option #1080

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

Closed
wants to merge 3 commits into from
Closed

add as_excutable option #1080

wants to merge 3 commits into from

Conversation

ds1sqe
Copy link

@ds1sqe ds1sqe commented Jun 3, 2024

add new option on build
( as_executable(flag:bool) )
which create executable output and
do not compile as lib

Copy link
Collaborator

@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, thanks for the PR, but I am hesitant to merge it.

cc is designed for compiling to static archive instead of executable, it would be a lot more work in supporting executable.

@ds1sqe
Copy link
Author

ds1sqe commented Jun 4, 2024

But it's will be great if can compile into executable, and i think we can do that by a little efforts.
So why do not add feature with unstable?
and with my PR, we can compile as executable (if the "files" have unique main) on gcc and clang and msvc, if the language is C or C++.
with existing out_dir and compile(path) option. ( the executable will be placed on out_dir / compile_arg )

@ds1sqe
Copy link
Author

ds1sqe commented Jun 4, 2024

And also there are some projects which have to compile some c / cpp project and configure root rust project with compiled c / cpp executable. that's why i upload this PR.
I think the .as_executable option will be much help on that case

@thomcc
Copy link
Member

thomcc commented Jun 8, 2024

I don't think we have the maintainer resources to support large new features like this, honestly. The architecture is also not set up to make this easy, and it's not clear to me that this patch is actually correct for multi-file projects in parallel mode. Either way, I think this is probably going to have to be closed, sorry.

@thomcc thomcc closed this Jun 8, 2024
@NobodyXu
Copy link
Collaborator

NobodyXu commented Jun 8, 2024

I think you can create another crate cc-executable which uses cc to generate an archive first, then compile it to an executable.

The code in this PR breaks parallel compilation, whereas using cc to generate an archive first would support parallel compilation and easier to implement.

cc @thomcc @ds1sqe I do think we can support generating object files instead of archive though, to support compiling to executable in another crate

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

Successfully merging this pull request may close these issues.

3 participants