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

[native_toolchain_c] Some CTool options don't apply to linking #1793

Open
blaugold opened this issue Dec 9, 2024 · 0 comments
Open

[native_toolchain_c] Some CTool options don't apply to linking #1793

blaugold opened this issue Dec 9, 2024 · 0 comments

Comments

@blaugold
Copy link
Contributor

blaugold commented Dec 9, 2024

IMHO, a few options defined in CTool don't apply to linking and should only be available for CBuilder.

  • sources: The name suggests compilation from some kind of source file. Also, relative paths are resolved relative to the HookConfig.packageRoot. So conceptionally this options is for source files in the package and should be in CBuilder. Object files can be passed to compilers and linkers, so it would make sense to have a new option objects in CTool that is resolved relative to HookConfig.buildDirectory for relative files (it seems more likely that users want to link some object file that was just built by the hook than shipping precompiled object files in the package). To link in whole static libraries CTool.libraries ([native_toolchain_c] Add libraries and libraryDirectories options to CTool #1423) feels pretty intuitive.
  • includes: Include directives are specific to source file compilation.
  • flags: It's confusing that you can pass flags to the linker through this option as well as CLinker.linkerOptions. For CBuilder it makes sense to have flags and linkerOptions because we need to distinguish between compiler and linker flags (especially for MSVC where linker flags and only linker flags must follow /link). So linkerOptions should eventually be in CTool.
  • defines: Also a source file compilation-specific thing.
  • std: Sets the language standard to use for source file compilation, so does not apply to linking.
  • optimizationLevel: Sets the optimization level to compile source files with, so does not apply to linking.
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

1 participant