From 38e2fd0aec5a13a960d80bc8204b3cc9070ebcc4 Mon Sep 17 00:00:00 2001 From: Nicole Marsaglia Date: Tue, 15 Oct 2024 21:12:18 +0000 Subject: [PATCH] add script changes and setup cmake --- scripts/build_ascent/build_ascent.sh | 32 ++++++++++++------------ src/cmake/Setup3rdParty.cmake | 10 ++++++++ src/cmake/thirdparty/SetupANARI.cmake | 35 +++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 16 deletions(-) create mode 100644 src/cmake/thirdparty/SetupANARI.cmake diff --git a/scripts/build_ascent/build_ascent.sh b/scripts/build_ascent/build_ascent.sh index e2cc38c31..1b9f5233e 100755 --- a/scripts/build_ascent/build_ascent.sh +++ b/scripts/build_ascent/build_ascent.sh @@ -567,7 +567,6 @@ anari_version=0.10.0 anari_src_dir=$(ospath ${source_dir}/ANARI-SDK-${anari_version}) anari_build_dir=$(ospath ${build_dir}/anari-v${anari_version}) anari_install_dir=$(ospath ${install_dir}/anari-v${anari_version}/) -anari_cmake_dir=${anari_install_dir}lib64/cmake/anari/ anari_tarball=$(ospath ${source_dir}/anari-v${anari_version}.tar.gz) # build only if install doesn't exist @@ -639,8 +638,8 @@ if [[ "$enable_mpicc" == "ON" ]]; then vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DMPI_CXX_COMPILER=${mpicxx_exe}" fi -if [[ "$build_anari" == "ON" ]]; then - vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DVTKm_build_anari=ON" +if ${build_anari}; then + vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DVTKm_ENABLE_ANARI=ON" vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DANARI_DIR=$anari_install_dir}" vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DCMAKE_PREFIX_PATH=${anari_install_dir}" fi @@ -928,17 +927,17 @@ fi # build_catalyst # Ascent ################ # if we are in an ascent checkout, use existing source -ascent_checkout_dir=$(ospath ${script_dir}/../../src) -ascent_checkout_dir=$(abs_path ${ascent_checkout_dir}) -echo ${ascent_checkout_dir} -if [ -d ${ascent_checkout_dir} ]; then - ascent_version=checkout - ascent_src_dir=$(abs_path ${ascent_checkout_dir}) - echo "**** Using existing Ascent source repo checkout: ${ascent_src_dir}" -else - ascent_version=develop - ascent_src_dir=$(ospath ${source_dir}/ascent/src) -fi +#ascent_checkout_dir=$(ospath ${script_dir}/../../src) +#ascent_checkout_dir=$(abs_path ${ascent_checkout_dir}) +#echo ${ascent_checkout_dir} +#if [ -d ${ascent_checkout_dir} ]; then +# ascent_version=checkout +# ascent_src_dir=$(abs_path ${ascent_checkout_dir}) +# echo "**** Using existing Ascent source repo checkout: ${ascent_src_dir}" +#else +ascent_version=develop_anari +ascent_src_dir=$(ospath ${source_dir}/ascent/src) +#fi # otherwise use ascent develop ascent_build_dir=$(ospath ${build_dir}/ascent-${ascent_version}/) @@ -1013,8 +1012,9 @@ if ${build_catalyst}; then echo 'set(CATALYST_DIR ' ${catalyst_cmake_dir} ' CACHE PATH "")' >> ${root_dir}/ascent-config.cmake fi -if [[ "$build_anari" == "ON" ]]; then - echo 'set(ANARI_DIR ' ${anari_install_dir} ' CACHE PATH "")' >> ${root_dir}/ascent-config.cmake +if ${build_anari}; then + echo 'set(ENABLE_ANARI ON CACHE BOOL "")' >> ${root_dir}/ascent-config.cmake + echo 'set(ANARI_DIR ' ${anari_install_dir}' CACHE PATH "")' >> ${root_dir}/ascent-config.cmake fi if [[ "$enable_cuda" == "ON" ]]; then diff --git a/src/cmake/Setup3rdParty.cmake b/src/cmake/Setup3rdParty.cmake index f7aebc1a0..cdb71768d 100644 --- a/src/cmake/Setup3rdParty.cmake +++ b/src/cmake/Setup3rdParty.cmake @@ -140,6 +140,16 @@ if (GENTEN_DIR) include(cmake/thirdparty/SetupGenTen.cmake) endif() +################################ +# Setup Catalyst +################################ if (CATALYST_DIR) include(cmake/thirdparty/SetupCatalyst.cmake) endif() + +################################ +# Setup ANARI +################################ +if (ANARI_DIR) + include(cmake/thirdparty/SetupANARI.cmake) +endif() diff --git a/src/cmake/thirdparty/SetupANARI.cmake b/src/cmake/thirdparty/SetupANARI.cmake new file mode 100644 index 000000000..ec3563fa5 --- /dev/null +++ b/src/cmake/thirdparty/SetupANARI.cmake @@ -0,0 +1,35 @@ +############################################################################### +# Copyright (c) Lawrence Livermore National Security, LLC and other Ascent +# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and +# other details. No copyright assignment is required to contribute to Ascent. +############################################################################### + +############################################################################### +# Setup ANARI +############################################################################### + +if(NOT ANARI_DIR) + MESSAGE(FATAL_ERROR "ANARI support needs explicit ANARI_DIR") +endif() + +MESSAGE(STATUS "Looking for ANARI using ANARI_DIR = ${ANARI_DIR}") + +set(ANARI_DIR_ORIG ${ANARI_DIR}) +set(ANARI_FOUND TRUE) + +file(GLOB ANARI_DIR "${ANARI_DIR}/lib/cmake/anari-*") +if(NOT EXISTS ${ANARI_DIR}/anariConfig.cmake) + MESSAGE(FATAL_ERROR "Could not find ANARI CMake at (${ANARI_DIR}/lib/cmake/anari-*)") +endif() + +############################################################################### +# Import ANARI CMake targets +############################################################################### +#find_package(anari REQUIRED) +find_package(anari REQUIRED + NO_DEFAULT_PATH + PATHS ${ANARI_DIR}) +if(NOT TARGET vtkm::anari) + message(FATAL_ERROR "vtkm::anari not found, check your VTK-m install") +endif() +