Skip to content

Commit

Permalink
use latest ModernCppStarter template
Browse files Browse the repository at this point in the history
  • Loading branch information
luk036 committed Aug 4, 2023
1 parent b51bd04 commit 4794af0
Show file tree
Hide file tree
Showing 31 changed files with 247 additions and 301 deletions.
16 changes: 0 additions & 16 deletions .clang-format.bak

This file was deleted.

3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

13 changes: 4 additions & 9 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
jobs:
build:
name: Build and publish documentation
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

Expand All @@ -22,21 +22,16 @@ jobs:

- name: Install dependencies
run: |
brew install doxygen
pip3 install jinja2 Pygments
- name: Before Install
run: |
sudo apt-get install doxygen
sudo apt-get install g++-10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 90
- name: Build
run: |
cmake -S. -Bbuild
cmake -Sdocumentation -Bbuild
cmake --build build --target GenerateDocs
- name: Publish
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/documentation/doxygen/html
publish_dir: ./build/doxygen/html
16 changes: 7 additions & 9 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
Expand All @@ -31,21 +31,19 @@ jobs:
sudo apt-get install g++-10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 90
# - name: Install dependencies
# run: |
# sudo apt-get install libboost-dev

- name: build and install library
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
sudo cmake --build build --target install
rm -rf build
- name: configure
run: cmake -Stest_installed -Bbuild
run: cmake -Stest -Bbuild -DTEST_INSTALLED_VERSION=1

- name: build
run: cmake --build build --config Debug -j4

- name: run
run: ./build/test_installed/XNetwork
- name: test
run: |
cd build
ctest --build-config Debug
11 changes: 4 additions & 7 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,20 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

# - name: Install project dependencies
# run: brew install boost

- name: configure
run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug
run: cmake -Stest -Bbuild -DCMAKE_BUILD_TYPE=Debug

- name: build
run: cmake --build build -j4

- name: test
run: |
cd build/test
cd build
ctest --build-config Debug
11 changes: 4 additions & 7 deletions .github/workflows/standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
Expand All @@ -30,14 +30,11 @@ jobs:
sudo apt-get install g++-10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 90
# - name: Install dependencies
# run: sudo apt-get install libboost-dev

- name: configure
run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug
run: cmake -Sstandalone -Bbuild -DCMAKE_BUILD_TYPE=Debug

- name: build
run: cmake --build build -j4

- name: run
run: ./build/standalone/XNetwork
run: ./build/XNetwork
19 changes: 9 additions & 10 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,26 @@ env:

jobs:
build:
runs-on: macos-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: Install format dependencies
- name: Before Install
run: |
brew install clang-format
pip3 install cmake_format==0.6.11 pyyaml
sudo apt-get install g++-10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 90
# - name: Install project dependencies
# run: |
# brew install boost
- name: Install format dependencies
run: pip3 install clang-format==14.0.6 cmake_format==0.6.11 pyyaml

- name: configure
run: cmake -S. -Bbuild
run: cmake -Stest -Bbuild

- name: check style
run: cmake --build build --target check-format
19 changes: 6 additions & 13 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,28 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: Before Install
run: |
sudo apt-get install g++-10 lcov
sudo apt-get install g++-10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 90
# - name: Install dependencies
# run: sudo apt-get install libboost-dev

- name: configure
run: cmake -S. -Bbuild -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug
run: cmake -Stest -Bbuild -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug

- name: build
run: cmake --build build -j4

- name: test
run: |
cd build/test
cd build
ctest --build-config Debug
- name: collect code coverage
run: |
lcov --directory . --capture --output-file coverage.info # capture coverage info
lcov --remove coverage.info '/usr/*' 'standalone/*' 'bench/*' --output-file coverage.info # filter out system
lcov --list coverage.info #debug info
bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
run: bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
16 changes: 2 additions & 14 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,13 @@ jobs:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

# - name: Setup Miniconda
# # You may pin to the exact commit or the version.
# # uses: conda-incubator/setup-miniconda@35d1405e78aa3f784fe3ce9a2eb378d5eeb62169
# uses: conda-incubator/setup-miniconda@v2.1.1
# with:
# auto-update-conda: ture
#
# - name: Install dependent software
# run: |
# conda info
# conda install -c conda-forge cmake boost=1.74

- name: configure
run: cmake -S. -Bbuild
run: cmake -Stest -Bbuild

- name: build
run: cmake --build build --config Debug -j4

- name: test
run: |
cd build/test
cd build
ctest --build-config Debug
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.vscode
/cpm_modules
/.cache
/.trunk
/.xmake
/.trunk
compile_commands.json
.DS_Store
4 changes: 0 additions & 4 deletions .hadolint.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions .isort.cfg

This file was deleted.

10 changes: 0 additions & 10 deletions .markdownlint.yaml

This file was deleted.

1 change: 0 additions & 1 deletion .trunk/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions .trunk/trunk.yaml

This file was deleted.

33 changes: 9 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

cmake_minimum_required(VERSION 3.14...3.22)
# set(USE_STATIC_ANALYZER "iwyu")

option(CPM_USE_LOCAL_PACKAGES "Use Local package" TRUE)
Expand All @@ -10,7 +9,7 @@ option(INSTALL_ONLY "Enable for installation only" OFF)
# Note: update this to your new project's name and version
project(
XNetwork
VERSION 1.6.6
VERSION 1.6.7
LANGUAGES CXX
)

Expand All @@ -26,23 +25,17 @@ endif()
# ---- Add dependencies via CPM ----
# see https://github.com/TheLartians/CPM.cmake for more info

# --- Import tools ----

include(cmake/tools.cmake)

# ---- Dependencies ----

include(cmake/CPM.cmake)

# PackageProject.cmake will be used to make our target installable
CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.6.0")
CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.8.0")

# ---- Add source files ----

# Note: globbing sources is considered bad practice as CMake's generators may not detect new files
# automatically. Keep that in mind when changing files, or explicitly mention them here.
file(GLOB_RECURSE headers CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp"
file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp"
)
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp")

Expand All @@ -52,16 +45,16 @@ file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/
# target: add_library(${PROJECT_NAME} INTERFACE)
add_library(${PROJECT_NAME} INTERFACE)

# set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
# set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20)

# being a cross-platform target, we enforce standards conformance on MSVC
target_compile_options(${PROJECT_NAME} INTERFACE "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive->")

# Link dependencies target_link_libraries(${PROJECT_NAME} INTERFACE cppcoro::cppcoro)
# target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt)

target_include_directories(
${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
)

# ---- Create an installable target ----
Expand All @@ -80,13 +73,5 @@ packageProject(
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
VERSION_HEADER "${VERSION_HEADER_LOCATION}"
COMPATIBILITY SameMajorVersion
DEPENDENCIES "Py2Cpp 1.2"
DEPENDENCIES "Py2Cpp 1.4"
)

if(NOT INSTALL_ONLY)
include(specific.cmake)

add_subdirectory(test)
add_subdirectory(standalone)
add_subdirectory(documentation)
endif()
Loading

0 comments on commit 4794af0

Please sign in to comment.