NexGenAnalytics / MIT-MUQ

BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

HDF5: remove internal find, check and build; use find_package with namespace #31

Closed pierrepebay closed 3 months ago

pierrepebay commented 3 months ago

What I did to build hdf5:

# from MUQ root:
mkdir deps
mkdir deps/hdf5
cd deps/hdf5
mkdir build install
# we can change this to .tar if needed
wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_8_19.zip
unzip hdf5-1_8_19.zip
cmake -S hdf5-hdf5-1_8_19/ -B build/ -DCMAKE_INSTALL_PREFIX=~/Develop/MIT-MUQ/deps/hdf5/install/ -DHDF5_BUILD_CPP_LIB=ON
cd build
make -j24 && make install

How I used this build with MUQ:

cmake -DCMAKE_C_COMPILER=gcc \
      -DCMAKE_CXX_COMPILER=g++ \
      -S /home/plpebay/Develop/MIT-MUQ/ \
      -B /home/plpebay/Develop/MIT-MUQ/build/ \
      -DMUQ_USE_GTEST=ON \
      -DMUQ_GTEST_DIR=/home/plpebay/Develop/MIT-MUQ/deps/googletest/install \
      -DCMAKE_INSTALL_PREFIX=/home/plpebay/Develop/MIT-MUQ/install \
      -DHDF5_DIR=~/Develop/MIT-MUQ/deps/hdf5/install/share/cmake
make -j24 && make install
fnrizzi commented 3 months ago

please make sure (1) you write in the description how you built hdf5 so we can keep track of all libs on the fly (2) verify that everything builds

fnrizzi commented 3 months ago

why :

using -DHDF5_DIR=... doesn't work! 

?

pierrepebay commented 3 months ago

When building MUQ with:

cmake -DCMAKE_C_COMPILER=gcc \
      -DCMAKE_CXX_COMPILER=g++ \
      -S /home/plpebay/Develop/MIT-MUQ/ \
      -B /home/plpebay/Develop/MIT-MUQ/build/ \
      -DMUQ_USE_GTEST=ON \
      -DMUQ_GTEST_DIR=/home/plpebay/Develop/MIT-MUQ/deps/googletest/install \
      -DHDF5_DIR=/home/plpebay/Develop/MIT-MUQ/deps/hdf5/build \
      -DCMAKE_INSTALL_PREFIX=/home/plpebay/Develop/MIT-MUQ/install

I get the error:

CMake Error at deps/hdf5/build/hdf5-config.cmake:25 (message):
  File or directory /home/plpebay/Develop/MIT-MUQ/deps/bin referenced by
  variable HDF5_TOOLS_DIR does not exist !
Call Stack (most recent call first):
  deps/hdf5/build/hdf5-config.cmake:102 (set_and_check)
  /opt/cmake-3.27.1-linux-x86_64/share/cmake-3.27/Modules/FindHDF5.cmake:510 (find_package)
  cmake/finds/RequiredDependencySearch.cmake:80 (find_package)
  cmake/DependencySearch.cmake:2 (include)
  CMakeLists.txt:74 (INCLUDE)

Same thing when pointing HDF_DIR to the install directory.

pierrepebay commented 3 months ago

Updated top comment

pierrepebay commented 3 months ago

Tests passed: test.log