nim-lang / RFCs

A repository for your Nim proposals.
135 stars 26 forks source link

Accept `zig cc` as a C compiler #489

Closed sls1005 closed 1 year ago

sls1005 commented 1 year ago

Abstract

Add an option: --cc:zig to support zig cc as a C compiler for the C backend of Nim, and zig c++ for the C++ backend.

Motivation

The command zig cc can be used as a C cross-compiler. And as a replacement for MinGW. So I hope it could be supported.

See: https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html

Description

The command is zig cc for C, and zig c++ for C++. The other cmdline options are the same as that of clang.

For example:

zig cc *.nim.c -I/usr/lib/nim/lib -o a.out

Code Examples

No response

Backwards Compatibility

No response

dom96 commented 1 year ago

This doesn't need any Nim support. It's already possible using this package https://github.com/nim-lang/packages/pull/2323

sls1005 commented 1 year ago

I see.