Skip to content
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

update gtest, benchmark, doxygen and CI #34

Merged
merged 6 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms

on:
push:
branches: [ "dev", "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release, Debug]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl

steps:
- uses: actions/checkout@v3

- if: matrix.c_compiler == 'clang'
name: install OpenMP
run: sudo apt-get install -y libomp-dev

- name: Configure CMake
run: >
cmake -B build
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DOPTION_BUILD_TESTS=ON
-DOPTION_BUILD_BENCHMARKS=ON
-DOPTION_BUILD_EXAMPLES=ON
-DOPTION_BUILD_DOCS=ON
-S ${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build build --config ${{ matrix.build_type }}

- name: Test
working-directory: build
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}
47 changes: 47 additions & 0 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Doxygen and GraphViz
run: sudo apt-get install -y doxygen graphviz
- name: Configure CMake
run: cmake -B build -DOPTION_BUILD_DOCS=ON -S ${{ github.workspace }}
- name: Build Docs
run: cmake --build build --target docs
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: build/docs/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

# CMake version
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

#
# Configure CMake environment
Expand All @@ -24,12 +24,12 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Include modules provided by cmake
include(GenerateExportHeader)
include(GoogleTest)
include(FetchContent)
enable_testing()


# Include custom cmake modules
include(cmake/GetGitRevisionDescription.cmake)
include(cmake/DownloadProject.cmake)


#
Expand Down Expand Up @@ -83,7 +83,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(IDE_FOLDER "")

# Declare project
project(${META_PROJECT_NAME} C CXX)
project(${META_PROJECT_NAME} VERSION ${META_VERSION} DESCRIPTION ${META_PROJECT_DESCRIPTION} LANGUAGES C CXX)

# Set output directories
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
Expand Down
53 changes: 29 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@

[![Build Status](https://travis-ci.org/chistopher/girgs.svg)](https://travis-ci.org/chistopher/girgs)

This project contains an implementation of a linear-time sampling algorithm
for geometric inhomogeneous random graphs (GIRG)
with a special case implementation for hyperbolic random graphs (HRG).
Details on the algorithms as well as the models can be found in our corresponding paper:
Efficiently Generating Geometric Inhomogeneous and Hyperbolic Random Graphs ([conference version](http://dx.doi.org/10.4230/LIPIcs.ESA.2019.21), [full version](https://arxiv.org/abs/1905.06706)).
To cite this work, please use the bibtex entry for our conference version.
Efficiently Generating Geometric Inhomogeneous and Hyperbolic Random Graphs ([conference version](http://dx.doi.org/10.4230/LIPIcs.ESA.2019.21), [journal version](https://doi.org/10.1017/nws.2022.32)).

We provide a C++ library and a command line client for each of the two generators.

Expand All @@ -32,11 +28,11 @@ The result should look something like this.
```
HyperGIRGs command line interface.

girgs v1.0.0 (2dd23aad456e)
girgs v1.0.2 (8a6647cd7ec2)
Generator for Geometric Inhomogeneous Random Graphs
Hasso Plattner Institute
Karlsruhe Institute of Technology
https://github.com/chistopher/girgs/
christopher.weyand@hpi.de
christopher.weyand@kit.edu
```

## Windows
Expand All @@ -58,35 +54,30 @@ An integration into the [NetworKit](https://networkit.github.io) framework is pl
## Build from Source

To build the project from source you need
- CMake 3.9
- CMake 3.12+
- C++11
- OpenMP
- OPTIONAL: CPU with BMI2 instruction set

The optional development components use
- [Google Test](https://github.com/google/googletest)
- [Google Benchmark](https://github.com/google/benchmark)
- [Doxygen](https://github.com/google/benchmark), which uses [Graphviz](https://www.graphviz.org/) and latex
- [Doxygen](https://github.com/google/benchmark), which uses [Graphviz](https://www.graphviz.org/)
- [Boost](https://www.boost.org/)

The simplest way to build the project is
```
mkdir build
cd build
cmake ..
make
cmake -DCMAKE_BUILD_TYPE=Release -B build
cmake --build build
```

Otherwise, our `configure` script provides reasonable defaults
for release, debug, and packaging builds.
For example, to install the project from source use
or for a debug build
```
./configure
./configure pack
cmake --build ./build/
cmake --build ./build/ --target install
cmake -DOPTION_BUILD_TESTS=ON -B build-debug
cmake --build build-debug
```
Specifying the `pack` target instead of `install` generates a debian package that can be installed via aptitude or dpkg.

The project can be installed globally with the `install` target.
Alternatively, there is the `pack` target which generates a debian package that can be installed via aptitude or dpkg.

# CLI

Expand Down Expand Up @@ -158,5 +149,19 @@ generator.generate(seed);

For details we refer to our example applications in `source/examples/` or the CLI's in `source/cli/`.
Also, a deployed version of the documentation is available at [weyand.dev/girgs](https://weyand.dev/girgs/).
I suggest to look at the `girgs` namespace.


# Usage in a CMake Project

To include girgs into your CMake project, it's as simple as this.
```cmake
cmake_minimum_required(VERSION 3.12)
project(ineedgirgs CXX)
find_package(girgs REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main PRIVATE girgs::girgs)
```

If you have girgs installed globally (e.g. via the Debian package), they are found automatically.
If you want to link against a source build, then add the girgs repo to your `CMAKE_PREFIX_PATH` or specify it directly when configuring the build.
That is, in your repo do `cmake -Dgirgs_DIR=~/repos/girgs/ -B build-debug`.
17 changes: 0 additions & 17 deletions cmake/DownloadProject.CMakeLists.cmake.in

This file was deleted.

Loading