Skip to content

Commit 9522a57

Browse files
committed
clean up, add sep logic to check for tarball vs untar
1 parent f47ae6b commit 9522a57

1 file changed

Lines changed: 75 additions & 54 deletions

File tree

scripts/build_conduit/build_conduit.sh

Lines changed: 75 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,16 @@ zlib_tarball=$(ospath ${source_dir}/zlib-${zlib_version}.tar.gz)
197197
# build only if install doesn't exist
198198
if [ ! -d ${zlib_install_dir} ]; then
199199
if ${build_zlib}; then
200-
if [ ! -d ${zlib_src_dir} ]; then
200+
if [ ! -f ${zlib_tarball} ]; then
201201
echo "**** Downloading ${zlib_tarball}"
202202
curl -L https://github.com/madler/zlib/releases/download/v${zlib_version}/zlib-${zlib_version}.tar.gz -o ${zlib_tarball}
203+
fi
204+
if [ ! -d ${zlib_src_dir} ]; then
205+
echo "**** Extracting ${zlib_tarball}"
203206
tar ${tar_extra_args} -xzf ${zlib_tarball} -C ${source_dir}
204207
fi
205208

209+
206210
echo "**** Configuring Zlib ${zlib_version}"
207211
cmake -S ${zlib_src_dir} -B ${zlib_build_dir} ${cmake_compiler_settings} \
208212
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${enable_verbose} \
@@ -234,18 +238,20 @@ hdf5_tarball=$(ospath ${source_dir}/hdf5-${hdf5_version}.tar.gz)
234238
# build only if install doesn't exist
235239
if [ ! -d ${hdf5_install_dir} ]; then
236240
if ${build_hdf5}; then
237-
if [ ! -d ${hdf5_src_dir} ]; then
241+
if [ ! -f ${hdf5_tarball} ]; then
238242
echo "**** Downloading ${hdf5_tarball}"
239-
curl -L https://support.hdfgroup.org/releases/hdf5/v${hdf5_short_version}/v${hdf5_middle_version}/downloads/hdf5-${hdf5_version}.tar.gz -o ${hdf5_tarball}
243+
curl -L https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${hdf5_short_version}/hdf5-${hdf5_middle_version}/src/hdf5-${hdf5_version}.tar.gz -o ${hdf5_tarball}
244+
fi
245+
if [ ! -d ${hdf5_src_dir} ]; then
246+
echo "**** Extracting ${hdf5_tarball}"
240247
tar ${tar_extra_args} -xzf ${hdf5_tarball} -C ${source_dir}
241248
fi
242249

243-
244250
#################
245251
#
246252
# hdf5 CMake recipe for using zlib
247253
#
248-
# -DHDF5_ENABLE_Z_LIB_SUPPORT=ON
254+
# -DHDF5_ENABLE_ZLIB_SUPPORT=ON
249255
# Add zlib install dir to CMAKE_PREFIX_PATH
250256
#
251257
#################
@@ -293,13 +299,16 @@ cgns_tarball=$(ospath ${source_dir}/cgns-${cgns_version}.tar.gz)
293299
# build only if install doesn't exist
294300
if [ ! -d ${cgns_install_dir} ]; then
295301
if ${build_cgns}; then
296-
if [ ! -d ${cgns_src_dir} ]; then
302+
if [ ! -f ${cgns_tarball} ]; then
297303
echo "**** Downloading ${cgns_tarball}"
298304
curl -L https://github.com/CGNS/CGNS/archive/refs/tags/v${cgns_version}.tar.gz -o ${cgns_tarball}
305+
fi
306+
if [ ! -d ${cgns_src_dir} ]; then
307+
echo "**** Extracting ${cgns_tarball}"
299308
tar ${tar_extra_args} -xzf ${cgns_tarball} -C ${source_dir}
300309

