Skip to content

Commit

Permalink
add code from pgcpp
Browse files Browse the repository at this point in the history
  • Loading branch information
luk036 committed Jul 21, 2021
1 parent 8a0e874 commit fa94ea5
Show file tree
Hide file tree
Showing 41 changed files with 4,286 additions and 135 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
IncludeBlocks: Regroup
IndentPPDirectives: AfterHash
IndentWidth: '2'
IndentWidth: '4'
NamespaceIndentation: All
BreakBeforeBinaryOperators: All
BreakBeforeTernaryOperators: 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Install dependencies
run: |
brew install doxygen
brew install doxygen boost
pip3 install jinja2 Pygments
- name: Build
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ jobs:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: Before Install
run: |
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
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: install dependency
run: brew install boost

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

Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@ jobs:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: Before Install
run: |
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 -Sstandalone -Bbuild -DCMAKE_BUILD_TYPE=Debug -DCMAKE_BUILD_TYPE=Debug

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

- name: run
run: ./build/Greeter
run: ./build/ProjGeom
1 change: 1 addition & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:

- name: Install format dependencies
run: |
brew install boost
brew install clang-format
pip3 install cmake_format==0.6.11 pyyaml
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ jobs:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}

- name: Before Install
run: |
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 -Stest -Bbuild -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug

Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ 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/[email protected]
with:
auto-update-conda: ture

- name: Install dependent software
run: |
conda info
conda list
conda config --show-sources
conda config --show
conda install -c conda-forge cmake boost
- name: configure
run: cmake -Stest -Bbuild

Expand Down
20 changes: 11 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

# Note: update this to your new project's name and version
project(
Greeter
ProjGeom
VERSION 1.0
LANGUAGES CXX
)
Expand Down Expand Up @@ -37,26 +37,28 @@ CPMAddPackage(

# 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")
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")

# ---- Create library ----

# Note: for header-only libraries change all PUBLIC flags to INTERFACE and create an interface
# target: add_library(Greeter INTERFACE)
add_library(Greeter ${headers} ${sources})
# target: add_library(ProjGeom INTERFACE) add_library(ProjGeom ${headers} ${sources})
add_library(ProjGeom INTERFACE)

set_target_properties(Greeter PROPERTIES CXX_STANDARD 17)
set_target_properties(ProjGeom PROPERTIES CXX_STANDARD 20)

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

# Link dependencies
target_link_libraries(Greeter PRIVATE fmt::fmt)
target_link_libraries(ProjGeom INTERFACE fmt::fmt)

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

# ---- Create an installable target ----
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ This template is the result of learnings from many previous projects and should
### Adjust the template to your needs

- Use this repo [as a template](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template).
- Replace all occurrences of "Greeter" in the relevant CMakeLists.txt with the name of your project
- Capitalization matters here: `Greeter` means the name of the project, while `greeter` is used in file names.
- Remember to rename the `include/greeter` directory to use your project's lowercase name and update all relevant `#include`s accordingly.
- Replace all occurrences of "ProjGeom" in the relevant CMakeLists.txt with the name of your project
- Capitalization matters here: `ProjGeom` means the name of the project, while `projgeom` is used in file names.
- Remember to rename the `include/projgeom` directory to use your project's lowercase name and update all relevant `#include`s accordingly.
- Replace the source files with your own
- For header-only libraries: see the comments in [CMakeLists.txt](CMakeLists.txt)
- Add [your project's codecov token](https://docs.codecov.io/docs/quick-start) to your project's github secrets under `CODECOV_TOKEN`
Expand All @@ -54,7 +54,7 @@ Use the following command to build and run the executable target.
```bash
cmake -S standalone -B build/standalone
cmake --build build/standalone
./build/standalone/Greeter --help
./build/standalone/ProjGeom --help
```

### Build and run test suite
Expand All @@ -67,7 +67,7 @@ cmake --build build/test
CTEST_OUTPUT_ON_FAILURE=1 cmake --build build/test --target test

# or simply call the executable:
./build/test/GreeterTests
./build/test/ProjGeomTests
```

To collect code coverage information, run CMake with the `-DENABLE_TEST_COVERAGE=1` option.
Expand Down Expand Up @@ -113,11 +113,11 @@ cmake -S all -B build
cmake --build build

# run tests
./build/test/GreeterTests
./build/test/ProjGeomTests
# format code
cmake --build build --target fix-format
# run standalone
./build/standalone/Greeter --help
./build/standalone/ProjGeom --help
# build docs
cmake --build build --target GenerateDocs
```
Expand Down
8 changes: 4 additions & 4 deletions documentation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(GreeterDocs)
project(ProjGeomDocs)

# ---- Dependencies ----

include(../cmake/CPM.cmake)

CPMAddPackage("gh:mosra/m.css#42d4a9a48f31f5df6e246c948403b54b50574a2a")
CPMAddPackage(NAME Greeter SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
CPMAddPackage(NAME ProjGeom SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)

# ---- Doxygen variables ----

# set Doxyfile variables
set(DOXYGEN_PROJECT_NAME Greeter)
set(DOXYGEN_PROJECT_VERSION ${Greeter_VERSION})
set(DOXYGEN_PROJECT_NAME ProjGeom)
set(DOXYGEN_PROJECT_VERSION ${ProjGeom_VERSION})
set(DOXYGEN_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/..")
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doxygen")

Expand Down
6 changes: 3 additions & 3 deletions documentation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

# LINKS_NAVBAR1 = [
# (None, 'pages', [(None, 'about')]),
# (None, 'namespaces', [(None, 'namespacegreeter')]),
# (None, 'namespaces', [(None, 'namespaceprojgeom')]),
# ]
#
# LINKS_NAVBAR2 = [
# (None, 'annotated', [(None, 'classgreeter_1_1_greeter')]),
# (None, 'files', [(None, 'greeter_8h')]),
# (None, 'annotated', [(None, 'classprojgeom_1_1_projgeom')]),
# (None, 'files', [(None, 'projgeom_8h')]),
# ]
31 changes: 0 additions & 31 deletions include/greeter/greeter.h

This file was deleted.

Loading

0 comments on commit fa94ea5

Please sign in to comment.