-
Notifications
You must be signed in to change notification settings - Fork 64
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
build: Add ClangCL profiles #791
base: master
Are you sure you want to change the base?
Conversation
Also fix some compilation errors catched by clang Signed-off-by: Ali Cheraghi <[email protected]>
Signed-off-by: Ali Cheraghi <[email protected]>
Signed-off-by: Ali Cheraghi <[email protected]>
Signed-off-by: Ali Cheraghi <[email protected]>
else() | ||
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") | ||
endif() | ||
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${NBL_COMPILER_DYNAMIC_RUNTIME}>:DLL>") |
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.
AFAIK in Clang and GCC there are options about static linking of libstd-c++
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.
else() | ||
list(APPEND NBL_DXC_CMAKE_OPTIONS "-DCMAKE_MSVC_RUNTIME_LIBRARY:STATIC=MultiThreaded$<$<CONFIG:Debug>:Debug>") | ||
endif() | ||
list(APPEND NBL_DXC_CMAKE_OPTIONS "-DCMAKE_MSVC_RUNTIME_LIBRARY:STATIC=MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${NBL_COMPILER_DYNAMIC_RUNTIME}>:DLL>") |
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.
same as with the general nabla comment
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.
if(NOT NBL_COMPILER_DYNAMIC_RUNTIME) | ||
message(FATAL_ERROR "Turn NBL_COMPILER_DYNAMIC_RUNTIME on! For dynamic Nabla builds dynamic runtime is mandatory!") | ||
endif() |
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.
aah ok so we want to ban compiling with static-libstdc++
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.
yes we agreed it must match
list(APPEND NBL_CXX_COMPILE_OPTIONS | ||
-Wextra | ||
-fno-strict-aliasing | ||
-msse4.2 |
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.
mavx
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.
I think you might also need a flag for stripping debug symbols
-Wno-sequence-point | ||
-Wno-unused-parameter | ||
-Wno-unused-but-set-parameter | ||
-Wno-c++98-compat | ||
-Wno-c++98-compat-pedantic | ||
-Wno-padded | ||
-Wno-unsafe-buffer-usage | ||
-Wno-switch-enum | ||
-Wno-error=ignored-attributes | ||
-Wno-error=unused-function | ||
-Wno-error=unused-variable | ||
-Wno-error=unused-parameter | ||
-Wno-error=ignored-attributes | ||
-Wno-error=non-pod-varargs |
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.
I take it that we'll remove this over time?
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.
yes, @YasInvolved is going to kill all warnings
-Wno-error=unused-parameter | ||
-Wno-error=ignored-attributes | ||
-Wno-error=non-pod-varargs | ||
-fno-exceptions |
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.
I dont think we can compile without exceptions, there are some try-catch block in our code IIRC ?
set(NBL_CXX_RELEASE_COMPILE_OPTIONS | ||
-fexpensive-optimizations | ||
) |
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.
I think O3 enables this by default ?
# RelWithDebInfo | ||
set(NBL_CXX_RELWITHDEBINFO_COMPILE_OPTIONS "") |
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.
what about O1 or something ? Alos don't you need ggdb3
?
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.
or even O2
|
||
# Debug | ||
set(NBL_CXX_DEBUG_COMPILE_OPTIONS | ||
-ggdb3 -Wall -fno-omit-frame-pointer -fstack-protector-strong |
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.
is ggdb3
sufficient?
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.
shouldn't -g
also be used?
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.
btw GCC/Clang have an equivalent of ffast math that we use in MSVC
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.
actually ggdb3
doesn't exist on clang and it throws a warning about unknown arg
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.
yeah I swear it was a GCC / Emscripten thing
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.
also ggdb3 is for GDB, I think on Clang one is supposed to use LLDB
# our pervious flags-set function called this, does not affect flags nor configs so I will keep it here temporary | ||
# TODO: move it out from the profile | ||
link_libraries(-fuse-ld=gold) |
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.
what about incremental linking and stuff?
include_guard(GLOBAL) | ||
|
||
# Debug |
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.
what about macro definitions like NDEBUG
?
P.S. should MSVC even define should macros from commandline instead of configuring theminto the header?
# Debug | ||
set(NBL_C_DEBUG_COMPILE_OPTIONS | ||
-ggdb3 -Wall -fno-omit-frame-pointer -fstack-protector-strong | ||
) | ||
|
||
# Release | ||
set(NBL_C_RELEASE_COMPILE_OPTIONS | ||
-fexpensive-optimizations | ||
) | ||
|
||
# RelWithDebInfo | ||
set(NBL_C_RELWITHDEBINFO_COMPILE_OPTIONS "") | ||
|
||
# Global | ||
list(APPEND NBL_C_COMPILE_OPTIONS | ||
-Wextra | ||
-fno-strict-aliasing | ||
-msse4.2 | ||
-maes | ||
-mfpmath=sse | ||
-Wextra | ||
-Wno-sequence-point | ||
-Wno-unused-parameter | ||
-Wno-unused-but-set-parameter | ||
-Wno-c++98-compat | ||
-Wno-c++98-compat-pedantic | ||
-Wno-padded | ||
-Wno-unsafe-buffer-usage | ||
-Wno-switch-enum | ||
-Wno-error=ignored-attributes | ||
-Wno-error=unused-function | ||
-Wno-error=unused-variable | ||
-Wno-error=unused-parameter | ||
-Wno-error=ignored-attributes | ||
-Wno-error=non-pod-varargs | ||
-fno-exceptions | ||
) | ||
|
||
if(NBL_SANITIZE_ADDRESS) | ||
list(APPEND NBL_C_COMPILE_OPTIONS -fsanitize=address) | ||
endif() | ||
|
||
if(NBL_SANITIZE_THREAD) | ||
list(APPEND NBL_C_COMPILE_OPTIONS -fsanitize=thread) | ||
endif() | ||
|
||
# our pervious flags-set function called this, does not affect flags nor configs so I will keep it here temporary | ||
# TODO: move it out from the profile | ||
link_libraries(-fuse-ld=gold) |
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.
same comments as for C++, maybe unify a bit with a common cmake include ?
@@ -330,7 +330,7 @@ class IDescriptorSetLayout : public IDescriptorSetLayoutBase | |||
bindings[i].binding = i; | |||
bindings[i].type = type; | |||
bindings[i].createFlags = SBinding::E_CREATE_FLAGS::ECF_NONE; | |||
bindings[i].stageFlags = stageAccessFlags ? stageAccessFlags[i]:asset::IShader::ESS_ALL_OR_LIBRARY; | |||
bindings[i].stageFlags = stageAccessFlags ? stageAccessFlags[i]:asset::IShader::E_SHADER_STAGE::ESS_ALL_OR_LIBRARY; |
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.
hlsl::ShaderStage`
//! Workarounds for compiler specific bugs | ||
// MSVC 2019 is a special snowflake | ||
#if defined(_MSC_VER) && _MSC_VER>=1920 | ||
#if defined(_MSC_VER) && !defined(__clang__) && _MSC_VER>=1920 |
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.
can we just ban old MSC_VER and old GCC ? and not do weird macro tricks ( or less)
SSharedCreationParams() {} | ||
|
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.
we'll lose designated initializers with a default ctor
…er new compile errors after upgrading VS and toolsets (coming from DXC source files)
… NBL_REQUEST_COMPILE_OPTION_SUPPORT, add required instruction set features for simdjson explicitly; now I hit GLI errors due to bad templates
|
||
# also instead of enabling single options maybe we could consider requesting an | ||
# instruction implementation set instead, eg -march=haswel, though this approach | ||
# could add a few more flags then we actually need while building - to rethink |
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.
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.
… (to latest and our own fork not mine, this one was 6 years old) submodules
Also fix some compilation errors catched by clang
Description
Testing
TODO list: