From 9eaeb1f6af1ccae290fae88ffa669fd2bf79f71c Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 17 Nov 2023 02:53:06 -0600 Subject: [PATCH 01/35] Remove CMakeList.txt files --- .gitmodules | 3 -- CMakeLists.txt | 35 ------------- cmake/utils.cmake | 26 ---------- examples/CMakeLists.txt | 3 -- examples/average_subtract/CMakeLists.txt | 16 ------ examples/process/CMakeLists.txt | 32 ------------ external/vcpkg | 1 - openpiv/CMakeLists.txt | 62 ------------------------ test/CMakeLists.txt | 60 ----------------------- vcpkg.json | 13 ----- 10 files changed, 251 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 cmake/utils.cmake delete mode 100644 examples/CMakeLists.txt delete mode 100644 examples/average_subtract/CMakeLists.txt delete mode 100644 examples/process/CMakeLists.txt delete mode 160000 external/vcpkg delete mode 100644 openpiv/CMakeLists.txt delete mode 100644 test/CMakeLists.txt delete mode 100644 vcpkg.json diff --git a/.gitmodules b/.gitmodules index 0c7819d..1e9ff34 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "external/vcpkg"] - path = external/vcpkg - url = https://github.com/microsoft/vcpkg [submodule "external/pocketfft"] path = external/pocketfft url = https://github.com/hayguen/pocketfft diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 3601f75..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -cmake_minimum_required(VERSION 3.8) - -# pickup environment to get vcpkg cmake files -set(vcpkg_root ${CMAKE_CURRENT_SOURCE_DIR}/external/vcpkg) -include(cmake/utils.cmake) -setup_vcpkg_before_project() - -project(openpiv-c++) - -set(CMAKE_CXX_STANDARD 17) - -set(openpiv-c++_VERSION_MAJOR 0) -set(openpiv-c++_VERSION_MINOR 1) -set(openpiv-c++_VERSION_PATCH 0) - -enable_testing() - -if(WIN32) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif(WIN32) - -if(MSVC) - set(CMAKE_CXX_FLAGS "/EHsc /W3 /WX") -else() - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") - set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unknown-pragmas") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -g -O3 -ffast-math") -endif() - -add_subdirectory(openpiv) -add_subdirectory(test) -add_subdirectory(examples) diff --git a/cmake/utils.cmake b/cmake/utils.cmake deleted file mode 100644 index bce6c44..0000000 --- a/cmake/utils.cmake +++ /dev/null @@ -1,26 +0,0 @@ -function(setup_vcpkg_before_project) - if(DEFINED ENV{VCPKG_ROOT} OR vcpkg_root) - if(DEFINED ENV{VCPKG_ROOT}) - set(vcpkg_root $ENV{VCPKG_ROOT}) - endif() - set(vcpkg_toolchain_path "${vcpkg_root}/scripts/buildsystems/vcpkg.cmake") - message(STATUS "found VCPKG_ROOT: ${vcpkg_root} -> ${vcpkg_toolchain_path}") - get_filename_component(vcpkg_toolchain_path "${vcpkg_toolchain_path}" ABSOLUTE) - endif() - - if(DEFINED CMAKE_TOOLCHAIN_FILE AND vcpkg_toolchain_path) - get_filename_component(supplied_toolchain_file "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE) - if(NOT supplied_toolchain_file STREQUAL vcpkg_toolchain_path) - set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" CACHE STRING "") - endif() - endif() - - if(vcpkg_toolchain_path AND EXISTS "${vcpkg_toolchain_path}") - set(CMAKE_TOOLCHAIN_FILE "${vcpkg_toolchain_path}" CACHE STRING "" FORCE) - endif() - - if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT VCPKG_TARGET_TRIPLET) - set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "") - endif() - message(STATUS "Using vcpkg triplet ${VCPKG_TARGET_TRIPLET}") -endfunction() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt deleted file mode 100644 index 39de075..0000000 --- a/examples/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ - -add_subdirectory(process) -add_subdirectory(average_subtract) diff --git a/examples/average_subtract/CMakeLists.txt b/examples/average_subtract/CMakeLists.txt deleted file mode 100644 index b10908f..0000000 --- a/examples/average_subtract/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ - -# include packages -find_package(cxxopts CONFIG REQUIRED) -find_package(Threads REQUIRED) -find_package(fmt CONFIG REQUIRED) - -add_executable(average_subtract main.cpp) - -# include openpivcore -include_directories(${CMAKE_SOURCE_DIR}/openpiv) -target_link_libraries( - average_subtract - PRIVATE cxxopts::cxxopts - PRIVATE fmt::fmt-header-only - Threads::Threads - openpivcore) diff --git a/examples/process/CMakeLists.txt b/examples/process/CMakeLists.txt deleted file mode 100644 index 911a3c6..0000000 --- a/examples/process/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ - -# include packages -find_package(cxxopts CONFIG REQUIRED) -find_package(Async++ CONFIG) -find_package(Threads REQUIRED) -find_package(fmt CONFIG REQUIRED) - -add_executable(process main.cpp) - -# include path for pocket fft -set(POCKETFFT_EXTERNAL_LIBRARY_CXX ${PROJECT_SOURCE_DIR}/external/pocketfft) -include_directories(${POCKETFFT_EXTERNAL_LIBRARY_CXX}) - - -# include openpivcore -include_directories(${CMAKE_SOURCE_DIR}/openpiv) -target_link_libraries( - process - PRIVATE cxxopts::cxxopts - PRIVATE fmt::fmt-header-only - Threads::Threads - openpivcore) - -if (Async++_FOUND) - message("async++ found; including") - target_compile_definitions( - process - PRIVATE ASYNCPLUSPLUS) - target_link_libraries( - process - PRIVATE Async++) -endif() diff --git a/external/vcpkg b/external/vcpkg deleted file mode 160000 index 7b78396..0000000 --- a/external/vcpkg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7b78396b3f79621de5ac29e86c4eb10c07e77dec diff --git a/openpiv/CMakeLists.txt b/openpiv/CMakeLists.txt deleted file mode 100644 index 13934cc..0000000 --- a/openpiv/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -# ensure we check local libs first -set(CMAKE_FIND_FRAMEWORK LAST) - -set(SOURCE - ${CMAKE_CURRENT_SOURCE_DIR}/core/size.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core/rect.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/core/util.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/loaders/image_loader.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/loaders/pnm_image_loader.cpp) -set(LIBS) - -set(LIBNAME openpivcore) -add_library(${LIBNAME} SHARED ${SOURCE}) -target_compile_definitions(${LIBNAME} PUBLIC _USE_MATH_DEFINES) - -# include path for pocket fft -set(POCKETFFT_EXTERNAL_LIBRARY_CXX ${PROJECT_SOURCE_DIR}/external/pocketfft) -include_directories(${POCKETFFT_EXTERNAL_LIBRARY_CXX}) - -# include packages -find_package(TIFF) -if(TIFF_FOUND) - message("found libtiff") - # no reliable way to get libtiffxx so build local copy of - # tif_stream.cxx - set(TIFF_EXTERNAL_LIBRARY_CXX ${PROJECT_SOURCE_DIR}/external/libtiff/4.0.10) - target_sources( - ${LIBNAME} - PRIVATE - ${TIFF_EXTERNAL_LIBRARY_CXX}/tif_stream.cxx - ${CMAKE_CURRENT_SOURCE_DIR}/loaders/tiff_image_loader.cpp ) - - include_directories(${TIFF_EXTERNAL_LIBRARY_CXX}) - include_directories(BEFORE ${TIFF_INCLUDE_DIR}) - - target_link_libraries(${LIBNAME} PRIVATE ${TIFF_LIBRARIES}) -endif() - -find_package(mimalloc CONFIG) -if(mimalloc_FOUND) - message("found mimalloc") - target_link_libraries( - ${LIBNAME} - PRIVATE mimalloc mimalloc-static) -endif() - -find_package(Threads REQUIRED) -find_package(fmt CONFIG REQUIRED) -target_link_libraries( - ${LIBNAME} - PRIVATE fmt::fmt-header-only - PRIVATE Threads::Threads) - -# install -#install(TARGETS ${LIBNAME} DESTINATION lib/${LIBNAME}) - -# Install library headers -#file(GLOB HEADERS include/*.h) -#install(FILES ${HEADERS} DESTINATION include/${LIBNAME}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index a77a45b..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -# -# unit tests: -# - -# include catch -find_package(Catch2 REQUIRED) -find_package(Threads REQUIRED) -find_package(fmt CONFIG REQUIRED) - -file(GLOB SOURCES *_test.cpp) -foreach(SOURCE ${SOURCES}) - get_filename_component(OUTPUT ${SOURCE} NAME_WE) - message("building ${OUTPUT} from ${SOURCE}") - - # for each file, build a binary - add_executable(${OUTPUT} ${SOURCE}) - - # include openpivcore - include_directories(${CMAKE_SOURCE_DIR}/openpiv) - - target_link_libraries( - ${OUTPUT} - PRIVATE Catch2::Catch2WithMain - PRIVATE openpivcore - PRIVATE fmt::fmt-header-only - PRIVATE Threads::Threads) - - # add as a test - add_test( - NAME ${OUTPUT} - COMMAND ${OUTPUT} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test) -endforeach() - -# -# benchmark tests: -# - -# include google benchmark -find_package(benchmark) - -if(benchmark_FOUND) - file(GLOB BM_SOURCES *_benchmark.cpp) - foreach(BM_SOURCE ${BM_SOURCES}) - get_filename_component(OUTPUT ${BM_SOURCE} NAME_WE) - message("building ${OUTPUT} from ${BM_SOURCE}") - - # for each file, build a binary - add_executable(${OUTPUT} ${BM_SOURCE}) - - # include openpivcore - include_directories(${CMAKE_SOURCE_DIR}) - target_link_libraries( - ${OUTPUT} - PRIVATE openpivcore - PRIVATE fmt::fmt-header-only - PRIVATE benchmark::benchmark - PRIVATE benchmark::benchmark_main) - endforeach() -endif() diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index 402cc1f..0000000 --- a/vcpkg.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "openpiv-cplusplus", - "version-string": "latest", - "dependencies": [ - "fmt", - "catch2", - "cxxopts", - "tiff", - { "name": "benchmark", "platform": "!windows" }, - "asyncplusplus", - { "name": "mimalloc", "platform": "!(arm | uwp)" } - ] -} From 99f40a570e4cf8fb9e5acc666e0873bfff841694 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 17 Nov 2023 02:54:54 -0600 Subject: [PATCH 02/35] Renamed test folder to tests --- {test => tests}/A_00001_a.tif | Bin {test => tests}/corr_a.tiff | Bin {test => tests}/enum_helper_test.cpp | 0 {test => tests}/grid_test.cpp | 0 {test => tests}/image_algos_benchmark.cpp | 0 {test => tests}/image_algos_test.cpp | 0 {test => tests}/image_expression_test.cpp | 0 {test => tests}/image_loader_test.cpp | 0 {test => tests}/image_stats_test.cpp | 0 {test => tests}/image_test.cpp | 0 {test => tests}/image_utils_benchmark.cpp | 0 {test => tests}/image_utils_test.cpp | 0 {test => tests}/image_view_test.cpp | 0 {test => tests}/log_test.cpp | 0 {test => tests}/pixel_types_test.cpp | 0 {test => tests}/point_test.cpp | 0 {test => tests}/range_test.cpp | 0 {test => tests}/rect_test.cpp | 0 {test => tests}/size_test.cpp | 0 {test => tests}/stream_utils_test.cpp | 0 {test => tests}/test-mono.tiff | Bin {test => tests}/test-rgb.tiff | Bin {test => tests}/test_utils.h | 0 {test => tests}/util_test.cpp | 0 {test => tests}/vector_test.cpp | 0 25 files changed, 0 insertions(+), 0 deletions(-) rename {test => tests}/A_00001_a.tif (100%) rename {test => tests}/corr_a.tiff (100%) rename {test => tests}/enum_helper_test.cpp (100%) rename {test => tests}/grid_test.cpp (100%) rename {test => tests}/image_algos_benchmark.cpp (100%) rename {test => tests}/image_algos_test.cpp (100%) rename {test => tests}/image_expression_test.cpp (100%) rename {test => tests}/image_loader_test.cpp (100%) rename {test => tests}/image_stats_test.cpp (100%) rename {test => tests}/image_test.cpp (100%) rename {test => tests}/image_utils_benchmark.cpp (100%) rename {test => tests}/image_utils_test.cpp (100%) rename {test => tests}/image_view_test.cpp (100%) rename {test => tests}/log_test.cpp (100%) rename {test => tests}/pixel_types_test.cpp (100%) rename {test => tests}/point_test.cpp (100%) rename {test => tests}/range_test.cpp (100%) rename {test => tests}/rect_test.cpp (100%) rename {test => tests}/size_test.cpp (100%) rename {test => tests}/stream_utils_test.cpp (100%) rename {test => tests}/test-mono.tiff (100%) rename {test => tests}/test-rgb.tiff (100%) rename {test => tests}/test_utils.h (100%) rename {test => tests}/util_test.cpp (100%) rename {test => tests}/vector_test.cpp (100%) diff --git a/test/A_00001_a.tif b/tests/A_00001_a.tif similarity index 100% rename from test/A_00001_a.tif rename to tests/A_00001_a.tif diff --git a/test/corr_a.tiff b/tests/corr_a.tiff similarity index 100% rename from test/corr_a.tiff rename to tests/corr_a.tiff diff --git a/test/enum_helper_test.cpp b/tests/enum_helper_test.cpp similarity index 100% rename from test/enum_helper_test.cpp rename to tests/enum_helper_test.cpp diff --git a/test/grid_test.cpp b/tests/grid_test.cpp similarity index 100% rename from test/grid_test.cpp rename to tests/grid_test.cpp diff --git a/test/image_algos_benchmark.cpp b/tests/image_algos_benchmark.cpp similarity index 100% rename from test/image_algos_benchmark.cpp rename to tests/image_algos_benchmark.cpp diff --git a/test/image_algos_test.cpp b/tests/image_algos_test.cpp similarity index 100% rename from test/image_algos_test.cpp rename to tests/image_algos_test.cpp diff --git a/test/image_expression_test.cpp b/tests/image_expression_test.cpp similarity index 100% rename from test/image_expression_test.cpp rename to tests/image_expression_test.cpp diff --git a/test/image_loader_test.cpp b/tests/image_loader_test.cpp similarity index 100% rename from test/image_loader_test.cpp rename to tests/image_loader_test.cpp diff --git a/test/image_stats_test.cpp b/tests/image_stats_test.cpp similarity index 100% rename from test/image_stats_test.cpp rename to tests/image_stats_test.cpp diff --git a/test/image_test.cpp b/tests/image_test.cpp similarity index 100% rename from test/image_test.cpp rename to tests/image_test.cpp diff --git a/test/image_utils_benchmark.cpp b/tests/image_utils_benchmark.cpp similarity index 100% rename from test/image_utils_benchmark.cpp rename to tests/image_utils_benchmark.cpp diff --git a/test/image_utils_test.cpp b/tests/image_utils_test.cpp similarity index 100% rename from test/image_utils_test.cpp rename to tests/image_utils_test.cpp diff --git a/test/image_view_test.cpp b/tests/image_view_test.cpp similarity index 100% rename from test/image_view_test.cpp rename to tests/image_view_test.cpp diff --git a/test/log_test.cpp b/tests/log_test.cpp similarity index 100% rename from test/log_test.cpp rename to tests/log_test.cpp diff --git a/test/pixel_types_test.cpp b/tests/pixel_types_test.cpp similarity index 100% rename from test/pixel_types_test.cpp rename to tests/pixel_types_test.cpp diff --git a/test/point_test.cpp b/tests/point_test.cpp similarity index 100% rename from test/point_test.cpp rename to tests/point_test.cpp diff --git a/test/range_test.cpp b/tests/range_test.cpp similarity index 100% rename from test/range_test.cpp rename to tests/range_test.cpp diff --git a/test/rect_test.cpp b/tests/rect_test.cpp similarity index 100% rename from test/rect_test.cpp rename to tests/rect_test.cpp diff --git a/test/size_test.cpp b/tests/size_test.cpp similarity index 100% rename from test/size_test.cpp rename to tests/size_test.cpp diff --git a/test/stream_utils_test.cpp b/tests/stream_utils_test.cpp similarity index 100% rename from test/stream_utils_test.cpp rename to tests/stream_utils_test.cpp diff --git a/test/test-mono.tiff b/tests/test-mono.tiff similarity index 100% rename from test/test-mono.tiff rename to tests/test-mono.tiff diff --git a/test/test-rgb.tiff b/tests/test-rgb.tiff similarity index 100% rename from test/test-rgb.tiff rename to tests/test-rgb.tiff diff --git a/test/test_utils.h b/tests/test_utils.h similarity index 100% rename from test/test_utils.h rename to tests/test_utils.h diff --git a/test/util_test.cpp b/tests/util_test.cpp similarity index 100% rename from test/util_test.cpp rename to tests/util_test.cpp diff --git a/test/vector_test.cpp b/tests/vector_test.cpp similarity index 100% rename from test/vector_test.cpp rename to tests/vector_test.cpp From 6a8812a4fb84e70d6993d6c08f74132ba9529733 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 17 Nov 2023 02:58:02 -0600 Subject: [PATCH 03/35] Add meson build files --- examples/average_subtract/meson.build | 11 ++ examples/meson.build | 2 + examples/process/meson.build | 12 ++ meson.build | 153 ++++++++++++++++++++++++++ meson_options.txt | 1 + openpiv/meson.build | 17 +++ subprojects/catch2.wrap | 11 ++ subprojects/cxxopts.wrap | 13 +++ subprojects/fmt.wrap | 13 +++ subprojects/google-benchmark.wrap | 13 +++ subprojects/libjpeg-turbo.wrap | 12 ++ subprojects/liblzma.wrap | 12 ++ subprojects/libtiff.wrap | 12 ++ subprojects/zlib.wrap | 13 +++ tests/meson.build | 77 +++++++++++++ 15 files changed, 372 insertions(+) create mode 100644 examples/average_subtract/meson.build create mode 100644 examples/meson.build create mode 100644 examples/process/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 openpiv/meson.build create mode 100644 subprojects/catch2.wrap create mode 100644 subprojects/cxxopts.wrap create mode 100644 subprojects/fmt.wrap create mode 100644 subprojects/google-benchmark.wrap create mode 100644 subprojects/libjpeg-turbo.wrap create mode 100644 subprojects/liblzma.wrap create mode 100644 subprojects/libtiff.wrap create mode 100644 subprojects/zlib.wrap create mode 100644 tests/meson.build diff --git a/examples/average_subtract/meson.build b/examples/average_subtract/meson.build new file mode 100644 index 0000000..819c761 --- /dev/null +++ b/examples/average_subtract/meson.build @@ -0,0 +1,11 @@ +avd_sub_exec = executable( + 'average_subtract', + 'main.cpp', + include_directories: openpiv_include, + dependencies: [ + cxxopts_dep, + fmt_dep, + thread_dep + ], + link_with: openpiv_lib +) \ No newline at end of file diff --git a/examples/meson.build b/examples/meson.build new file mode 100644 index 0000000..ddf0210 --- /dev/null +++ b/examples/meson.build @@ -0,0 +1,2 @@ +subdir('average_subtract') +subdir('process') \ No newline at end of file diff --git a/examples/process/meson.build b/examples/process/meson.build new file mode 100644 index 0000000..6535ef8 --- /dev/null +++ b/examples/process/meson.build @@ -0,0 +1,12 @@ +avd_sub_exec = executable( + 'process', + ['main.cpp', 'threadpool.hpp'], + include_directories: [openpiv_include, pocketfft_include], + dependencies: [ + cxxopts_dep, + fmt_dep, + thread_dep + ], + cpp_args: ['-D_USE_MATH_DEFINES'], + link_with: openpiv_lib +) \ No newline at end of file diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..bc247b8 --- /dev/null +++ b/meson.build @@ -0,0 +1,153 @@ +project( + 'OpenPIV-c++', + 'cpp', + version: '0.2.0', + license: 'GPL-3', + meson_version: '>= 1.1.0', + default_options: [ + 'buildtype=release', + 'cpp_std=c++17' + ] +) + +fs = import('fs') + +cpp = meson.get_compiler('cpp') + +if cpp.get_id() == 'gcc' + if not cpp.version().version_compare('>=8.4') + error('OpenPIV-c++ requires GCC >= 8.4') + endif +elif cpp.get_id() == 'msvc' + error('OpenPIV-c++ requires a GNU GCC compatible compiler') +endif + +_gnu_args = cpp.get_supported_arguments( +## '-Wall', +## '-Wextra', + '-Wno-unknown-pragmas', + '-export-symbols' +) + +add_project_arguments( + _gnu_args, + language: 'cpp' +) + +pocketfft_include = include_directories( + 'external/pocketfft' +) + +libtiff_include = include_directories( + 'external/libtiff/4.0.10' +) + +libtiff_cpp_include = files('external/libtiff/4.0.10/tif_stream.cxx') + +openpiv_include = include_directories( + 'openpiv' +) + +cxxopts_dep = dependency( + 'cxxopts', + include_type: get_option('deps_include_type'), + required: true +) + +thread_dep = dependency( + 'threads', + required: true +) + +catch2_dep = dependency( + 'catch2', + fallback: ['catch2', 'catch2_with_main_dep'], + include_type: get_option('deps_include_type'), + required: true +) + +fmt_dep = dependency( + 'fmt', + fallback: ['fmt', 'fmt_header_only_dep'], + include_type: get_option('deps_include_type'), + method : 'cmake', + modules : ['fmt::fmt-header-only'], + required: true +## static: true +) + +jpeg_dep = dependency( + 'libjpeg', + fallback: ['libjpeg-turbo', 'jpeg_dep'], + include_type: get_option('deps_include_type'), + required: true +## static: true +) + +lzma_dep = dependency( + 'liblzma', + fallback: ['liblzma', 'lzma_dep'], + include_type: get_option('deps_include_type'), + required: true +## static: true +) + +zlib_dep = dependency( + 'zlib', + include_type: get_option('deps_include_type'), + required: true +## static: true +) + +tiff_dep = dependency( + 'libtiff', + fallback: ['libtiff', 'libtiff4_dep'], + include_type: get_option('deps_include_type'), + default_options: ['jpeg=enabled', 'lzma=enabled', 'zlib=enabled'], + required: true +## static: true +) + +found_benchmark = false +if build_machine.system() != 'windows' + benchmark_dep = dependency( + 'benchmark', + include_type: get_option('deps_include_type') + ) + found_benchmark = benchmark_dep.found() +endif + +openpivcore_deps = [ + fmt_dep, +## jpeg_dep, # jpeg image loaders are not currently implemented +## png_dep, # png image loaders are not currently implemented +## raw_dep, # raw image loaders are not currently implemented + tiff_dep, + thread_dep +] + +openpiv_deps = [ + cxxopts_dep, + fmt_dep, + thread_dep +] + +subdir('openpiv') + +openpiv_dep = declare_dependency( + include_directories: openpiv_include, + dependencies: openpivcore_deps, + link_with: openpiv_lib +) + +subdir('examples') +subdir('tests') + +pkgconfig = import('pkgconfig') + +pkgconfig.generate( + version: '0.2.0', + name: 'OpenPIV-c++', + description: 'Open-source Particle Image Velocimetry in c++', + libraries: [openpiv_lib] +) \ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..8e060fd --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('deps_include_type', type : 'string', value : 'non-system') \ No newline at end of file diff --git a/openpiv/meson.build b/openpiv/meson.build new file mode 100644 index 0000000..7fb55cc --- /dev/null +++ b/openpiv/meson.build @@ -0,0 +1,17 @@ +openpiv_src = [ + 'core/size.cpp', + 'core/rect.cpp', + 'core/util.cpp', + 'loaders/image_loader.cpp', + 'loaders/pnm_image_loader.cpp', + 'loaders/tiff_image_loader.cpp', + libtiff_cpp_include +] + +openpiv_lib = shared_library( + 'openpiv', + openpiv_src, + include_directories: [openpiv_include, libtiff_include, pocketfft_include], + dependencies: openpivcore_deps, + cpp_args: ['-D_USE_MATH_DEFINES'] +) \ No newline at end of file diff --git a/subprojects/catch2.wrap b/subprojects/catch2.wrap new file mode 100644 index 0000000..691d39c --- /dev/null +++ b/subprojects/catch2.wrap @@ -0,0 +1,11 @@ +[wrap-file] +directory = Catch2-3.4.0 +source_url = https://github.com/catchorg/Catch2/archive/v3.4.0.tar.gz +source_filename = Catch2-3.4.0.tar.gz +source_hash = 122928b814b75717316c71af69bd2b43387643ba076a6ec16e7882bfb2dfacbb +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/catch2_3.4.0-1/Catch2-3.4.0.tar.gz +wrapdb_version = 3.4.0-1 + +[provide] +catch2 = catch2_dep +catch2-with-main = catch2_with_main_dep diff --git a/subprojects/cxxopts.wrap b/subprojects/cxxopts.wrap new file mode 100644 index 0000000..7b60c73 --- /dev/null +++ b/subprojects/cxxopts.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = cxxopts-3.0.0 +source_url = https://github.com/jarro2783/cxxopts/archive/v3.0.0.tar.gz +source_filename = cxxopts-3.0.0.tar.gz +source_hash = 36f41fa2a46b3c1466613b63f3fa73dc24d912bc90d667147f1e43215a8c6d00 +patch_filename = cxxopts_3.0.0-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/cxxopts_3.0.0-1/get_patch +patch_hash = 704d7f49f768dde81376a607e9a189bb7e7f151bfc5512d9b7af9e13df2024cb + +[provide] +cxxopts = cxxopts_dep + + diff --git a/subprojects/fmt.wrap b/subprojects/fmt.wrap new file mode 100644 index 0000000..9efe101 --- /dev/null +++ b/subprojects/fmt.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = fmt-9.1.0 +source_url = https://github.com/fmtlib/fmt/archive/9.1.0.tar.gz +source_filename = fmt-9.1.0.tar.gz +source_hash = 5dea48d1fcddc3ec571ce2058e13910a0d4a6bab4cc09a809d8b1dd1c88ae6f2 +patch_filename = fmt_9.1.0-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/fmt_9.1.0-2/get_patch +patch_hash = 23e8c4829f3e63f509b5643fe6bb87cbed39eae9594c451b338475d14d051967 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fmt_9.1.0-2/fmt-9.1.0.tar.gz +wrapdb_version = 9.1.0-2 + +[provide] +fmt = fmt_dep diff --git a/subprojects/google-benchmark.wrap b/subprojects/google-benchmark.wrap new file mode 100644 index 0000000..2872336 --- /dev/null +++ b/subprojects/google-benchmark.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = benchmark-1.7.1 +source_url = https://github.com/google/benchmark/archive/refs/tags/v1.7.1.tar.gz +source_filename = benchmark-1.7.1.tar.gz +source_hash = 6430e4092653380d9dc4ccb45a1e2dc9259d581f4866dc0759713126056bc1d7 +patch_filename = google-benchmark_1.7.1-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/google-benchmark_1.7.1-2/get_patch +patch_hash = 169304b7095ed39f2a260c84fe3fe368124a5a9ab66e529f11c71c9907fc4085 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/google-benchmark_1.7.1-2/benchmark-1.7.1.tar.gz +wrapdb_version = 1.7.1-2 + +[provide] +benchmark = google_benchmark_dep diff --git a/subprojects/libjpeg-turbo.wrap b/subprojects/libjpeg-turbo.wrap new file mode 100644 index 0000000..a83bbd6 --- /dev/null +++ b/subprojects/libjpeg-turbo.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = libjpeg-turbo-2.1.4 +source_url = https://sourceforge.net/projects/libjpeg-turbo/files/2.1.4/libjpeg-turbo-2.1.4.tar.gz +source_filename = libjpeg-turbo-2.1.4.tar.gz +source_hash = d3ed26a1131a13686dfca4935e520eb7c90ae76fbc45d98bb50a8dc86230342b +patch_filename = libjpeg-turbo_2.1.4-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/libjpeg-turbo_2.1.4-1/get_patch +patch_hash = 5ac2378c090a3456f4dd34e80b12bbaf17e40eba67de1eeb366b3cbf5eb03269 +wrapdb_version = 2.1.4-1 + +[provide] +dependency_names = libjpeg diff --git a/subprojects/liblzma.wrap b/subprojects/liblzma.wrap new file mode 100644 index 0000000..6ddc964 --- /dev/null +++ b/subprojects/liblzma.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = xz-5.2.5 +source_url = http://tukaani.org/xz/xz-5.2.5.tar.xz +source_filename = xz-5.2.5.tar.xz +source_hash = 3e1e518ffc912f86608a8cb35e4bd41ad1aec210df2a47aaa1f95e7f5576ef56 +patch_filename = liblzma_5.2.5-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/liblzma_5.2.5-2/get_patch +patch_hash = 9029c596b8fb85b2fe081b5f31269d2703ca6ff76ebf607d4c1dbdba8a333917 +wrapdb_version = 5.2.5-2 + +[provide] +liblzma = liblzma_dep diff --git a/subprojects/libtiff.wrap b/subprojects/libtiff.wrap new file mode 100644 index 0000000..4415f6c --- /dev/null +++ b/subprojects/libtiff.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = tiff-4.4.0 +source_url = http://download.osgeo.org/libtiff/tiff-4.4.0.tar.gz +source_filename = tiff-4.4.0.tar.gz +source_hash = 917223b37538959aca3b790d2d73aa6e626b688e02dcda272aec24c2f498abed +patch_filename = libtiff_4.4.0-3_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/libtiff_4.4.0-3/get_patch +patch_hash = bdad3524fb2e029511ce2709b264dd79bba31c0215161b6283d60b8794865cce +wrapdb_version = 4.4.0-3 + +[provide] +libtiff-4 = libtiff4_dep diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap new file mode 100644 index 0000000..4f19672 --- /dev/null +++ b/subprojects/zlib.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = zlib-1.2.13 +source_url = http://zlib.net/fossils/zlib-1.2.13.tar.gz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.2.13-4/zlib-1.2.13.tar.gz +source_filename = zlib-1.2.13.tar.gz +source_hash = b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30 +patch_filename = zlib_1.2.13-4_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.2.13-4/get_patch +patch_hash = 19636b7807e679b92240bc7a99aed85d1be908a45430b12c7687a825cb499d5e +wrapdb_version = 1.2.13-4 + +[provide] +zlib = zlib_dep diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..07a3ad2 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,77 @@ +test_source_files = [ + 'enum_helper_test.cpp', + 'grid_test.cpp', + 'image_algos_test.cpp', + 'image_expression_test.cpp', + 'image_loader_test.cpp', + 'image_stats_test.cpp', + 'image_test.cpp', + 'image_utils_test.cpp', + 'image_view_test.cpp', + 'log_test.cpp', + 'pixel_types_test.cpp', + 'point_test.cpp', + 'range_test.cpp', + 'rect_test.cpp', + 'size_test.cpp', + 'stream_utils_test.cpp', + 'util_test.cpp', + 'vector_test.cpp' +] + +foreach test_file: test_source_files + source_name = test_file.split('.')[0] + + exec = executable( + source_name, + test_file, + include_directories: [openpiv_include, libtiff_include], + dependencies: openpiv_deps + [catch2_dep], + cpp_args: ['-D_USE_MATH_DEFINES'], + link_with: openpiv_lib + ) + + test( + source_name, + exec + ) + +endforeach + +if found_benchmark + benchmark_source_files = [ + 'image_algos_benchmark.cpp', + 'image_utils_benchmark.cpp' + ] + + foreach test_file: test_source_files + source_name = test_file.split('.')[0] + + exec = executable( + source_name, + test_file, + include_directories: [openpiv_include, libtiff_include], + dependencies: openpiv_deps + [catch2_dep], + cpp_args: ['-D_USE_MATH_DEFINES'], + link_with: openpiv_lib + ) + + test( + source_name, + exec + ) + + endforeach +endif + +fs.copyfile( + 'corr_a.tiff' +) + +fs.copyfile( + 'test-mono.tiff' +) + +fs.copyfile( + 'test-rgb.tiff' +) \ No newline at end of file From ebdedc6169e8a5abc02e9b6b11c47e6f4fda8aa2 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 17 Nov 2023 04:00:49 -0600 Subject: [PATCH 04/35] Add support for github actions --- .github/workflows/build_test.yml | 33 ++++++++++++++++++++++++ .github/workflows/cmake.yml | 37 --------------------------- examples/average_subtract/meson.build | 3 ++- examples/process/meson.build | 5 ++-- openpiv/meson.build | 3 ++- 5 files changed, 40 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/build_test.yml delete mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml new file mode 100644 index 0000000..b4439a6 --- /dev/null +++ b/.github/workflows/build_test.yml @@ -0,0 +1,33 @@ +name: CMake + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Configure Meson + # Configure meson to dump all executables in the test directory so Windows would work + run: cd ${{github.workspace}} && meson setup builddir --prefix ${{github.workspace}}/builddir/tests --bindir ${{github.workspace}}/builddir/tests + + - name: Build + # Build your program with the given configuration + run: meson compile -C ${{github.workspace}}/builddir --clean --verbose + + - name: Test + working-directory: ${{github.workspace}}/builddir + # Execute tests defined by meson test configuration. + run: meson test + diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml deleted file mode 100644 index b17567c..0000000 --- a/.github/workflows/cmake.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: CMake - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - build: - runs-on: ${{matrix.os}} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -S ${{github.workspace}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} --trace-expand - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --verbose --clean-first --config ${{env.BUILD_TYPE}} - - - 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}} - diff --git a/examples/average_subtract/meson.build b/examples/average_subtract/meson.build index 819c761..ed24d04 100644 --- a/examples/average_subtract/meson.build +++ b/examples/average_subtract/meson.build @@ -7,5 +7,6 @@ avd_sub_exec = executable( fmt_dep, thread_dep ], - link_with: openpiv_lib + link_with: openpiv_lib, + install: true ) \ No newline at end of file diff --git a/examples/process/meson.build b/examples/process/meson.build index 6535ef8..557ab37 100644 --- a/examples/process/meson.build +++ b/examples/process/meson.build @@ -7,6 +7,7 @@ avd_sub_exec = executable( fmt_dep, thread_dep ], - cpp_args: ['-D_USE_MATH_DEFINES'], - link_with: openpiv_lib + cpp_args: ['-D_USE_MATH_DEFINES', '-mavx2'], + link_with: openpiv_lib, + install: true ) \ No newline at end of file diff --git a/openpiv/meson.build b/openpiv/meson.build index 7fb55cc..eed04a1 100644 --- a/openpiv/meson.build +++ b/openpiv/meson.build @@ -13,5 +13,6 @@ openpiv_lib = shared_library( openpiv_src, include_directories: [openpiv_include, libtiff_include, pocketfft_include], dependencies: openpivcore_deps, - cpp_args: ['-D_USE_MATH_DEFINES'] + cpp_args: ['-D_USE_MATH_DEFINES'], + install: true ) \ No newline at end of file From a22dcc5164b8e6d5edb02b2c91cc0a6983799f04 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 24 Nov 2023 11:27:30 -0600 Subject: [PATCH 05/35] Update GH workflow --- .github/workflows/build_test.yml | 9 ++++- README.md | 67 ++++++++++++++++++++++---------- 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index b4439a6..012330a 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -1,8 +1,11 @@ name: CMake on: + workflow_dispatch: + push: branches: [ master ] + pull_request: branches: [ master ] @@ -20,12 +23,16 @@ jobs: - name: Configure Meson # Configure meson to dump all executables in the test directory so Windows would work - run: cd ${{github.workspace}} && meson setup builddir --prefix ${{github.workspace}}/builddir/tests --bindir ${{github.workspace}}/builddir/tests + run: cd ${{github.workspace}} && meson setup builddir --prefix ${{github.workspace}}/builddir/tests --bindir /. - name: Build # Build your program with the given configuration run: meson compile -C ${{github.workspace}}/builddir --clean --verbose + - name: Install + # Build your program with the given configuration + run: meson install -C ${{github.workspace}}/builddir --tags runtime,python-runtime + - name: Test working-directory: ${{github.workspace}}/builddir # Execute tests defined by meson test configuration. diff --git a/README.md b/README.md index 05b4d97..e6d65cc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Build Status](https://github.com/OpenPIV/openpiv-c--qt/actions/workflows/cmake.yml/badge.svg) +![Build Status](https://github.com/OpenPIV/openpiv-c--qt/actions/workflows/build_test.yml/badge.svg) # OpenPIV (c++) @@ -11,44 +11,68 @@ There are some external dependencies under external/, so when cloning use: ```git clone --recursive ``` -Building uses cmake and vcpkg, and is simplified by using a vcpkg manifest to specify -the dependent packages. Vcpkg has some pre-requisites: +Building uses cmake and meson, and is simplified by using meson wrap files to specify +the dependent packages. Meson has some pre-requisites: * a compiler (e.g. `apt install build-essentials`) * cmake -* git +* python * (linux) pkg-config (e.g. `apt install pkg-config`) * curl, zip, unzip, tar (e.g. `apt install curl zip unzip tar`) * ninja (e.g. `apt install ninja-build`) +* meson (e.g., pip install --user meson) + +On Windows, the following can be used: +* install TDM-GCC +* install miniconda and setup virtual environment +* pip install cmake +* pip install meson To build: +* `meson setup builddir` +* `meson compile -C builddir` -* `cmake -B build -S .` -* `cmake --build build` +On Windows, use the following to build: +* `meson setup builddir --prefix builddir/tests --bindir builddir/tests` (places binaries in tests directory) +* `meson compile -C builddir` +* `meson install -C builddir` To run tests: -* `cd build` -* `ctest` +* `cd build && meson test` -To change the build type, add `-DCMAKE_BUILD_TYPE` e.g. -`cmake -DCMAKE_BUILD_TYPE=RelWithDebugInfo -B build -S .`. +To change the build type, add `--buildtype ` -* build - * test -> *_test +Make sure the prefix, or destdir, is set so binaries are not accidentally installed on the system. + +The binaries are located in the bindir (if installed) and build directory: + +Build directory: +* builddir * examples * process * average_subtract * openpiv -> libopenpivcore.so -### Raspberry Pi +Install directory: +* prefix/destdir + * bindir + * libopenpivcore.so + * all other dependent shared libraries + * process.exe + * average_subtract.exe + +### Raspberry Pi (using deprecated VCPKG build system) Build times are, as expected, much slower than on a modern Intel CPU, but the code will compile. Some observations: -* `VCPKG_FORCE_SYSTEM_BINARIES=1` must be set +* `VCPKG_FORCE_SYSTEM_BINARIES=1` must be set ( * `VCPKG_MAX_CONCURRENCY=` can help if you find you get kernel panics due to poor cooling @@ -165,15 +189,18 @@ This is about 230us per interrogation area (7 cores, 3696 interrogation areas, 0 ## Dependencies -These are captured in `vcpkg.json`: +These are captured in `.wrap`: * c++17 compiler e.g. clang++-5.0, gcc7 -* [vcpkg](https://github.com/Microsoft/vcpkg) - * catch2: unit test framework - * libtiff: TIFF IO support +* python3 +* [meson](https://mesonbuild.com/index.html) * benchmark: used to run performance benchmarks - * async++ (optional): implements c++17 parallel algorithms + * catch2: unit test framework * cxxopts: nice command line parsing + * libtiff: TIFF IO support + * libjpeg-turbo + * liblzma + * zlib ## Examples From 8ef761735aeee747fbc9cd35e4285d2951f8cdb6 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 24 Nov 2023 11:45:57 -0600 Subject: [PATCH 06/35] Revise GH workflow --- .github/workflows/build_test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 012330a..f977f24 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -21,6 +21,15 @@ jobs: with: submodules: recursive + - name: Setup Python + uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 + with: + python-version: '3.11' + + - name: Install build dependencies from PyPI + run: | + python -m pip install meson cmake ninja + - name: Configure Meson # Configure meson to dump all executables in the test directory so Windows would work run: cd ${{github.workspace}} && meson setup builddir --prefix ${{github.workspace}}/builddir/tests --bindir /. From bf43b5ddfb42c951b4c3fec3b1f029a8c655ed2f Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 24 Nov 2023 12:17:07 -0600 Subject: [PATCH 07/35] Update build options --- meson.build | 3 ++- meson_options.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index bc247b8..c4cd3b6 100644 --- a/meson.build +++ b/meson.build @@ -112,7 +112,8 @@ found_benchmark = false if build_machine.system() != 'windows' benchmark_dep = dependency( 'benchmark', - include_type: get_option('deps_include_type') + include_type: get_option('deps_include_type'), + requited: get_option('benchmarks') ) found_benchmark = benchmark_dep.found() endif diff --git a/meson_options.txt b/meson_options.txt index 8e060fd..d27303b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1 +1,2 @@ -option('deps_include_type', type : 'string', value : 'non-system') \ No newline at end of file +option('deps_include_type', type : 'string', value : 'non-system') +option('benchmarks', type : 'feature', value : 'disabled') \ No newline at end of file From 3a14fecf4da6f94581fccf9e51b749791a8af272 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 24 Nov 2023 12:22:27 -0600 Subject: [PATCH 08/35] Typo --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index c4cd3b6..691cdbe 100644 --- a/meson.build +++ b/meson.build @@ -113,7 +113,7 @@ if build_machine.system() != 'windows' benchmark_dep = dependency( 'benchmark', include_type: get_option('deps_include_type'), - requited: get_option('benchmarks') + required: get_option('benchmarks') ) found_benchmark = benchmark_dep.found() endif From 4376b5566f248bc95de62f430943ead06a74108a Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 24 Nov 2023 12:28:23 -0600 Subject: [PATCH 09/35] Revised build script options --- meson.build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 691cdbe..3aef18f 100644 --- a/meson.build +++ b/meson.build @@ -109,11 +109,10 @@ tiff_dep = dependency( ) found_benchmark = false -if build_machine.system() != 'windows' +if get_option('benchmarks').enabled() benchmark_dep = dependency( 'benchmark', - include_type: get_option('deps_include_type'), - required: get_option('benchmarks') + include_type: get_option('deps_include_type') ) found_benchmark = benchmark_dep.found() endif From 03c45f27c9c71f5cca6a787c98e6478081b4da5a Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 24 Nov 2023 12:46:34 -0600 Subject: [PATCH 10/35] Revised build script --- examples/process/meson.build | 4 ++-- meson.build | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/process/meson.build b/examples/process/meson.build index 557ab37..b79ab99 100644 --- a/examples/process/meson.build +++ b/examples/process/meson.build @@ -1,13 +1,13 @@ avd_sub_exec = executable( 'process', - ['main.cpp', 'threadpool.hpp'], + 'main.cpp', include_directories: [openpiv_include, pocketfft_include], dependencies: [ cxxopts_dep, fmt_dep, thread_dep ], - cpp_args: ['-D_USE_MATH_DEFINES', '-mavx2'], + cpp_args: ['-D_USE_MATH_DEFINES'], link_with: openpiv_lib, install: true ) \ No newline at end of file diff --git a/meson.build b/meson.build index 3aef18f..a5703d2 100644 --- a/meson.build +++ b/meson.build @@ -94,6 +94,7 @@ lzma_dep = dependency( zlib_dep = dependency( 'zlib', + fallback: ['zlib', 'zlib_dep'], include_type: get_option('deps_include_type'), required: true ## static: true @@ -141,13 +142,16 @@ openpiv_dep = declare_dependency( ) subdir('examples') -subdir('tests') + +if not meson.is_subproject() + subdir('tests') +endif pkgconfig = import('pkgconfig') pkgconfig.generate( version: '0.2.0', - name: 'OpenPIV-c++', + name: 'OpenPIV-cxx', description: 'Open-source Particle Image Velocimetry in c++', libraries: [openpiv_lib] ) \ No newline at end of file From 23b27851602c1fd1b6e9dcc8e7e3a9b2f75864cf Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 24 Nov 2023 12:50:50 -0600 Subject: [PATCH 11/35] Update GH workflow --- .github/workflows/build_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index f977f24..453db9e 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -36,7 +36,7 @@ jobs: - name: Build # Build your program with the given configuration - run: meson compile -C ${{github.workspace}}/builddir --clean --verbose + run: meson compile -C ${{github.workspace}}/builddir --verbose - name: Install # Build your program with the given configuration From 9c88c00dc0c6591f32cbe2c35687d0cb6afd1ef6 Mon Sep 17 00:00:00 2001 From: Erich Zimmer <69478071+ErichZimmer@users.noreply.github.com> Date: Fri, 24 Nov 2023 19:54:26 -0600 Subject: [PATCH 12/35] Update build_test.yml Updated via cell phone to see if this change fixes some problems. --- .github/workflows/build_test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 453db9e..92b618a 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -39,8 +39,10 @@ jobs: run: meson compile -C ${{github.workspace}}/builddir --verbose - name: Install - # Build your program with the given configuration - run: meson install -C ${{github.workspace}}/builddir --tags runtime,python-runtime + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + meson install -C ${{github.workspace}}/builddir --tags runtime,python-runtime + fi - name: Test working-directory: ${{github.workspace}}/builddir From 824dabe7e19122dc48cc69ccc96e5dad0146d9a0 Mon Sep 17 00:00:00 2001 From: Erich Zimmer <69478071+ErichZimmer@users.noreply.github.com> Date: Fri, 24 Nov 2023 20:30:53 -0600 Subject: [PATCH 13/35] Update .gitmodules More updated version of pocketfft. --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 1e9ff34..4b5f7fd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "external/pocketfft"] path = external/pocketfft - url = https://github.com/hayguen/pocketfft + url = https://github.com/mreineck/pocketfft From f93d5b6bba1c7f6029c39687d29c1209d6f1c787 Mon Sep 17 00:00:00 2001 From: Erich Zimmer <69478071+ErichZimmer@users.noreply.github.com> Date: Sat, 25 Nov 2023 13:01:43 -0600 Subject: [PATCH 14/35] Update build_test.yml Changed via cellphone to see if this can fix Windows pocketfft compile issue. --- .github/workflows/build_test.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 92b618a..8c567f8 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -25,11 +25,17 @@ jobs: uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 with: python-version: '3.11' - + - name: Install rtools (mingw-w64) (see SciPy workflow for more details) + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + choco install rtools -y --no-progress --force --version=4.0.0.20220206 + echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH + fi + - name: Install build dependencies from PyPI run: | python -m pip install meson cmake ninja - + - name: Configure Meson # Configure meson to dump all executables in the test directory so Windows would work run: cd ${{github.workspace}} && meson setup builddir --prefix ${{github.workspace}}/builddir/tests --bindir /. From 3bfce337a60b84a50418fbf0c4cadc287d7c1df4 Mon Sep 17 00:00:00 2001 From: Erich Zimmer <69478071+ErichZimmer@users.noreply.github.com> Date: Sun, 26 Nov 2023 21:04:27 -0600 Subject: [PATCH 15/35] Forgot to set shell to bash --- .github/workflows/build_test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 8c567f8..d36c9e4 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -25,17 +25,19 @@ jobs: uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 with: python-version: '3.11' + - name: Install rtools (mingw-w64) (see SciPy workflow for more details) run: | if [ "$RUNNER_OS" == "Windows" ]; then choco install rtools -y --no-progress --force --version=4.0.0.20220206 echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH fi - + shell: bash + - name: Install build dependencies from PyPI run: | python -m pip install meson cmake ninja - + - name: Configure Meson # Configure meson to dump all executables in the test directory so Windows would work run: cd ${{github.workspace}} && meson setup builddir --prefix ${{github.workspace}}/builddir/tests --bindir /. @@ -54,4 +56,3 @@ jobs: working-directory: ${{github.workspace}}/builddir # Execute tests defined by meson test configuration. run: meson test - From 3910a89bed6d28d525907b2485690585a8470c5d Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 29 Dec 2023 23:10:46 -0600 Subject: [PATCH 16/35] Add missing test file --- tests/meson.build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/meson.build b/tests/meson.build index 07a3ad2..6c7c210 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -64,6 +64,10 @@ if found_benchmark endforeach endif +fs.copyfile( + 'A_00001_a.tiff' +) + fs.copyfile( 'corr_a.tiff' ) From 6c745336f8e37bea10ee9fff7285f15de1c1c968 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 29 Dec 2023 23:22:27 -0600 Subject: [PATCH 17/35] Misspelled said file, Oops --- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/meson.build b/tests/meson.build index 6c7c210..7be87be 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -65,7 +65,7 @@ if found_benchmark endif fs.copyfile( - 'A_00001_a.tiff' + 'A_00001_a.tif' ) fs.copyfile( From 6ca9887cb703710f785a353793220161c67e0469 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 29 Dec 2023 23:36:25 -0600 Subject: [PATCH 18/35] Set verbosity for Meson tests --- .github/workflows/build_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index d36c9e4..0f4e22c 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -55,4 +55,4 @@ jobs: - name: Test working-directory: ${{github.workspace}}/builddir # Execute tests defined by meson test configuration. - run: meson test + run: meson test -v From 73b3957d9941954c667855707f9b7181835f73ac Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Sat, 30 Dec 2023 01:24:44 -0600 Subject: [PATCH 19/35] Pocketfft version did not work --- .gitmodules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 4b5f7fd..36528f3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "external/pocketfft"] path = external/pocketfft - url = https://github.com/mreineck/pocketfft + url = https://github.com/mreineck/pocketfft.git + branch = fix_issue_5 From c7e4abf2929570dbb5eac15effc53dd6d68bb4c3 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Sat, 30 Dec 2023 01:45:11 -0600 Subject: [PATCH 20/35] Update GH actions --- .github/workflows/build_test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 0f4e22c..33f3146 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -19,7 +19,12 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: recursive + submodules: true + + - name: Git Submodule Update + run: | + git pull --recurse-submodules + git submodule update --remote --recursive - name: Setup Python uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 From 855f3187dfd5b8894ec07402d8519d661574181d Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Thu, 15 Feb 2024 23:40:03 -0600 Subject: [PATCH 21/35] Reverted GH actions --- .github/workflows/build_test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 33f3146..0f4e22c 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -19,12 +19,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - submodules: true - - - name: Git Submodule Update - run: | - git pull --recurse-submodules - git submodule update --remote --recursive + submodules: recursive - name: Setup Python uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 From 8b6c377f46fafce536296dc9eccd2a4ed23f43f6 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Thu, 15 Feb 2024 23:41:07 -0600 Subject: [PATCH 22/35] Fixed relative path issue --- tests/meson.build | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/meson.build b/tests/meson.build index 7be87be..d392fac 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -25,7 +25,7 @@ foreach test_file: test_source_files exec = executable( source_name, test_file, - include_directories: [openpiv_include, libtiff_include], + include_directories: openpiv_include, dependencies: openpiv_deps + [catch2_dep], cpp_args: ['-D_USE_MATH_DEFINES'], link_with: openpiv_lib @@ -33,7 +33,8 @@ foreach test_file: test_source_files test( source_name, - exec + exec, + workdir: meson.current_build_dir() ) endforeach @@ -58,7 +59,8 @@ if found_benchmark test( source_name, - exec + exec, + workdir: meson.current_build_dir() ) endforeach From 985398dc2e0c7eff6fe8159178ff3832505db79e Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Wed, 13 Mar 2024 12:47:57 -0500 Subject: [PATCH 23/35] Update main ReadMe --- README.md | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index e6d65cc..d67d3f1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,18 @@ ![Build Status](https://github.com/OpenPIV/openpiv-c--qt/actions/workflows/build_test.yml/badge.svg) -# OpenPIV (c++) +# OpenPIV (c++), a fast, open-source particle image velocimetry (PIV) library -An implementation of a PIV analysis engine in C++ using as few dependencies as possible; -the implementation requires a c++17 compliant compiler. +## An implementation of a PIV analysis engine in C++ using as few dependencies as possible; the implementation requires a c++17 compliant compiler. + +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: + + * Load images with .tif and .pgm extensions + * Save images with .tif and .pgm extensions + * Pre-process and modify images + * Perform digital PIV analysis including subpixel estimation + * and more! + +Additionally, two examples are provided to demonstrate how the library can be used for background subtraction of images and multi-threaded PIV analysis. ## Build @@ -11,8 +20,7 @@ There are some external dependencies under external/, so when cloning use: ```git clone --recursive ``` -Building uses cmake and meson, and is simplified by using meson wrap files to specify -the dependent packages. Meson has some pre-requisites: +Building uses cmake and meson, and is simplified by using meson wrap files to specify the dependent packages. Building has some pre-requisites: * a compiler (e.g. `apt install build-essentials`) * cmake @@ -22,31 +30,30 @@ the dependent packages. Meson has some pre-requisites: * ninja (e.g. `apt install ninja-build`) * meson (e.g., pip install --user meson) +Unix users can also use the method used for the Windows build environment as detailed below. + On Windows, the following can be used: -* install TDM-GCC -* install miniconda and setup virtual environment +* install TDM-GCC or any other Windows GNU distribution +* install miniconda or venv and setup virtual environment * pip install cmake * pip install meson To build: -* `meson setup builddir` +* `meson setup builddir` Note, it is good practice to setup --prefix flags so files are not installed on the system. * `meson compile -C builddir` -On Windows, use the following to build: -* `meson setup builddir --prefix builddir/tests --bindir builddir/tests` (places binaries in tests directory) -* `meson compile -C builddir` -* `meson install -C builddir` +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`. To run tests: -* `cd build && meson test` - -To change the build type, add `--buildtype ` +* `meson install -C builddir` if the prefix was set or +* `meson install -C buildfir --destdir ` to install in a specifit directory. + +Sometimes you only want the runtime dynamic libraries and executables. Meson comes with a handy targeted installation using the following command: + * `meson install -C builddir --tags runtime` Make sure the prefix, or destdir, is set so binaries are not accidentally installed on the system. @@ -72,7 +79,7 @@ Install directory: Build times are, as expected, much slower than on a modern Intel CPU, but the code will compile. Some observations: -* `VCPKG_FORCE_SYSTEM_BINARIES=1` must be set ( +* `VCPKG_FORCE_SYSTEM_BINARIES=1` must be set * `VCPKG_MAX_CONCURRENCY=` can help if you find you get kernel panics due to poor cooling From d78ce12ad3fe1f489bdde6238604e5b2cebb673d Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Wed, 13 Mar 2024 12:53:19 -0500 Subject: [PATCH 24/35] fmt_dep is now built statically --- meson.build | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index a5703d2..a8efdfe 100644 --- a/meson.build +++ b/meson.build @@ -66,14 +66,21 @@ catch2_dep = dependency( required: true ) +# Use CMake because Meson overrides the header only dependency for some reason fmt_dep = dependency( 'fmt', - fallback: ['fmt', 'fmt_header_only_dep'], +# fallback: ['fmt', 'fmt_header_only_dep'], include_type: get_option('deps_include_type'), + default_options: ['default_library=static'], method : 'cmake', modules : ['fmt::fmt-header-only'], required: true -## static: true +) + +# Needed for the header only dependency +add_project_arguments( + '-DFMT_HEADER_ONLY', + language: 'cpp' ) jpeg_dep = dependency( From 7d39379fd18ca5c60b8be0a2524d5604c7724b00 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Wed, 13 Mar 2024 13:29:13 -0500 Subject: [PATCH 25/35] Creat readme.md for subprojects folder --- subprojects/.gitignore | 6 ++++++ subprojects/README.md | 1 + 2 files changed, 7 insertions(+) create mode 100644 subprojects/.gitignore create mode 100644 subprojects/README.md diff --git a/subprojects/.gitignore b/subprojects/.gitignore new file mode 100644 index 0000000..36cb21c --- /dev/null +++ b/subprojects/.gitignore @@ -0,0 +1,6 @@ +# ignore everything +* + +#Except these files +!*.wrap +!README.md diff --git a/subprojects/README.md b/subprojects/README.md new file mode 100644 index 0000000..ee97911 --- /dev/null +++ b/subprojects/README.md @@ -0,0 +1 @@ +This folder is for fetching dependencies. All content should be ignored except for *.wrap files. For dependencies that are not in the wrap database, create wrap files using `wrap-git`. \ No newline at end of file From 62d15af7466fcaf6fa38de014ea87f6b8155df01 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Wed, 13 Mar 2024 13:34:00 -0500 Subject: [PATCH 26/35] Rename pgm to pnm --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d67d3f1..9acb142 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ 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: - * Load images with .tif and .pgm extensions - * Save images with .tif and .pgm extensions + * Load images with .tif and .pnm extensions + * Save images with .tif and .pnm extensions * Pre-process and modify images * Perform digital PIV analysis including subpixel estimation * and more! From 4b2e703e12183b318cdc3181ba509ca442e60eb1 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Wed, 13 Mar 2024 21:13:23 -0500 Subject: [PATCH 27/35] Updated pocketfft --- .gitmodules | 3 +-- external/pocketfft | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 36528f3..2285ba5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,3 @@ [submodule "external/pocketfft"] path = external/pocketfft - url = https://github.com/mreineck/pocketfft.git - branch = fix_issue_5 + url = https://github.com/mreineck/pocketfft/tree/fix_issue_5 diff --git a/external/pocketfft b/external/pocketfft index ea778e3..764893f 160000 --- a/external/pocketfft +++ b/external/pocketfft @@ -1 +1 @@ -Subproject commit ea778e37710c07723435b1be58235996d1d43a5a +Subproject commit 764893f3f232d778608025d1256a1c814ce0139e From fe8a195ffa381555f8d7bdb37b4797995b806759 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Wed, 13 Mar 2024 22:24:14 -0500 Subject: [PATCH 28/35] Updated pocketfft fork --- .gitmodules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 2285ba5..3a32d54 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ + [submodule "external/pocketfft"] path = external/pocketfft - url = https://github.com/mreineck/pocketfft/tree/fix_issue_5 + url = https://github.com/ErichZimmer/pocketfft.git From ac6e9e350e7e9dbf423b8532b2798d0f1699b7fb Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Wed, 13 Mar 2024 23:18:13 -0500 Subject: [PATCH 29/35] Fix github actions --- .github/workflows/build_test.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 0f4e22c..67fc57b 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -40,18 +40,12 @@ jobs: - name: Configure Meson # Configure meson to dump all executables in the test directory so Windows would work - run: cd ${{github.workspace}} && meson setup builddir --prefix ${{github.workspace}}/builddir/tests --bindir /. + run: cd ${{github.workspace}} && meson setup builddir - name: Build # Build your program with the given configuration run: meson compile -C ${{github.workspace}}/builddir --verbose - - name: Install - run: | - if [ "$RUNNER_OS" == "Windows" ]; then - meson install -C ${{github.workspace}}/builddir --tags runtime,python-runtime - fi - - name: Test working-directory: ${{github.workspace}}/builddir # Execute tests defined by meson test configuration. From 9cbe5b85f632c93b45292be02c8d447ca749e8cb Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 15 Mar 2024 00:16:23 -0500 Subject: [PATCH 30/35] Added untracked vcpkg --- .gitmodules | 3 +++ external/vcpkg | 1 + 2 files changed, 4 insertions(+) create mode 160000 external/vcpkg diff --git a/.gitmodules b/.gitmodules index 3a32d54..a56adb1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ [submodule "external/pocketfft"] path = external/pocketfft url = https://github.com/ErichZimmer/pocketfft.git +[submodule "external/vcpkg"] + path = external/vcpkg + url = https://github.com/microsoft/vcpkg diff --git a/external/vcpkg b/external/vcpkg new file mode 160000 index 0000000..8d3649b --- /dev/null +++ b/external/vcpkg @@ -0,0 +1 @@ +Subproject commit 8d3649ba34aab36914ddd897958599aa0a91b08e From 554e02855ad71fcbc964d63f9b3673859575d89a Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Fri, 15 Mar 2024 00:18:11 -0500 Subject: [PATCH 31/35] Removed untracked vcpkg --- .gitmodules | 3 --- external/vcpkg | 1 - 2 files changed, 4 deletions(-) delete mode 160000 external/vcpkg diff --git a/.gitmodules b/.gitmodules index a56adb1..3a32d54 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,6 +2,3 @@ [submodule "external/pocketfft"] path = external/pocketfft url = https://github.com/ErichZimmer/pocketfft.git -[submodule "external/vcpkg"] - path = external/vcpkg - url = https://github.com/microsoft/vcpkg diff --git a/external/vcpkg b/external/vcpkg deleted file mode 160000 index 8d3649b..0000000 --- a/external/vcpkg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8d3649ba34aab36914ddd897958599aa0a91b08e From 9f24b7066383f1976bdd5d00e0e1b6dc79d4ae57 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Mon, 18 Mar 2024 02:24:58 -0500 Subject: [PATCH 32/35] Update PocketFFT --- .gitmodules | 2 +- external/pocketfft | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 3a32d54..c572e7a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "external/pocketfft"] path = external/pocketfft - url = https://github.com/ErichZimmer/pocketfft.git + url = https://github.com/mreineck/pocketfft.git diff --git a/external/pocketfft b/external/pocketfft index 764893f..0f7aa12 160000 --- a/external/pocketfft +++ b/external/pocketfft @@ -1 +1 @@ -Subproject commit 764893f3f232d778608025d1256a1c814ce0139e +Subproject commit 0f7aa1225b065938fc263b7914df16b8c1cbc9d7 From 648b3523e15447b9e6ee47920934fc5869038086 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Wed, 20 Mar 2024 14:11:45 -0500 Subject: [PATCH 33/35] Reformat and remove CMake dep --- meson.build | 78 ++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/meson.build b/meson.build index a8efdfe..806811f 100644 --- a/meson.build +++ b/meson.build @@ -1,13 +1,14 @@ project( - 'OpenPIV-c++', - 'cpp', - version: '0.2.0', - license: 'GPL-3', - meson_version: '>= 1.1.0', - default_options: [ - 'buildtype=release', - 'cpp_std=c++17' - ] + 'OpenPIV-c++', + 'cpp', + version: '0.2.0', + license: 'GPL-3', + meson_version: '>= 1.1.0', + default_options: [ + 'buildtype=release', + 'cpp_std=c++17', + 'warning_level=2' + ] ) fs = import('fs') @@ -15,37 +16,35 @@ fs = import('fs') cpp = meson.get_compiler('cpp') if cpp.get_id() == 'gcc' - if not cpp.version().version_compare('>=8.4') - error('OpenPIV-c++ requires GCC >= 8.4') - endif + if not cpp.version().version_compare('>=8.4') + error('OpenPIV-c++ requires GCC >= 8.4') + endif elif cpp.get_id() == 'msvc' - error('OpenPIV-c++ requires a GNU GCC compatible compiler') + error('OpenPIV-c++ requires a GNU GCC compatible compiler') endif _gnu_args = cpp.get_supported_arguments( -## '-Wall', -## '-Wextra', - '-Wno-unknown-pragmas', - '-export-symbols' + '-Wno-unknown-pragmas', + '-export-symbols' ) add_project_arguments( - _gnu_args, - language: 'cpp' + _gnu_args, + language: 'cpp' ) pocketfft_include = include_directories( - 'external/pocketfft' + 'external/pocketfft' ) libtiff_include = include_directories( - 'external/libtiff/4.0.10' + 'external/libtiff/4.0.10' ) libtiff_cpp_include = files('external/libtiff/4.0.10/tif_stream.cxx') openpiv_include = include_directories( - 'openpiv' + 'openpiv' ) cxxopts_dep = dependency( @@ -66,29 +65,28 @@ catch2_dep = dependency( required: true ) -# Use CMake because Meson overrides the header only dependency for some reason +# meson overrides the header-only dep fmt_dep = dependency( 'fmt', -# fallback: ['fmt', 'fmt_header_only_dep'], include_type: get_option('deps_include_type'), - default_options: ['default_library=static'], - method : 'cmake', - modules : ['fmt::fmt-header-only'], - required: true + required: false ) -# Needed for the header only dependency -add_project_arguments( - '-DFMT_HEADER_ONLY', - language: 'cpp' -) +if not fmt_dep.found() + fmt = subproject( + 'fmt', + default_options: 'default_library=static' # meson still installs dynamic library if not static + ) + + fmt_dep = fmt.get_variable('fmt_header_only_dep') +endif jpeg_dep = dependency( 'libjpeg', fallback: ['libjpeg-turbo', 'jpeg_dep'], include_type: get_option('deps_include_type'), required: true -## static: true +# static: true ) lzma_dep = dependency( @@ -96,7 +94,7 @@ lzma_dep = dependency( fallback: ['liblzma', 'lzma_dep'], include_type: get_option('deps_include_type'), required: true -## static: true +# static: true ) zlib_dep = dependency( @@ -104,7 +102,7 @@ zlib_dep = dependency( fallback: ['zlib', 'zlib_dep'], include_type: get_option('deps_include_type'), required: true -## static: true +# static: true ) tiff_dep = dependency( @@ -113,7 +111,7 @@ tiff_dep = dependency( include_type: get_option('deps_include_type'), default_options: ['jpeg=enabled', 'lzma=enabled', 'zlib=enabled'], required: true -## static: true +# static: true ) found_benchmark = false @@ -127,9 +125,9 @@ endif openpivcore_deps = [ fmt_dep, -## jpeg_dep, # jpeg image loaders are not currently implemented -## png_dep, # png image loaders are not currently implemented -## raw_dep, # raw image loaders are not currently implemented +# jpeg_dep, # jpeg image loaders are not currently implemented +# png_dep, # png image loaders are not currently implemented +# raw_dep, # raw image loaders are not currently implemented tiff_dep, thread_dep ] From 014c1570aee81333af6eaa95efc2918e242799d9 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Wed, 20 Mar 2024 14:26:29 -0500 Subject: [PATCH 34/35] Grammatical clarifications --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9acb142..2cc476d 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,10 @@ There are some external dependencies under external/, so when cloning use: ```git clone --recursive ``` -Building uses cmake and meson, and is simplified by using meson wrap files to specify the dependent packages. Building has some pre-requisites: +Building uses meson, and is simplified by using meson wrap files to specify the dependent packages. Building has some pre-requisites: * a compiler (e.g. `apt install build-essentials`) -* cmake +* cmake (optional) * python * (linux) pkg-config (e.g. `apt install pkg-config`) * curl, zip, unzip, tar (e.g. `apt install curl zip unzip tar`) @@ -35,7 +35,7 @@ Unix users can also use the method used for the Windows build environment as det On Windows, the following can be used: * install TDM-GCC or any other Windows GNU distribution * install miniconda or venv and setup virtual environment -* pip install cmake +* pip install cmake (optional) * pip install meson To build: @@ -50,14 +50,14 @@ To run tests: To get binaries: * `meson install -C builddir` if the prefix was set or -* `meson install -C buildfir --destdir ` to install in a specifit directory. +* `meson install -C buildfir --destdir ` to install in a specific directory. Sometimes you only want the runtime dynamic libraries and executables. Meson comes with a handy targeted installation using the following command: * `meson install -C builddir --tags runtime` Make sure the prefix, or destdir, is set so binaries are not accidentally installed on the system. -The binaries are located in the bindir (if installed) and build directory: +The binaries are located the build or installation directory: Build directory: * builddir @@ -71,8 +71,8 @@ Install directory: * bindir * libopenpivcore.so * all other dependent shared libraries - * process.exe - * average_subtract.exe + * process (executable) + * average_subtract (executable) ### Raspberry Pi (using deprecated VCPKG build system) From bef6988e65443f98ccb35deecdb08440f32fdd49 Mon Sep 17 00:00:00 2001 From: erich-zimmer Date: Wed, 20 Mar 2024 15:55:51 -0500 Subject: [PATCH 35/35] Remove redundant information --- meson.build | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 806811f..9f5719f 100644 --- a/meson.build +++ b/meson.build @@ -155,8 +155,8 @@ endif pkgconfig = import('pkgconfig') pkgconfig.generate( - version: '0.2.0', - name: 'OpenPIV-cxx', - description: 'Open-source Particle Image Velocimetry in c++', - libraries: [openpiv_lib] + name: meson.project_name(), + version: meson.project_version(), + description: 'Open-source Particle Image Velocimetry in c++', + libraries: [openpiv_lib] ) \ No newline at end of file