-
Notifications
You must be signed in to change notification settings - Fork 472
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
GCC 10.1 support #158
Draft
dutow
wants to merge
5
commits into
lewissbaker:master
Choose a base branch
from
dutow:gcc_support
base: master
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.
Draft
GCC 10.1 support #158
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
16ae7f1
Added CMake build system
mmha 0b201f8
Support both <coroutine> and <experimental/coroutine>
dutow d99be58
Generalize CMake flag handling to support GCC
dutow 3e08a7d
Fixing GCC compilation issues
dutow 4b1951f
Fixing tests with GCC 10.1
dutow 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
project(cppcoro LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") | ||
include(CTest) | ||
|
||
add_subdirectory(lib) | ||
if(BUILD_TESTING) | ||
add_subdirectory(test) | ||
endif() | ||
|
||
export(EXPORT cppcoroTargets | ||
FILE "${PROJECT_BINARY_DIR}/cppcoro/cppcoroTargets.cmake" | ||
NAMESPACE cppcoro::) | ||
configure_file(cmake/cppcoroConfig.cmake | ||
"${PROJECT_BINARY_DIR}/cppcoro/cppcoroConfig.cmake" | ||
COPYONLY) | ||
|
||
set(config_package_location lib/cmake/cppcoro) | ||
install(DIRECTORY include | ||
DESTINATION . | ||
COMPONENT Devel) | ||
install(FILES cmake/FindCppcoroCoroutines.cmake | ||
DESTINATION ${config_package_location} | ||
COMPONENT Devel) | ||
install(EXPORT cppcoroTargets | ||
FILE cppcoroTargets.cmake | ||
NAMESPACE cppcoro:: | ||
DESTINATION ${config_package_location}) | ||
install( | ||
FILES ${CMAKE_CURRENT_BINARY_DIR}/cppcoro/cppcoroConfig.cmake | ||
DESTINATION ${config_package_location} | ||
COMPONENT Devel) |
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
Empty file.
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 @@ | ||
include(CheckCXXCompilerFlag) | ||
include(CheckIncludeFileCXX) | ||
include(FindPackageHandleStandardArgs) | ||
|
||
check_cxx_compiler_flag(/await Coroutines_SUPPORTS_MS_FLAG) | ||
check_cxx_compiler_flag(-fcoroutines-ts Coroutines_SUPPORTS_CLANG_FLAG) | ||
check_cxx_compiler_flag(-fcoroutines Coroutines_SUPPORTS_GCC_FLAG) | ||
if(Coroutines_SUPPORTS_MS_FLAG OR Coroutines_SUPPORTS_CLANG_FLAG OR Coroutines_SUPPORTS_GCC_FLAG) | ||
set(Coroutines_COMPILER_SUPPORT ON) | ||
endif() | ||
|
||
set(Coroutines_ADDITIONAL_FLAG "") | ||
if(Coroutines_SUPPORTS_MS_FLAG) | ||
set(Coroutines_ADDITIONAL_FLAG "/await") | ||
elseif(Coroutines_SUPPORTS_CLANG_FLAG) | ||
set(Coroutines_ADDITIONAL_FLAG "-fcoroutines-ts") | ||
elseif(Coroutines_SUPPORTS_GCC_FLAG) | ||
set(Coroutines_ADDITIONAL_FLAG "-fcoroutines") | ||
endif() | ||
|
||
check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT ${Coroutines_ADDITIONAL_FLAG}) | ||
check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT ${Coroutines_ADDITIONAL_FLAG}) | ||
|
||
if(Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT OR Coroutines_STANDARD_LIBRARY_SUPPORT) | ||
set(Coroutines_LIBRARY_SUPPORT ON) | ||
endif() | ||
|
||
find_package_handle_standard_args(CppcoroCoroutines | ||
REQUIRED_VARS Coroutines_LIBRARY_SUPPORT Coroutines_COMPILER_SUPPORT | ||
FAIL_MESSAGE "Verify that the compiler and the standard library both support the Coroutines TS") | ||
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. nit: Maybe reword to also be inclusive of C++20 coroutines, not just Coroutines TS? |
||
|
||
if(NOT CppcoroCoroutines_FOUND OR TARGET cppcoro::coroutines) | ||
return() | ||
endif() | ||
|
||
add_library(cppcoro::coroutines INTERFACE IMPORTED) | ||
target_compile_options(cppcoro::coroutines INTERFACE ${Coroutines_ADDITIONAL_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,6 @@ | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency(CppcoroCoroutines QUIET REQUIRED) | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/cppcoroTargets.cmake") |
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
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.
There is also the (undocumented)
/await:heapelide
flag for msvc that we probably want to add underRelease
build configs.I'm not sure whether it would be more idiomatic to set it here or have the application setting this or perhaps even as part of the CXX_COMPILER_FLAGS on the command-line.