forked from VowpalWabbit/vowpal_wabbit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: consolidate flags and simplify cmake (VowpalWabbit#3871)
* refactor: consolidate flags and simplify cmake * use old version of generator expression * bring back gcov as an option and name VW_GCOV * flags * disallow VW_GCOV on windows
- Loading branch information
1 parent
69eee24
commit 9a96372
Showing
8 changed files
with
100 additions
and
131 deletions.
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
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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
set(VW_LINUX_FLAGS "") | ||
if(LTO) | ||
if(NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||
message(FATAL_ERROR "LTO requires Clang") | ||
endif() | ||
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "8.0.0") | ||
message(FATAL_ERROR "LTO requires Clang 8.0 (llvm 3.9) or later") | ||
endif() | ||
If("${CONFIG}" STREQUAL "DEBUG") | ||
message(FATAL_ERROR "LTO only works with Release builds") | ||
endif() | ||
set(VW_LINUX_FLAGS ${VW_LINUX_FLAGS} -flto=thin) | ||
endif() | ||
|
||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") | ||
set(LINUX_X86_64_OPT_FLAGS -msse2 -mfpmath=sse) | ||
endif() | ||
|
||
# Add -ffast-math for speed, remove for testability. | ||
# no-stack-check is added to mitigate stack alignment issue on Catalina where there is a bug with aligning stack-check instructions, and stack-check became default option | ||
set(LINUX_RELEASE_CONFIG -fno-strict-aliasing ${LINUX_X86_64_OPT_FLAGS} -fno-stack-check -fomit-frame-pointer) | ||
set(LINUX_DEBUG_CONFIG -fno-stack-check) | ||
|
||
#Use default visiblity on UNIX otherwise a lot of the C++ symbols end up for exported and interpose'able | ||
set(VW_LINUX_FLAGS -fvisibility=hidden $<$<CONFIG:Debug>:${LINUX_DEBUG_CONFIG}> $<$<CONFIG:Release>:${LINUX_RELEASE_CONFIG}> $<$<CONFIG:RelWithDebInfo>:${LINUX_RELEASE_CONFIG}>) | ||
set(VW_WIN_FLAGS /MP /Zc:__cplusplus) | ||
|
||
# Turn on warnings | ||
set(WARNING_OPTIONS "") | ||
if(WARNINGS) | ||
if(WIN32) | ||
set(WARNING_OPTIONS /W4) | ||
else() | ||
set(WARNING_OPTIONS -Wall -Wextra -Wpedantic) | ||
endif() | ||
endif(WARNINGS) | ||
|
||
# Turn on warnings as errors | ||
set(WARNING_AS_ERROR_OPTIONS "") | ||
if(WARNING_AS_ERROR) | ||
if(WIN32) | ||
set(WARNING_AS_ERROR_OPTIONS /WX) | ||
else() | ||
set(WARNING_AS_ERROR_OPTIONS -Werror) | ||
endif() | ||
endif(WARNING_AS_ERROR) |
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
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