-
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.
- Loading branch information
Showing
13 changed files
with
196 additions
and
200 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,96 @@ | ||
name: CI | ||
|
||
on: [push, pull_request, release] | ||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- { | ||
name: linux-x64-clang-9, | ||
os: ubuntu-18.04, | ||
cxx: clang++-9, | ||
cmake-build-type: Release | ||
} | ||
- { | ||
name: macos-x64-gcc, | ||
os: macos-10.15, | ||
cxx: g++, | ||
cmake-build-type: Release | ||
} | ||
- { | ||
name: macos-x64-clang, | ||
os: macos-10.15, | ||
cxx: clang++, | ||
cmake-build-type: Release | ||
} | ||
- { | ||
name: linux-x64-clang-12-sanitize, | ||
os: ubuntu-20.04, | ||
cxx: clang++-12, | ||
cxx-flags: "-fsanitize=address,undefined", | ||
cmake-build-type: Release | ||
} | ||
- { | ||
name: linux-x64-gcc-10-coverage, | ||
os: ubuntu-20.04, | ||
cxx: g++-10, | ||
cxx-flags: --coverage, | ||
gcov-tool: gcov-10, | ||
cmake-build-type: Debug | ||
} | ||
- { | ||
name: linux-x64-clang-11, | ||
os: ubuntu-20.04, | ||
cxx: clang++-11, | ||
cmake-build-type: Release | ||
} | ||
- { | ||
name: linux-x64-clang-12, | ||
os: ubuntu-22.04, | ||
cxx: clang++-12, | ||
cmake-build-type: Release | ||
} | ||
- { | ||
name: linux-x64-clang-13, | ||
os: ubuntu-22.04, | ||
cxx: clang++-13, | ||
cmake-build-type: Release | ||
} | ||
- { | ||
name: linux-x64-clang-14, | ||
os: ubuntu-22.04, | ||
cxx: clang++-14, | ||
cmake-build-type: Release | ||
} | ||
- { | ||
name: linux-x64-gcc-11, | ||
os: ubuntu-22.04, | ||
cxx: g++-11, | ||
cmake-build-type: Release | ||
} | ||
- name: linux-x64-clang-15 | ||
os: ubuntu-22.04 | ||
cxx: clang++-15 | ||
- name: linux-x64-clang-16-sanitize | ||
os: ubuntu-20.04 | ||
cxx: clang++-16 | ||
cxx-flags: "-fsanitize=address,undefined" | ||
|
||
- name: linux-x64-gcc-12 | ||
os: ubuntu-22.04 | ||
cxx: g++-12 | ||
- name: linux-x64-gcc-13-coverage | ||
os: ubuntu-22.04 | ||
cxx: g++-13 | ||
cxx-flags: -Werror --coverage | ||
gcov-tool: gcov-10 | ||
|
||
name: ${{matrix.config.name}} | ||
runs-on: ${{matrix.config.os}} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# setup env | ||
- name: Add repos for for gcc-13 and clang-16 | ||
run: | | ||
# gcc-13 | ||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y | ||
# clang-16 | ||
source /etc/os-release | ||
echo "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-16 main" | sudo tee /etc/apt/sources.list.d/llvm-16.list | ||
curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/llvm-16.gpg > /dev/null | ||
- name: Install tools | ||
run: | | ||
sudo apt-get install -y python3 python3-pip | ||
- name: Get minimum cmake version | ||
uses: lukka/[email protected] | ||
with: | ||
cmakeVersion: 3.22.6 | ||
|
||
- name: Install compiler | ||
id: install_cc | ||
uses: rlalik/[email protected] | ||
with: | ||
compiler: ${{ matrix.config.cxx }} | ||
|
||
- name: Install mold | ||
uses: rui314/setup-mold@v1 | ||
|
||
- name: Configure conan | ||
run: | | ||
pip3 install "conan==1.60.1" | ||
conan profile new --detect default | ||
conan profile update settings.compiler.libcxx=libstdc++11 default | ||
- name: Cache conan data | ||
id: cache-conan | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.conan/data | ||
key: ${{ matrix.config.os }}-${{ matrix.config.cxx }}-conan | ||
|
||
# Linux or macOS | ||
- name: Install boost (Linux or macOS) | ||
run: vcpkg install boost-test boost-container boost-interprocess | ||
if: runner.os == 'Linux' || runner.os == 'macOS' | ||
- name: Check out sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure CMake (Linux or macOS) | ||
run: cmake -DCMAKE_BUILD_TYPE=${{matrix.config.cmake-build-type}} -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -S ${{github.workspace}}/tests -B ${{github.workspace}}/build | ||
env: | ||
CXX: ${{matrix.config.cxx}} | ||
CXXFLAGS: ${{matrix.config.cxx-flags}} | ||
if: runner.os == 'Linux' || runner.os == 'macOS' | ||
- name: Configure CMake | ||
env: | ||
CC: ${{ steps.install_cc.outputs.cc }} | ||
CXX: ${{ steps.install_cc.outputs.cxx }} | ||
CXXFLAGS: ${{ matrix.config.cxx-flags }} | ||
run: cmake -B build_dir -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON | ||
|
||
- name: Build (Linux or macOS) | ||
run: cmake --build ${{github.workspace}}/build --verbose | ||
if: runner.os == 'Linux' || runner.os == 'macOS' | ||
- name: Build | ||
working-directory: build_dir | ||
run: cmake --build . --parallel 2 | ||
|
||
- name: Test (Linux or macOS) | ||
run: ${{github.workspace}}/build/tsl_sparse_map_tests | ||
if: runner.os == 'Linux' || runner.os == 'macOS' | ||
- name: Run tests | ||
working-directory: build_dir | ||
run: ctest --parallel 2 --verbose | ||
|
||
- name: Coverage | ||
run: | | ||
sudo apt-get install -y lcov | ||
lcov -c -b ${{github.workspace}}/include -d ${{github.workspace}}/build -o ${{github.workspace}}/coverage.info --no-external --gcov-tool ${{matrix.config.gcov-tool}} | ||
bash <(curl -s https://codecov.io/bash) -f ${{github.workspace}}/coverage.info | ||
if: ${{matrix.config.name == 'linux-x64-gcc-10-coverage'}} | ||
#- name: Coverage | ||
# run: | | ||
# sudo apt-get install -y lcov | ||
# lcov -c -b ${{github.workspace}}/include -d ${{github.workspace}}/build -o ${{github.workspace}}/coverage.info --no-external --gcov-tool ${{matrix.config.gcov-tool}} | ||
# bash <(curl -s https://codecov.io/bash) -f ${{github.workspace}}/coverage.info | ||
# if: ${{matrix.config.name == 'linux-x64-gcc-13-coverage'}} |
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 |
---|---|---|
@@ -1,33 +1,48 @@ | ||
cmake_minimum_required(VERSION 3.18) | ||
cmake_minimum_required(VERSION 3.22) | ||
project(dice-sparse-map | ||
VERSION 0.2.4 | ||
DESCRIPTION "C++ implementation of a memory efficient hash map and hash set based on [tsl::sparse_map](https://github.com/Tessil/sparse-map). We added support for fancy pointers.") | ||
|
||
include(cmake/boilerplate_init.cmake) | ||
boilerplate_init() | ||
|
||
find_package(Boost REQUIRED) | ||
option(USE_CONAN "Use conan to fetch dependencies" ON) | ||
option(BUILD_TESTING "Build tests" OFF) | ||
|
||
if (PROJECT_IS_TOP_LEVEL AND USE_CONAN) | ||
include(cmake/conan_cmake.cmake) | ||
|
||
if (BUILD_TESTING) | ||
set(CONAN_OPTIONS "with_test_deps=True") | ||
endif () | ||
|
||
install_packages_via_conan("${CMAKE_SOURCE_DIR}/conanfile.py" "${CONAN_OPTIONS}") | ||
endif () | ||
|
||
add_library(${PROJECT_NAME} INTERFACE) | ||
# Use dice::sparse_map as target, more consistent with other libraries conventions (Boost, Qt, ...) | ||
add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}") | ||
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) | ||
|
||
target_include_directories(${PROJECT_NAME} | ||
INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>") | ||
|
||
target_link_libraries(${PROJECT_NAME} INTERFACE | ||
Boost::headers | ||
INTERFACE | ||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" | ||
) | ||
|
||
if(MSVC) | ||
target_sources(${PROJECT_NAME} INTERFACE | ||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tsl-sparse-map.natvis>" | ||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_DATAROOTDIR}/tsl-sparse-map.natvis>") | ||
target_sources(${PROJECT_NAME} | ||
INTERFACE | ||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tsl-sparse-map.natvis>" | ||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_DATAROOTDIR}/tsl-sparse-map.natvis>") | ||
endif() | ||
|
||
if (IS_TOP_LEVEL) | ||
if (PROJECT_IS_TOP_LEVEL AND BUILD_TESTING) | ||
message("Tests are configured to be build.") | ||
include(CTest) | ||
enable_testing() | ||
add_subdirectory(tests) | ||
endif () | ||
|
||
if (PROJECT_IS_TOP_LEVEL) | ||
include(cmake/install_interface_library.cmake) | ||
install_interface_library("${PROJECT_NAME}" "${PROJECT_NAME}" "${PROJECT_NAME}" "include") | ||
endif () | ||
|
||
|
Oops, something went wrong.