Skip to content

Commit

Permalink
Make sure find_package(NCrystal) also works with pip installed NCrystal
Browse files Browse the repository at this point in the history
  • Loading branch information
tkittel committed Jan 23, 2025
1 parent 9cee17f commit 77a48a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,15 @@ endmacro()
#===============================================================================

if(OPENMC_USE_NCRYSTAL)
find_package(NCrystal REQUIRED)
if( NOT DEFINED "NCrystal_DIR" )
#Invocation of "ncrystal-config --show cmakedir" is needed to find NCrystal
#even if it is installaed 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})")
endif()

Expand Down
5 changes: 2 additions & 3 deletions docs/source/usersguide/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,8 @@ Prerequisites
Adding this option allows the creation of materials from NCrystal, which
replaces the scattering kernel treatment of ACE files with a modular,
on-the-fly approach. To use it `install
<https://github.com/mctools/ncrystal/wiki/Get-NCrystal>`_ and `initialize
<https://github.com/mctools/ncrystal/wiki/Using-NCrystal#setting-up>`_
NCrystal and turn on the option in the CMake configuration step::
<https://github.com/mctools/ncrystal/wiki/Get-NCrystal>`_ NCrystal and
turn on the option in the CMake configuration step::

cmake -DOPENMC_USE_NCRYSTAL=on ..

Expand Down

0 comments on commit 77a48a2

Please sign in to comment.