-
Notifications
You must be signed in to change notification settings - Fork 221
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: a few fixes for multi-config generators #2357
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5d22c3c
cmake: a few fixes for multi-config generators
apwojcik 7ff6bb5
Merge branch 'develop' into multiconfig
apwojcik 6849950
Merge branch 'develop' into multiconfig
junliume e555b0b
Merge branch 'develop' into multiconfig
apwojcik 58b71d5
Merge branch 'develop' into multiconfig
junliume 1ffcfef
Update CMakeLists.txt
apwojcik e923f11
incorporate review feedback
apwojcik 0648004
Merge branch 'develop' into multiconfig
apwojcik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,89 +26,104 @@ | |
# - Enable warning all for gcc/clang or use /W4 for visual studio | ||
|
||
## Strict warning level | ||
if (MSVC) | ||
# Use the highest warning level for visual studio. | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w") | ||
# set(CMAKE_CXX_WARNING_LEVEL 4) | ||
# if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") | ||
# string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
# else () | ||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") | ||
# endif () | ||
set(__msvc_cxx_compile_options /W4) | ||
|
||
# set(CMAKE_C_WARNING_LEVEL 4) | ||
# if (CMAKE_C_FLAGS MATCHES "/W[0-4]") | ||
# string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") | ||
# else () | ||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") | ||
# endif () | ||
set(__default_cxx_compile_options | ||
-Wall | ||
-Wextra | ||
-Wcomment | ||
-Wendif-labels | ||
-Wformat | ||
-Winit-self | ||
-Wreturn-type | ||
-Wsequence-point | ||
-Wswitch | ||
-Wtrigraphs | ||
-Wundef | ||
-Wuninitialized | ||
-Wunreachable-code | ||
-Wunused | ||
-Wno-ignored-qualifiers | ||
-Wno-sign-compare | ||
) | ||
|
||
else() | ||
foreach(COMPILER C CXX) | ||
set(CMAKE_COMPILER_WARNINGS) | ||
# use -Wall for gcc and clang | ||
list(APPEND CMAKE_COMPILER_WARNINGS | ||
-Wall | ||
-Wextra | ||
-Wcomment | ||
-Wendif-labels | ||
-Wformat | ||
-Winit-self | ||
-Wreturn-type | ||
-Wsequence-point | ||
# Shadow is broken on gcc when using lambdas | ||
# -Wshadow | ||
-Wswitch | ||
-Wtrigraphs | ||
-Wundef | ||
junliume marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-Wuninitialized | ||
-Wunreachable-code | ||
-Wunused | ||
-Wno-ignored-qualifiers | ||
-Wno-sign-compare | ||
) | ||
if (CMAKE_${COMPILER}_COMPILER_ID MATCHES "Clang") | ||
list(APPEND CMAKE_COMPILER_WARNINGS | ||
-Weverything | ||
-Wno-c++98-compat | ||
-Wno-c++98-compat-pedantic | ||
-Wno-conversion | ||
-Wno-double-promotion | ||
-Wno-exit-time-destructors | ||
-Wno-extra-semi | ||
-Wno-extra-semi-stmt | ||
-Wno-float-conversion | ||
-Wno-gnu-anonymous-struct | ||
-Wno-gnu-zero-variadic-macro-arguments | ||
-Wno-missing-prototypes | ||
-Wno-nested-anon-types | ||
-Wno-option-ignored | ||
-Wno-padded | ||
-Wno-return-std-move-in-c++11 | ||
-Wno-shorten-64-to-32 | ||
-Wno-sign-conversion | ||
-Wno-unknown-warning-option | ||
-Wno-unused-command-line-argument | ||
-Wno-weak-vtables | ||
-Wno-covered-switch-default | ||
-Wno-unused-result | ||
-Wno-unsafe-buffer-usage | ||
-Wno-deprecated-declarations | ||
-Wno-shadow-uncaptured-local | ||
) | ||
else() | ||
if (CMAKE_${COMPILER}_COMPILER_ID MATCHES "GNU" AND ${COMPILER} MATCHES "CXX") | ||
# cmake 3.5.2 does not support >=. | ||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1") | ||
list(APPEND CMAKE_COMPILER_WARNINGS | ||
-Wno-ignored-attributes) | ||
endif() | ||
endif() | ||
list(APPEND CMAKE_COMPILER_WARNINGS | ||
-Wno-missing-field-initializers | ||
) | ||
endif() | ||
add_definitions(${CMAKE_COMPILER_WARNINGS}) | ||
endforeach() | ||
endif () | ||
set(__clang_cxx_compile_options | ||
-Weverything | ||
-Wno-c++98-compat | ||
-Wno-c++98-compat-pedantic | ||
-Wno-conversion | ||
-Wno-double-promotion | ||
-Wno-exit-time-destructors | ||
-Wno-extra-semi | ||
-Wno-extra-semi-stmt | ||
-Wno-float-conversion | ||
-Wno-gnu-anonymous-struct | ||
-Wno-gnu-zero-variadic-macro-arguments | ||
-Wno-missing-prototypes | ||
-Wno-nested-anon-types | ||
-Wno-option-ignored | ||
-Wno-padded | ||
-Wno-return-std-move-in-c++11 | ||
-Wno-shorten-64-to-32 | ||
-Wno-sign-conversion | ||
-Wno-unknown-warning-option | ||
-Wno-unused-command-line-argument | ||
-Wno-weak-vtables | ||
-Wno-covered-switch-default | ||
-Wno-unused-result | ||
-Wno-unsafe-buffer-usage | ||
-Wno-deprecated-declarations | ||
-Wno-shadow-uncaptured-local | ||
-Wno-global-constructors | ||
-Wno-reserved-identifier | ||
-Wno-zero-as-null-pointer-constant | ||
-Wno-ignored-attributes | ||
-Wno-deprecated | ||
-Wno-incompatible-pointer-types | ||
-Wno-old-style-cast | ||
-Wno-unknown-attributes | ||
-Wno-microsoft-cpp-macro | ||
-Wno-microsoft-enum-value | ||
-Wno-language-extension-token | ||
-Wno-c++11-narrowing | ||
-Wno-float-equal | ||
-Wno-redundant-parens | ||
-Wno-format-nonliteral | ||
-Wno-unused-template | ||
-Wno-comma | ||
-Wno-suggest-destructor-override | ||
-Wno-switch-enum | ||
-Wno-shift-sign-overflow | ||
-Wno-suggest-override | ||
-Wno-inconsistent-missing-destructor-override | ||
-Wno-cast-function-type | ||
-Wno-nonportable-system-include-path | ||
-Wno-incompatible-pointer-types | ||
-Wno-documentation | ||
-Wno-deprecated-builtins | ||
-Wno-enum-constexpr-conversion | ||
-Wno-unused-value | ||
-Wno-unused-parameter | ||
-Wno-missing-noreturn | ||
-Wno-tautological-constant-out-of-range-compare) | ||
if(WIN32) | ||
list(APPEND __clang_cxx_compile_options | ||
-fdelayed-template-parsing | ||
-fms-extensions | ||
-fms-compatibility) | ||
endif() | ||
|
||
set(__gnu_cxx_compile_options | ||
-Wno-missing-field-initializers | ||
) | ||
|
||
add_compile_options( | ||
"$<$<CXX_COMPILER_ID:MSVC>:${__msvc_cxx_compile_options}>" | ||
"$<$<CXX_COMPILER_ID:Clang>:${__default_cxx_compile_options};${__clang_cxx_compile_options}>" | ||
"$<$<CXX_COMPILER_ID:GNU>:${__default_cxx_compile_options};${__gnu_cxx_compile_options}>" | ||
) | ||
Comment on lines
+120
to
+124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Recommendation] @apwojcik This should work, but please double-check correctness of this. |
||
|
||
unset(__msvc_cxx_compile_options) | ||
unset(__default_cxx_compile_options) | ||
unset(__gnu_cxx_compile_options) | ||
unset(__clang_cxx_compile_options) |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@apwojcik 🐛 These extra double ticks break HIP kernel builds on offline path (
-DMIOPEN_USE_COMGR=Off -DMIOPEN_USE_HIPRTC=Off
), and, possibly, on COMgr path (-DMIOPEN_USE_HIPRTC=Off
), thus affecting Tuna. Fix TBD soon./cc @JehandadKhan @junliume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #2544