Skip to content

Commit b69b417

Browse files
authored
Merge pull request #1855 from McStasMcXtrace/willend-NCRYSTALFLAGS
Implement support for @NCRYSTALFLAGS@ in mcrun etc
2 parents 8199009 + 48e1ae0 commit b69b417

File tree

10 files changed

+22
-7
lines changed

10 files changed

+22
-7
lines changed

buildscripts/build_debs_mcstas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ mv $DEB $WORK/dist/$DEBNAME
7272

7373
cd $WORK
7474

75-
cd 3rdparty/ncrystal
75+
cd 3rdparty/ncrystal/ncrystal_core
7676
rm -rf build
7777
mkdir build
7878
cd build

buildscripts/build_debs_mcstas32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ mv $DEB $WORK/dist/$DEBNAME
7272

7373
cd $WORK
7474

75-
cd 3rdparty/ncrystal
75+
cd 3rdparty/ncrystal/ncrystal_core
7676
rm -rf build
7777
mkdir build
7878
cd build

buildscripts/build_debs_mcstas_arm64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ mv $DEB $WORK/dist/$DEBNAME
7272

7373
cd $WORK
7474

75-
cd 3rdparty/ncrystal
75+
cd 3rdparty/ncrystal/ncrystal_core
7676
rm -rf build
7777
mkdir build
7878
cd build

cmake/Modules/PlatformDefaults.cmake

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,23 @@ function( detect_platform_variables resultvarname )
7272
endif()
7373
provide_var( EDITOR )
7474

75-
#idf-generator:
75+
#McStas/McXtrace switches:
76+
# - idf-generator
77+
# - NCrystal flags
7678
if ( BUILD_MCSTAS )
7779
set( IDFGEN mcdisplay-mantid )
80+
set( NCRYSTALFLAGS "CMD(ncrystal-config --show buildflags)" )
81+
82+
# Temporary solution for NCrystal on Windows 'MingW cross-compiled' systems
83+
if ( WINDOWS AND NOT MCCODE_BUILD_CONDA_PKG )
84+
set( NCRYSTALFLAGS "-Wl,-rpath,CMD(ncrystal-config --show libdir) -Wl,CMD(ncrystal-config --show libpath) -ICMD(ncrystal-config --show includedir)" )
85+
endif()
7886
else()
7987
set( IDFGEN "" )
88+
set( NCRYSTALFLAGS "")
8089
endif()
8190
provide_var( IDFGEN )
91+
provide_var( NCRYSTALFLAGS )
8292

8393
#HDF viewer
8494
if ( NOT HDFVIEW )

mcstas-comps/samples/NCrystal_sample.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
DEFINE COMPONENT NCrystal_sample
6868
SETTING PARAMETERS (string cfg="void", absorptionmode=1, multscat=1, xwidth=0, yheight=0, zdepth=0, radius=0 )
69-
DEPENDENCY "CMD(ncrystal-config --show buildflags)"
69+
DEPENDENCY "@NCRYSTALFLAGS@"
7070
NOACC /* Notice: you must remove this line if using the legacy McStas 2.x branch. */
7171

7272
SHARE

mcstas-comps/union/NCrystal_process.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
DEFINE COMPONENT NCrystal_process // Remember to change the name of process here
9696

9797
SETTING PARAMETERS(string cfg = "", packing_factor=1, interact_fraction=-1, string init="init")
98-
DEPENDENCY "CMD(ncrystal-config --show buildflags)"
98+
DEPENDENCY "@NCRYSTALFLAGS@"
9999

100100
SHARE
101101
%{

meta-pkgs/windows/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dependencies:
2626
- nexusformat
2727
- nexpy
2828
- hdf5
29+
- ncrystal
2930
- xraylib
3031
- jupytext
3132
- jupyterlab

tools/Python/mccodelib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ include(CPack)
9292

9393
set(WORK "${PROJECT_BINARY_DIR}/work")
9494

95-
set(entries_with_conda_prefix "CFLAGS;NEXUSFLAGS;MPIFLAGS;GSLFLAGS;XRLFLAGS;OACCFLAGS;TOOLS_CC;MPIRUN;MPICC")
95+
set(entries_with_conda_prefix "CFLAGS;NEXUSFLAGS;MPIFLAGS;NCRYSTALFLAGS;GSLFLAGS;XRLFLAGS;OACCFLAGS;TOOLS_CC;MPIRUN;MPICC")
9696
foreach( var ${entries_with_conda_prefix} )
9797
set( MCCODE_FINAL_${var} "${${var}}" )
9898
endforeach()

tools/Python/mccodelib/mccode_config.json.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"NEXUSFLAGS": "@MCCODE_FINAL_NEXUSFLAGS@",
2626
"MPIFLAGS": "@MCCODE_FINAL_MPIFLAGS@",
2727
"GSLFLAGS": "@MCCODE_FINAL_GSLFLAGS@",
28+
"NCRYSTALFLAGS": "@MCCODE_FINAL_NCRYSTALFLAGS@",
2829
"XRLFLAGS": "@MCCODE_FINAL_XRLFLAGS@",
2930
"OACCFLAGS": "@MCCODE_FINAL_OACCFLAGS@",
3031
"CC": "@MCCODE_FINAL_TOOLS_CC@",

tools/Python/mcrun/mccode.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ def x_path(file):
249249
# Insert NEXUSFLAGS if instrument/comps request this
250250
flags = re.sub(r'\@NEXUSFLAGS\@', mccode_config.compilation['NEXUSFLAGS'], flags)
251251

252+
# Insert NCRYSTALFLAGS if instrument/comps request this
253+
flags = re.sub(r'\@NCRYSTALFLAGS\@', mccode_config.compilation['NCRYSTALFLAGS'], flags)
254+
252255
# Insert GSLFLAGS if instrument/comps request this
253256
flags = re.sub(r'\@GSLFLAGS\@', mccode_config.compilation['GSLFLAGS'], flags)
254257

0 commit comments

Comments
 (0)