Skip to content
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

CMake: Add LLVM build for Windows and other linker fixes #71713

Merged
merged 8 commits into from
Feb 16, 2024

Conversation

alef
Copy link
Contributor

@alef alef commented Feb 12, 2024

Summary

Build "CMake: Add LLVM build for Windows and other linker fixes"

Purpose of change

  • Compile and link using LLVM v17 for Windows.
  • Simplify logic for embedding the manifest.
  • Fix MINGW executable not running right after the build.
  • Fix LNK4098 from MSVC

Describe the solution

  • Add a new CMake preset for using LLVM on Windows. Requires LLVM_ROOT to be defined. Default C:\Program Files\LLVM
  • LLVM build uses clang-cl.exe so that we can reuse flags from MSVC.cmake toolchain file
  • Removed a weird logic to handle manifest because it wasn't clear /MANIFEST:NO was about commanding the linker to not automatically generate and embed a manifest.
  • Instead of manually stripping the MSYS/MINGW build manually, just add --strip-debug to ld.exe to make the executable run on native Windows.
  • Handle /NODEFAULTLIB: and CMAKE_MSVC_RUNTIME_LIBRARY to fix MSVC's linker warning LNK4098 about conflicting libraries.
  • Do not always write version.h when configuring the build. Avoid version.cpp to be rebuilt when there is no need.

Describe alternatives you've considered

Split this PR in smaller ones.

Testing

✅ Build and run LLVM, MSVC and UCRT64 executables

Additional context

N/A

@github-actions github-actions bot added Code: Build Issues regarding different builds and build environments [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Feb 12, 2024
@alef alef marked this pull request as ready for review February 12, 2024 10:15
src/CMakeLists.txt Outdated Show resolved Hide resolved
@alef alef requested a review from Qrox February 15, 2024 21:31
@Maleclypse Maleclypse merged commit f9801d8 into CleverRaven:master Feb 16, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions Code: Build Issues regarding different builds and build environments [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants