diff --git a/CMakeLists.txt b/CMakeLists.txt index 94caec757ab..916c775a0fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,16 +121,8 @@ endmacro() #=============================================================================== if(OPENMC_USE_NCRYSTAL) - if(NOT DEFINED "NCrystal_DIR") - #Invocation of "ncrystal-config --show cmakedir" is needed to find NCrystal - #when it is installed from Python wheels: - execute_process( - COMMAND "ncrystal-config" "--show" "cmakedir" - OUTPUT_VARIABLE "NCrystal_DIR" OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif() - find_package(NCrystal 3.8.0 REQUIRED) - message(STATUS "Found NCrystal: ${NCrystal_DIR} (version ${NCrystal_VERSION})") + find_package(NCrystal 4.0.0 REQUIRED) + message(STATUS "Found NCrystal: ${NCrystal_LIBRARIES} (version ${NCrystal_VERSION})") endif() #=============================================================================== diff --git a/cmake/OpenMCConfig.cmake.in b/cmake/OpenMCConfig.cmake.in index b02bbffe5cf..668376ce5ae 100644 --- a/cmake/OpenMCConfig.cmake.in +++ b/cmake/OpenMCConfig.cmake.in @@ -10,16 +10,7 @@ if(@OPENMC_USE_DAGMC@) endif() if(@OPENMC_USE_NCRYSTAL@) - if(NOT DEFINED "NCrystal_DIR") - #Invocation of "ncrystal-config --show cmakedir" is needed to find NCrystal - #when it is installed from Python wheels: - execute_process( - COMMAND "ncrystal-config" "--show" "cmakedir" - OUTPUT_VARIABLE "NCrystal_DIR" OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif() - find_package(NCrystal REQUIRED) - message(STATUS "Found NCrystal: ${NCrystal_DIR} (version ${NCrystal_VERSION})") + find_package(NCrystal REQUIRED HINTS @CMAKE_PREFIX_PATH@) endif() if(@OPENMC_USE_LIBMESH@) diff --git a/tools/ci/gha-install-ncrystal.sh b/tools/ci/gha-install-ncrystal.sh new file mode 100644 index 00000000000..3bc29ab5417 --- /dev/null +++ b/tools/ci/gha-install-ncrystal.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -ex + +# NCrystal Variables +NCRYSTAL_BRANCH='v4.0.0' +NCRYSTAL_REPO='https://github.com/mctools/ncrystal' +NCRYSTAL_INSTALL_DIR=$HOME/NCRYSTAL/ + +CURRENT_DIR=$(pwd) + +# NCrystal Install +cd $HOME +git clone -b $NCRYSTAL_BRANCH $NCRYSTAL_REPO ncrystal +cd ncrystal +mkdir build && cd build +cmake .. \ + -DBUILD_SHARED_LIBS=ON \ + -DNCRYSTAL_NOTOUCH_CMAKE_BUILD_TYPE=ON \ + -DNCRYSTAL_MODIFY_RPATH=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DNCRYSTAL_ENABLE_EXAMPLES=OFF \ + -DNCRYSTAL_ENABLE_SETUPSH=OFF \ + -DNCRYSTAL_ENABLE_DATA=EMBED \ + -DCMAKE_INSTALL_PREFIX="$NCRYSTAL_INSTALL_DIR" +make -j4 && make install +rm -rf $HOME/ncrystal +cd $CURRENT_DIR \ No newline at end of file diff --git a/tools/ci/gha-install.py b/tools/ci/gha-install.py index 1eb9a55b4dc..7cfb78e11a3 100644 --- a/tools/ci/gha-install.py +++ b/tools/ci/gha-install.py @@ -2,7 +2,6 @@ import shutil import subprocess - def install(omp=False, mpi=False, phdf5=False, dagmc=False, libmesh=False, ncrystal=False): # Create build directory and change to it shutil.rmtree('build', ignore_errors=True) @@ -42,6 +41,8 @@ def install(omp=False, mpi=False, phdf5=False, dagmc=False, libmesh=False, ncrys if ncrystal: cmake_cmd.append('-DOPENMC_USE_NCRYSTAL=ON') + ncrystal_path = os.environ.get('HOME') + '/NCRYSTAL' + cmake_cmd.append(f'-DCMAKE_PREFIX_PATH={ncrystal_path}') # Build in coverage mode for coverage testing cmake_cmd.append('-DOPENMC_ENABLE_COVERAGE=on') diff --git a/tools/ci/gha-install.sh b/tools/ci/gha-install.sh index 50f110ed4e6..f7c95ddff1c 100755 --- a/tools/ci/gha-install.sh +++ b/tools/ci/gha-install.sh @@ -16,9 +16,8 @@ fi # Install NCrystal if needed if [[ $NCRYSTAL = 'y' ]]; then - pip install 'ncrystal>=4.0.0' - #Basic quick verification: - nctool --test + chmod +x ./tools/ci/gha-install-ncrystal.sh + ./tools/ci/gha-install-ncrystal.sh fi # Install vectfit for WMP generation if needed diff --git a/tools/ci/gha-script.sh b/tools/ci/gha-script.sh index 4733907eb25..7d98e152456 100755 --- a/tools/ci/gha-script.sh +++ b/tools/ci/gha-script.sh @@ -14,9 +14,9 @@ if [[ $EVENT == 'y' ]]; then args="${args} --event " fi -# Check NCrystal installation +# Install NCrystal for testing if [[ $NCRYSTAL = 'y' ]]; then - nctool --test + pip install ncrystal fi # Run regression and unit tests