301310
# hdf5 2.0 patch
302-
cd ${cgns_src_dir}
311+
cd ${cgns_src_dir}
303312
patch -p1 < ${script_dir}/2026_01_06_cgns_hdf5_2.patch
304313
cd ${root_dir}
305314
fi
@@ -347,17 +356,19 @@ silo_tarball=$(ospath ${source_dir}/silo-${silo_version}.tar.gz)
347356
# build only if install doesn't exist
348357
if [ ! -d ${silo_install_dir} ]; then
349358
if ${build_silo}; then
350-
if [ ! -d ${silo_src_dir} ]; then
359+
if [ ! -f ${silo_tarball} ]; then
351360
echo "**** Downloading ${silo_tarball}"
352361
curl -L https://github.com/LLNL/Silo/archive/refs/tags/${silo_version}.tar.gz -o ${silo_tarball}
362+
fi
363+
if [ ! -d ${silo_src_dir} ]; then
364+
echo "**** Extracting ${silo_tarball}"
353365
# untar and avoid symlinks (which windows despises)
354366
tar ${tar_extra_args} -xzf ${silo_tarball} -C ${source_dir} \
355367
--exclude="Silo-${silo_version}/config-site/*" \
356368
--exclude="Silo-${silo_version}/LICENSE.md" \
357369
--exclude="Silo-${silo_version}/silo_objects.png"
358370
fi
359371

