-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for building with clang-cl
This commit allows building with the Visual Studio LLVM toolchain by passing --cc=clangcl to the configure.py script.
- Loading branch information
1 parent
3e2a7ce
commit 630d6f1
Showing
6 changed files
with
134 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
macro_name CLANG | ||
|
||
minimum_supported_version 19.30 | ||
|
||
binary_name clang-cl | ||
linker_name lld-link | ||
|
||
output_to_object "/Fo" | ||
output_to_exe "/OUT:" | ||
|
||
add_include_dir_option "/I" | ||
add_system_include_dir_option "/external:W0 /external:I" | ||
add_lib_dir_option "/LIBPATH:" | ||
add_compile_definition_option "/D" | ||
add_lib_option "%s.lib" | ||
|
||
compile_flags "/nologo /c" | ||
|
||
supports_gcc_inline_asm yes | ||
|
||
optimization_flags "/O2 /Oi" | ||
size_optimization_flags "/O1 /Os" | ||
|
||
# for debug info in the object file (required if using sccache): | ||
#debug_info_flags "/Z7" | ||
|
||
# for using a PDB file: | ||
debug_info_flags "/Zi /FS" | ||
|
||
preproc_flags "/nologo /EP" | ||
|
||
lang_flags "/std:c++20 /EHs /GR" | ||
|
||
# 4251: STL types used in DLL interface | ||
# 4275: ??? | ||
# 5072: ASan without debug info | ||
warning_flags "/W4 /wd4251 /wd4275 /wd5072" | ||
|
||
werror_flags "/WX" | ||
|
||
visibility_build_flags "/DBOTAN_DLL=__declspec(dllexport)" | ||
visibility_attribute "__declspec(dllimport)" | ||
|
||
# Include dependency tracking for Ninja | ||
# See: https://ninja-build.org/manual.html#ref_headers | ||
ninja_header_deps_style 'msvc' | ||
header_deps_flag '/showIncludes' | ||
|
||
ar_command lib | ||
ar_options "/nologo" | ||
ar_output_to "/OUT:" | ||
|
||
<sanitizers> | ||
default -> address | ||
|
||
iterator -> "/D_ITERATOR_DEBUG_LEVEL=1" | ||
address -> "/fsanitize=address" | ||
</sanitizers> | ||
|
||
<isa_flags> | ||
sse2 -> "-msse2" | ||
ssse3 -> "-mssse3" | ||
sse41 -> "-msse4.1" | ||
sse42 -> "-msse4.2" | ||
avx2 -> "-mavx2" | ||
avx512 -> "-mavx512f -mavx512bw -mavx512dq -mavx512vbmi -mavx512vbmi2 -mavx512bitalg -mavx512vl -mavx512ifma" | ||
|
||
bmi2 -> "-mbmi -mbmi2" | ||
aesni -> "-maes -mpclmul" | ||
rdrand -> "-mrdrnd" | ||
rdseed -> "-mrdseed" | ||
sha -> "-msha" | ||
altivec -> "-maltivec" | ||
|
||
arm64:armv8crypto -> "-march=armv8+crypto" | ||
arm64:armv8sha512 -> "-march=armv8.2-a+sha3" | ||
|
||
arm32:neon -> "-mfpu=neon" | ||
arm64:neon -> "" | ||
</isa_flags> | ||
|
||
<lib_flags> | ||
debug -> "/Fd%{build_dir}/%{libname}.pdb" | ||
</lib_flags> | ||
|
||
<so_link_commands> | ||
default -> "{linker} /DLL" | ||
default-debug -> "{linker} /DLL /DEBUG" | ||
</so_link_commands> | ||
|
||
<binary_link_commands> | ||
default -> "{linker}" | ||
default-debug -> "{linker} /DEBUG" | ||
</binary_link_commands> | ||
|
||
<mach_abi_linking> | ||
all -> "/bigobj" | ||
|
||
# These can be overridden with --msvc-runtime option | ||
rt -> "/MD" | ||
rt-debug -> "/MDd" | ||
</mach_abi_linking> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters