Skip to content

Commit

Permalink
Test compilation with clang-cl
Browse files Browse the repository at this point in the history
  • Loading branch information
timangus committed Sep 4, 2023
1 parent 36ec2d3 commit b4b6526
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/windows-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mkdir %BUILD_DIR%
cd %BUILD_DIR%
cmake --version || EXIT /B 1
cmake -DCMAKE_UNITY_BUILD=%UNITY_BUILD% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -GNinja ^
-DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" ^
-DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_CXX_COMPILER="clang-cl.exe" ^
.. || EXIT /B 1
type variables.bat
call variables.bat
Expand Down
12 changes: 10 additions & 2 deletions source/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ if(MSVC)

# Only do MSVC code analysis on CI
if(DEFINED ENV{CI})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /analyze")
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /analyze")
endif()
endif()

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \
Expand All @@ -95,7 +97,13 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
/permissive- \
/Zc:rvalueCast /Zc:inline /Zc:strictStrings \
/Zc:wchar_t /Zc:throwingNew")
/Zc:wchar_t")

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-narrowing")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew")
endif()

# Assembler
ENABLE_LANGUAGE(ASM_MASM)
Expand Down
2 changes: 1 addition & 1 deletion source/thirdparty/cryptopp/config_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// discussed at http://github.com/weidai11/cryptopp/issues/147.
#if (defined(_MSC_VER) && defined(__clang__) && \
!(defined( __clang_analyzer__)) && !defined(__INTEL_LLVM_COMPILER))
# error: "Unsupported configuration"
//# error: "Unsupported configuration"
#endif

// Windows platform
Expand Down

0 comments on commit b4b6526

Please sign in to comment.