Skip to content

Commit

Permalink
Windows build with clang-cl
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Apr 18, 2024
1 parent 10a389e commit a4fc1b6
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/windows-alt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,35 @@ jobs:
options: |
CMAKE_SYSTEM_NAME=Windows \
CMAKE_SYSTEM_PROCESSOR=x86_64 \
CMAKE_BUILD_TOOL=ninja.exe \
CMAKE_MAKE_PROGRAM=ninja.exe \
CMAKE_BUILD_TYPE=Release \
- name: Build Project
run: cmake --build ./build --target all
- name: Run tests
run: cmake --build ./build --target run_tests
clang-cl:
if: github.repository_owner == 'aws'
runs-on: windows-latest
steps:
- name: Install NASM
uses: ilammy/[email protected]
- name: Checkout
uses: actions/checkout@v4
- uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
- name: Setup CMake
uses: threeal/[email protected]
with:
generator: Ninja
c-compiler: clang-cl
cxx-compiler: clang-cl
options: |
CMAKE_SYSTEM_NAME=Windows \
CMAKE_SYSTEM_PROCESSOR=x86_64 \
CMAKE_MAKE_PROGRAM=ninja.exe \
CMAKE_BUILD_TYPE=Release \
- name: Build Project
run: cmake --build ./build --target all
- name: Run tests
run: cmake --build ./build --target run_tests
32 changes: 31 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,37 @@ if(GCC OR CLANG)
# TODO(CryptoAlg-759): enable '-Wpedantic' if awslc has to follow c99 spec.
if(CLANG OR (GCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.1.3"))
# GCC 4.1.3 and below do not support all of these flags or they raise false positives.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Werror")
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-bad-function-cast")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-cast-function-type-strict")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-cast-function-type")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-cast-align")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-cast-qual")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-comma")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-c++98-compat")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-declaration-after-statement")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-disabled-macro-expansion")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-deprecated-declarations")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-extra-semi-stmt")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-extra-semi")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-implicit-int-conversion")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-missing-noreturn")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-missing-variable-declarations")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-overlength-strings")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-nonportable-system-include-path")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-reserved-identifier")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shorten-64-to-32")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-sign-conversion")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unreachable-code-break")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-tautological-value-range-compare")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unreachable-code-return")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-unsafe-buffer-usage")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-unused-macros")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-used-but-marked-unused")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -Werror")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wwrite-strings -Wformat-security -Wunused-result")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wvla -Wtype-limits")
Expand Down

0 comments on commit a4fc1b6

Please sign in to comment.