Skip to content

Commit

Permalink
add script changes and setup cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolemarsaglia committed Oct 15, 2024
1 parent bbacd70 commit 38e2fd0
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 16 deletions.
32 changes: 16 additions & 16 deletions scripts/build_ascent/build_ascent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}/)
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/cmake/Setup3rdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
35 changes: 35 additions & 0 deletions src/cmake/thirdparty/SetupANARI.cmake
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 38e2fd0

Please sign in to comment.