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

Clang requires compiler targets in order to work #28

Open
reynarzz opened this issue May 1, 2024 · 1 comment · May be fixed by #30
Open

Clang requires compiler targets in order to work #28

reynarzz opened this issue May 1, 2024 · 1 comment · May be fixed by #30
Labels
enhancement New feature or request

Comments

@reynarzz
Copy link

reynarzz commented May 1, 2024

I encountered some minor issues trying to build using Clang on Windows, it looks like we need to turn on a few compiler features.
I added this to the CMakeLists.txt and it's compiling.

if(WIN32)
target_compile_options(${PROJECT_NAME} PRIVATE 
"-mavx"
"-march=native"
"-mssse3"
"-msse4.1"
"-mpclmul"
"-maes"
)
endif()

However, some guards must be added to check if the processor contains these features.
On another note, Clang for Android (NDK) does not need this

@reynarzz reynarzz changed the title Clang (Windows) requires compiler targets in order to work Clang requires compiler targets in order to work May 1, 2024
@robinlinden robinlinden linked a pull request Jun 24, 2024 that will close this issue
@robinlinden robinlinden added the enhancement New feature or request label Jun 24, 2024
@robinlinden
Copy link
Owner

Thank you! I've opened a PR adding support for building with clang-cl as well as adding CI to make sure it remains working. :)

Looks like the #pragma ... target(...) macros in libsodium weren't ifdef'd in when building with clang-cl even though they're required, so manual feature-detection it is. This might be resolved in a newer version, so hopefully we can drop this once we've updated to target a more recent release of libsodium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants