-
Notifications
You must be signed in to change notification settings - Fork 18
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
Introduce CMake toolchain #76
Open
wusatosi
wants to merge
38
commits into
bemanproject:main
Choose a base branch
from
wusatosi:toolchain
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
60c0bd5
add toolchain
wusatosi 054c877
enable santizier
wusatosi 8a59d2e
fix toolchain
wusatosi d65aeaf
update action script
wusatosi aba4789
use toolchain in CI
wusatosi 730028a
Update toolchain.cmake
wusatosi f4932e9
run gcc-debug on macos
wusatosi cc37b1a
give up using toolchain
wusatosi 14431a5
Merge branch 'main' into toolchain
wusatosi 78e0a40
revert previous changes that are no longer needed
wusatosi 6287403
readd -O3 flag to release build
wusatosi 18f2be1
move sanitizer entry
wusatosi 4f892cf
refactor apply_santizers
wusatosi 87ac8ed
run profile test on windows
wusatosi 219978e
Revert "run profile test on windows"
wusatosi 93c0641
revert preset changes
wusatosi d648625
tweak for msvc
wusatosi ff6a3d9
warp apply_santizers.cmake in ifdef
wusatosi 03a0ea0
extract sanitizer generation as function
wusatosi 55c966c
update comment
wusatosi ac9408b
Merge branch 'main' into toolchain
wusatosi 8057e45
use toolchain
wusatosi 6822493
move generator out
wusatosi b99f9ad
remove generator at preset
wusatosi f309be8
remove cmake/apply_santizers.cmake
wusatosi b93b070
add msvc toolchain
wusatosi 0c6f92b
ensure portable
wusatosi 9127cc2
msvc does not support TSan
wusatosi ab682c6
Merge branch 'main' into toolchain
wusatosi 3bba8f1
apply license
wusatosi a0f8cd2
adopt include guard
wusatosi f7e1c96
apply sanitizer to all targets
wusatosi f1f3f69
update all release targets
wusatosi 66d8fd1
asan -> maxsan
wusatosi fa2f1b9
add documentation
wusatosi 1dee249
remove unneeded include guard
wusatosi c0910c4
Merge branch 'main' into toolchain
wusatosi e97cec1
update use of toolchain for appleclang and msvc
wusatosi 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
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,37 @@ | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# This toolchain file is not meant to be used directly, | ||
# but to be invoked by CMake preset and GitHub CI. | ||
# | ||
# This toolchain file configures for apple clang family of compiler. | ||
# Note this is different from LLVM toolchain. | ||
# | ||
# BEMAN_BUILDSYS_SANITIZER: | ||
# This optional CMake parameter is not meant for public use and is subject to | ||
# change. | ||
# Possible values: | ||
# - MaxSan: configures clang and clang++ to use all available non-conflicting | ||
# sanitizers. Note that apple clang does not support leak sanitizer. | ||
# - TSan: configures clang and clang++ to enable the use of thread sanitizer. | ||
|
||
set(CMAKE_C_COMPILER clang) | ||
set(CMAKE_CXX_COMPILER clang++) | ||
|
||
if(BEMAN_BUILDSYS_SANITIZER STREQUAL "MaxSan") | ||
set(SANITIZER_FLAGS | ||
"-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined" | ||
) | ||
elseif(BEMAN_BUILDSYS_SANITIZER STREQUAL "TSan") | ||
set(SANITIZER_FLAGS "-fsanitize=thread") | ||
endif() | ||
|
||
set(CMAKE_C_FLAGS_DEBUG_INIT "${SANITIZER_FLAGS}") | ||
set(CMAKE_CXX_FLAGS_DEBUG_INIT "${SANITIZER_FLAGS}") | ||
|
||
set(RELEASE_FLAG "-O3 ${SANITIZER_FLAGS}") | ||
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. FLAG -> FLAGS to match the existing CMake conventions. |
||
|
||
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "${RELEASE_FLAG}") | ||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "${RELEASE_FLAG}") | ||
|
||
set(CMAKE_C_FLAGS_RELEASE_INIT "${RELEASE_FLAG}") | ||
set(CMAKE_CXX_FLAGS_RELEASE_INIT "${RELEASE_FLAG}") |
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,36 @@ | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# This toolchain file is not meant to be used directly, | ||
# but to be invoked by CMake preset and GitHub CI. | ||
# | ||
# This toolchain file configures for GNU family of compiler. | ||
# | ||
# BEMAN_BUILDSYS_SANITIZER: | ||
# This optional CMake parameter is not meant for public use and is subject to | ||
# change. | ||
# Possible values: | ||
# - MaxSan: configures gcc and g++ to use all available non-conflicting | ||
# sanitizers. | ||
# - TSan: configures gcc and g++ to enable the use of thread sanitizer | ||
|
||
set(CMAKE_C_COMPILER gcc) | ||
wusatosi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
set(CMAKE_CXX_COMPILER g++) | ||
|
||
if(BEMAN_BUILDSYS_SANITIZER STREQUAL "MaxSan") | ||
set(SANITIZER_FLAGS | ||
"-fsanitize=address -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined" | ||
) | ||
elseif(BEMAN_BUILDSYS_SANITIZER STREQUAL "TSan") | ||
set(SANITIZER_FLAGS "-fsanitize=thread") | ||
endif() | ||
|
||
set(CMAKE_C_FLAGS_DEBUG_INIT "${SANITIZER_FLAGS}") | ||
set(CMAKE_CXX_FLAGS_DEBUG_INIT "${SANITIZER_FLAGS}") | ||
|
||
set(RELEASE_FLAG "-O3 ${SANITIZER_FLAGS}") | ||
|
||
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "${RELEASE_FLAG}") | ||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "${RELEASE_FLAG}") | ||
|
||
set(CMAKE_C_FLAGS_RELEASE_INIT "${RELEASE_FLAG}") | ||
set(CMAKE_CXX_FLAGS_RELEASE_INIT "${RELEASE_FLAG}") |
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,36 @@ | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
camio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# This toolchain file is not meant to be used directly, | ||
# but to be invoked by CMake preset and GitHub CI. | ||
# | ||
# This toolchain file configures for LLVM family of compiler. | ||
# | ||
# BEMAN_BUILDSYS_SANITIZER: | ||
# This optional CMake parameter is not meant for public use and is subject to | ||
# change. | ||
# Possible values: | ||
# - MaxSan: configures clang and clang++ to use all available non-conflicting | ||
# sanitizers. | ||
# - TSan: configures clang and clang++ to enable the use of thread sanitizer. | ||
|
||
set(CMAKE_C_COMPILER clang) | ||
set(CMAKE_CXX_COMPILER clang++) | ||
|
||
if(BEMAN_BUILDSYS_SANITIZER STREQUAL "MaxSan") | ||
set(SANITIZER_FLAGS | ||
"-fsanitize=address -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined" | ||
) | ||
elseif(BEMAN_BUILDSYS_SANITIZER STREQUAL "TSan") | ||
set(SANITIZER_FLAGS "-fsanitize=thread") | ||
endif() | ||
|
||
set(CMAKE_C_FLAGS_DEBUG_INIT "${SANITIZER_FLAGS}") | ||
set(CMAKE_CXX_FLAGS_DEBUG_INIT "${SANITIZER_FLAGS}") | ||
|
||
set(RELEASE_FLAG "-O3 ${SANITIZER_FLAGS}") | ||
|
||
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "${RELEASE_FLAG}") | ||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "${RELEASE_FLAG}") | ||
|
||
set(CMAKE_C_FLAGS_RELEASE_INIT "${RELEASE_FLAG}") | ||
set(CMAKE_CXX_FLAGS_RELEASE_INIT "${RELEASE_FLAG}") |
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,34 @@ | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# This toolchain file is not meant to be used directly, | ||
# but to be invoked by CMake preset and GitHub CI. | ||
# | ||
# This toolchain file configures for MSVC family of compiler. | ||
# | ||
# BEMAN_BUILDSYS_SANITIZER: | ||
# This optional CMake parameter is not meant for public use and is subject to | ||
# change. | ||
# Possible values: | ||
# - MaxSan: configures cl to use all available non-conflicting sanitizers. | ||
# | ||
# Note that in other toolchain files, TSan is also a possible value for | ||
# BEMAN_BUILDSYS_SANITIZER, however, MSVC does not support thread sanitizer, | ||
# thus this value is omitted. | ||
|
||
set(CMAKE_C_COMPILER cl) | ||
set(CMAKE_CXX_COMPILER cl) | ||
|
||
if(BEMAN_BUILDSYS_SANITIZER STREQUAL "MaxSan") | ||
set(SANITIZER_FLAGS "/fsanitize=address /Zi") | ||
endif() | ||
|
||
set(CMAKE_CXX_FLAGS_DEBUG_INIT "/EHsc /permissive- ${SANITIZER_FLAGS}") | ||
set(CMAKE_C_FLAGS_DEBUG_INIT "/EHsc /permissive- ${SANITIZER_FLAGS}") | ||
|
||
set(RELEASE_FLAG "/EHsc /permissive- /O2 ${SANITIZER_FLAGS}") | ||
|
||
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "${RELEASE_FLAG}") | ||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "${RELEASE_FLAG}") | ||
|
||
set(CMAKE_C_FLAGS_RELEASE_INIT "${RELEASE_FLAG}") | ||
set(CMAKE_CXX_FLAGS_RELEASE_INIT "${RELEASE_FLAG}") |
Oops, something went wrong.
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.
I think this variable should be prefixed with
BEMAN_BUILDSYS_
to avoid conflicts with project variables.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.
This is only meant to be a local variable and not to be exported. I will see if I can make it so that it's treated like a local variable.