-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows build with clang-cl; CI for Windows/ARM64 build #1538
Merged
Conversation
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
justsmth
force-pushed
the
windows-clang-cl
branch
27 times, most recently
from
April 22, 2024 13:00
8c2e497
to
2fec18c
Compare
justsmth
changed the title
[DRAFT] Windows build with clang-cl
Windows build with clang-cl; CI for Windows/ARM64 build
Apr 22, 2024
justsmth
force-pushed
the
windows-clang-cl
branch
from
April 22, 2024 13:02
2fec18c
to
8ba3ae3
Compare
smittals2
previously approved these changes
Apr 23, 2024
justsmth
force-pushed
the
windows-clang-cl
branch
2 times, most recently
from
April 30, 2024 12:44
801d0fa
to
e19977e
Compare
justsmth
force-pushed
the
windows-clang-cl
branch
from
April 30, 2024 22:20
e19977e
to
83cdd47
Compare
smittals2
previously approved these changes
Apr 30, 2024
samuel40791765
previously approved these changes
Apr 30, 2024
This was referenced May 3, 2024
diff --git a/.github/workflows/windows-alt.yml b/.github/workflows/windows-alt.yml index 5d808ad19..e25ef8350 100644 --- a/.github/workflows/windows-alt.yml +++ b/.github/workflows/windows-alt.yml @@ -63,12 +63,64 @@ 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' + strategy: + fail-fast: false + matrix: + target: + - x64 + - x64_arm64 + runs-on: windows-latest + steps: + - if: ${{ matrix.target == 'x64' }} + name: Install NASM + uses: ilammy/[email protected] + - name: Remove wrong clang-cl.exe + run: rm "C:/Program Files/LLVM/bin/clang-cl.exe" + - name: Checkout + uses: actions/checkout@v4 + - uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: ${{ matrix.target }} + - if: ${{ matrix.target == 'x64' }} + name: Setup CMake + uses: threeal/[email protected] + with: + generator: Ninja + c-compiler: clang-cl + cxx-compiler: clang-cl + options: | + CMAKE_CROSSCOMPILING=${{ ((matrix.target == 'x64') && '0') || '1' }} \ + CMAKE_SYSTEM_NAME=Windows \ + CMAKE_SYSTEM_PROCESSOR=x86_64 \ + CMAKE_BUILD_TYPE=Release \ + - if: ${{ matrix.target == 'x64_arm64' }} + name: Setup CMake + uses: threeal/[email protected] + with: + generator: Ninja + c-compiler: clang-cl + cxx-compiler: clang-cl + options: | + CMAKE_CROSSCOMPILING=1 \ + CMAKE_SYSTEM_NAME=Windows \ + CMAKE_SYSTEM_PROCESSOR=ARM64 \ + CMAKE_C_COMPILER_TARGET=arm64-pc-windows-msvc \ + CMAKE_ASM_COMPILER_TARGET=arm64-pc-windows-msvc \ + CMAKE_CXX_COMPILER_TARGET=arm64-pc-windows-msvc \ + CMAKE_BUILD_TYPE=Release \ + - name: Build Project + run: cmake --build ./build --target all + - if: ${{ matrix.target == 'x64' }} + name: Run tests + run: cmake --build ./build --target run_tests cross-mingw: if: github.repository_owner == 'aws' runs-on: ubuntu-22.04 @@ -95,4 +147,3 @@ jobs: - name: x86_64-w64-mingw32 Build/Test run: ./tests/ci/run_cross_mingw_tests.sh x86_64 w64-mingw32 "-DCMAKE_BUILD_TYPE=Release" - diff --git a/CMakeLists.txt b/CMakeLists.txt index 3089697c7..8dace468f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -347,7 +347,15 @@ 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) + # clang-cl sets different default warnings than clang. It also treats -Wall + # as -Weverything, to match MSVC. Instead -W3 is the alias for -Wall. + # See http://llvm.org/viewvc/llvm-project?view=revision&revision=319116 + set(C_CXX_FLAGS "${C_CXX_FLAGS} -W3 -Wno-unused-parameter -fmsc-version=1900 -Werror") + set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-deprecated-declarations") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Werror") + endif() 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") @@ -359,12 +367,7 @@ if(GCC OR CLANG) endif() set(C_CXX_FLAGS "${C_CXX_FLAGS} -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings") - if(MSVC) - # clang-cl sets different default warnings than clang. It also treats -Wall - # as -Weverything, to match MSVC. Instead -W3 is the alias for -Wall. - # See http://llvm.org/viewvc/llvm-project?view=revision&revision=319116 - set(C_CXX_FLAGS "${C_CXX_FLAGS} -W3 -Wno-unused-parameter -fmsc-version=1900") - else() + if(!MSVC) if(EMSCRIPTEN) # emscripten's emcc/clang does not accept the "-ggdb" flag. set(C_CXX_FLAGS "${C_CXX_FLAGS} -g")
justsmth
force-pushed
the
windows-clang-cl
branch
from
May 13, 2024 13:02
9c4db6f
to
b02504b
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1538 +/- ##
=======================================
Coverage 77.91% 77.91%
=======================================
Files 560 560
Lines 94613 94613
Branches 13618 13618
=======================================
+ Hits 73720 73722 +2
+ Misses 20299 20298 -1
+ Partials 594 593 -1 ☔ View full report in Codecov by Sentry. |
samuel40791765
approved these changes
May 13, 2024
skmcgrail
approved these changes
May 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issues
Needed for: aws/aws-lc-rs#376
Description
CMakeLists.txt
to support a Windows build usingclang-cl
.Callout
-ggdb
build flag via CMAKE_C_FLAGS or by using the "Relwithdebinfo" or "Debug" build types.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.