Skip to content

Commit a3a858d

Browse files
authored
Merge pull request #44 from ErichZimmer/35-investigate-migrating-to-meson
35 investigate migrating to meson [WIP]
2 parents 8bdf76e + bef6988 commit a3a858d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+510
-313
lines changed

.github/workflows/build_test.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CMake
2+
3+
on:
4+
workflow_dispatch:
5+
6+
push:
7+
branches: [ master ]
8+
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
runs-on: ${{matrix.os}}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, windows-latest, macos-latest]
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
with:
22+
submodules: recursive
23+
24+
- name: Setup Python
25+
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
26+
with:
27+
python-version: '3.11'
28+
29+
- name: Install rtools (mingw-w64) (see SciPy workflow for more details)
30+
run: |
31+
if [ "$RUNNER_OS" == "Windows" ]; then
32+
choco install rtools -y --no-progress --force --version=4.0.0.20220206
33+
echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH
34+
fi
35+
shell: bash
36+
37+
- name: Install build dependencies from PyPI
38+
run: |
39+
python -m pip install meson cmake ninja
40+
41+
- name: Configure Meson
42+
# Configure meson to dump all executables in the test directory so Windows would work
43+
run: cd ${{github.workspace}} && meson setup builddir
44+
45+
- name: Build
46+
# Build your program with the given configuration
47+
run: meson compile -C ${{github.workspace}}/builddir --verbose
48+
49+
- name: Test
50+
working-directory: ${{github.workspace}}/builddir
51+
# Execute tests defined by meson test configuration.
52+
run: meson test -v

.github/workflows/cmake.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.gitmodules

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
[submodule "external/vcpkg"]
2-
path = external/vcpkg
3-
url = https://github.com/microsoft/vcpkg
1+
42
[submodule "external/pocketfft"]
53
path = external/pocketfft
6-
url = https://github.com/hayguen/pocketfft
4+
url = https://github.com/mreineck/pocketfft.git

CMakeLists.txt

Lines changed: 0 additions & 35 deletions
This file was deleted.

