OpenPIV / openpiv-c--qt

C++ with Qt frontend (superfast) version of OpenPIV
http://www.openpiv.net
GNU General Public License v3.0
22 stars 17 forks source link

Windows installation? #17

Open alexlib opened 2 years ago

alexlib commented 2 years ago

Are there tips to install it on Windows ?

timdewhirst commented 2 years ago

Interesting question, thanks! There shouldn't be any platform specific build instructions required - cmake, git and vcpkg should mean that the same process is followed for all platforms; you can see this in the .github/workflows/cmake.yml file.

Having said that, I'll try and do a local build on windows to see if this indeed as straight forward as it should be!

ErichZimmer commented 2 years ago

FYI, the windows installation went very smooth, even when I thought Microsoft vcpkg was a package manager and compiler.

alexlib commented 2 years ago

Please write a short doc or screenshot the way you used. @ErichZimmer

ErichZimmer commented 2 years ago

I compiled openpiv with a different Windows laptop, but this time, no executables are made. What I ran: git clone --recursive https://github.com/OpenPIV/openpiv-c--qt.git cd <directory to openpiv-c> cmake -B build -S . cmake --build build

alexlib commented 2 years ago

I get these errors which clearly point to missing packages:

(openpiv-cpp) PS C:\Users\alex\repos\openpiv-c--qt> cmake -B build -S .
-- Building for: Visual Studio 16 2019
-- found VCPKG_ROOT: C:/Users/alex/repos/openpiv-c--qt/external/vcpkg -> C:/Users/alex/repos/openpiv-c--qt/external/vcpkg/scripts/buildsystems/vcpkg.cmake
-- Using vcpkg triplet
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.29.30040.0
-- The CXX compiler identification is MSVC 19.29.30040.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find TIFF (missing: TIFF_LIBRARY) (found version "4.0.10")
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
CMake Error at openpiv/CMakeLists.txt:36 (find_package):
  Could not find a package configuration file provided by "spdlog" with any
  of the following names:

    spdlogConfig.cmake
    spdlog-config.cmake

  Add the installation prefix of "spdlog" to CMAKE_PREFIX_PATH or set
  "spdlog_DIR" to a directory containing one of the above files.  If "spdlog"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!
See also "C:/Users/alex/repos/openpiv-c--qt/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/alex/repos/openpiv-c--qt/build/CMakeFiles/CMakeError.log".
ErichZimmer commented 2 years ago

For spdlog, I installed it with vcpkg and everything compiled. When trying to compile openpiv on my personal laptop, no executables or dlls are made and there are no messages that I observed detailing why.

timdewhirst commented 2 years ago

spdlog is no longer required, and I suspect cmake has cached config info in build that should be removed; simplest way to do this is completely remove the build directory and rerun:

cd <directory to openpiv-c>
cmake -B build -S .
cmake --build build
ErichZimmer commented 2 years ago

Are there supposed to be a DLL in build/openpiv? The only place where I found the DLL and executable files were in build/out/Debug

alexlib commented 2 years ago

spdlog is no longer required, and I suspect cmake has cached config info in build that should be removed; simplest way to do this is completely remove the build directory and rerun:

cd <directory to openpiv-c>
cmake -B build -S .
cmake --build build

You're right. yet, there are other errors after I removed the folder, clone the present git master branch and run the build:


(openpiv-cpp) PS C:\Users\alex\repos\openpiv-c--qt> cmake -B build -S .
-- Building for: Visual Studio 16 2019
-- found VCPKG_ROOT: C:/Users/alex/repos/openpiv-c--qt/external/vcpkg -> C:/Users/alex/repos/openpiv-c--qt/external/vcpkg/scripts/buildsystems/vcpkg.cmake
-- Using vcpkg triplet
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.29.30040.0
-- The CXX compiler identification is MSVC 19.29.30040.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find TIFF (missing: TIFF_LIBRARY) (found version "4.0.10")
-- Could NOT find mimalloc (missing: mimalloc_DIR)
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
CMake Error at openpiv/CMakeLists.txt:47 (find_package):
  Could not find a package configuration file provided by "fmt" with any of
  the following names:

    fmtConfig.cmake
    fmt-config.cmake

  Add the installation prefix of "fmt" to CMAKE_PREFIX_PATH or set "fmt_DIR"
  to a directory containing one of the above files.  If "fmt" provides a
  separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred!
