1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builder: add support for icc (Intel C Compiler) (#14975)

This commit is contained in:
CC 2022-07-07 10:48:07 -06:00 committed by GitHub
parent 758f84fa86
commit 6b597a4b58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -22,7 +22,7 @@ The major way to get the latest and greatest V, is to __install it from source__
It is __easy__, and it usually takes __only a few seconds__.
### Linux, macOS, FreeBSD, etc:
You need `git`, and a C compiler like `tcc`, `gcc` or `clang`, and `make`:
You need `git`, and a C compiler like `tcc`, `gcc`, `icc` or `clang`, and `make`:
```bash
git clone https://github.com/vlang/v
cd v
@ -38,7 +38,7 @@ git clone https://github.com/vlang/v
cd v
make.bat -tcc
```
NB: You can also pass one of `-gcc`, `-msvc`, `-clang` to `make.bat` instead,
NB: You can also pass one of `-gcc`, `-msvc`, `-clang`, to `make.bat` instead,
if you do prefer to use a different C compiler, but -tcc is small, fast, and
easy to install (V will download a prebuilt binary automatically).

View File

@ -147,6 +147,7 @@ mut:
debug_mode bool
is_cc_tcc bool
is_cc_gcc bool
is_cc_icc bool
is_cc_msvc bool
is_cc_clang bool
//
@ -240,6 +241,7 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
//
ccoptions.is_cc_tcc = ccompiler.contains('tcc') || ccoptions.guessed_compiler == 'tcc'
ccoptions.is_cc_gcc = ccompiler.contains('gcc') || ccoptions.guessed_compiler == 'gcc'
ccoptions.is_cc_icc = ccompiler.contains('icc') || ccoptions.guessed_compiler == 'icc'
ccoptions.is_cc_msvc = ccompiler.contains('msvc') || ccoptions.guessed_compiler == 'msvc'
ccoptions.is_cc_clang = ccompiler.contains('clang') || ccoptions.guessed_compiler == 'clang'
// For C++ we must be very tolerant
@ -275,6 +277,15 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
}
optimization_options = ['-O3', '-fno-strict-aliasing', '-flto']
}
if ccoptions.is_cc_icc {
if ccoptions.debug_mode {
debug_options = ['-g']
if user_darwin_version > 9 {
debug_options << '-no-pie'
}
}
optimization_options = ['-Ofast', '-fno-strict-aliasing']
}
//
if ccoptions.debug_mode {
ccoptions.args << debug_options