Skip to content

Commit 0c56375

Browse files
committed
changed CMake, updated gitignore, added gitattributes
- update pipeline, packages, fixed beast example - updated readme and changed naming
1 parent bf600c4 commit 0c56375

22 files changed

+1274
-632
lines changed

Diff for: .gitattributes

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
###############################
2+
# Git Line Endings #
3+
###############################
4+
5+
* text=auto eol=lf
6+
*.{cmd,[cC][mM][dD]} text eol=crlf
7+
*.{bat,[bB][aA][tT]} text eol=crlf
8+
*.{vcxproj,vcxproj.filters} text eol=crlf
9+
10+
###############################
11+
# Git Large File System (LFS) #
12+
###############################
13+
14+
# Archives
15+
#*.7z filter=lfs diff=lfs merge=lfs -text
16+
#*.br filter=lfs diff=lfs merge=lfs -text
17+
#*.gz filter=lfs diff=lfs merge=lfs -text
18+
#*.tar filter=lfs diff=lfs merge=lfs -text
19+
#*.zip filter=lfs diff=lfs merge=lfs -text
20+
21+
# Documents
22+
#*.pdf filter=lfs diff=lfs merge=lfs -text
23+
24+
# Images
25+
#*.gif filter=lfs diff=lfs merge=lfs -text
26+
#*.ico filter=lfs diff=lfs merge=lfs -text
27+
#*.jpg filter=lfs diff=lfs merge=lfs -text
28+
#*.pdf filter=lfs diff=lfs merge=lfs -text
29+
#*.png filter=lfs diff=lfs merge=lfs -text
30+
#*.psd filter=lfs diff=lfs merge=lfs -text
31+
#*.webp filter=lfs diff=lfs merge=lfs -text
32+
33+
# Fonts
34+
#*.woff2 filter=lfs diff=lfs merge=lfs -text
35+
36+
# Other
37+
#*.exe filter=lfs diff=lfs merge=lfs -text

Diff for: .github/workflows/build_cmake.yml

+38-45
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CMake
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
env:
66
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
@@ -12,21 +12,37 @@ env:
1212
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short"
1313