See also "C:/Users/alex/repos/openpiv-c--qt/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/alex/repos/openpiv-c--qt/build/CMakeFiles/CMakeError.log".```
timdewhirst commented 2 years ago

@alexlib I wonder if that could be a stale non-recursive clone or something similar - something is looking for fmt still but there isn't a requirement. I'm fairly sure the code in master is good because the builds for all platforms are working, including windows.

I don't have the ability to try this locally at the moment, I will try and do a local windows build in the next few days.

timdewhirst commented 2 years ago

@ErichZimmer I haven't put much (any?) effort into making the post build step do anything useful; build artefacts will probably appear in config specific directories i.e. Debug, Release, ...

ErichZimmer commented 2 years ago

@timdewhirst All build related files are in the out/Debug directory. To execute the example files, I use process.exe -s 32 -i ... and everything works as advertised.

timdewhirst commented 2 years ago

I recently noticed that cmake behaves differently on windows: on unix it will create a configuration and then when you build, you build that configuration. Windows appears to make a number of configurations up front, and then you can select which configuration to build with an additional --config option i.e.

cmake --build build --config Release

Worth knowing as the Release build will contain significant compiler optimizations. I'll update the README.md

ErichZimmer commented 2 years ago

@timdewhirst Should we add a /O3 optimization flag to msvc compilations?

timdewhirst commented 2 years ago

CMake should take care of applying optimizations for us; running cmake --build build --clean-first --verbose --config Release on windows gives:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\CL.exe /c /I"C:\Use
  rs\Tim Dewhirst\source\openpiv-c--qt\openpiv" /I"C:\Users\Tim Dewhirst\source\openpiv-c--qt\build\vcpkg_installed\x64
  -windows\include" /nologo /W3 /WX- /diagnostics:column /O2 /Ob2 /D _MBCS /D WIN32 /D _WINDOWS /D NDEBUG /D _USE_MATH_
  DEFINES /D FMT_HEADER_ONLY=1 /D "CMAKE_INTDIR=\"Release\"" /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Z
  c:inline /GR /std:c++17 /Fo"vector_test.dir\Release\\" /Fd"vector_test.dir\Release\vc143.pdb" /external:W3 /Gd /TP /e
  rrorReport:queue "C:\Users\Tim Dewhirst\source\openpiv-c--qt\test\vector_test.cpp"

The \O2 flag is present; if after some experiments \O3 was found to be better then by all means we could modify.

ErichZimmer commented 1 year ago

On windows 11 with MSVC 2022 compiler, I get the following error now.

(openpiv) C:\Users\Erich\openpiv-c--qt>cmake -B build -S .
-- Building for: Visual Studio 17 2022
-- found VCPKG_ROOT: C:/Users/Erich/openpiv-c--qt/external/vcpkg -> C:/Users/Erich/openpiv-c--qt/external/vcpkg/scripts/buildsystems/vcpkg.cmake
-- Using vcpkg triplet
-- Running vcpkg install
Detecting compiler hash for triplet x64-windows...
The following packages will be built and installed:
    asyncplusplus[core]:x64-windows -> 1.1#1
    catch2[core]:x64-windows -> 3.1.1#2
    cxxopts[core]:x64-windows -> 3.0.0
    fmt[core]:x64-windows -> 9.1.0
  * libjpeg-turbo[core]:x64-windows -> 2.1.4
  * liblzma[core]:x64-windows -> 5.2.5#6
    mimalloc[core]:x64-windows -> 2.0.6#1
    tiff[core,jpeg,lzma,zip]:x64-windows -> 4.4.0#1
  * vcpkg-cmake[core]:x64-windows -> 2022-09-26
  * vcpkg-cmake-config[core]:x64-windows -> 2022-02-06#1
  * zlib[core]:x64-windows -> 1.2.13
Additional packages (*) will be modified to complete this operation.
Restored 11 package(s) from C:\Users\Erich\AppData\Local\vcpkg\archives in 949.3 ms. Use --debug to see more details.
Installing 1/11 asyncplusplus:x64-windows...
Elapsed time to handle asyncplusplus:x64-windows: 43.87 ms
Installing 2/11 vcpkg-cmake-config:x64-windows...
Elapsed time to handle vcpkg-cmake-config:x64-windows: 12.95 ms
Installing 3/11 vcpkg-cmake:x64-windows...
Elapsed time to handle vcpkg-cmake:x64-windows: 13.89 ms
Installing 4/11 catch2:x64-windows...
Elapsed time to handle catch2:x64-windows: 311.8 ms
Installing 5/11 cxxopts:x64-windows...
Elapsed time to handle cxxopts:x64-windows: 10.93 ms
Installing 6/11 fmt:x64-windows...
Elapsed time to handle fmt:x64-windows: 29.27 ms
Installing 7/11 mimalloc:x64-windows...
Elapsed time to handle mimalloc:x64-windows: 20.84 ms
Installing 8/11 zlib:x64-windows...
Elapsed time to handle zlib:x64-windows: 18.41 ms
Installing 9/11 liblzma:x64-windows...
Elapsed time to handle liblzma:x64-windows: 32.04 ms
Installing 10/11 libjpeg-turbo:x64-windows...
Elapsed time to handle libjpeg-turbo:x64-windows: 30.26 ms
Installing 11/11 tiff:x64-windows...
Elapsed time to handle tiff:x64-windows: 23.36 ms

Total elapsed time: 5.16 s
asyncplusplus provides CMake targets:

    # this is heuristically generated, and may not be correct
    find_package(Async++ CONFIG REQUIRED)
    target_link_libraries(main PRIVATE Async++)

catch2 provides CMake targets:

    # this is heuristically generated, and may not be correct
    find_package(Catch2 CONFIG REQUIRED)
    target_link_libraries(main PRIVATE Catch2::Catch2 Catch2::Catch2WithMain)

cxxopts provides CMake targets:

    # this is heuristically generated, and may not be correct
    find_package(cxxopts CONFIG REQUIRED)
    target_link_libraries(main PRIVATE cxxopts::cxxopts)

The package fmt provides CMake targets:

    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt)

    # Or use the header-only version
    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt-header-only)

mimalloc provides CMake targets:

    # this is heuristically generated, and may not be correct
    find_package(mimalloc CONFIG REQUIRED)
    target_link_libraries(main PRIVATE mimalloc mimalloc-static)

-- Running vcpkg install - done
-- The C compiler identification is MSVC 19.34.31937.0
-- The CXX compiler identification is MSVC 19.34.31937.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found TIFF: optimized;C:/Users/Erich/openpiv-c--qt/build/vcpkg_installed/x64-windows/lib/tiff.lib;debug;C:/Users/Erich/openpiv-c--qt/build/vcpkg_installed/x64-windows/debug/lib/tiffd.lib (found version "4.4.0")
found libtiff
found mimalloc
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
building enum_helper_test from C:/Users/Erich/openpiv-c--qt/test/enum_helper_test.cpp
building grid_test from C:/Users/Erich/openpiv-c--qt/test/grid_test.cpp
building image_algos_test from C:/Users/Erich/openpiv-c--qt/test/image_algos_test.cpp
building image_expression_test from C:/Users/Erich/openpiv-c--qt/test/image_expression_test.cpp
building image_loader_test from C:/Users/Erich/openpiv-c--qt/test/image_loader_test.cpp
building image_stats_test from C:/Users/Erich/openpiv-c--qt/test/image_stats_test.cpp
building image_test from C:/Users/Erich/openpiv-c--qt/test/image_test.cpp
building image_utils_test from C:/Users/Erich/openpiv-c--qt/test/image_utils_test.cpp
building image_view_test from C:/Users/Erich/openpiv-c--qt/test/image_view_test.cpp
building log_test from C:/Users/Erich/openpiv-c--qt/test/log_test.cpp
building pixel_types_test from C:/Users/Erich/openpiv-c--qt/test/pixel_types_test.cpp
building point_test from C:/Users/Erich/openpiv-c--qt/test/point_test.cpp
building range_test from C:/Users/Erich/openpiv-c--qt/test/range_test.cpp
building rect_test from C:/Users/Erich/openpiv-c--qt/test/rect_test.cpp
building size_test from C:/Users/Erich/openpiv-c--qt/test/size_test.cpp
building stream_utils_test from C:/Users/Erich/openpiv-c--qt/test/stream_utils_test.cpp
building util_test from C:/Users/Erich/openpiv-c--qt/test/util_test.cpp
building vector_test from C:/Users/Erich/openpiv-c--qt/test/vector_test.cpp
CMake Warning at external/vcpkg/scripts/buildsystems/vcpkg.cmake:834 (_find_package):
  By not providing "Findbenchmark.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "benchmark", but CMake did not find one.

  Could not find a package configuration file provided by "benchmark" with
  any of the following names:

    benchmarkConfig.cmake
    benchmark-config.cmake

  Add the installation prefix of "benchmark" to CMAKE_PREFIX_PATH or set
  "benchmark_DIR" to a directory containing one of the above files.  If
  "benchmark" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  test/CMakeLists.txt:40 (find_package)

async++ found; including
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Erich/openpiv-c--qt/build
ErichZimmer commented 1 year ago

Nevermind, I simply misinterpreted the warning and everything works.

timdewhirst commented 1 year ago

I should probably clean that up...