README.md

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,80 @@
1-
![Build Status](https://github.com/OpenPIV/openpiv-c--qt/actions/workflows/cmake.yml/badge.svg)
1+
![Build Status](https://github.com/OpenPIV/openpiv-c--qt/actions/workflows/build_test.yml/badge.svg)
22

3-
# OpenPIV (c++)
3+
# OpenPIV (c++), a fast, open-source particle image velocimetry (PIV) library
44

5-
An implementation of a PIV analysis engine in C++ using as few dependencies as possible;
6-
the implementation requires a c++17 compliant compiler.
5+
## An implementation of a PIV analysis engine in C++ using as few dependencies as possible; the implementation requires a c++17 compliant compiler.
6+
7+
This project is the result of the collaborative effort of numerous researchers in order to provide one of the fastest PIV software on the market while remaining cross-platform and open-source. The software can do the following:
8+
9+
* Load images with .tif and .pnm extensions
10+
* Save images with .tif and .pnm extensions
11+
* Pre-process and modify images
12+
* Perform digital PIV analysis including subpixel estimation
13+
* and more!
14+
15+
Additionally, two examples are provided to demonstrate how the library can be used for background subtraction of images and multi-threaded PIV analysis.
716

817
## Build
918

1019
There are some external dependencies under external/, so when cloning use:
1120

1221
```git clone --recursive <path to git repo>```
1322

14-
Building uses cmake and vcpkg, and is simplified by using a vcpkg manifest to specify
15-
the dependent packages. Vcpkg has some pre-requisites:
23+
Building uses meson, and is simplified by using meson wrap files to specify the dependent packages. Building has some pre-requisites:
1624

1725
* a compiler (e.g. `apt install build-essentials`)
18-
* cmake
19-
* git
26+
* cmake (optional)
27+
* python
2028
* (linux) pkg-config (e.g. `apt install pkg-config`)
2129
* curl, zip, unzip, tar (e.g. `apt install curl zip unzip tar`)
2230
* ninja (e.g. `apt install ninja-build`)
31+
* meson (e.g., pip install --user meson)
32+
33+
Unix users can also use the method used for the Windows build environment as detailed below.
34+
35+
On Windows, the following can be used:
36+
* install TDM-GCC or any other Windows GNU distribution
37+
* install miniconda or venv and setup virtual environment
38+
* pip install cmake (optional)
39+
* pip install meson
2340

2441
To build:
42+
* `meson setup builddir` Note, it is good practice to setup --prefix flags so files are not installed on the system.
43+
* `meson compile -C builddir`
2544

26-
* `cmake -B build -S .`
27-
* `cmake --build build`
45+
Meson provides multiple build types such as debug, debugoptimized, and release. To change the build type, use the --buildtype flag. For example, `meson setup builddir --buildtype debugoptimized`.
2846

2947
To run tests:
3048

31-
* `cd build`
32-
* `ctest`
49+
* `meson test -C builddir'
3350

34-
To change the build type, add `-DCMAKE_BUILD_TYPE` e.g.
35-
`cmake -DCMAKE_BUILD_TYPE=RelWithDebugInfo -B build -S .`.
51+
To get binaries:
52+
* `meson install -C builddir` if the prefix was set or
53+
* `meson install -C buildfir --destdir <some directory>` to install in a specific directory.
3654

37-
The binaries are located in the build directory:
55+
Sometimes you only want the runtime dynamic libraries and executables. Meson comes with a handy targeted installation using the following command:
56+
* `meson install -C builddir --tags runtime`
3857

39-
* build
40-
* test -> *_test
58+
Make sure the prefix, or destdir, is set so binaries are not accidentally installed on the system.
59+
60+
The binaries are located the build or installation directory:
61+
62+
Build directory:
63+
* builddir
4164
* examples
4265
* process
4366
* average_subtract
4467
* openpiv -> libopenpivcore.so
4568

46-
### Raspberry Pi
69+
Install directory:
70+
* prefix/destdir
71+
* bindir
72+
* libopenpivcore.so
73+
* all other dependent shared libraries
74+
* process (executable)
75+
* average_subtract (executable)
76+
77+
### Raspberry Pi (using deprecated VCPKG build system)
4778

4879
Build times are, as expected, much slower than on a modern Intel CPU, but the code
4980
will compile. Some observations:
@@ -165,15 +196,18 @@ This is about 230us per interrogation area (7 cores, 3696 interrogation areas, 0
165196

166197
## Dependencies
167198

168-
These are captured in `vcpkg.json`:
199+
These are captured in `<dependency>.wrap`:
169200

170201
* c++17 compiler e.g. clang++-5.0, gcc7
171-
* [vcpkg](https://github.com/Microsoft/vcpkg)
172-
* catch2: unit test framework
173-
* libtiff: TIFF IO support
202+
* python3
203+
* [meson](https://mesonbuild.com/index.html)
174204
* benchmark: used to run performance benchmarks
175-
* async++ (optional): implements c++17 parallel algorithms
205+
* catch2: unit test framework
176206
* cxxopts: nice command line parsing
207+
* libtiff: TIFF IO support
208+
* libjpeg-turbo
209+
* liblzma
210+
* zlib
177211

178212
## Examples
179213

cmake/utils.cmake

Lines changed: 0 additions & 26 deletions
This file was deleted.

examples/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/average_subtract/CMakeLists.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

examples/average_subtract/meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
avd_sub_exec = executable(
2+
'average_subtract',
3+
'main.cpp',
4+
include_directories: openpiv_include,
5+
dependencies: [
6+
cxxopts_dep,
7+
fmt_dep,
8+
thread_dep
9+
],
10+
link_with: openpiv_lib,
11+
install: true
12+
)

examples/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
subdir('average_subtract')
2+
subdir('process')

examples/process/CMakeLists.txt

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/process/meson.build

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
avd_sub_exec = executable(
2+
'process',
3+
'main.cpp',
4+
include_directories: [openpiv_include, pocketfft_include],
5+
dependencies: [
6+
cxxopts_dep,
7+
fmt_dep,
8+
thread_dep
9+
],
10+
cpp_args: ['-D_USE_MATH_DEFINES'],
11+
link_with: openpiv_lib,
12+
install: true
13+
)

external/vcpkg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)