Add compile options for clang-cl to allow it to compile riptide_cpp.#121
Merged
jack-pappas merged 1 commit intomasterfrom Mar 23, 2022
Merged
Add compile options for clang-cl to allow it to compile riptide_cpp.#121jack-pappas merged 1 commit intomasterfrom
jack-pappas merged 1 commit intomasterfrom
Conversation
jack-pappas
commented
Mar 23, 2022
| add_compile_options(-permissive- -d2FH4- -Zc:strictStrings-) | ||
| elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||
| add_compile_options(-Wno-unused-variable -Wno-unused-function) | ||
| add_compile_options(-march=haswell) |
Collaborator
Author
There was a problem hiding this comment.
FYI: I used this because specifying -mavx2 -mbmi2 like the script is doing for regular GCC/Clang wasn't enough. I got the following error about missing lzcnt support, and using -march=haswell fixed it:
src\BasicMath.cpp(2154,46): error : always_inline function '_lzcnt_u64' requires target feature 'lzcnt', but would be inlined into function 'PossiblyUpcast' that is compiled without support for 'lzcnt'
Contributor
There was a problem hiding this comment.
[nit] pls add indent
Collaborator
Author
There was a problem hiding this comment.
Ugh, sorry, I missed this comment before merging. Next time I'm poking around in here I'll fix the indentation.
Collaborator
Author
|
If you want to try compiling with setup.py @@ -27,11 +27,12 @@ class CMakeBuild(build_ext):
"-DRIPTIDE_PYTHON_VER=" + platform.python_version()
]
if platform.system() == 'Windows':
cmake_args += [
- '-GVisual Studio 16 2019'
+ '-GVisual Studio 17 2022',
+ '-TClangCL'
]
elif platform.system() == 'Linux':
if find_executable('ninja'):
cmake_args += [
'-GNinja' |
OrestZborowski-SIG
approved these changes
Mar 23, 2022
This file contains hidden or 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
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.
While trying to work out a compile error for #120 when compiling with Linux/GCC, I tried compiling with
clang-cland MSVC to see if I could easily reproduce the error that way. I wasn't quite able to get riptide_cpp to compile withclang-cl(and VS 2022.0), but I did make some progress towards getting it compiling -- mainly I needed to add the existing compile options for Clang to the options forclang-cl(detected as MSVC + Clang).It might be useful to set up a clang-cl build for riptide_cpp in the future. To that end, I'm submitting the CMakeLists.txt changes I tried, so when someone has time to sort out the remaining issue(s) they'll have a better starting point.
The remaining issues I see when attempting to compile:
Details
One other thing that surprised me (that seems worth investigating) -- even though the root CMakeLists.txt in the repo specifies the C++17 standard is required and that's respected when building with MSVC, building with clang-cl (via
python setup.py build) doesn't appear to respect the setting and falls back to compiling with C++14. I'm using CMake 3.22.1 in case it matters. From one build log:Details