-
Notifications
You must be signed in to change notification settings - Fork 71
build: Add ClangCL profiles #791
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
Changes from 1 commit
60e1e5b
114c549
ff5513b
44acfcf
dbff78d
616f7d7
aad8bb1
7b8cb61
062b5ba
39bb3e1
cbb4db1
c1cc48b
16088b9
8f454a9
b4e722a
eda05ee
25e0120
b5d6795
d1bb5c6
a1b9b99
77ed416
a2a7e72
cde9e79
8246891
6e4392e
bba9dab
209ecf3
292f792
b3b2b03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| include_guard(GLOBAL) | ||
|
|
||
| # Debug | ||
|
Member
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. what about macro definitions like P.S. should MSVC even define should macros from commandline instead of configuring theminto the header?
Member
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.
in theory we set them in MSVC frontend profile but we could skip doing so both for this profile & Clang since CMake sets
to be discussed but we already generate a set of defines which is included in nabla.h iirc, we could remove defines from CLI
Member
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. a2a7e72 I stay at defining it myself though |
||
| set(NBL_CXX_DEBUG_COMPILE_OPTIONS | ||
| -ggdb3 -Wall -fno-omit-frame-pointer -fstack-protector-strong | ||
|
Member
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. is
Member
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. shouldn't
Member
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. btw GCC/Clang have an equivalent of ffast math that we use in MSVC
Member
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. actually
Member
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. yeah I swear it was a GCC / Emscripten thing
Member
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. also ggdb3 is for GDB, I think on Clang one is supposed to use LLDB
Member
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. on windows
|
||
| ) | ||
|
|
||
| # Release | ||
| set(NBL_CXX_RELEASE_COMPILE_OPTIONS | ||
| -fexpensive-optimizations | ||
| ) | ||
|
Member
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. I think O3 enables this by default ?
Member
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. yes however |
||
|
|
||
| # RelWithDebInfo | ||
| set(NBL_CXX_RELWITHDEBINFO_COMPILE_OPTIONS "") | ||
|
Member
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. what about O1 or something ? Alos don't you need
Member
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. or even O2
Member
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.
#791 (comment) + resolved |
||
|
|
||
| # Global | ||
| list(APPEND NBL_CXX_COMPILE_OPTIONS | ||
| -Wextra | ||
| -fno-strict-aliasing | ||
| -msse4.2 | ||
|
Member
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. mavx
Member
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. I think you might also need a flag for stripping debug symbols
Member
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.
resolved |
||
| -mfpmath=sse | ||
| -Wextra | ||
| -Wno-sequence-point | ||
| -Wno-unused-parameter | ||
| -Wno-unused-but-set-parameter | ||
| -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 | ||
|
Member
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. I dont think we can compile without exceptions, there are some try-catch block in our code IIRC ?
Member
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.
resolved, |
||
| ) | ||
|
|
||
| if(NBL_SANITIZE_ADDRESS) | ||
| list(APPEND NBL_CXX_COMPILE_OPTIONS -fsanitize=address) | ||
| endif() | ||
|
|
||
| if(NBL_SANITIZE_THREAD) | ||
| list(APPEND NBL_CXX_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) | ||
|
Member
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. what about incremental linking and stuff?
Member
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. resolved, we use incremental linking |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| include_guard(GLOBAL) | ||
|
|
||
| # https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170 | ||
|
|
||
| # The default instruction set is SSE2 if no /arch option is specified. | ||
| if(NBL_REQUEST_SSE_4_2) | ||
| NBL_REQUEST_COMPILE_OPTION_SUPPORT("/arch:SSE4.2") | ||
| endif() | ||
|
|
||
| # Enables Intel Advanced Vector Extensions 2. | ||
| if(NBL_REQUEST_SSE_AXV2) | ||
| NBL_REQUEST_COMPILE_OPTION_SUPPORT("/arch:AVX2") | ||
| endif() | ||
|
|
||
| # Debug | ||
| set(NBL_CXX_DEBUG_COMPILE_OPTIONS | ||
| /Zc:__cplusplus /Ob0 /Od /MP${_NBL_JOBS_AMOUNT_} /fp:fast /Zc:wchar_t /INCREMENTAL | ||
| ) | ||
|
|
||
| if(NBL_SANITIZE_ADDRESS) | ||
| list(APPEND NBL_CXX_DEBUG_COMPILE_OPTIONS /RTC1) | ||
| endif() | ||
|
|
||
| set(NBL_DEBUG_CXX_COMPILE_OPTIONS | ||
|
AnastaZIuk marked this conversation as resolved.
Outdated
|
||
| $<$<COMPILE_LANGUAGE:CXX>:${NBL_CXX_DEBUG_COMPILE_OPTIONS}> | ||
| ) | ||
|
|
||
| # Release | ||
| set(NBL_CXX_RELEASE_COMPILE_OPTIONS | ||
| /Zc:__cplusplus /O2 /Ob2 /DNDEBUG /GL /MP${_NBL_JOBS_AMOUNT_} /Gy- /Zc:wchar_t /sdl- /GF /GS- /fp:fast | ||
| ) | ||
|
|
||
| # RelWithDebInfo | ||
| set(NBL_CXX_RELWITHDEBINFO_COMPILE_OPTIONS | ||
| /Zc:__cplusplus /O2 /Ob1 /DNDEBUG /GL /Zc:wchar_t /MP${_NBL_JOBS_AMOUNT_} /Gy /sdl- /Oy- /fp:fast | ||
| ) | ||
|
|
||
| if(NBL_SANITIZE_ADDRESS) | ||
| list(APPEND NBL_CXX_COMPILE_OPTIONS /fsanitize=address) | ||
| endif() | ||
|
|
||
| # this should also be not part of profile, pasting from old flags-set function temporary | ||
| # TODO: use profile | ||
|
|
||
| #reason for INCREMENTAL:NO: https://docs.microsoft.com/en-us/cpp/build/reference/ltcg-link-time-code-generation?view=vs-2019 /LTCG is not valid for use with /INCREMENTAL. | ||
| set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO /LTCG:incremental") | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| include_guard(GLOBAL) | ||
|
|
||
| # 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 | ||
| -mfpmath=sse | ||
| -maes | ||
| -Wextra | ||
| -Wno-sequence-point | ||
| -Wno-unused-parameter | ||
| -Wno-unused-but-set-parameter | ||
| -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) |
Uh oh!
There was an error while loading. Please reload this page.