1414
jobs:
15-
build:
16-
name: ${{ matrix.os }}, ${{ matrix.compiler.name }}, C++${{ matrix.cxx }}
15+
docker:
16+
name: Test docker images
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Build docker-ci image
22+
shell: bash
23+
run: cd docker && ./build-ci-image.sh
24+
25+
- name: Build docker-dev image
26+
shell: bash
27+
run: cd docker && ./build-dev-image.sh
28+
29+
linux:
30+
name: ${{ matrix.os }}, ${{ matrix.compiler.name }}, C++${{ matrix.cxx }}, ${{ matrix.buildtype }}
1731
runs-on: ${{ matrix.os }}
1832
strategy:
1933
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix entry fails.
2034
matrix:
2135
os: [ubuntu-22.04]
22-
compiler: [ {name: 'GCC 10', cpp: g++-10, c: gcc-10, pkgs: 'gcc-10 g++-10 lib32gcc-10-dev gcc-multilib'},
23-
{name: 'GCC 11', cpp: g++-11, c: gcc-11, pkgs: 'gcc-11 g++-11 lib32gcc-11-dev gcc-multilib'},
24-
{name: 'Clang 12', cpp: clang++-12, c: clang-12, pkgs: 'clang-12 llvm-12'},
25-
{name: 'Clang 13', cpp: clang++-13, c: clang-13, pkgs: 'clang-13 llvm-13'},
26-
{name: 'Clang 14', cpp: clang++-14, c: clang-14, pkgs: 'clang-14 llvm-14'},
27-
{name: 'Clang 15', cpp: clang++-15, c: clang-15, pkgs: 'clang-15 llvm-15'}
36+
buildtype: [debug]
37+
compiler: [ {name: 'GCC 10', preset: gcc-10, pkgs: 'gcc-10 g++-10 lib32gcc-10-dev gcc-multilib'},
38+
{name: 'GCC 11', preset: gcc-11, pkgs: 'gcc-11 g++-11 lib32gcc-11-dev gcc-multilib'},
39+
{name: 'GCC 12', preset: gcc-12, pkgs: 'gcc-12 g++-12 lib32gcc-12-dev gcc-multilib'},
40+
{name: 'Clang 12', preset: clang-12, pkgs: 'clang-12 llvm-12'},
41+
{name: 'Clang 13', preset: clang-13, pkgs: 'clang-13 llvm-13'},
42+
{name: 'Clang 14', preset: clang-14, pkgs: 'clang-14 llvm-14'},
43+
{name: 'Clang 15', preset: clang-15, pkgs: 'clang-15 llvm-15'}
2844
]
29-
cxx: [14, 17, 20]
45+
cxx: [17, 20]
3046

3147
steps:
3248
- uses: actions/checkout@v3
@@ -41,50 +57,27 @@ jobs:
4157
~/.cache/pip
4258
key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Conan.cmake') }}
4359

44-
- name: Create Build Environment
45-
# Some projects don't allow in-source building, so create a separate build directory
46-
# We'll use this as our working directory for all subsequent commands
47-
run: cmake -E make_directory ${{runner.workspace}}/build
48-
49-
- run: |
50-
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
51-
sudo apt update
52-
sudo apt install ${{ matrix.compiler.pkgs }}
53-
shell: bash
54-
5560
- name: Install conan
5661
shell: bash
5762
run: |
58-
python3 -m pip install --upgrade pip setuptools
59-
python3 -m pip install conan
63+
python3 -m pip install --upgrade pip setuptools conan==1.59
6064
source ~/.profile
6165
62-
- name: Configure CMake
63-
# Use a bash shell so we can use the same syntax for environment variable
64-
# access regardless of the host operating system
66+
- name: Install dependencies
67+
run: |
68+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
69+
sudo apt update
70+
sudo apt install ninja-build ${{ matrix.compiler.pkgs }}
6571
shell: bash
66-
working-directory: ${{runner.workspace}}/build
67-
env:
68-
CC: ${{ matrix.compiler.c }}
69-
CXX: ${{ matrix.compiler.cpp }}
70-
# Note the current convention is to use the -S and -B options here to specify source
71-
# and build directories, but this is only available with CMake 3.13 and higher.
72-
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
73-
#
74-
# We need to source the profile file to make sure conan is in PATH
75-
run: |
76-
source ~/.profile
77-
cmake $GITHUB_WORKSPACE -DCXX_STANDARD=${{ matrix.cxx }} -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCPP_STARTER_USE_SML=ON -DCPP_STARTER_USE_BOOST_BEAST=ON -DCPP_STARTER_USE_CROW=ON -DCPP_STARTER_USE_CPPZMQ_PROTO=ON
72+
73+
- name: Configure via CMake
74+
shell: bash
75+
run: cmake --preset unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }} -DCXX_STANDARD=${{ matrix.cxx }}
7876

7977
- name: Build
80-
working-directory: ${{runner.workspace}}/build
8178
shell: bash
82-
# Execute the build. You can specify a specific target with "--target <NAME>"
83-
run: cmake --build . --config $BUILD_TYPE
79+
run: cmake --build --preset build-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}
8480

8581
- name: Test
86-
working-directory: ${{runner.workspace}}/build
8782
shell: bash
88-
# Execute tests defined by the CMake configuration.
89-
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
90-
run: ctest -C $BUILD_TYPE
83+
run: ctest --preset test-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}

Diff for: .gitignore

+34-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,39 @@
1-
# Ignore build directory
2-
build/
3-
41
# Ignore vim/YouCompleteMe settings
52
.cache/
63
.vimrc
74
compile_commands.json
85

6+
# Build directories and binary files
7+
build/
8+
out/
9+
cmake-build-*/
10+
conan-cache/
11+
12+
# User spesific settings
13+
CMakeUserPresets.json
14+
15+
# IDE files
16+
.vs/
17+
.idea/
18+
.vscode/
19+
!.vscode/settings.json
20+
!.vscode/tasks.json
21+
!.vscode/launch.json
22+
!.vscode/extensions.json
23+
*.swp
24+
*~
25+
_ReSharper*
26+
*.log
27+
28+
# OS Generated Files
29+
.DS_Store
30+
.AppleDouble
31+
.LSOverride
32+
._*
33+
.Spotlight-V100
34+
.Trashes
35+
.Trash-*
36+
$RECYCLE.BIN/
37+
.TemporaryItems
38+
ehthumbs.db
39+
Thumbs.db

