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 5, 2023
1 parent a688c75 commit 6a4e8a4
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ jobs:
- name: Compile
shell: cmd
run: call scripts\windows-build.bat
env:
CC: cl.exe
CXX: cl.exe
- name: NSIS Installer
shell: cmd
run: call installers\windows\build.bat
Expand All @@ -104,6 +107,7 @@ jobs:
shell: bash
env:
SYM_UPLOAD_URL: ${{ secrets.SYM_UPLOAD_URL }}

macos:
name: macOS
runs-on: macos-12
Expand Down Expand Up @@ -211,6 +215,37 @@ jobs:
build/clang/**/*.cpp
build/clang/**/*.cxx
windows-clang:
name: Windows Clang
runs-on: windows-2019
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
modules: ${{ env.QT_MODULES }}
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: ccache
uses: hendrikmuhs/[email protected]
with:
variant: sccache
key: windows-clang
- uses: ilammy/msvc-dev-cmd@v1
- uses: seanmiddleditch/gha-setup-ninja@v3
- name: Compile
shell: cmd
run: call scripts\windows-build.bat
env:
CC: clang-cl.exe
CXX: clang-cl.exe
- uses: actions/upload-artifact@v3
with:
name: Windows Clang Logs
path: build/*.log

clang-tidy:
name: Clang-Tidy
runs-on: ubuntu-latest
Expand Down Expand Up @@ -527,6 +562,7 @@ jobs:
- windows
- macos
- clang-debug
- windows-clang
- clang-tidy
- cppcheck
- clazy
Expand All @@ -548,6 +584,10 @@ jobs:
with:
name: Windows Logs
path: logs/windows
- uses: actions/download-artifact@v3
with:
name: Windows Clang Logs
path: logs/windows-clang
- uses: actions/download-artifact@v3
with:
name: Static Analysis Logs
Expand Down
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=%CC% -DCMAKE_CXX_COMPILER=%CXX% ^
.. || 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 6a4e8a4

Please sign in to comment.