Skip to content

Commit a4c00cc

Browse files
committed
Migrate to Conan 2 [skip appveyor]
1 parent 8778ea9 commit a4c00cc

14 files changed

+813
-16
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[settings]
2+
arch=x86_64
3+
os=Linux
4+
compiler=gcc
5+
compiler.cppstd=17
6+
7+
[options]
8+
matio/*:shared=False
9+
matio/*:with_hdf5=static
10+
matio/*:with_zlib=static
11+
hdf5/*:hl=False
12+
hdf5/*:shared=False
13+
hdf5/*:with_zlib=True
14+
hdf5/*:enable_cxx=False
15+
zlib/*:shared=False
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[settings]
2+
compiler.cppstd=17
3+
4+
[options]
5+
matio/*:shared=False
6+
matio/*:with_hdf5=static
7+
matio/*:with_zlib=static
8+
hdf5/*:hl=False
9+
hdf5/*:shared=False
10+
hdf5/*:with_zlib=True
11+
hdf5/*:enable_cxx=False
12+
zlib/*:shared=False
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[settings]
2+
arch=x86_64
3+
os=Windows
4+
compiler=gcc
5+
compiler.cppstd=17
6+
7+
[options]
8+
matio/*:shared=False
9+
matio/*:with_zlib=static
10+
hdf5/*:hl=False
11+
hdf5/*:shared=False
12+
hdf5/*:with_zlib=True
13+
hdf5/*:enable_cxx=False
14+
zlib/*:shared=False
15+
16+
[conf]
17+
user.workaround.matio:with_hdf5=Off
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[settings]
2+
arch=x86_64
3+
os=Windows
4+
compiler=msvc
5+
compiler.cppstd=17
6+
7+
[options]
8+
matio/*:shared=False
9+
matio/*:with_hdf5=static
10+
matio/*:with_zlib=static
11+
hdf5/*:hl=False
12+
hdf5/*:shared=False
13+
hdf5/*:with_zlib=True
14+
hdf5/*:enable_cxx=False
15+
zlib/*:shared=False

.github/workflows/cmake.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ jobs:
4040
os: ubuntu-latest
4141
compiler: gcc
4242
- toolchain: macos-clang
43-
os: macos-14
43+
os: macos-latest
4444
compiler: clang
4545
- toolchain: windows-msvc
4646
os: windows-latest
4747
compiler: msvc
4848
- toolchain: windows-mingw
49-
os: windows-2022
49+
os: windows-latest
5050
compiler: mingw
5151
exclude:
5252
- toolchain: windows-mingw
@@ -66,20 +66,25 @@ jobs:
6666
if [ "${{ matrix.toolchain }}" == "macos-clang" ]; then
6767
echo "/Users/runner/Library/Python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH
6868
fi
69-
pip install --disable-pip-version-check --user "conan>=1.62.0,<2"
69+
pip install --disable-pip-version-check --user "conan>=2.16.1,<3"
70+
- name: Cache conan folder
71+
uses: actions/cache@v4
72+
with:
73+
path: ~/.conan2
74+
key: ${{ runner.os }}-conan2-${{ hashFiles('conanfile.txt', 'conanfile.py', 'conan.lock') }}
75+
restore-keys: |
76+
${{ runner.os }}-conan2-
7077
- name: Configure (${{ matrix.configuration }})
7178
run: |
7279
if [ "${{ matrix.toolchain }}" == "macos-clang" ]; then
7380
echo "/Users/runner/Library/Python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH
7481
fi
7582
if [ "${{ matrix.toolchain }}" == "windows-msvc" ]; then
76-
cmake -S . -B build -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF -DMATIO_EXTENDED_SPARSE=${{ matrix.extended-sparse }} -DMATIO_MAT73=${{ matrix.mat73 }} -DMATIO_WITH_ZLIB=${{ matrix.with-zlib }}
83+
cmake -S . -B build -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider -DCONAN_HOST_PROFILE="default;auto-cmake;${{ github.workspace }}/.ci/conan_static_profile_windows-msvc.cmake" -DMATIO_SHARED=OFF -DMATIO_EXTENDED_SPARSE=${{ matrix.extended-sparse }} -DMATIO_MAT73=${{ matrix.mat73 }} -DMATIO_WITH_ZLIB=${{ matrix.with-zlib }}
7784
elif [ "${{ matrix.toolchain }}" == "windows-mingw" ]; then
78-
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF -DMATIO_EXTENDED_SPARSE=${{ matrix.extended-sparse }} -DMATIO_MAT73=${{ matrix.mat73 }} -DMATIO_WITH_ZLIB=${{ matrix.with-zlib }} -DMATIO_WITH_HDF5=${{ matrix.mat73 }} -G "MinGW Makefiles"
79-
elif [ "${{ matrix.toolchain }}" == "linux-gcc" ]; then
80-
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF -DMATIO_ENABLE_CPPCHECK=ON -DMATIO_EXTENDED_SPARSE=${{ matrix.extended-sparse }} -DMATIO_MAT73=${{ matrix.mat73 }} -DMATIO_WITH_ZLIB=${{ matrix.with-zlib }}
85+
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider -DCONAN_HOST_PROFILE="default;auto-cmake;${{ github.workspace }}/.ci/conan_static_profile_windows-mingw.cmake" -DMATIO_SHARED=OFF -DMATIO_EXTENDED_SPARSE=${{ matrix.extended-sparse }} -DMATIO_MAT73=${{ matrix.mat73 }} -DMATIO_WITH_ZLIB=${{ matrix.with-zlib }} -DMATIO_WITH_HDF5=${{ matrix.mat73 }} -G "MinGW Makefiles"
8186
else
82-
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF -DMATIO_EXTENDED_SPARSE=${{ matrix.extended-sparse }} -DMATIO_MAT73=${{ matrix.mat73 }} -DMATIO_WITH_ZLIB=${{ matrix.with-zlib }}
87+
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider -DCONAN_HOST_PROFILE="default;auto-cmake;${{ github.workspace }}/.ci/conan_static_profile_${{ matrix.toolchain }}.cmake" -DMATIO_SHARED=OFF -DMATIO_EXTENDED_SPARSE=${{ matrix.extended-sparse }} -DMATIO_MAT73=${{ matrix.mat73 }} -DMATIO_WITH_ZLIB=${{ matrix.with-zlib }}
8388
fi
8489
- name: Build with ${{ matrix.compiler }}
8590
run: |

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ if(POLICY CMP0074)
44
cmake_policy(SET CMP0074 NEW)
55
endif()
66

7+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
8+
79
project(matio
810
VERSION 1.5.28
911
LANGUAGES C CXX
1012
)
1113

14+
set(CMAKE_CXX_STANDARD 11)
15+
1216
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
1317
set(matio_PLATFORM ${CMAKE_SYSTEM_PROCESSOR}-pc-${CMAKE_SYSTEM_NAME})
1418
set(matio_PACKAGE "${PROJECT_NAME}")

Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ VS_FILES = visual_studio/libmatio/libmatio.vcproj \
4747
visual_studio/stdint_msvc.h
4848

4949
CMAKE_FILES = CMakeLists.txt \
50+
conanfile.py \
5051
cmake/compilerOptions.cmake \
5152
cmake/conan.cmake \
53+
cmake/conan_provider.cmake \
5254
cmake/getopt.cmake \
5355
cmake/options.cmake \
5456
cmake/src.cmake \

README

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ Table of Contents
176176
The following matio specific options for building with CMake are
177177
available.
178178

179-
* 'MATIO_USE_CONAN:BOOL=OFF'
180-
This option enables the Conan package manager to resolve the
181-
library dependencies. Only Conan 1.x is supported.
182179
* 'MATIO_DEFAULT_FILE_VERSION:STRING=5'
183180
This option sets the default MAT file version (4,5,7.3) that
184181
will be used when writing.
@@ -205,6 +202,9 @@ Table of Contents
205202
* 'MATIO_ENABLE_CPPCHECK:BOOL=OFF'
206203
This option enables CMake >= 3.10 to perform static analysis
207204
with Cppcheck.
205+
* 'MATIO_USE_CONAN:BOOL=OFF'
206+
This deprecated option enables the Conan 1.X package manager to
207+
resolve the library dependencies.
208208

209209
To help CMake find the HDF5 libraries, set environment variable
210210
HDF5_DIR to the 'cmake/hdf5' directory (containing 'hdf5-config.cmake')
@@ -216,6 +216,10 @@ Table of Contents
216216
using CMake's built-in 'FindHDF5', especially for static builds.
217217
CMake 3.10 or later is recommended.
218218

219+
For Conan 2.X as dependency provider call CMake with
220+
`-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider`. CMake 3.24 or
221+
later is required.
222+
219223
2.2.4 Visual Studio
220224
Visual Studio solutions are provided as visual_studio/matio_vs2008.sln
221225
for VS2008 and as visual_studio/matio.sln for VS2010 (and newer).

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ cmake --install .
123123
```
124124
The following matio specific options for building with CMake are available.
125125

126-
* `MATIO_USE_CONAN:BOOL=OFF`
127-
This option enables the Conan package manager to resolve the library dependencies. Only Conan 1.x is supported.
128126
* `MATIO_DEFAULT_FILE_VERSION:STRING=5`
129127
This option sets the default MAT file version (4,5,7.3) that will be used when writing.
130128
* `MATIO_EXTENDED_SPARSE:BOOL=ON`
@@ -143,9 +141,13 @@ This option enables CMake to check for availability of the zlib library (see sec
143141
This option enables the matio testsuite for CTest.
144142
* `MATIO_ENABLE_CPPCHECK:BOOL=OFF`
145143
This option enables CMake &GreaterEqual; 3.10 to perform static analysis with Cppcheck.
144+
* `MATIO_USE_CONAN:BOOL=OFF`
145+
This deprecated option enables the Conan 1.X package manager to resolve the library dependencies.
146146

147147
To help CMake find the HDF5 libraries, set environment variable `HDF5_DIR` to the `cmake/hdf5` directory (containing `hdf5-config.cmake`) inside the HDF5 build or installation directory, or call cmake with `-DHDF5_DIR="dir/to/hdf5/cmake/hdf5"`. Alternatively call CMake with `-DCMAKE_PREFIX_PATH="dir/to/hdf5/cmake"`. See the [HDF5 instructions](https://support.hdfgroup.org/HDF5/release/cmakebuild.html#compile) for more information. Using `hdf5-config` is recommended over using CMake's built-in `FindHDF5`, especially for static builds. CMake 3.10 or later is recommended.
148148

149+
For Conan 2.X as dependency provider call CMake with `-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider`. CMake 3.24 or later is required.
150+
149151
#### 2.2.4 Visual Studio
150152
Visual Studio solutions are provided as [matio_vs2008.sln](visual_studio/matio_vs2008.sln) for VS2008 and as [matio.sln](visual_studio/matio.sln) for VS2010 (and newer). The Debug and Release configurations of both solutions are set up to build a DLL of the matio library (libmatio.dll) and the matdump tool and assume HDF5 is available in the directory specified by the HDF5_DIR environment variable. It is assumed that the **shared** libraries of HDF5 (and zlib) are available. If the **static** libraries of HDF5 (and zlib) are installed/built the macro `H5_BUILT_AS_STATIC_LIB` needs to be defined (instead of `H5_BUILT_AS_DYNAMIC_LIB`). Furthermore, the Release Lib configuration of the VS2010 solution is set up to build a static LIB of the matio library (libmatio.lib) and assumes that the **static** libraries of HDF5 (and zlib) are installed/built.
151153

0 commit comments

Comments
 (0)