360-
361372
echo "**** Configuring Silo ${silo_version}"
362373
cmake -S ${silo_src_dir} -B ${silo_build_dir} ${cmake_compiler_settings} \
363374
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${enable_verbose} \
@@ -426,9 +437,12 @@ caliper_tarball=$(ospath ${source_dir}/caliper-${caliper_version}-src-with-blt.t
426437
# build only if install doesn't exist
427438
if [ ! -d ${caliper_install_dir} ]; then
428439
if ${build_caliper}; then
429-
if [ ! -d ${caliper_src_dir} ]; then
440+
if [ ! -f ${caliper_tarball} ]; then
430441
echo "**** Downloading ${caliper_tarball}"
431442
curl -L https://github.com/LLNL/Caliper/archive/refs/tags/v${caliper_version}.tar.gz -o ${caliper_tarball}
443+
fi
444+
if [ ! -d ${caliper_src_dir} ]; then
445+
echo "**** Extracting ${caliper_tarball}"
432446
tar ${tar_extra_args} -xzf ${caliper_tarball} -C ${source_dir}
433447
# windows specific patch
434448
cd ${caliper_src_dir}
@@ -437,7 +451,6 @@ if [ ! -d ${caliper_src_dir} ]; then
437451
fi
438452
cd ${root_dir}
439453
fi
440-
441454
#
442455
# Note: Caliper has optional Umpire support,
443456
# if we want to support in the future, we will need to build umpire first
@@ -675,9 +688,12 @@ zfp_tarball=$(ospath ${source_dir}/zfp-${zfp_version}.tar.gz)
675688
# build only if install doesn't exist
676689
if [ ! -d ${zfp_install_dir} ]; then
677690
if ${build_zfp}; then
678-
if [ ! -d ${zfp_src_dir} ]; then
691+
if [ ! -f ${zfp_tarball} ]; then
679692
echo "**** Downloading ${zfp_tarball}"
680-
curl -L https://github.com/LLNL/zfp/releases/download/${zfp_version}/zfp-${zfp_version}.tar.gz -o ${zfp_tarball}
693+
curl -L https://github.com/LLNL/zfp/releases/download/1.0.1/zfp-${zfp_version}.tar.gz -o ${zfp_tarball}
694+
fi
695+
if [ ! -d ${zfp_src_dir} ]; then
696+
echo "**** Extracting ${zfp_tarball}"
681697
tar ${tar_extra_args} -xzf ${zfp_tarball} -C ${source_dir}
682698

683699
# apply patches
@@ -727,9 +743,12 @@ h5zzfp_tarball=$(ospath ${source_dir}/h5zzfp-${h5zzfp_version}.tar.gz)
727743
if [ ! -d ${h5zzfp_install_dir} ]; then
728744
# also enabled via `build_zfp` instead of sep option
729745
if ${build_zfp}; then
730-
if [ ! -d ${h5zzfp_src_dir} ]; then
746+
if [ ! -f ${h5zzfp_tarball} ]; then
731747
echo "**** Downloading ${h5zzfp_tarball}"
732748
curl -L "https://github.com/LLNL/H5Z-ZFP/archive/refs/tags/v${h5zzfp_version}.tar.gz" -o ${h5zzfp_tarball}
749+
fi
750+
if [ ! -d ${h5zzfp_src_dir} ]; then
751+
echo "**** Extracting ${h5zzfp_tarball}"
733752
tar ${tar_extra_args} -xzf ${h5zzfp_tarball} -C ${source_dir}
734753

735754
# apply patches
@@ -780,88 +799,90 @@ fi
780799
conduit_build_dir=$(ospath ${build_dir}/conduit-${conduit_version}/)
781800
conduit_install_dir=$(ospath ${install_dir}//conduit-${conduit_version}/)
782801

802+
cmake_host_config=${root_dir}/conduit-config.cmake
803+
783804
echo "**** Creating Conduit host-config (conduit-config.cmake)"
784805
#
785-
echo '# host-config file generated by build_conduit.sh' > ${root_dir}/conduit-config.cmake
806+
echo '# host-config file generated by build_conduit.sh' > ${cmake_host_config}
786807

787808
# capture compilers if they are provided via env vars
788809
if [ ! -z ${CC+x} ]; then
789-
echo 'set(CMAKE_C_COMPILER ' ${CC} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
810+
echo 'set(CMAKE_C_COMPILER ' ${CC} ' CACHE PATH "")' >> ${cmake_host_config}
790811
fi
791812

792813
if [ ! -z ${CXX+x} ]; then
793-
echo 'set(CMAKE_CXX_COMPILER ' ${CXX} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
814+
echo 'set(CMAKE_CXX_COMPILER ' ${CXX} ' CACHE PATH "")' >> ${cmake_host_config}
794815
fi
795816

796817
if [ ! -z ${FTN+x} ]; then
797-
echo 'set(CMAKE_Fortran_COMPILER ' ${FTN} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
818+
echo 'set(CMAKE_Fortran_COMPILER ' ${FTN} ' CACHE PATH "")' >> ${cmake_host_config}
798819
fi
799820

800821
# capture compiler flags if they are provided via env vars
801822
if [ ! -z ${CFLAGS+x} ]; then
802-
echo 'set(CMAKE_C_FLAGS "' ${CFLAGS} '" CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
823+
echo 'set(CMAKE_C_FLAGS "' ${CFLAGS} '" CACHE PATH "")' >> ${cmake_host_config}
803824
fi
804825

805826
if [ ! -z ${CXXFLAGS+x} ]; then
806-
echo 'set(CMAKE_CXX_FLAGS "' ${CXXFLAGS} '" CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
827+
echo 'set(CMAKE_CXX_FLAGS "' ${CXXFLAGS} '" CACHE PATH "")' >> ${cmake_host_config}
807828
fi
808829

809830
if [ ! -z ${FFLAGS+x} ]; then
810-
echo 'set(CMAKE_F_FLAGS "' ${FFLAGS} '" CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
831+
echo 'set(CMAKE_F_FLAGS "' ${FFLAGS} '" CACHE PATH "")' >> ${cmake_host_config}
811832
fi
812833

813834
if [[ "$enable_mpicc" == "ON" ]]; then
814-
echo 'set(MPI_C_COMPILER ' ${mpicc_exe} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
815-
echo 'set(MPI_CXX_COMPILER ' ${mpicxx_exe} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
816-
fi
817-
818-
echo 'set(CMAKE_VERBOSE_MAKEFILE ' ${enable_verbose} ' CACHE BOOL "")' >> ${root_dir}/conduit-config.cmake
819-
echo 'set(CMAKE_BUILD_TYPE ' ${build_config} ' CACHE STRING "")' >> ${root_dir}/conduit-config.cmake
820-
echo 'set(BUILD_SHARED_LIBS ' ${build_shared_libs} ' CACHE STRING "")' >> ${root_dir}/conduit-config.cmake
821-
echo 'set(CMAKE_INSTALL_PREFIX ' ${conduit_install_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
822-
echo 'set(ENABLE_TESTS ' ${enable_tests} ' CACHE BOOL "")' >> ${root_dir}/conduit-config.cmake
823-
echo 'set(ENABLE_MPI ' ${enable_mpi} ' CACHE BOOL "")' >> ${root_dir}/conduit-config.cmake
824-
echo 'set(ENABLE_FIND_MPI ' ${enable_find_mpi} ' CACHE BOOL "")' >> ${root_dir}/conduit-config.cmake
825-
echo 'set(ENABLE_FORTRAN ' ${enable_fortran} ' CACHE BOOL "")' >> ${root_dir}/conduit-config.cmake
826-
echo 'set(ENABLE_PYTHON ' ${enable_python} ' CACHE BOOL "")' >> ${root_dir}/conduit-config.cmake
835+
echo 'set(MPI_C_COMPILER ' ${mpicc_exe} ' CACHE PATH "")' >> ${cmake_host_config}
836+
echo 'set(MPI_CXX_COMPILER ' ${mpicxx_exe} ' CACHE PATH "")' >> ${cmake_host_config}
837+
fi
838+
839+
echo 'set(CMAKE_VERBOSE_MAKEFILE ' ${enable_verbose} ' CACHE BOOL "")' >> ${cmake_host_config}
840+
echo 'set(CMAKE_BUILD_TYPE ' ${build_config} ' CACHE STRING "")' >> ${cmake_host_config}
841+
echo 'set(BUILD_SHARED_LIBS ' ${build_shared_libs} ' CACHE STRING "")' >> ${cmake_host_config}
842+
echo 'set(CMAKE_INSTALL_PREFIX ' ${conduit_install_dir} ' CACHE PATH "")' >> ${cmake_host_config}
843+
echo 'set(ENABLE_TESTS ' ${enable_tests} ' CACHE BOOL "")' >> ${cmake_host_config}
844+
echo 'set(ENABLE_MPI ' ${enable_mpi} ' CACHE BOOL "")' >> ${cmake_host_config}
845+
echo 'set(ENABLE_FIND_MPI ' ${enable_find_mpi} ' CACHE BOOL "")' >> ${cmake_host_config}
846+
echo 'set(ENABLE_FORTRAN ' ${enable_fortran} ' CACHE BOOL "")' >> ${cmake_host_config}
847+
echo 'set(ENABLE_PYTHON ' ${enable_python} ' CACHE BOOL "")' >> ${cmake_host_config}
827848
if ${build_pyvenv}; then
828-
echo 'set(PYTHON_EXECUTABLE ' ${venv_python_exe} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
829-
echo 'set(PYTHON_MODULE_INSTALL_PREFIX ' ${venv_python_site_pkgs_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
830-
echo 'set(ENABLE_DOCS ON CACHE BOOL "")' >> ${root_dir}/conduit-config.cmake
831-
echo 'set(SPHINX_EXECUTABLE ' ${venv_sphinx_exe} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
849+
echo 'set(PYTHON_EXECUTABLE ' ${venv_python_exe} ' CACHE PATH "")' >> ${cmake_host_config}
850+
echo 'set(PYTHON_MODULE_INSTALL_PREFIX ' ${venv_python_site_pkgs_dir} ' CACHE PATH "")' >> ${cmake_host_config}
851+
echo 'set(ENABLE_DOCS ON CACHE BOOL "")' >> ${cmake_host_config}
852+
echo 'set(SPHINX_EXECUTABLE ' ${venv_sphinx_exe} ' CACHE PATH "")' >> ${cmake_host_config}
832853
fi
833854
if ${build_caliper}; then
834-
echo 'set(CALIPER_DIR ' ${caliper_install_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
855+
echo 'set(CALIPER_DIR ' ${caliper_install_dir} ' CACHE PATH "")' >> ${cmake_host_config}
835856
fi
836857
if ${build_camp}; then
837-
echo 'set(CAMP_DIR ' ${camp_install_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
858+
echo 'set(CAMP_DIR ' ${camp_install_dir} ' CACHE PATH "")' >> ${cmake_host_config}
838859
fi
839860
if ${build_raja}; then
840-
echo 'set(RAJA_DIR ' ${raja_install_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
861+
echo 'set(RAJA_DIR ' ${raja_install_dir} ' CACHE PATH "")' >> ${cmake_host_config}
841862
fi
842863
if ${build_umpire}; then
843-
echo 'set(UMPIRE_DIR ' ${umpire_install_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
864+
echo 'set(UMPIRE_DIR ' ${umpire_install_dir} ' CACHE PATH "")' >> ${cmake_host_config}
844865
fi
845866

846867

847-
echo 'set(HDF5_DIR ' ${hdf5_install_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
848-
echo 'set(CGNS_DIR ' ${cgns_install_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
849-
echo 'set(ZLIB_DIR ' ${zlib_install_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
868+
echo 'set(HDF5_DIR ' ${hdf5_install_dir} ' CACHE PATH "")' >> ${cmake_host_config}
869+
echo 'set(CGNS_DIR ' ${cgns_install_dir} ' CACHE PATH "")' >> ${cmake_host_config}
870+
echo 'set(ZLIB_DIR ' ${zlib_install_dir} ' CACHE PATH "")' >> ${cmake_host_config}
850871
if ${build_zfp}; then
851-
echo 'set(ZFP_DIR ' ${zfp_install_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
852-
echo 'set(H5ZZFP_DIR ' ${h5zzfp_install_dir} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
872+
echo 'set(ZFP_DIR ' ${zfp_install_dir} ' CACHE PATH "")' >> ${cmake_host_config}
873+
echo 'set(H5ZZFP_DIR ' ${h5zzfp_install_dir} ' CACHE PATH "")' >> ${cmake_host_config}
853874
fi
854875

855876
if [[ "$enable_cuda" == "ON" ]]; then
856-
echo 'set(ENABLE_CUDA ON CACHE BOOL "")' >> ${root_dir}/conduit-config.cmake
857-
echo 'set(CMAKE_CUDA_ARCHITECTURES ' ${CUDA_ARCH} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
877+
echo 'set(ENABLE_CUDA ON CACHE BOOL "")' >> ${cmake_host_config}
878+
echo 'set(CMAKE_CUDA_ARCHITECTURES ' ${CUDA_ARCH} ' CACHE PATH "")' >> ${cmake_host_config}
858879
fi
859880

860881
if [[ "$enable_hip" == "ON" ]]; then
861-
echo 'set(ENABLE_HIP ON CACHE BOOL "")' >> ${root_dir}/conduit-config.cmake
862-
echo 'set(CMAKE_HIP_COMPILER ' ${CXX} ' CACHE STRING "")' >> ${root_dir}/conduit-config.cmake
863-
echo 'set(CMAKE_HIP_ARCHITECTURES ' ${ROCM_ARCH} ' CACHE STRING "")' >> ${root_dir}/conduit-config.cmake
864-
echo 'set(ROCM_PATH ' ${ROCM_PATH} ' CACHE PATH "")' >> ${root_dir}/conduit-config.cmake
882+
echo 'set(ENABLE_HIP ON CACHE BOOL "")' >> ${cmake_host_config}
883+
echo 'set(CMAKE_HIP_COMPILER ' ${CXX} ' CACHE STRING "")' >> ${cmake_host_config}
884+
echo 'set(CMAKE_HIP_ARCHITECTURES ' ${ROCM_ARCH} ' CACHE STRING "")' >> ${cmake_host_config}
885+
echo 'set(ROCM_PATH ' ${ROCM_PATH} ' CACHE PATH "")' >> ${cmake_host_config}
865886
fi
866887

867888
# build only if install doesn't exist
@@ -873,7 +894,7 @@ if [ ! -d ${conduit_src_dir} ]; then
873894
fi
874895

875896
echo "**** Configuring Conduit"
876-
cmake -S ${conduit_src_dir} -B ${conduit_build_dir} -C ${root_dir}/conduit-config.cmake
897+
cmake -S ${conduit_src_dir} -B ${conduit_build_dir} -C ${cmake_host_config}
877898

878899
echo "**** Building Conduit"
879900
cmake --build ${conduit_build_dir} --config ${build_config} -j${build_jobs}

0 commit comments

Comments
 (0)