Skip to content

Commit

Permalink
Migrate to conan 2
Browse files Browse the repository at this point in the history
  • Loading branch information
joakimono committed Jul 6, 2023
1 parent 31d6506 commit 0a8e5e9
Show file tree
Hide file tree
Showing 11 changed files with 357 additions and 355 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/ci-conan-clang.yml

This file was deleted.

71 changes: 40 additions & 31 deletions .github/workflows/ci-conan-gcc.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,65 @@
name: GCC Conan
---
name: Linux GCC

# This workflow is triggered on pushes to the repository.
on: [push]
on: [push, workflow_dispatch]

env:
SINTEF_REFERENCE: "mathgl*"
SINTEF_LIBNAME: "mathgl"
CONAN_UPLOAD: ${{ secrets.CONAN_URL }}
CONAN_PASSWORD_SINTEF: ${{ secrets.CONAN_PASSWORD }}
CONAN_LOGIN_USERNAME_SINTEF: ${{ secrets.CONAN_USER }}
CONAN_NON_INTERACTIVE: True
CONAN_USE_ALWAYS_SHORT_PATHS: True
CONAN_SYSREQUIRES_MODE: enabled
CONFIG_URL: https://github.com/sintef-ocean/conan-configs.git

jobs:
conan-with-gcc:
name: Conan
runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04
env:
PKG_REFERENCE: >-
${{ matrix.conan == '1.0' &&
format('{0}@{1}/{2}', matrix.version, 'sintef', matrix.channel) ||
format('--version {0} --user {1} --channel {2}', matrix.version, 'sintef', matrix.channel) }}
UPLOAD_FLAGS: "${{ matrix.conan == '1.0' && '--all' || '' }}"
cppstd: "${{ matrix.compiler_version < 11 && 'gnu14' || 'gnu17' }}"
strategy:
fail-fast: false
matrix:
compiler_version: [63, 7, 8, 9, 10, 11]
conan: ["1.0", "2.0"]
version: [2.4.4]
shared: ["True", "False"]
build_type: [Debug, Release]
option_shared: [shared=True, shared=False]
option_qt5: [qt5=False]
os: [ubuntu-20.04]
exclude:
- compiler_version: 6
option_qt5: qt5=True
# qt 5.15 did not compile with gcc 6
profile: [gcc]
compiler_version: [8, 9, 10, 11, 12]
channel: ["${{ (github.head_ref || github.ref_name) == 'master' && 'stable' || 'testing' }}"]
container:
image: conanio/gcc${{ matrix.compiler_version }}
image: conanio/gcc${{ matrix.compiler_version }}-ubuntu18.04
options: -u 0
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install prerequisites
run: |
sudo apt-get update
sudo pip3 install --upgrade setuptools pip requests
sudo pip3 install --upgrade conan
sudo apt-get install -y jq
pip3 install --upgrade setuptools pip
pip3 install --upgrade conan~=${{ matrix.conan }}
- name: Configure Conan
run: |
conan remote add sintef ${CONAN_UPLOAD} --insert 0
conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan --insert 0
conan config set general.revisions_enabled=1
run: conan remote add sintef ${{ env.CONAN_UPLOAD }}
- name: Get package name Conan 1
if: matrix.conan == '1.0'
run: echo "package_name=$(conan inspect --raw name .)" >> $GITHUB_ENV
- name: Get package name Conan 2
if: matrix.conan == '2.0'
run: echo "package_name=$(conan inspect -f json . | jq .name -r)" >> $GITHUB_ENV
- name: Conan create
run: |
git config --global --add safe.directory '*'
conan config install ${{ env.CONFIG_URL }} --type git -sf conan${{ matrix.conan }}
conan config install ${{ env.CONFIG_URL }} --type git -sf profiles -tf profiles
conan create -s build_type=${{ matrix.build_type }} \
-s compiler.libcxx=libstdc++11 \
-o ${SINTEF_LIBNAME}:${{ matrix.option_shared }} \
-o ${SINTEF_LIBNAME}:${{ matrix.option_qt5 }} \
-b missing -b outdated . sintef/steady
-s compiler.version=${{ matrix.compiler_version }} \
-s compiler.cppstd=${{ env.cppstd }} \
-pr:b=${{ matrix.profile }} -pr:h=${{ matrix.profile }} \
- o ${{ env.package_name }}/*:shared=${{ matrix.shared }} \
-b missing -b outdated -b ${{ env.package_name }}* \
. ${{ env.PKG_REFERENCE }}
- name: Conan upload
run: |
conan upload --all -c -r sintef ${SINTEF_REFERENCE} --retry 5 --retry-wait 20 --force
run: conan upload --confirm -r sintef ${{ env.package_name }}* --force ${{ env.UPLOAD_FLAGS }}
67 changes: 38 additions & 29 deletions .github/workflows/ci-conan-msvc.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,64 @@
name: MSVC Conan
---
name: Windows MSVC

# This workflow is triggered on pushes to the repository.
on: [push]
on: [push, workflow_dispatch]

env:
SINTEF_REFERENCE: "mathgl*"
SINTEF_LIBNAME: "mathgl"
CONAN_UPLOAD: ${{ secrets.CONAN_URL }}
CONAN_PASSWORD_SINTEF: ${{ secrets.CONAN_PASSWORD }}
CONAN_LOGIN_USERNAME_SINTEF: ${{ secrets.CONAN_USER }}
CONAN_NON_INTERACTIVE: True
CONAN_USE_ALWAYS_SHORT_PATHS: True
CONFIG_URL: https://github.com/sintef-ocean/conan-configs.git

jobs:
conan-with-msvc:
name: Conan
runs-on: ${{ matrix.os }}
runs-on: windows-2022
env:
CONAN_USER_HOME_SHORT: C:\c
CONAN_USE_ALWAYS_SHORT_PATHS: 1
PKG_REFERENCE: >-
${{ matrix.conan == '1.0' &&
format('{0}@{1}/{2}', matrix.version, 'sintef', matrix.channel) ||
format('--version {0} --user {1} --channel {2}', matrix.version, 'sintef', matrix.channel) }}
UPLOAD_FLAGS: "${{ matrix.conan == '1.0' && '--all' || '' }}"
cppstd: "${{ matrix.compiler_version < 11 && 'gnu14' || 'gnu17' }}"
strategy:
fail-fast: false
matrix:
compiler_toolset: [v141, v142, v143]
conan: ["1.0", "2.0"]
version: [2.4.4]
shared: ["True", "False"]
build_type: [Debug, Release]
option_shared: [shared=True, shared=False]
option_qt5: [qt5=False]
compiler_version: [17]
os: [windows-2022]
profile: [msvc17]
compiler_version: [191, 192, 193]
channel: ["${{ (github.head_ref || github.ref_name) == 'master' && 'stable' || 'testing' }}"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install prerequisites
run: |
pip3 install --upgrade setuptools pip
pip3 install conan requests
vcpkg install opengl:x64-windows
pip3 install --upgrade conan~=${{ matrix.conan }}
- name: Configure Conan
run: conan remote add sintef ${{ env.CONAN_UPLOAD }}
- name: Get package name Conan 1
if: matrix.conan == '1.0'
shell: pwsh
run: |
conan remote add sintef ${env:CONAN_UPLOAD} --insert 0
conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan --insert 0
conan config set general.revisions_enabled=1
$package_name=conan inspect --raw name .
echo "package_name=$package_name" >> $Env:GITHUB_ENV
- name: Get package name Conan 2
if: matrix.conan == '2.0'
shell: pwsh
run: |
$package_name=conan inspect -f json . | jq .name -r
echo "package_name=$package_name" >> $Env:GITHUB_ENV
- name: Conan create
run: |
conan config install ${{ env.CONFIG_URL }} --type git -sf conan${{ matrix.conan }}
conan config install ${{ env.CONFIG_URL }} --type git -sf profiles -tf profiles
conan create -s build_type=${{ matrix.build_type }} `
-s compiler.version=${{ matrix.compiler_version }} `
-s compiler.toolset=${{ matrix.compiler_toolset }} `
-s compiler="Visual Studio" `
-s compiler.cppstd=14 `
-o ${env:SINTEF_LIBNAME}:${{ matrix.option_shared }} `
-o ${env:SINTEF_LIBNAME}:${{ matrix.option_qt5 }} `
-b missing -b outdated . sintef/steady
-pr:b=${{ matrix.profile }} -pr:h=${{ matrix.profile }} `
-o ${{ env.package_name }}/*:shared=${{ matrix.shared }} `
-b missing -b outdated -b ${{ env.package_name }}* `
. ${{ env.PKG_REFERENCE }}
- name: Conan upload
run: |
conan upload --all -c -r sintef ${env:SINTEF_REFERENCE} --retry 10 --retry-wait 20 --force
run: conan upload --confirm -r sintef ${{ env.package_name }}* --force ${{ env.UPLOAD_FLAGS }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.pyc
test_package/build
__pycache__
CMakeUserPresets.json
78 changes: 37 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,81 @@
[![GCC Conan](https://github.com/sintef-ocean/conan-mathgl/workflows/GCC%20Conan/badge.svg)](https://github.com/sintef-ocean/conan-mathgl/actions?query=workflow%3A"GCC+Conan")
[![Clang Conan](https://github.com/sintef-ocean/conan-mathgl/workflows/Clang%20Conan/badge.svg)](https://github.com/sintef-ocean/conan-mathgl/actions?query=workflow%3A"Clang+Conan")
[![MSVC Conan](https://github.com/sintef-ocean/conan-mathgl/workflows/MSVC%20Conan/badge.svg)](https://github.com/sintef-ocean/conan-mathgl/actions?query=workflow%3A"MSVC+Conan")

[![Linux GCC](https://github.com/sintef-ocean/conan-mathgl/workflows/Linux%20GCC/badge.svg)](https://github.com/sintef-ocean/conan-mathgl/actions?query=workflow%3A"Linux+GCC")
[![Windows MSVC](https://github.com/sintef-ocean/conan-mathgl/workflows/Windows%20MSVC/badge.svg)](https://github.com/sintef-ocean/conan-mathgl/actions?query=workflow%3A"Windows+MSVC")

[Conan.io](https://conan.io) recipe for [mathgl](http://mathgl.sourceforge.net).

The package is usually consumed using the `conan install` command or a *conanfile.txt*.

## How to use this package

1. Add remote to conan's package [remotes](https://docs.conan.io/en/latest/reference/commands/misc/remote.html?highlight=remotes):
1. Add remote to conan's package [remotes](https://docs.conan.io/2/reference/commands/remote.html)

```bash
$ conan remote add sintef https://artifactory.smd.sintef.no/artifactory/api/conan/conan-local
$ conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan
$ conan config set general.revisions_enabled=1
```

2. Using *conanfile.txt* in your project with *cmake*

Add a [*conanfile.txt*](http://docs.conan.io/en/latest/reference/conanfile_txt.html) to your project. This file describes dependencies and your configuration of choice, e.g.:
2. Using [*conanfile.txt*](https://docs.conan.io/2/reference/conanfile_txt.html) and *cmake* in your project.

Add *conanfile.txt*:
```
[requires]
mathgl/[>=2.4.4]@sintef/steady
clapack/3.2.1@sintef/stable

[tool_requires]
cmake/[>=3.25.0]

[options]
mathgl:shared=False

[imports]
licenses, * -> ./licenses @ folder=True
[layout]
cmake_layout

[generators]
cmake_paths
cmake_find_package
CMakeDeps
CMakeToolchain
VirtualBuildEnv
```

Insert into your *CMakeLists.txt* something like the following lines:
```cmake
cmake_minimum_required(VERSION 3.13)
cmake_minimum_required(VERSION 3.15)
project(TheProject CXX)
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
find_package(MathGL MODULE REQUIRED)
find_package(MathGL REQUIRED)
add_executable(the_executor code.cpp)
target_link_libraries(the_executor MathGL::MathGL)
```
Then, do
Install and build e.g. a Release configuration:
```bash
$ mkdir build && cd build
$ conan install .. -s build_type=<build_type>
$ conan install . -s build_type=Release -pr:b=default
$ source build/Release/generators/conanbuild.sh
$ cmake --preset conan-release
$ cmake --build build/Release
$ source build/Release/generators/deactivate_conanbuild.sh
```
where `<build_type>` is e.g. `Debug` or `Release`.
You can now continue with the usual dance with cmake commands for configuration and compilation. For details on how to use conan, please consult [Conan.io docs](http://docs.conan.io/en/latest/)

## Package options

Option | Default | Domain
Option | Default | Allowed values
---|---|---
shared | False | [True, False]
fPIC | True | [True, False]
lgpl | True | [True, False]
double_precision | True | [True, False]
rvalue_support | False | [True, False]
pthread | False | [True, False]
pthr_widget | False | [True, False]
openmp | False | [True, False]
opengl | True | [True, False]
wxWidgets | False | [True, False]
qt5 | False | [True, False]
zlib | True | [True, False]
png | True | [True, False]
jpeg | True | [True, False]
all_swig | False | [True, False]
gif | False | [True, False]
pdf | True | [True, False]
glut | False | [True, False]
gsl | False | [True, False]
hdf5 | False | [True, False]
mpi | False | [True, False]
jpeg | True | [True, False]
ltdl | False | [True, False]
all_swig | False | [True, False]
mpi | False | [True, False]
opengl | True | [True, False]
openmp | False | [True, False]
pdf | True | [True, False]
png | True | [True, False]
qt5 | False | [True, False]
wxWidgets | False | [True, False]
zlib | True | [True, False]

## Known recipe issues

We cannot upload to bintray sintef/stable for this package. It is instead found under **sintef/steady**
- There are several options which may not work as they are not been tested, including: fltk, wxWidgets
- With Qt5 does not currently work
9 changes: 9 additions & 0 deletions conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sources:
"2.4.4":
url: "https://sourceforge.net/projects/mathgl/files/mathgl/mathgl%202.4.4/mathgl-2.4.4.tar.gz"
sha1: "c7faa770a78a8b6783a4eab6959703172f28b329"

patches:
"2.4.4":
- patch_file: "patches/CMakeLists.patch"
- patch_file: "patches/FindQt5.patch"
Loading

0 comments on commit 0a8e5e9

Please sign in to comment.