Diff for: CMakeLists.txt

+35-15
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,44 @@
1-
CMAKE_MINIMUM_REQUIRED(VERSION 3.15)
1+
CMAKE_MINIMUM_REQUIRED(VERSION 3.16...3.23)
2+
3+
# strongly encouraged to enable this globally to avoid conflicts between
4+
# -Wpedantic being enabled and -std=c++20 and -std=gnu++20 for example
5+
# when compiling with PCH enabled
6+
SET(CMAKE_CXX_EXTENSIONS OFF)
7+
8+
INCLUDE(cmake/Options.cmake)
29

310
# Set the project name to your project name, my project isn't very descriptive
411
PROJECT(myproject
512
LANGUAGES CXX
613
VERSION 0.0.1)
714

8-
if(NOT DEFINED CXX_STANDARD)
9-
set(CXX_STANDARD 20)
10-
endif()
15+
IF(NOT DEFINED CXX_STANDARD)
16+
SET(CXX_STANDARD 20)
17+
ENDIF()
18+
19+
SET(CMAKE_CXX_STANDARD ${CXX_STANDARD})
20+
21+
GET_PROPERTY(BUILDING_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
22+
IF(BUILDING_MULTI_CONFIG)
23+
IF(NOT CMAKE_BUILD_TYPE)
24+
# Make sure that all supported configuration types have their
25+
# associated conan packages available. You can reduce this
26+
# list to only the configuration types you use, but only if one
27+
# is not forced-set on the command line for VS
28+
MESSAGE(TRACE "Setting up multi-config build types")
29+
SET(CMAKE_CONFIGURATION_TYPES
30+
Debug
31+
Release
32+
RelWithDebInfo
33+
MinSizeRel
34+
CACHE STRING "Enabled build types" FORCE)
35+
ELSE()
36+
MESSAGE(TRACE "User chose a specific build type, so we are using that")
37+
SET(CMAKE_CONFIGURATION_TYPES
38+
${CMAKE_BUILD_TYPE}
39+
CACHE STRING "Enabled build types" FORCE)
40+
ENDIF()
41+
ENDIF()
1142

1243
INCLUDE(cmake/StandardProjectSettings.cmake)
1344
INCLUDE(cmake/PreventInSourceBuilds.cmake)
@@ -27,7 +58,6 @@ ADD_LIBRARY(project_options INTERFACE)
2758
TARGET_COMPILE_FEATURES(project_options INTERFACE cxx_std_${CXX_STANDARD})
2859

2960
IF(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
30-
OPTION(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF)
3161
IF(ENABLE_BUILD_WITH_TIME_TRACE)
3262
TARGET_COMPILE_OPTIONS(project_options INTERFACE -ftime-trace)
3363
ENDIF()
@@ -54,12 +84,6 @@ ENABLE_DOXYGEN()
5484
# allow for static analysis options
5585
INCLUDE(cmake/StaticAnalyzers.cmake)
5686

57-
OPTION(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
58-
OPTION(ENABLE_TESTING "Enable Test Builds" ON)
59-
OPTION(ENABLE_FUZZING "Enable Fuzzing Builds" OFF)
60-
61-
# Very basic PCH example
62-
OPTION(ENABLE_PCH "Enable Precompiled Headers" OFF)
6387
IF(ENABLE_PCH)
6488
# This sets a global PCH parameter, each project will build its own PCH, which is a good idea if any #define's change
6589
#
@@ -73,10 +97,6 @@ IF(ENABLE_PCH)
7397
<utility>)
7498
ENDIF()
7599

76-
# Set up some extra Conan dependencies based on our needs before loading Conan
77-
SET(CONAN_EXTRA_REQUIRES "")
78-
SET(CONAN_EXTRA_OPTIONS "")
79-
80100
INCLUDE(cmake/Conan.cmake)
81101
RUN_CONAN()
82102

0 commit comments

Comments
 (0)