Skip to content

Commit

Permalink
Merge pull request #2 from andreasbuhr/master
Browse files Browse the repository at this point in the history
Update to Andreas
  • Loading branch information
tobias-loew authored Nov 1, 2020
2 parents 3efe8b7 + 2785792 commit 3c069a0
Show file tree
Hide file tree
Showing 87 changed files with 6,735 additions and 5,238 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: CMake

on: [push, pull_request]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}

strategy:
fail-fast: false
matrix:
config:
- {
name: "Linux g++ 10.2",
os: ubuntu-20.04,
cxx: "g++-10",
}
- {
name: "Linux clang-10",
os: ubuntu-20.04,
cxx: "clang++-10",
cxx_flags: -stdlib=libc++,
exe_linker_flags: -lc++,
}
- {
name: "Linux clang-11",
os: ubuntu-20.04,
cxx: "clang++-11",
cxx_flags: -stdlib=libc++,
exe_linker_flags: -lc++,
}
- {
name: "Windows MSVC 2017 (x64)",
os: windows-2016,
cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
}
- {
name: "Windows MSVC 2019 (x64)",
os: windows-latest,
cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
}

steps:
- uses: actions/checkout@v2

- name: Install Clang 10
id: install_clang_10
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-10' )
shell: bash
working-directory: ${{ env.HOME }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 10
sudo apt-get install libc++-10-dev libc++abi-10-dev
- name: Install Clang 11
id: install_clang_11
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-11' )
shell: bash
working-directory: ${{ env.HOME }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 11
sudo apt-get install libc++-11-dev libc++abi-11-dev
- name: Install g++ 10
id: install_gcc_10
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-10' )
shell: bash
working-directory: ${{ env.HOME }}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt-get install g++-10
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
env:
CXX: ${{ matrix.config.cxx }}
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
# run environment setup script if any
[ -n "${{ matrix.config.environment_script }}" ] && "${{ matrix.config.environment_script }}"
cmake $GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_CXX_STANDARD=20 \
-DBUILD_TESTING=ON \
-DCMAKE_CXX_FLAGS=${{ matrix.config.cxx_flags }} \
-DCMAKE_EXE_LINKER_FLAGS=${{ matrix.config.exe_linker_flags }} \
-DCMAKE_VERBOSE_MAKEFILE=ON
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE

- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --output-on-failure -C $BUILD_TYPE
37 changes: 37 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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")

add_subdirectory(lib)

enable_testing()
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/cppcoro
DESTINATION include
COMPONENT Devel)
install(FILES cmake/FindCoroutines.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)
Loading

0 comments on commit 3c069a0

Please sign in to comment.