Skip to content

Commit

Permalink
Merge pull request #25 from stephenberry/cmake_find_package
Browse files Browse the repository at this point in the history
CMake find package
  • Loading branch information
stephenberry authored Oct 24, 2022
2 parents e253ea7 + ab561f1 commit 65b81eb
Show file tree
Hide file tree
Showing 25 changed files with 401 additions and 233 deletions.
15 changes: 15 additions & 0 deletions .github/clang-14.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=14
compiler.libcxx=libc++
compiler.cppstd=20

[options]

[build_requires]

[env]
15 changes: 15 additions & 0 deletions .github/gcc-11.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=11
compiler.libcxx=libstdc++11
compiler.cppstd=20

[options]

[build_requires]

[env]
14 changes: 14 additions & 0 deletions .github/vs-16.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
compiler.cppstd=20

[options]

[build_requires]

[env]
43 changes: 27 additions & 16 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,49 @@ name: clang

on:
push:
branches: [ "main" ]
branches:
- main
- feature/*
paths-ignore:
- '**.md'
- '**.md'
pull_request:
branches: [ "main" ]
branches: [main]
paths-ignore:
- '**.md'
- '**.md'

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: macos-12

steps:
- uses: actions/checkout@v3

- name: Set Apple Clang 14 as the compiler
run: |
echo "CC=$(brew --prefix llvm@14)/bin/clang" >> "$GITHUB_ENV"
echo "CXX=$(brew --prefix llvm@14)/bin/clang++" >> "$GITHUB_ENV"
- name: Install Conan
uses: turtlebrowser/get-conan@main

- name: Configure Conan
run: |
conan profile new default
cp .github/clang-14.profile ~/.conan/profiles/default
conan profile update settings.build_type=${{env.BUILD_TYPE}} default
- name: Install dependencies
run: conan install . -b missing

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE="./conan/conan_toolchain.cmake"

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build build -j 2

- name: Test
working-directory: ${{github.workspace}}/build
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

working-directory: build
run: ctest -j 2 --output-on-failure
51 changes: 28 additions & 23 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,48 @@ name: gcc

on:
push:
branches: [ "main" ]
branches:
- main
- feature/*
paths-ignore:
- '**.md'
pull_request:
branches: [ "main" ]
branches: [main]
paths-ignore:
- '**.md'

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
CC: gcc-11
CXX: g++-11

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-22.04

env:
CC: gcc-11
CXX: g++-11

steps:
- uses: actions/checkout@v3
#- name: Set up Clang
# uses: egor-tensin/setup-clang@v1
# with:
# version: 15
# platform: x64

- name: Install Conan
uses: turtlebrowser/get-conan@main

- name: Configure Conan
run: |
conan profile new default
cp .github/gcc-11.profile ~/.conan/profiles/default
conan profile update settings.build_type=${{env.BUILD_TYPE}} default
- name: Install dependencies
run: conan install . -b missing

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE="./conan/conan_toolchain.cmake"

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build build -j 2

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

working-directory: build
run: ctest -j 2 --output-on-failure
38 changes: 25 additions & 13 deletions .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,45 @@ name: msvc

on:
push:
branches: [ "main" ]
branches:
- main
- feature/*
paths-ignore:
- '**.md'
pull_request:
branches: [ "main" ]
branches: [main]
paths-ignore:
- '**.md'

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-2019

steps:
- uses: actions/checkout@v3

- name: Install Conan
uses: turtlebrowser/get-conan@main

- name: Configure Conan
run: |
conan profile new default
cp .github/vs-16.profile "$env:userprofile/.conan/profiles/default"
conan profile update settings.build_type=${{env.BUILD_TYPE}} default
conan profile update "settings.compiler.runtime=MD$(($env:BUILD_TYPE -eq 'Release') ? '' : 'd')" default
- name: Install dependencies
run: conan install . -b missing

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE="./conan/conan_toolchain.cmake"

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build build --config ${{env.BUILD_TYPE}} -j 2

- name: Test
working-directory: ${{github.workspace}}/build
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
working-directory: build
run: ctest -C ${{env.BUILD_TYPE}} -j 2 --output-on-failure
17 changes: 11 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
*build/
*bin/
.vscode/
.cache/
compile_commands.json
.DS_Store
*build/
*bin/
.vscode/
.cache/
conan/
compile_commands.json
.DS_Store
CMakeUserPresets.json
conanbuildinfo.txt
conaninfo.txt
graph_info.json
Loading

0 comments on commit 65b81eb

Please sign in to comment.