ncrystal-core 3.9.80__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ncrystal_core-3.9.80/CMakeLists.txt +823 -0
- ncrystal_core-3.9.80/LICENSE +206 -0
- ncrystal_core-3.9.80/PKG-INFO +512 -0
- ncrystal_core-3.9.80/README.md +293 -0
- ncrystal_core-3.9.80/app_config/main.c +497 -0
- ncrystal_core-3.9.80/cmake/NCrystalConfig.cmake.in +161 -0
- ncrystal_core-3.9.80/cmake/modules/ncrystal_coresrc.cmake +224 -0
- ncrystal_core-3.9.80/cmake/modules/ncrystal_legacyoptions.cmake +38 -0
- ncrystal_core-3.9.80/cmake/modules/ncrystal_ncapi.cmake +54 -0
- ncrystal_core-3.9.80/cmake/modules/ncrystal_nccfgapp.cmake +131 -0
- ncrystal_core-3.9.80/cmake/modules/ncrystal_options.cmake +52 -0
- ncrystal_core-3.9.80/cmake/modules/ncrystal_utils.cmake +95 -0
- ncrystal_core-3.9.80/cmake/template_ncconfig.h +45 -0
- ncrystal_core-3.9.80/cmake/template_pymod.py.in +108 -0
- ncrystal_core-3.9.80/include/NCrystal/NCPluginBoilerplate.hh +137 -0
- ncrystal_core-3.9.80/include/NCrystal/NCrystal.hh +119 -0
- ncrystal_core-3.9.80/include/NCrystal/cinterface/ncrystal.h +1321 -0
- ncrystal_core-3.9.80/include/NCrystal/core/NCDefs.hh +1490 -0
- ncrystal_core-3.9.80/include/NCrystal/core/NCException.hh +183 -0
- ncrystal_core-3.9.80/include/NCrystal/core/NCFmt.hh +213 -0
- ncrystal_core-3.9.80/include/NCrystal/core/NCImmutBuf.hh +341 -0
- ncrystal_core-3.9.80/include/NCrystal/core/NCMem.hh +529 -0
- ncrystal_core-3.9.80/include/NCrystal/core/NCSmallVector.hh +1033 -0
- ncrystal_core-3.9.80/include/NCrystal/core/NCTypes.hh +1026 -0
- ncrystal_core-3.9.80/include/NCrystal/core/NCVariant.hh +320 -0
- ncrystal_core-3.9.80/include/NCrystal/dump/NCDump.hh +55 -0
- ncrystal_core-3.9.80/include/NCrystal/factories/NCDataSources.hh +176 -0
- ncrystal_core-3.9.80/include/NCrystal/factories/NCFact.hh +74 -0
- ncrystal_core-3.9.80/include/NCrystal/factories/NCFactImpl.hh +243 -0
- ncrystal_core-3.9.80/include/NCrystal/factories/NCFactRequests.hh +315 -0
- ncrystal_core-3.9.80/include/NCrystal/factories/NCFactRequestsImpl.hh +170 -0
- ncrystal_core-3.9.80/include/NCrystal/factories/NCFactTypes.hh +234 -0
- ncrystal_core-3.9.80/include/NCrystal/factories/NCMatCfg.hh +451 -0
- ncrystal_core-3.9.80/include/NCrystal/interfaces/NCAtomData.hh +278 -0
- ncrystal_core-3.9.80/include/NCrystal/interfaces/NCInfo.hh +628 -0
- ncrystal_core-3.9.80/include/NCrystal/interfaces/NCInfoTypes.hh +380 -0
- ncrystal_core-3.9.80/include/NCrystal/interfaces/NCProc.hh +184 -0
- ncrystal_core-3.9.80/include/NCrystal/interfaces/NCProcImpl.hh +498 -0
- ncrystal_core-3.9.80/include/NCrystal/interfaces/NCRNG.hh +200 -0
- ncrystal_core-3.9.80/include/NCrystal/interfaces/NCSABData.hh +98 -0
- ncrystal_core-3.9.80/include/NCrystal/interfaces/NCSCOrientation.hh +151 -0
- ncrystal_core-3.9.80/include/NCrystal/interfaces/NCVersion.hh +64 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/absoov/NCAbsOOV.hh +63 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/atomdb/NCAtomDB.hh +58 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/atomdb/NCAtomDBExtender.hh +87 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/bkgdextcurve/NCBkgdExtCurve.hh +51 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/cfgutils/NCCfgManip.hh +481 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/cfgutils/NCCfgTypes.hh +775 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/cfgutils/NCCfgVars.hh +771 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/dyninfoutils/NCDynInfoUtils.hh +69 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/elincscatter/NCElIncScatter.hh +98 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/extd_utils/NCABIUtils.hh +137 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/extd_utils/NCFillHKL.hh +75 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/extd_utils/NCLCRefModels.hh +80 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/extd_utils/NCLCUtils.hh +284 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/extd_utils/NCOrientUtils.hh +49 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/extd_utils/NCPlaneProvider.hh +150 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/extd_utils/NCProcCompBldr.hh +65 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/extd_utils/NCSANSUtils.hh +168 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/fact_utils/NCFactoryJobs.hh +86 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/fact_utils/NCFactoryUtils.hh +327 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/freegas/NCFreeGas.hh +62 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/gasmix/NCGasMixUtils.hh +101 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/infobld/NCInfoBuilder.hh +121 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/lcbragg/NCLCBragg.hh +78 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_Basket.hh +172 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_BasketMgr.hh +359 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_BasketSrcFiller.hh +218 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_Defs.hh +63 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_Geom.hh +63 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_RunSim.hh +69 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_SimMgrMT.hh +273 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_Source.hh +71 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_StdEngine.hh +154 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_StdTallies.hh +203 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_Tally.hh +90 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/minimc/NCMMC_Utils.hh +61 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/ncmat/NCLoadNCMAT.hh +90 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/ncmat/NCNCMATData.hh +162 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/ncmat/NCParseNCMAT.hh +46 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/pcbragg/NCPCBragg.hh +88 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/phys_utils/NCDebyeMSD.hh +48 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/phys_utils/NCElIncXS.hh +135 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/phys_utils/NCEqRefl.hh +175 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/phys_utils/NCFreeGasUtils.hh +160 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/phys_utils/NCGaussMos.hh +217 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/phys_utils/NCGaussOnSphere.hh +215 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/phys_utils/NCIofQHelper.hh +108 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/phys_utils/NCKinUtils.hh +208 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCSABEval.hh +430 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCSABExtender.hh +79 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCSABFactory.hh +51 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCSABIntegrator.hh +74 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCSABSampler.hh +100 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCSABSamplerModels.hh +112 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCSABScatterHelper.hh +61 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCSABUCN.hh +191 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCSABUtils.hh +319 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCSABXSProvider.hh +54 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sab/NCScatKnlData.hh +108 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sabscatter/NCSABScatter.hh +79 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/sanshardsphere/NCSANSSphScat.hh +77 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/scbragg/NCSCBragg.hh +78 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCAtomUtils.hh +136 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCCFileUtils.hh +220 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCDynLoader.hh +88 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCFastConvolve.hh +62 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCFileUtils.hh +78 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCHists.hh +575 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCIter.hh +89 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCLatticeUtils.hh +104 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCMath.hh +696 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCMatrix.hh +242 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCMsg.hh +99 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCPointwiseDist.hh +79 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCRandUtils.hh +243 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCRomberg.hh +78 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCRotMatrix.hh +187 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCSpan.hh +154 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCSpline.hh +208 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCStrView.hh +489 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCString.hh +417 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/utils/NCVector.hh +268 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/vdos/NCVDOSEval.hh +138 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/vdos/NCVDOSGn.hh +160 -0
- ncrystal_core-3.9.80/include/NCrystal/internal/vdos/NCVDOSToScatKnl.hh +59 -0
- ncrystal_core-3.9.80/include/NCrystal/misc/NCCompositionUtils.hh +154 -0
- ncrystal_core-3.9.80/include/NCrystal/misc/NCMsgCtrl.hh +47 -0
- ncrystal_core-3.9.80/include/NCrystal/ncapi.h.in +218 -0
- ncrystal_core-3.9.80/include/NCrystal/ncrystal.h +26 -0
- ncrystal_core-3.9.80/include/NCrystal/plugins/NCPluginMgmt.hh +86 -0
- ncrystal_core-3.9.80/include/NCrystal/text/NCTextData.hh +361 -0
- ncrystal_core-3.9.80/include/NCrystal/threads/NCFactThreads.hh +82 -0
- ncrystal_core-3.9.80/pyproject.toml +59 -0
- ncrystal_core-3.9.80/skbld_autogen/_ncrystal_core/__init__.py +1 -0
- ncrystal_core-3.9.80/skbld_autogen/_ncrystal_core/info.py +108 -0
- ncrystal_core-3.9.80/skbld_autogen/autogen_ncmat_data.cc +95678 -0
- ncrystal_core-3.9.80/skbld_autogen/is_sdist.txt +0 -0
- ncrystal_core-3.9.80/src/absfact/NCStdAbsFact.cc +70 -0
- ncrystal_core-3.9.80/src/absfact/dep.txt +3 -0
- ncrystal_core-3.9.80/src/absoov/NCAbsOOV.cc +83 -0
- ncrystal_core-3.9.80/src/absoov/dep.txt +2 -0
- ncrystal_core-3.9.80/src/atomdb/NCAtomDB.cc +683 -0
- ncrystal_core-3.9.80/src/atomdb/NCAtomDBExtender.cc +225 -0
- ncrystal_core-3.9.80/src/atomdb/dep.txt +3 -0
- ncrystal_core-3.9.80/src/bkgdextcurve/NCBkgdExtCurve.cc +52 -0
- ncrystal_core-3.9.80/src/bkgdextcurve/dep.txt +2 -0
- ncrystal_core-3.9.80/src/cfgutils/NCCfgManip.cc +482 -0
- ncrystal_core-3.9.80/src/cfgutils/NCCfgTypes.cc +185 -0
- ncrystal_core-3.9.80/src/cfgutils/NCCfgVars.cc +396 -0
- ncrystal_core-3.9.80/src/cfgutils/dep.txt +2 -0
- ncrystal_core-3.9.80/src/cinterface/dep.txt +16 -0
- ncrystal_core-3.9.80/src/cinterface/ncrystal.cc +2352 -0
- ncrystal_core-3.9.80/src/core/NCDefs.cc +100 -0
- ncrystal_core-3.9.80/src/core/NCException.cc +68 -0
- ncrystal_core-3.9.80/src/core/NCFmt.cc +197 -0
- ncrystal_core-3.9.80/src/core/NCMem.cc +154 -0
- ncrystal_core-3.9.80/src/core/NCTypes.cc +112 -0
- ncrystal_core-3.9.80/src/core/dep.txt +1 -0
- ncrystal_core-3.9.80/src/dump/NCDump.cc +494 -0
- ncrystal_core-3.9.80/src/dump/dep.txt +5 -0
- ncrystal_core-3.9.80/src/dyninfoutils/NCDynInfoUtils.cc +282 -0
- ncrystal_core-3.9.80/src/dyninfoutils/dep.txt +5 -0
- ncrystal_core-3.9.80/src/elincscatter/NCElIncScatter.cc +260 -0
- ncrystal_core-3.9.80/src/elincscatter/dep.txt +4 -0
- ncrystal_core-3.9.80/src/extd_utils/NCFillHKL.cc +711 -0
- ncrystal_core-3.9.80/src/extd_utils/NCLCRefModels.cc +167 -0
- ncrystal_core-3.9.80/src/extd_utils/NCLCUtils.cc +772 -0
- ncrystal_core-3.9.80/src/extd_utils/NCOrientUtils.cc +42 -0
- ncrystal_core-3.9.80/src/extd_utils/NCPlaneProvider.cc +229 -0
- ncrystal_core-3.9.80/src/extd_utils/NCProcCompBldr.cc +135 -0
- ncrystal_core-3.9.80/src/extd_utils/NCSANSUtils.cc +170 -0
- ncrystal_core-3.9.80/src/extd_utils/dep.txt +6 -0
- ncrystal_core-3.9.80/src/fact_utils/NCFactoryJobs.cc +128 -0
- ncrystal_core-3.9.80/src/fact_utils/NCFactoryUtils.cc +59 -0
- ncrystal_core-3.9.80/src/fact_utils/dep.txt +3 -0
- ncrystal_core-3.9.80/src/factories/NCDataSources.cc +748 -0
- ncrystal_core-3.9.80/src/factories/NCFact.cc +77 -0
- ncrystal_core-3.9.80/src/factories/NCFactImpl.cc +998 -0
- ncrystal_core-3.9.80/src/factories/NCFactRequests.cc +229 -0
- ncrystal_core-3.9.80/src/factories/NCFactRequestsImpl.cc +208 -0
- ncrystal_core-3.9.80/src/factories/NCFactTypes.cc +72 -0
- ncrystal_core-3.9.80/src/factories/NCMatCfg.cc +1283 -0
- ncrystal_core-3.9.80/src/factories/NCTDProd.cc +205 -0
- ncrystal_core-3.9.80/src/factories/dep.txt +10 -0
- ncrystal_core-3.9.80/src/freegas/NCFreeGas.cc +90 -0
- ncrystal_core-3.9.80/src/freegas/dep.txt +3 -0
- ncrystal_core-3.9.80/src/gasmix/NCGasMixUtils.cc +652 -0
- ncrystal_core-3.9.80/src/gasmix/dep.txt +4 -0
- ncrystal_core-3.9.80/src/infobld/NCInfoBuilder.cc +1238 -0
- ncrystal_core-3.9.80/src/infobld/dep.txt +4 -0
- ncrystal_core-3.9.80/src/interfaces/NCAtomData.cc +329 -0
- ncrystal_core-3.9.80/src/interfaces/NCInfo.cc +343 -0
- ncrystal_core-3.9.80/src/interfaces/NCProc.cc +78 -0
- ncrystal_core-3.9.80/src/interfaces/NCProcImpl.cc +797 -0
- ncrystal_core-3.9.80/src/interfaces/NCRNG.cc +401 -0
- ncrystal_core-3.9.80/src/interfaces/NCSABData.cc +67 -0
- ncrystal_core-3.9.80/src/interfaces/NCSCOrientation.cc +83 -0
- ncrystal_core-3.9.80/src/interfaces/NCVersion.cc +44 -0
- ncrystal_core-3.9.80/src/interfaces/dep.txt +2 -0
- ncrystal_core-3.9.80/src/lazlau/NCLauLazyFact.cc +65 -0
- ncrystal_core-3.9.80/src/lazlau/NCLazy.cc +682 -0
- ncrystal_core-3.9.80/src/lazlau/NCLazy.hh +68 -0
- ncrystal_core-3.9.80/src/lazlau/dep.txt +6 -0
- ncrystal_core-3.9.80/src/lcbragg/NCLCBragg.cc +143 -0
- ncrystal_core-3.9.80/src/lcbragg/dep.txt +5 -0
- ncrystal_core-3.9.80/src/minimc/NCMMC_BasketSrcFiller.cc +68 -0
- ncrystal_core-3.9.80/src/minimc/NCMMC_Geom.cc +88 -0
- ncrystal_core-3.9.80/src/minimc/NCMMC_ParseCfg.hh +163 -0
- ncrystal_core-3.9.80/src/minimc/NCMMC_RunSim.cc +74 -0
- ncrystal_core-3.9.80/src/minimc/NCMMC_Source.cc +258 -0
- ncrystal_core-3.9.80/src/minimc/NCMMC_Sphere.hh +201 -0
- ncrystal_core-3.9.80/src/minimc/NCMMC_StdEngine.cc +228 -0
- ncrystal_core-3.9.80/src/minimc/NCMMC_Utils.cc +102 -0
- ncrystal_core-3.9.80/src/minimc/dep.txt +5 -0
- ncrystal_core-3.9.80/src/misc/NCCompositionUtils.cc +335 -0
- ncrystal_core-3.9.80/src/misc/NCMsgCtrl.cc +30 -0
- ncrystal_core-3.9.80/src/misc/dep.txt +3 -0
- ncrystal_core-3.9.80/src/ncmat/NCFactory_NCMAT.cc +53 -0
- ncrystal_core-3.9.80/src/ncmat/NCLoadNCMAT.cc +788 -0
- ncrystal_core-3.9.80/src/ncmat/NCNCMATData.cc +715 -0
- ncrystal_core-3.9.80/src/ncmat/NCParseNCMAT.cc +949 -0
- ncrystal_core-3.9.80/src/ncmat/dep.txt +13 -0
- ncrystal_core-3.9.80/src/pcbragg/NCPCBragg.cc +398 -0
- ncrystal_core-3.9.80/src/pcbragg/dep.txt +2 -0
- ncrystal_core-3.9.80/src/phys_utils/NCDebyeMSD.cc +99 -0
- ncrystal_core-3.9.80/src/phys_utils/NCElIncXS.cc +238 -0
- ncrystal_core-3.9.80/src/phys_utils/NCEqRefl.cc +150 -0
- ncrystal_core-3.9.80/src/phys_utils/NCFreeGasUtils.cc +931 -0
- ncrystal_core-3.9.80/src/phys_utils/NCGaussMos.cc +280 -0
- ncrystal_core-3.9.80/src/phys_utils/NCGaussOnSphere.cc +547 -0
- ncrystal_core-3.9.80/src/phys_utils/NCIofQHelper.cc +89 -0
- ncrystal_core-3.9.80/src/phys_utils/NCKinUtils.cc +57 -0
- ncrystal_core-3.9.80/src/phys_utils/dep.txt +2 -0
- ncrystal_core-3.9.80/src/plugins/NCPluginMgmt.cc +472 -0
- ncrystal_core-3.9.80/src/plugins/dep.txt +2 -0
- ncrystal_core-3.9.80/src/quickfact/NCGasMixFact.cc +133 -0
- ncrystal_core-3.9.80/src/quickfact/NCQuickFact.cc +306 -0
- ncrystal_core-3.9.80/src/quickfact/dep.txt +4 -0
- ncrystal_core-3.9.80/src/sab/NCSABEval.cc +680 -0
- ncrystal_core-3.9.80/src/sab/NCSABExtender.cc +50 -0
- ncrystal_core-3.9.80/src/sab/NCSABFactory.cc +141 -0
- ncrystal_core-3.9.80/src/sab/NCSABIntegrator.cc +545 -0
- ncrystal_core-3.9.80/src/sab/NCSABSampler.cc +231 -0
- ncrystal_core-3.9.80/src/sab/NCSABSamplerModels.cc +234 -0
- ncrystal_core-3.9.80/src/sab/NCSABUCN.cc +599 -0
- ncrystal_core-3.9.80/src/sab/NCSABUtils.cc +619 -0
- ncrystal_core-3.9.80/src/sab/NCSABXSProvider.cc +95 -0
- ncrystal_core-3.9.80/src/sab/NCScatKnlData.cc +93 -0
- ncrystal_core-3.9.80/src/sab/dep.txt +5 -0
- ncrystal_core-3.9.80/src/sabscatter/NCSABScatter.cc +102 -0
- ncrystal_core-3.9.80/src/sabscatter/dep.txt +5 -0
- ncrystal_core-3.9.80/src/sanshardsphere/NCSANSFact.cc +108 -0
- ncrystal_core-3.9.80/src/sanshardsphere/NCSANSSphScat.cc +259 -0
- ncrystal_core-3.9.80/src/sanshardsphere/dep.txt +4 -0
- ncrystal_core-3.9.80/src/scbragg/NCSCBragg.cc +350 -0
- ncrystal_core-3.9.80/src/scbragg/dep.txt +4 -0
- ncrystal_core-3.9.80/src/stdscatfactory/NCStdMPScatFact.cc +110 -0
- ncrystal_core-3.9.80/src/stdscatfactory/NCStdScatFact.cc +411 -0
- ncrystal_core-3.9.80/src/stdscatfactory/dep.txt +13 -0
- ncrystal_core-3.9.80/src/text/NCTextData.cc +188 -0
- ncrystal_core-3.9.80/src/text/dep.txt +2 -0
- ncrystal_core-3.9.80/src/threads/NCFactThreads.cc +120 -0
- ncrystal_core-3.9.80/src/threads/NCThreadPool.cc +156 -0
- ncrystal_core-3.9.80/src/threads/NCThreadPool.hh +64 -0
- ncrystal_core-3.9.80/src/threads/dep.txt +1 -0
- ncrystal_core-3.9.80/src/utils/NCAtomUtils.cc +397 -0
- ncrystal_core-3.9.80/src/utils/NCCFileUtils.cc +1625 -0
- ncrystal_core-3.9.80/src/utils/NCDynLoader.cc +209 -0
- ncrystal_core-3.9.80/src/utils/NCFastConvolve.cc +564 -0
- ncrystal_core-3.9.80/src/utils/NCFileUtils.cc +453 -0
- ncrystal_core-3.9.80/src/utils/NCFileUtilsWin.cc +263 -0
- ncrystal_core-3.9.80/src/utils/NCFileUtilsWin.hh +41 -0
- ncrystal_core-3.9.80/src/utils/NCHists.cc +105 -0
- ncrystal_core-3.9.80/src/utils/NCLatticeUtils.cc +477 -0
- ncrystal_core-3.9.80/src/utils/NCMath.cc +543 -0
- ncrystal_core-3.9.80/src/utils/NCMatrix.cc +129 -0
- ncrystal_core-3.9.80/src/utils/NCMsg.cc +82 -0
- ncrystal_core-3.9.80/src/utils/NCPointwiseDist.cc +152 -0
- ncrystal_core-3.9.80/src/utils/NCRandUtils.cc +566 -0
- ncrystal_core-3.9.80/src/utils/NCRomberg.cc +176 -0
- ncrystal_core-3.9.80/src/utils/NCRotMatrix.cc +134 -0
- ncrystal_core-3.9.80/src/utils/NCSpline.cc +224 -0
- ncrystal_core-3.9.80/src/utils/NCStrView.cc +207 -0
- ncrystal_core-3.9.80/src/utils/NCString.cc +524 -0
- ncrystal_core-3.9.80/src/utils/NCVector.cc +32 -0
- ncrystal_core-3.9.80/src/utils/dep.txt +1 -0
- ncrystal_core-3.9.80/src/vdos/NCVDOSEval.cc +702 -0
- ncrystal_core-3.9.80/src/vdos/NCVDOSGn.cc +492 -0
- ncrystal_core-3.9.80/src/vdos/NCVDOSToScatKnl.cc +942 -0
- ncrystal_core-3.9.80/src/vdos/dep.txt +6 -0
|
@@ -0,0 +1,823 @@
|
|
|
1
|
+
################################################################################
|
|
2
|
+
## ##
|
|
3
|
+
## This file is part of NCrystal (see https://mctools.github.io/ncrystal/) ##
|
|
4
|
+
## ##
|
|
5
|
+
## Copyright 2015-2024 NCrystal developers ##
|
|
6
|
+
## ##
|
|
7
|
+
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
|
8
|
+
## you may not use this file except in compliance with the License. ##
|
|
9
|
+
## You may obtain a copy of the License at ##
|
|
10
|
+
## ##
|
|
11
|
+
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
|
12
|
+
## ##
|
|
13
|
+
## Unless required by applicable law or agreed to in writing, software ##
|
|
14
|
+
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
|
15
|
+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
|
16
|
+
## See the License for the specific language governing permissions and ##
|
|
17
|
+
## limitations under the License. ##
|
|
18
|
+
## ##
|
|
19
|
+
################################################################################
|
|
20
|
+
|
|
21
|
+
cmake_minimum_required(VERSION 3.16...3.27)
|
|
22
|
+
|
|
23
|
+
# Respect value of CMAKE_BUILD_TYPE if already defined, otherwise fall back to
|
|
24
|
+
# Release. In any case, expose CMAKE_BUILD_TYPE as an explicit cache variable
|
|
25
|
+
# (gives drop-down list in gui). This must come before the call to
|
|
26
|
+
# project(..). We do not do this in case the generator is multi-cfg, and we also
|
|
27
|
+
# provide the hidden NCRYSTAL_NOTOUCH_CMAKE_BUILD_TYPE option to not do it.
|
|
28
|
+
#
|
|
29
|
+
if ( DEFINED SKBUILD_PROJECT_NAME )
|
|
30
|
+
set( NCRYSTAL_NOTOUCH_CMAKE_BUILD_TYPE "OFF" )
|
|
31
|
+
set( nccore_pymodname "_ncrystal_core" )
|
|
32
|
+
if ( NCRYSTAL_SKBUILD_MONOLITHIC )
|
|
33
|
+
set( nccore_pymodname "_ncrystal_core_monolithic" )
|
|
34
|
+
endif()
|
|
35
|
+
else()
|
|
36
|
+
set ( NCRYSTAL_SKBUILD_MONOLITHIC "OFF" )
|
|
37
|
+
endif()
|
|
38
|
+
|
|
39
|
+
if( NOT NCRYSTAL_NOTOUCH_CMAKE_BUILD_TYPE )
|
|
40
|
+
get_property( gen_is_multicfg GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG )
|
|
41
|
+
if ( NOT gen_is_multicfg )
|
|
42
|
+
if( DEFINED CMAKE_BUILD_TYPE )
|
|
43
|
+
set( _def_cbt ${CMAKE_BUILD_TYPE} )
|
|
44
|
+
else()
|
|
45
|
+
set( _def_cbt Release )
|
|
46
|
+
endif()
|
|
47
|
+
set( CMAKE_BUILD_TYPE ${_def_cbt} CACHE STRING
|
|
48
|
+
"Choose the type of build, options are: Debug Release RelWithDebInfo and MinSizeRel." )
|
|
49
|
+
set_property( CACHE CMAKE_BUILD_TYPE
|
|
50
|
+
PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel None )
|
|
51
|
+
endif()
|
|
52
|
+
endif()
|
|
53
|
+
|
|
54
|
+
#Setup project:
|
|
55
|
+
|
|
56
|
+
set( _project_metadata LANGUAGES CXX C )
|
|
57
|
+
|
|
58
|
+
list( APPEND
|
|
59
|
+
_project_metadata DESCRIPTION
|
|
60
|
+
"Library for thermal neutron transport in crystals and other materials" )
|
|
61
|
+
list( APPEND
|
|
62
|
+
_project_metadata HOMEPAGE_URL
|
|
63
|
+
"https://github.com/mctools/ncrystal" )
|
|
64
|
+
|
|
65
|
+
project( NCrystal VERSION 3.9.80 ${_project_metadata} )
|
|
66
|
+
|
|
67
|
+
unset( _project_metadata )
|
|
68
|
+
|
|
69
|
+
if( NOT NCRYSTAL_NOTOUCH_CMAKE_BUILD_TYPE )
|
|
70
|
+
if ( NOT gen_is_multicfg )
|
|
71
|
+
if ( NOT CMAKE_BUILD_TYPE )
|
|
72
|
+
#This can happen if parent project called the project(..) function before
|
|
73
|
+
#doing the song and dance we did above.
|
|
74
|
+
set(CMAKE_BUILD_TYPE Release)
|
|
75
|
+
endif()
|
|
76
|
+
endif()
|
|
77
|
+
endif()
|
|
78
|
+
|
|
79
|
+
# Set module path
|
|
80
|
+
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")
|
|
81
|
+
|
|
82
|
+
#Define options:
|
|
83
|
+
include(ncrystal_options)
|
|
84
|
+
|
|
85
|
+
function( _ncrystal_option_force varname value )
|
|
86
|
+
message( STATUS "Forcing ${varname}=\"${value}\"" )
|
|
87
|
+
set( "${varname}" "${value}" PARENT_SCOPE )
|
|
88
|
+
endfunction()
|
|
89
|
+
|
|
90
|
+
if ( DEFINED SKBUILD_PROJECT_NAME )
|
|
91
|
+
message( STATUS "scikit-build mode detected. Overriding various settings" )
|
|
92
|
+
_ncrystal_option_force( NCRYSTAL_ENABLE_EXAMPLES "OFF" )
|
|
93
|
+
_ncrystal_option_force( NCRYSTAL_ENABLE_DYNLOAD "ON" )
|
|
94
|
+
_ncrystal_option_force( NCRYSTAL_MODIFY_RPATH "OFF" )
|
|
95
|
+
_ncrystal_option_force( NCRYSTAL_ENABLE_DATA "EMBED" )
|
|
96
|
+
_ncrystal_option_force( NCRYSTAL_ENABLE_GEANT4 "OFF" )
|
|
97
|
+
_ncrystal_option_force( NCRYSTAL_ENABLE_THREADS "ON" )
|
|
98
|
+
_ncrystal_option_force( NCRYSTAL_ENABLE_TESTING "OFF" )
|
|
99
|
+
_ncrystal_option_force( CMAKE_INSTALL_LIBDIR "${nccore_pymodname}/data/lib" )
|
|
100
|
+
_ncrystal_option_force( CMAKE_INSTALL_INCLUDEDIR "${nccore_pymodname}/data/include" )
|
|
101
|
+
_ncrystal_option_force( CMAKE_INSTALL_DATADIR "${nccore_pymodname}/data/data" )
|
|
102
|
+
_ncrystal_option_force( CMAKE_INSTALL_BINDIR "${nccore_pymodname}/data/bin" )
|
|
103
|
+
set ( ncrystal_skbld_autogendir "${PROJECT_SOURCE_DIR}/skbld_autogen" )
|
|
104
|
+
|
|
105
|
+
#Cleanup skbld_autogendir unless we are building FROM an sdist (or creating
|
|
106
|
+
#one):
|
|
107
|
+
if ( EXISTS "${ncrystal_skbld_autogendir}/is_sdist.txt"
|
|
108
|
+
AND NOT "${SKBUILD_STATE}" STREQUAL "sdist" )
|
|
109
|
+
message(STATUS "Running from sdist - will not clean autogenerated files")
|
|
110
|
+
else()
|
|
111
|
+
if ( IS_DIRECTORY "${ncrystal_skbld_autogendir}" )
|
|
112
|
+
message( STATUS "Cleaning out ${ncrystal_skbld_autogendir}" )
|
|
113
|
+
file( REMOVE_RECURSE "${ncrystal_skbld_autogendir}" )
|
|
114
|
+
endif()
|
|
115
|
+
file( MAKE_DIRECTORY "${ncrystal_skbld_autogendir}" )
|
|
116
|
+
if ( "${SKBUILD_STATE}" STREQUAL "sdist" )
|
|
117
|
+
file(TOUCH "${ncrystal_skbld_autogendir}/is_sdist.txt")
|
|
118
|
+
endif()
|
|
119
|
+
endif()
|
|
120
|
+
endif()
|
|
121
|
+
|
|
122
|
+
if ( NCRYSTAL_ENABLE_TESTING )
|
|
123
|
+
#When testing we require a namespace of "test" which is intended to ensure
|
|
124
|
+
#that we never clash with a system-installed NCrystal version (for instance we
|
|
125
|
+
#had problems when a ctest executable picked up libNCrystal.so from the conda
|
|
126
|
+
#installed NCrystal, resulting in hard to debug errors).
|
|
127
|
+
#
|
|
128
|
+
#Additionally on windows we need to use NCRYSTAL_WINEXPORTALL=ON so the ctest
|
|
129
|
+
#binaries can access internal symbols in the NCrystal library.
|
|
130
|
+
#
|
|
131
|
+
#For both of these reasons we will for safety forbid actual installations with
|
|
132
|
+
#these settings, to avoid potential weird installations.
|
|
133
|
+
if( "${CMAKE_VERSION}" VERSION_LESS "3.28" )
|
|
134
|
+
#NB: Keep this minimum version value synchronised with the one on the top of
|
|
135
|
+
#tests/CMakeLists.txt
|
|
136
|
+
message( FATAL_ERROR "NCRYSTAL_ENABLE_TESTING requires cmake >= 3.28" )
|
|
137
|
+
endif()
|
|
138
|
+
if ( NOT NCRYSTAL_SKIP_INSTALL )
|
|
139
|
+
message(
|
|
140
|
+
WARNING
|
|
141
|
+
"NCRYSTAL_ENABLE_TESTING implies NCRYSTAL_SKIP_INSTALL=ON for safety"
|
|
142
|
+
)
|
|
143
|
+
_ncrystal_option_force( NCRYSTAL_SKIP_INSTALL "ON" )
|
|
144
|
+
endif()
|
|
145
|
+
if ( WIN32 AND NOT NCRYSTAL_WINEXPORTALL )
|
|
146
|
+
message(
|
|
147
|
+
WARNING
|
|
148
|
+
"NCRYSTAL_ENABLE_TESTING implies NCRYSTAL_WINEXPORTALL=ON in Windows"
|
|
149
|
+
)
|
|
150
|
+
_ncrystal_option_force( NCRYSTAL_WINEXPORTALL "ON" )
|
|
151
|
+
endif()
|
|
152
|
+
if ( NCRYSTAL_NAMESPACE AND NOT "x${NCRYSTAL_NAMESPACE}" STREQUAL "xtest" )
|
|
153
|
+
message(
|
|
154
|
+
FATAL_ERROR
|
|
155
|
+
"Do not set NCRYSTAL_NAMESPACE with NCRYSTAL_ENABLE_TESTING."
|
|
156
|
+
)
|
|
157
|
+
endif()
|
|
158
|
+
_ncrystal_option_force( NCRYSTAL_NAMESPACE "test" )
|
|
159
|
+
else()
|
|
160
|
+
#Make sure the namespace "test" is only ever used by the
|
|
161
|
+
#NCRYSTAL_ENABLE_TESTING option (so no installation out there can have that
|
|
162
|
+
#namespace).
|
|
163
|
+
if ( "x${NCRYSTAL_NAMESPACE}" STREQUAL "xtest" )
|
|
164
|
+
message(
|
|
165
|
+
FATAL_ERROR
|
|
166
|
+
"The NCRYSTAL_NAMESPACE value \"test\" is reserved for internal usage."
|
|
167
|
+
)
|
|
168
|
+
endif()
|
|
169
|
+
endif()
|
|
170
|
+
|
|
171
|
+
function( ncinstall )
|
|
172
|
+
if ( NOT NCRYSTAL_SKIP_INSTALL )
|
|
173
|
+
install( ${ARGN} )
|
|
174
|
+
endif()
|
|
175
|
+
endfunction()
|
|
176
|
+
|
|
177
|
+
if ( NCRYSTAL_ENABLE_CPACK )
|
|
178
|
+
set(CPACK_PACKAGE_CONTACT "ncrystal-developers@cern.ch")
|
|
179
|
+
set(CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME} ${PROJECT_VERSION}")
|
|
180
|
+
set(CPACK_NSIS_DISPLAY_NAME "${PROJECT_NAME} ${PROJECT_VERSION}")
|
|
181
|
+
include(CPack)
|
|
182
|
+
endif()
|
|
183
|
+
|
|
184
|
+
if ( NCRYSTAL_NAMESPACE )
|
|
185
|
+
string( MAKE_C_IDENTIFIER "${NCRYSTAL_NAMESPACE}" tmp)
|
|
186
|
+
string( TOLOWER "${tmp}" tmp)
|
|
187
|
+
if ( NOT "x${NCRYSTAL_NAMESPACE}" STREQUAL "x${tmp}" )
|
|
188
|
+
message(
|
|
189
|
+
FATAL_ERROR
|
|
190
|
+
"The NCRYSTAL_NAMESPACE must be a lowercased valid C identifier"
|
|
191
|
+
"(meaning: alphanumeric, not leading with digit, lowercased)."
|
|
192
|
+
)
|
|
193
|
+
endif()
|
|
194
|
+
else()
|
|
195
|
+
if ( NOT "x${NCRYSTAL_NAMESPACE}" STREQUAL "x" )
|
|
196
|
+
message(
|
|
197
|
+
FATAL_ERROR
|
|
198
|
+
"Do not set NCRYSTAL_NAMESPACE to a value which CMake interprets "
|
|
199
|
+
"as \"false\". To disable, instead set it to an empty string."
|
|
200
|
+
)
|
|
201
|
+
endif()
|
|
202
|
+
endif()
|
|
203
|
+
if ( DEFINED NCRYSTAL_SKBUILD_MONOLITHIC )
|
|
204
|
+
#Add a namespace for safety
|
|
205
|
+
set( NCRYSTAL_NAMESPACE "mono${NCRYSTAL_NAMESPACE}" )
|
|
206
|
+
endif()
|
|
207
|
+
|
|
208
|
+
#Installation directories (try to follow standard conventions):
|
|
209
|
+
include(GNUInstallDirs)
|
|
210
|
+
set(NCrystal_BINDIR "${CMAKE_INSTALL_BINDIR}")#e.g. <prefix>/bin>
|
|
211
|
+
set(NCrystal_LIBDIR "${CMAKE_INSTALL_LIBDIR}")#e.g. <prefix>/lib>
|
|
212
|
+
|
|
213
|
+
function( ncfind_relinstpath resultvar srcdir tgtdir )
|
|
214
|
+
if ( NOT srcdir OR NOT IS_ABSOLUTE "${srcdir}" )
|
|
215
|
+
set( srcdir "${CMAKE_INSTALL_PREFIX}/${srcdir}" )
|
|
216
|
+
endif()
|
|
217
|
+
if ( NOT tgtdir OR NOT IS_ABSOLUTE "${tgtdir}" )
|
|
218
|
+
set( tgtdir "${CMAKE_INSTALL_PREFIX}/${tgtdir}" )
|
|
219
|
+
endif()
|
|
220
|
+
file(RELATIVE_PATH res "${srcdir}" "${tgtdir}")
|
|
221
|
+
set( "${resultvar}" "${res}" PARENT_SCOPE )
|
|
222
|
+
endfunction()
|
|
223
|
+
|
|
224
|
+
set(ncrystal_skbuild_shlib_in_wheel_scripts "OFF")
|
|
225
|
+
if ( WIN32 )
|
|
226
|
+
#dll's must be in %PATH% so we put them in bin (same as seems to be the way
|
|
227
|
+
#most packages do it on conda-forge).
|
|
228
|
+
set(NCrystal_SHLIBDIR "${NCrystal_BINDIR}")
|
|
229
|
+
if ( DEFINED SKBUILD_PROJECT_NAME )
|
|
230
|
+
#For wheels we will place the NCrystal.dll into the scripts folder, since
|
|
231
|
+
#that seems to be the only way to get the dll onto the PATH.
|
|
232
|
+
set(NCrystal_SHLIBDIR "${SKBUILD_SCRIPTS_DIR}")
|
|
233
|
+
set(ncrystal_skbuild_shlib_in_wheel_scripts "ON")
|
|
234
|
+
endif()
|
|
235
|
+
else()
|
|
236
|
+
#sane standard world
|
|
237
|
+
set(NCrystal_SHLIBDIR "${NCrystal_LIBDIR}")
|
|
238
|
+
endif()
|
|
239
|
+
|
|
240
|
+
set(NCrystal_INCDIR "${CMAKE_INSTALL_INCLUDEDIR}")#e.g. <prefix>/include>
|
|
241
|
+
set(NCrystal_DATAROOT "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")#e.g. <prefix>/share/NCrystal>
|
|
242
|
+
if( NOT NCrystal_DATAFILESDIR )
|
|
243
|
+
set( NCrystal_DATAFILESDIR "${NCrystal_DATAROOT}/data")#e.g. <prefix>/share/NCrystal/data>
|
|
244
|
+
endif()
|
|
245
|
+
if ( NOT NCrystal_CMAKEDIR )
|
|
246
|
+
set(NCrystal_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")#e.g. <prefix>/lib/cmake/NCrystal>
|
|
247
|
+
endif()
|
|
248
|
+
|
|
249
|
+
#Get a few relative paths, mostly for expansion in various installed files (we
|
|
250
|
+
#use PROJECT_BINARY_DIR as prefix here, but it should not matter which as long
|
|
251
|
+
#as it is an absolute path):
|
|
252
|
+
|
|
253
|
+
ncfind_relinstpath( NCrystal_relpath_BINDIR2LIBDIR "${NCrystal_BINDIR}" "${NCrystal_LIBDIR}" )
|
|
254
|
+
ncfind_relinstpath( NCrystal_relpath_BINDIR2SHLIBDIR "${NCrystal_BINDIR}" "${NCrystal_SHLIBDIR}" )
|
|
255
|
+
#file(RELATIVE_PATH NCrystal_relpath_BINDIR2LIBDIR "${PROJECT_BINARY_DIR}/${NCrystal_BINDIR}" "${PROJECT_BINARY_DIR}/${NCrystal_LIBDIR}")
|
|
256
|
+
#file(RELATIVE_PATH NCrystal_relpath_BINDIR2SHLIBDIR "${PROJECT_BINARY_DIR}/${NCrystal_BINDIR}" "${PROJECT_BINARY_DIR}/${NCrystal_SHLIBDIR}")
|
|
257
|
+
if ( NCRYSTAL_ENABLE_DATA STREQUAL "ON" )
|
|
258
|
+
ncfind_relinstpath( NCrystal_relpath_BINDIR2DATADIR "${NCrystal_BINDIR}" "${NCrystal_DATAROOT}/data" )
|
|
259
|
+
#file(RELATIVE_PATH NCrystal_relpath_BINDIR2DATADIR "${PROJECT_BINARY_DIR}/${NCrystal_BINDIR}" "${PROJECT_BINARY_DIR}/${NCrystal_DATAROOT}/data")
|
|
260
|
+
else()
|
|
261
|
+
set(NCrystal_relpath_BINDIR2DATADIR "")
|
|
262
|
+
endif()
|
|
263
|
+
ncfind_relinstpath( NCrystal_relpath_BINDIR2CMAKEDIR "${NCrystal_BINDIR}" "${NCrystal_CMAKEDIR}" )
|
|
264
|
+
ncfind_relinstpath( NCrystal_relpath_BINDIR2INCDIR "${NCrystal_BINDIR}" "${NCrystal_INCDIR}" )
|
|
265
|
+
#file(RELATIVE_PATH NCrystal_relpath_BINDIR2CMAKEDIR "${PROJECT_BINARY_DIR}/${NCrystal_BINDIR}" "${PROJECT_BINARY_DIR}/${NCrystal_CMAKEDIR}")
|
|
266
|
+
#file(RELATIVE_PATH NCrystal_relpath_BINDIR2INCDIR "${PROJECT_BINARY_DIR}/${NCrystal_BINDIR}" "${PROJECT_BINARY_DIR}/${NCrystal_INCDIR}")
|
|
267
|
+
#REMOVED file(RELATIVE_PATH NCrystal_relpath_BINDIR2ROOT "${PROJECT_BINARY_DIR}/${NCrystal_BINDIR}" "${PROJECT_BINARY_DIR}/")
|
|
268
|
+
ncfind_relinstpath( NCrystal_relpath_BINDIR2CMAKEDIR "${NCrystal_BINDIR}" "${NCrystal_CMAKEDIR}" )
|
|
269
|
+
ncfind_relinstpath( NCrystal_relpath_BINDIR2INCDIR "${NCrystal_BINDIR}" "${NCrystal_INCDIR}" )
|
|
270
|
+
ncfind_relinstpath( NCrystal_relpath_CMAKEDIR2ROOT "${NCrystal_CMAKEDIR}" "" )
|
|
271
|
+
ncfind_relinstpath( NCrystal_relpath_CMAKEDIR2BINDIR "${NCrystal_BINDIR}" "" )
|
|
272
|
+
ncfind_relinstpath( NCrystal_relpath_CMAKEDIR2LIBDIR "${NCrystal_LIBDIR}" "" )
|
|
273
|
+
ncfind_relinstpath( NCrystal_relpath_CMAKEDIR2INCDIR "${NCrystal_INCDIR}" "" )
|
|
274
|
+
ncfind_relinstpath( NCrystal_relpath_CMAKEDIR2DATAFILESDIR "${NCrystal_DATAFILESDIR}" "" )
|
|
275
|
+
#file(RELATIVE_PATH NCrystal_relpath_CMAKEDIR2ROOT "${PROJECT_BINARY_DIR}/${NCrystal_CMAKEDIR}" "${PROJECT_BINARY_DIR}/")
|
|
276
|
+
#file(RELATIVE_PATH NCrystal_relpath_CMAKEDIR2BINDIR "${PROJECT_BINARY_DIR}/${NCrystal_CMAKEDIR}" "${PROJECT_BINARY_DIR}/${NCrystal_BINDIR}")
|
|
277
|
+
#file(RELATIVE_PATH NCrystal_relpath_CMAKEDIR2LIBDIR "${PROJECT_BINARY_DIR}/${NCrystal_CMAKEDIR}" "${PROJECT_BINARY_DIR}/${NCrystal_LIBDIR}")
|
|
278
|
+
#file(RELATIVE_PATH NCrystal_relpath_CMAKEDIR2INCDIR "${PROJECT_BINARY_DIR}/${NCrystal_CMAKEDIR}" "${PROJECT_BINARY_DIR}/${NCrystal_INCDIR}")
|
|
279
|
+
#file(RELATIVE_PATH NCrystal_relpath_CMAKEDIR2DATAFILESDIR "${PROJECT_BINARY_DIR}/${NCrystal_CMAKEDIR}" "${PROJECT_BINARY_DIR}/${NCrystal_DATAFILESDIR}")
|
|
280
|
+
|
|
281
|
+
#Dummy interface target for common properties. Note that the interface is always
|
|
282
|
+
#built with C++11 compatible compiler (which CMake will choose from a wide
|
|
283
|
+
#variety depending on platform and other targets,
|
|
284
|
+
#i.e. C++11/C++14/C++17/gnu++11/...). The NCRYSTAL_BUILD_STRICT option only affects
|
|
285
|
+
#private non-transitive properties.
|
|
286
|
+
add_library( ncrystal_common INTERFACE )
|
|
287
|
+
target_compile_features( ncrystal_common INTERFACE cxx_std_11 )
|
|
288
|
+
|
|
289
|
+
#Properties for executables and G4NCrystal library (can't transfer all
|
|
290
|
+
#properties via INTERFACE targets, so we need this variable-based workaround):
|
|
291
|
+
set( _nc_executable_rpath "")
|
|
292
|
+
set( _nc_libncg4_rpath "")
|
|
293
|
+
|
|
294
|
+
if ( NCRYSTAL_MODIFY_RPATH )
|
|
295
|
+
#Set RPATH properties. For some annoying reason, this is not possible to do
|
|
296
|
+
#via interface targets, so we have to use a variable-based workaround:
|
|
297
|
+
|
|
298
|
+
if ( NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH )
|
|
299
|
+
#TODO: Figure out if we really need this (perhaps only for geant4 targets?)
|
|
300
|
+
set( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
|
|
301
|
+
endif()
|
|
302
|
+
if( NOT APPLE )
|
|
303
|
+
#Relocatable RPATHS: $ORIGIN in RPATH (including the $-char!!) means the
|
|
304
|
+
#location of the binary requiring the dependency:
|
|
305
|
+
list( APPEND _nc_executable_rpath "$ORIGIN/${NCrystal_relpath_BINDIR2LIBDIR}" )
|
|
306
|
+
list( APPEND _nc_libncg4_rpath $ORIGIN )
|
|
307
|
+
else()
|
|
308
|
+
#On OSX, rpaths are absolute paths:
|
|
309
|
+
get_filename_component( tmp "${CMAKE_INSTALL_PREFIX}/${NCrystal_LIBDIR}" ABSOLUTE)
|
|
310
|
+
list( APPEND _nc_executable_rpath "${tmp}" )
|
|
311
|
+
list( APPEND _nc_libncg4_rpath "${tmp}" )
|
|
312
|
+
endif()
|
|
313
|
+
|
|
314
|
+
if ( DEFINED ENV{CONDA_PREFIX} AND EXISTS "$ENV{CONDA_PREFIX}/lib" )
|
|
315
|
+
#In a conda environment we add $CONDA_PREFIX/lib to the rpath:
|
|
316
|
+
list( APPEND _nc_executable_rpath "$ENV{CONDA_PREFIX}/lib" )
|
|
317
|
+
list( APPEND _nc_libncg4_rpath "$ENV{CONDA_PREFIX}/lib" )
|
|
318
|
+
endif()
|
|
319
|
+
|
|
320
|
+
#Test if compiler supports -Wl,--disable-new-dtags. If it does, apply it
|
|
321
|
+
#(otherwise RPATH sections in binaries become RUNPATH instead, which can be
|
|
322
|
+
#overridden by users LD_LIBRARY_PATH (CMake>=3.14 is needed for LINK_OPTIONS on
|
|
323
|
+
#try_compile and for the target_link_options function):
|
|
324
|
+
#
|
|
325
|
+
#NB: CMake 3.18 introduces CheckLinkerFlag module which we can eventually use
|
|
326
|
+
# instead of try_compile!!
|
|
327
|
+
if( NOT MSVC )
|
|
328
|
+
set(TMP_TESTDIR ${PROJECT_BINARY_DIR}/test_dtagflags)
|
|
329
|
+
file(WRITE ${TMP_TESTDIR}/test.c "int main() { return 0; }\n")
|
|
330
|
+
try_compile(LINKER_HAS_DTAGS "${TMP_TESTDIR}" "${TMP_TESTDIR}/test.c" LINK_OPTIONS -Wl,--disable-new-dtags)
|
|
331
|
+
if (LINKER_HAS_DTAGS)
|
|
332
|
+
#target_link_options(NCrystal PUBLIC "-Wl,--disable-new-dtags")
|
|
333
|
+
target_link_options( ncrystal_common INTERFACE -Wl,--disable-new-dtags )
|
|
334
|
+
endif()
|
|
335
|
+
endif()
|
|
336
|
+
|
|
337
|
+
endif()
|
|
338
|
+
|
|
339
|
+
# Look for input files. Apparently "file(GLOB ...)" is frowned upon by some
|
|
340
|
+
# people. However, the only provided alternative (hardcode all your filenames)
|
|
341
|
+
# is rather unappealing. We glob for files, but apply the CONFIGURE_DEPENDS
|
|
342
|
+
# keyword when it is supported.
|
|
343
|
+
|
|
344
|
+
function(file_globsrc output_var pattern)
|
|
345
|
+
file(GLOB tmp LIST_DIRECTORIES false CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/${pattern}" )
|
|
346
|
+
set(${output_var} "${tmp}" PARENT_SCOPE)
|
|
347
|
+
endfunction()
|
|
348
|
+
|
|
349
|
+
function(file_glob output_var pattern)
|
|
350
|
+
file(GLOB tmp LIST_DIRECTORIES false CONFIGURE_DEPENDS "${pattern}" )
|
|
351
|
+
set(${output_var} "${tmp}" PARENT_SCOPE)
|
|
352
|
+
endfunction()
|
|
353
|
+
|
|
354
|
+
function( get_datafile_list output_var )
|
|
355
|
+
set ( ddir "${PROJECT_SOURCE_DIR}/../data" )
|
|
356
|
+
if ( NOT EXISTS "${ddir}/Al_sg225.ncmat" )
|
|
357
|
+
message( FATAL_ERROR "Could not find data directory: ${ddir}" )
|
|
358
|
+
endif()
|
|
359
|
+
file(GLOB tmp LIST_DIRECTORIES false CONFIGURE_DEPENDS "${ddir}/*.ncmat" )
|
|
360
|
+
set( ${output_var} "${tmp}" PARENT_SCOPE )
|
|
361
|
+
endfunction()
|
|
362
|
+
file_globsrc( SRCS_NC "src/*.cc")
|
|
363
|
+
file_globsrc( HDRS_NCG4 "ncrystal_geant4/include/G4NCrystal/*.*")
|
|
364
|
+
file_globsrc( SRCS_NCG4 "ncrystal_geant4/src/*.cc")
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
include( "ncrystal_ncapi" )
|
|
368
|
+
nccfgapp_create_ncapi_h( ncapi_include_path )
|
|
369
|
+
|
|
370
|
+
# Detect available NCrystal components and how they depend on each other,
|
|
371
|
+
# placing results in "ncpkg_*" variables. It also installs core header files and
|
|
372
|
+
# sets up properties on the source files:
|
|
373
|
+
include( "ncrystal_coresrc" )
|
|
374
|
+
ncrystal_detectsrc()
|
|
375
|
+
ncrystal_process_core_srcfiles()
|
|
376
|
+
|
|
377
|
+
#We must additionally install a few special top-level include files:
|
|
378
|
+
|
|
379
|
+
ncinstall(
|
|
380
|
+
FILES
|
|
381
|
+
"${ncapi_include_path}/NCrystal/ncapi.h"
|
|
382
|
+
"${PROJECT_SOURCE_DIR}/include/NCrystal/ncrystal.h" #redirects to cinterface/ncrystal.h
|
|
383
|
+
"${PROJECT_SOURCE_DIR}/include/NCrystal/NCrystal.hh" #includes all public non-C headers
|
|
384
|
+
"${PROJECT_SOURCE_DIR}/include/NCrystal/NCPluginBoilerplate.hh"
|
|
385
|
+
DESTINATION
|
|
386
|
+
"${NCrystal_INCDIR}/NCrystal"
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
include(CheckCXXCompilerFlag)
|
|
390
|
+
|
|
391
|
+
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
392
|
+
set( NC_STRICT_COMP_FLAGS "/WX" "/W4" "/WD4324" )
|
|
393
|
+
else()
|
|
394
|
+
set( NC_STRICT_COMP_FLAGS -Wall -Wextra -pedantic -Werror )
|
|
395
|
+
endif()
|
|
396
|
+
|
|
397
|
+
if ( NCRYSTAL_BUILD_STRICT )
|
|
398
|
+
set( "CMAKE_COMPILE_WARNING_AS_ERROR" "ON" )
|
|
399
|
+
# turn list into space separted string for check_cxx_compiler_flag:
|
|
400
|
+
string( REPLACE ";" " " tmp "${NC_STRICT_COMP_FLAGS}" )
|
|
401
|
+
check_cxx_compiler_flag( "${tmp}" ncrystal_compiler_supports_strict_comp_flags )
|
|
402
|
+
endif()
|
|
403
|
+
|
|
404
|
+
set( STRICT_CPPSTD OFF )
|
|
405
|
+
set( STRICT_CSTD OFF )
|
|
406
|
+
if ( NCRYSTAL_BUILD_STRICT )
|
|
407
|
+
#We also want to test the C-example with strict C standard (90, 99, 11). For
|
|
408
|
+
#simplicity we simply pick a C standard value based on the provided c++
|
|
409
|
+
#standard, in a way which allows us to cover the various C standards.
|
|
410
|
+
if ( NCRYSTAL_BUILD_STRICT STREQUAL "11"
|
|
411
|
+
OR NCRYSTAL_BUILD_STRICT STREQUAL "ON" )
|
|
412
|
+
set( STRICT_CSTD 90 )
|
|
413
|
+
set( STRICT_CPPSTD 11 )
|
|
414
|
+
elseif ( NCRYSTAL_BUILD_STRICT STREQUAL "14" )
|
|
415
|
+
set( STRICT_CSTD 99 )
|
|
416
|
+
set( STRICT_CPPSTD 14 )
|
|
417
|
+
elseif ( NCRYSTAL_BUILD_STRICT STREQUAL "17" )
|
|
418
|
+
set( STRICT_CSTD 11 )
|
|
419
|
+
set( STRICT_CPPSTD 17 )
|
|
420
|
+
elseif ( NCRYSTAL_BUILD_STRICT STREQUAL "20" )
|
|
421
|
+
if( "${CMAKE_VERSION}" VERSION_LESS "3.21" )
|
|
422
|
+
message(FATAL_ERROR "NCRYSTAL_BUILD_STRICT=20 requires cmake 3.21")
|
|
423
|
+
endif()
|
|
424
|
+
set( STRICT_CSTD 17 )#needs cmake 3.21
|
|
425
|
+
set( STRICT_CPPSTD 20 )
|
|
426
|
+
elseif ( NCRYSTAL_BUILD_STRICT STREQUAL "23" )
|
|
427
|
+
if( "${CMAKE_VERSION}" VERSION_LESS "3.21" )
|
|
428
|
+
message(FATAL_ERROR "NCRYSTAL_BUILD_STRICT=23 requires cmake 3.21")
|
|
429
|
+
endif()
|
|
430
|
+
set( STRICT_CSTD 17 )#needs cmake 3.21
|
|
431
|
+
set( STRICT_CPPSTD 23 )#needs cmake 3.20
|
|
432
|
+
else()
|
|
433
|
+
#should have been caught earlier:
|
|
434
|
+
message( FATAL_ERROR "Unexpected value of NCRYSTAL_BUILD_STRICT" )
|
|
435
|
+
endif()
|
|
436
|
+
endif()
|
|
437
|
+
|
|
438
|
+
set( ncrystal_extra_private_compile_options "" )
|
|
439
|
+
if ( "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntelLLVM" )
|
|
440
|
+
#Intel defaults to the equivalent of -ffast-math, revert back to proper math:
|
|
441
|
+
set( ncrystal_extra_private_compile_options -fp-model=precise )
|
|
442
|
+
elseif( "${CMAKE_VERSION}" VERSION_LESS "3.20" AND "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang" )
|
|
443
|
+
#Older cmake had the llvm-based intel compiler classified as "Clang". In
|
|
444
|
+
#this case, we check whether or not the -fp-model=precise flag is supported
|
|
445
|
+
#or not:
|
|
446
|
+
check_cxx_compiler_flag( -fp-model=precise ncrystal_compiler_supports_fpmodelprecise )
|
|
447
|
+
if ( ncrystal_compiler_supports_fpmodelprecise )
|
|
448
|
+
set( ncrystal_extra_private_compile_options -fp-model=precise )
|
|
449
|
+
endif()
|
|
450
|
+
endif()
|
|
451
|
+
|
|
452
|
+
function(set_target_common_props targetname)
|
|
453
|
+
#Set private non-transitive properties. If strict builds are enabled, this can
|
|
454
|
+
#enforce no warnings and compilation with a specific standards.
|
|
455
|
+
if ( NCRYSTAL_BUILD_STRICT AND ncrystal_compiler_supports_strict_comp_flags )
|
|
456
|
+
target_compile_options( ${targetname} PRIVATE ${NC_STRICT_COMP_FLAGS} )
|
|
457
|
+
endif()
|
|
458
|
+
if ( STRICT_CPPSTD )
|
|
459
|
+
set_target_properties( ${targetname} PROPERTIES CXX_STANDARD ${STRICT_CPPSTD} CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
|
|
460
|
+
endif()
|
|
461
|
+
if ( STRICT_CSTD )
|
|
462
|
+
set_target_properties( ${targetname} PROPERTIES C_STANDARD ${STRICT_CSTD} C_STANDARD_REQUIRED ON C_EXTENSIONS OFF)
|
|
463
|
+
endif()
|
|
464
|
+
#Always disallow M_PI and friends in our own code (they are not portable):
|
|
465
|
+
target_compile_definitions( ${targetname} PRIVATE NCRYSTAL_NO_CMATH_CONSTANTS )
|
|
466
|
+
if ( ncrystal_extra_private_compile_options )
|
|
467
|
+
target_compile_options( ${targetname} PRIVATE ${ncrystal_extra_private_compile_options} )
|
|
468
|
+
endif()
|
|
469
|
+
endfunction()
|
|
470
|
+
|
|
471
|
+
#Can we use -fno-math-errno when building the NCrystal library?
|
|
472
|
+
check_cxx_compiler_flag( -fno-math-errno ncrystal_compiler_supports_nomatherrno_flag )
|
|
473
|
+
|
|
474
|
+
set( ncrystal_threads_lib OFF )
|
|
475
|
+
if ( NOT NCRYSTAL_ENABLE_THREADS STREQUAL "OFF" )
|
|
476
|
+
#set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
477
|
+
find_package(Threads)
|
|
478
|
+
if( Threads_FOUND )
|
|
479
|
+
set( ncrystal_threads_lib "Threads::Threads" )
|
|
480
|
+
else()
|
|
481
|
+
if ( NOT NCRYSTAL_ENABLE_THREADS STREQUAL "IFAVAILABLE" )
|
|
482
|
+
message( FATAL_ERROR "NCRYSTAL_ENABLE_THREADS set to ON but failed to enable thread support (set to IFAVAILABLE or OFF to proceed without it)." )
|
|
483
|
+
endif()
|
|
484
|
+
endif()
|
|
485
|
+
endif()
|
|
486
|
+
|
|
487
|
+
#NCrystal library and header files, including optional built-in modules if enabled:
|
|
488
|
+
add_library( NCrystal SHARED ${ncpkg_all_ncrystal_lib_srcfiles} )
|
|
489
|
+
|
|
490
|
+
#Make sure client code will use at least c++11:
|
|
491
|
+
target_compile_features( NCrystal INTERFACE cxx_std_11 )
|
|
492
|
+
|
|
493
|
+
if ( ncrystal_compiler_supports_nomatherrno_flag )
|
|
494
|
+
target_compile_options( NCrystal PRIVATE -fno-math-errno )
|
|
495
|
+
endif()
|
|
496
|
+
|
|
497
|
+
if ( ncrystal_threads_lib )
|
|
498
|
+
message( STATUS "Thread support will be enabled.")
|
|
499
|
+
set( _ncrystal_actual_enable_threads ON )
|
|
500
|
+
target_link_libraries( NCrystal PRIVATE ${ncrystal_threads_lib} )
|
|
501
|
+
else()
|
|
502
|
+
message( STATUS "Thread support will not be enabled.")
|
|
503
|
+
set( _ncrystal_actual_enable_threads OFF )
|
|
504
|
+
target_compile_definitions( NCrystal PRIVATE NCRYSTAL_DISABLE_THREADS )
|
|
505
|
+
endif()
|
|
506
|
+
|
|
507
|
+
#Libname:
|
|
508
|
+
set( _tmp_basiclibname "NCrystal" )
|
|
509
|
+
if ( NCRYSTAL_NAMESPACE )
|
|
510
|
+
set( _tmp_basiclibname "${_tmp_basiclibname}-${NCRYSTAL_NAMESPACE}" )
|
|
511
|
+
endif()
|
|
512
|
+
set_target_properties( NCrystal PROPERTIES OUTPUT_NAME "${_tmp_basiclibname}" )
|
|
513
|
+
|
|
514
|
+
#Export all symbols on windows if requested:
|
|
515
|
+
if ( WIN32 AND NCRYSTAL_WINEXPORTALL )
|
|
516
|
+
#We must export all symbols in libNCrystal.so, even those from internal
|
|
517
|
+
#headers - since we also use internal files in our tests and plugins. We use
|
|
518
|
+
#NCRYSTAL_PREVENT_WINDLLEXPORT to avoid explicitly exporting any symbols in
|
|
519
|
+
#this case, since that triggers spurious warnings from VisualStudio.
|
|
520
|
+
set_target_properties( NCrystal PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE )
|
|
521
|
+
target_compile_definitions( NCrystal PUBLIC NCRYSTAL_PREVENT_WINDLLEXPORT )
|
|
522
|
+
endif()
|
|
523
|
+
|
|
524
|
+
# Dynamic library loading:
|
|
525
|
+
|
|
526
|
+
# NCRYSTAL_ENABLE_DYNLOAD must be ON or OFF or IFAVAILABLE:
|
|
527
|
+
if ( NCRYSTAL_ENABLE_DYNLOAD STREQUAL "IFAVAILABLE" )
|
|
528
|
+
if ( UNIX )
|
|
529
|
+
set( _ncrystal_actual_disable_dynload OFF )
|
|
530
|
+
else()
|
|
531
|
+
set( _ncrystal_actual_disable_dynload ON )
|
|
532
|
+
endif()
|
|
533
|
+
else()
|
|
534
|
+
if ( NCRYSTAL_ENABLE_DYNLOAD STREQUAL ON )
|
|
535
|
+
set( _ncrystal_actual_disable_dynload OFF )
|
|
536
|
+
else()
|
|
537
|
+
set( _ncrystal_actual_disable_dynload ON )
|
|
538
|
+
endif()
|
|
539
|
+
endif()
|
|
540
|
+
|
|
541
|
+
if ( NOT _ncrystal_actual_disable_dynload AND CMAKE_DL_LIBS AND UNIX )
|
|
542
|
+
#Cf. https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1642 for why we
|
|
543
|
+
#only do this on UNIX.
|
|
544
|
+
target_link_libraries( NCrystal PRIVATE ${CMAKE_DL_LIBS} )
|
|
545
|
+
endif()
|
|
546
|
+
if ( _ncrystal_actual_disable_dynload )
|
|
547
|
+
target_compile_definitions( NCrystal PRIVATE NCRYSTAL_DISABLE_DYNLOADER )
|
|
548
|
+
endif()
|
|
549
|
+
|
|
550
|
+
set_target_common_props( NCrystal )
|
|
551
|
+
target_link_libraries( NCrystal PRIVATE ncrystal_common )
|
|
552
|
+
target_include_directories(
|
|
553
|
+
NCrystal
|
|
554
|
+
PRIVATE "${PROJECT_SOURCE_DIR}/src"
|
|
555
|
+
PUBLIC
|
|
556
|
+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
|
557
|
+
$<BUILD_INTERFACE:${ncapi_include_path}>
|
|
558
|
+
$<INSTALL_INTERFACE:${NCrystal_INCDIR}>
|
|
559
|
+
)
|
|
560
|
+
|
|
561
|
+
#Make sure we link in math functions correctly (typically the linker needs libm on unix, but nothing on Windows).
|
|
562
|
+
set(TMP_TESTLIBMSRC "#include <math.h>\nint main(int argc,char** argv) { (void)argv;double a=(exp)(argc+1.0); return (int)(a*0.1); }\n")
|
|
563
|
+
set(TMP_TESTDIR ${PROJECT_BINARY_DIR}/test_libm)
|
|
564
|
+
file(WRITE ${TMP_TESTDIR}/test.c "${TMP_TESTLIBMSRC}")
|
|
565
|
+
try_compile(ALWAYS_HAS_MATH "${TMP_TESTDIR}" "${TMP_TESTDIR}/test.c")
|
|
566
|
+
if (NOT ALWAYS_HAS_MATH)
|
|
567
|
+
set(TMP_TESTDIR ${PROJECT_BINARY_DIR}/test_libm2)
|
|
568
|
+
file(WRITE ${TMP_TESTDIR}/test.c "${TMP_TESTLIBMSRC}")
|
|
569
|
+
try_compile(MATH_NEEDS_LIBM "${TMP_TESTDIR}" "${TMP_TESTDIR}/test.c" LINK_LIBRARIES m)
|
|
570
|
+
if (MATH_NEEDS_LIBM)
|
|
571
|
+
target_link_libraries(NCrystal PRIVATE m)
|
|
572
|
+
else()
|
|
573
|
+
message( FATAL_ERROR "Could not figure out link flags needed to enable math functions" )
|
|
574
|
+
endif()
|
|
575
|
+
endif()
|
|
576
|
+
|
|
577
|
+
if ( NCRYSTAL_ENABLE_DATA STREQUAL "EMBED" )
|
|
578
|
+
#Embed data (needs to invoke python process to generate C++ code from .ncmat files)
|
|
579
|
+
|
|
580
|
+
target_compile_definitions(NCrystal PRIVATE NCRYSTAL_STDCMAKECFG_EMBED_DATA_ON)
|
|
581
|
+
|
|
582
|
+
set( ncmatcc_bn "autogen_ncmat_data.cc" )
|
|
583
|
+
set( ncmatcc_file "${PROJECT_BINARY_DIR}/${ncmatcc_bn}" )
|
|
584
|
+
set( ncmatcc_file_needs_update ON )
|
|
585
|
+
if ( DEFINED SKBUILD_PROJECT_NAME )
|
|
586
|
+
#Ensure the file gets packaged up in the sdist (that way we do not need data
|
|
587
|
+
#files and _ncmat2cpp_impl.py to be in subdirs of ncrystal_core).
|
|
588
|
+
set( ncmatcc_file "${ncrystal_skbld_autogendir}/${ncmatcc_bn}" )
|
|
589
|
+
if ( EXISTS ${ncmatcc_file} AND NOT "${SKBUILD_STATE}" STREQUAL "sdist" )
|
|
590
|
+
message( STATUS "Using pregenerated ${ncmatcc_bn} with embedded NCMAT data" )
|
|
591
|
+
set( ncmatcc_file_needs_update OFF )
|
|
592
|
+
#Note: This can in principle fail if the generated .cc file is older than
|
|
593
|
+
#the source files. However, checking for this is a bit complicated since
|
|
594
|
+
#the data files might be absent. In any case, we only ever set
|
|
595
|
+
#ncmatcc_file_needs_update to off in skbuild mode, so this is unlikely to
|
|
596
|
+
#come up.
|
|
597
|
+
else()
|
|
598
|
+
message(STATUS "created ${ncrystal_skbld_autogendir}" )
|
|
599
|
+
endif()
|
|
600
|
+
endif()
|
|
601
|
+
if ( ncmatcc_file_needs_update )
|
|
602
|
+
#We must find python3 interpreter.
|
|
603
|
+
message( STATUS "Looking for python interpreter (needed when NCRYSTAL_ENABLE_DATA=EMBED).")
|
|
604
|
+
find_package(Python3 3.8 REQUIRED COMPONENTS Interpreter)
|
|
605
|
+
#Generate C++ code from the .ncmat files:
|
|
606
|
+
get_datafile_list( data_file_list )
|
|
607
|
+
set( ncmat2cpppy "${PROJECT_SOURCE_DIR}/../ncrystal_python/NCrystal/_ncmat2cpp_impl.py" )
|
|
608
|
+
if ( NOT EXISTS "${ncmat2cpppy}" )
|
|
609
|
+
message( FATAL_ERROR "Missing file: ${ncmat2cpppy}" )
|
|
610
|
+
endif()
|
|
611
|
+
execute_process(
|
|
612
|
+
COMMAND "${Python3_EXECUTABLE}" "-BI" "${ncmat2cpppy}"
|
|
613
|
+
"-n" "NCrystal::AutoGenNCMAT::registerStdNCMAT" "--regfctname"
|
|
614
|
+
"NCrystal::internal::registerEmbeddedNCMAT(const char*,const char*)"
|
|
615
|
+
"-o" "${ncmatcc_file}" ${data_file_list} RESULT_VARIABLE status
|
|
616
|
+
)
|
|
617
|
+
if(status AND NOT status EQUAL 0)
|
|
618
|
+
message(FATAL_ERROR "Failure while trying to invoke"
|
|
619
|
+
" ncmat2cpp (needed since NCRYSTAL_ENABLE_DATA=EMBED).")
|
|
620
|
+
endif()
|
|
621
|
+
message(STATUS "Generated ${ncmatcc_bn} with embedded NCMAT data (will be compiled into the NCrystal library)." )
|
|
622
|
+
endif()
|
|
623
|
+
target_sources(NCrystal PRIVATE "${ncmatcc_file}")
|
|
624
|
+
elseif( NCRYSTAL_ENABLE_DATA STREQUAL "ON" )
|
|
625
|
+
#Hardwiring NCRYSTAL_DATADIR in the binary, although handled with
|
|
626
|
+
#NCRYSTAL_DATADIR env var in ncrystal_setup.sh. The environment variable makes
|
|
627
|
+
#the installation relocatable (at least for users sourcing the installed
|
|
628
|
+
#ncrystal_setup.sh):
|
|
629
|
+
target_compile_definitions(NCrystal PRIVATE "NCRYSTAL_DATADIR=${CMAKE_INSTALL_PREFIX}/${NCrystal_DATAFILESDIR}")
|
|
630
|
+
get_datafile_list( DATAFILES )
|
|
631
|
+
ncinstall(FILES ${DATAFILES} DESTINATION ${NCrystal_DATAFILESDIR})
|
|
632
|
+
endif()
|
|
633
|
+
|
|
634
|
+
ncinstall(
|
|
635
|
+
TARGETS NCrystal
|
|
636
|
+
EXPORT NCrystalTargets
|
|
637
|
+
RUNTIME DESTINATION ${NCrystal_SHLIBDIR}
|
|
638
|
+
ARCHIVE DESTINATION ${NCrystal_LIBDIR}
|
|
639
|
+
LIBRARY DESTINATION ${NCrystal_LIBDIR}
|
|
640
|
+
)
|
|
641
|
+
|
|
642
|
+
#Examples:
|
|
643
|
+
if ( NCRYSTAL_ENABLE_EXAMPLES )
|
|
644
|
+
file_globsrc( EXAMPLES_NC "../examples/ncrystal_example_c*.c*")
|
|
645
|
+
foreach(ex ${EXAMPLES_NC})
|
|
646
|
+
get_filename_component(exbn "${ex}" NAME_WE)
|
|
647
|
+
add_executable(${exbn} "${ex}")
|
|
648
|
+
set_target_common_props( ${exbn} )
|
|
649
|
+
target_link_libraries(${exbn} NCrystal ncrystal_common )
|
|
650
|
+
if ( NOT "x${_nc_executable_rpath}" STREQUAL "x" )
|
|
651
|
+
set_target_properties(${exbn} PROPERTIES INSTALL_RPATH "${_nc_executable_rpath}" )
|
|
652
|
+
endif()
|
|
653
|
+
ncinstall(TARGETS ${exbn} DESTINATION ${NCrystal_BINDIR} )
|
|
654
|
+
endforeach()
|
|
655
|
+
endif()
|
|
656
|
+
|
|
657
|
+
#G4NCrystal
|
|
658
|
+
set( NCRYSTAL_GEANT4 OFF )
|
|
659
|
+
if ( NOT NCRYSTAL_ENABLE_GEANT4 STREQUAL "OFF" )
|
|
660
|
+
find_package(Geant4)
|
|
661
|
+
if( Geant4_FOUND )
|
|
662
|
+
set( NCRYSTAL_GEANT4 ON )
|
|
663
|
+
else()
|
|
664
|
+
if ( NOT NCRYSTAL_ENABLE_GEANT4 STREQUAL "IFAVAILABLE" )
|
|
665
|
+
message( FATAL_ERROR "NCRYSTAL_ENABLE_GEANT4 set to ON but failed to enable Geant4 support (set to IFAVAILABLE or OFF to proceed without Geant4 support)." )
|
|
666
|
+
endif()
|
|
667
|
+
endif()
|
|
668
|
+
endif()
|
|
669
|
+
|
|
670
|
+
if ( NCRYSTAL_GEANT4 )
|
|
671
|
+
set( _tmp_basiclibnameg4 "G4NCrystal" )
|
|
672
|
+
add_library(G4NCrystal SHARED ${SRCS_NCG4})
|
|
673
|
+
if ( NCRYSTAL_NAMESPACE )
|
|
674
|
+
#Since we didn't implement the namespace for the G4NCrystal C++ namespace as
|
|
675
|
+
#well, it is best to error out here. Once we have migrated to new and better
|
|
676
|
+
#(and standalone) NCrystal-Geant4 hooks, they should certainly also have an
|
|
677
|
+
#option for namespace protection there.
|
|
678
|
+
message( WARNING "The NCRYSTAL_NAMESPACE feature is not actually fully implemented for the NCRYSTAL_GEANT4 extension (please get in touch if you have a different need)" )
|
|
679
|
+
set( _tmp_basiclibnameg4 "${_tmp_basiclibnameg4}-${NCRYSTAL_NAMESPACE}" )
|
|
680
|
+
set_target_properties( G4NCrystal PROPERTIES OUTPUT_NAME "${_tmp_basiclibnameg4}" )
|
|
681
|
+
endif()
|
|
682
|
+
set(G4NCrystal_LIBNAME "${CMAKE_SHARED_LIBRARY_PREFIX}${_tmp_basiclibnameg4}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
|
683
|
+
#Make sure client code will use at least c++11:
|
|
684
|
+
target_compile_features( G4NCrystal INTERFACE cxx_std_11 )
|
|
685
|
+
set_target_common_props( G4NCrystal )
|
|
686
|
+
target_include_directories(G4NCrystal
|
|
687
|
+
PUBLIC
|
|
688
|
+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/ncrystal_geant4/include>
|
|
689
|
+
$<INSTALL_INTERFACE:${NCrystal_INCDIR}>
|
|
690
|
+
)
|
|
691
|
+
|
|
692
|
+
ncinstall(TARGETS G4NCrystal EXPORT G4NCrystalTargets DESTINATION ${NCrystal_LIBDIR} )
|
|
693
|
+
|
|
694
|
+
ncinstall(FILES ${HDRS_NCG4} DESTINATION ${NCrystal_INCDIR}/G4NCrystal)
|
|
695
|
+
#Transfer G4 flags uncovered by find_package(Geant4) call:
|
|
696
|
+
#TODO: This should really use Geant4 targets once all known users move to
|
|
697
|
+
#newer Geant4 release (G4 10.6?):
|
|
698
|
+
target_compile_definitions(G4NCrystal PUBLIC ${Geant4_DEFINITIONS})
|
|
699
|
+
target_link_libraries( G4NCrystal PUBLIC NCrystal ${Geant4_LIBRARIES} PRIVATE ncrystal_common )
|
|
700
|
+
if ( NOT "x${_nc_libncg4_rpath}" STREQUAL "x" )
|
|
701
|
+
set_target_properties( G4NCrystal PROPERTIES INSTALL_RPATH "${_nc_libncg4_rpath}" )
|
|
702
|
+
endif()
|
|
703
|
+
target_include_directories(G4NCrystal SYSTEM PUBLIC ${Geant4_INCLUDE_DIRS})
|
|
704
|
+
set(Geant4_CXX_FLAGS_aslist ${Geant4_CXX_FLAGS})
|
|
705
|
+
separate_arguments(Geant4_CXX_FLAGS_aslist)
|
|
706
|
+
target_compile_options(G4NCrystal PUBLIC ${Geant4_CXX_FLAGS_aslist})
|
|
707
|
+
#Check if compiler supports -Wno-overloaded-virtual. If so, we add it as a
|
|
708
|
+
#public flag on the G4NCrystal target. This is because of Geant4 adds
|
|
709
|
+
#-Wno-overloaded-virtual, and Geant4 v10.4 headers gives that warning with
|
|
710
|
+
#gcc8/gcc9.
|
|
711
|
+
check_cxx_compiler_flag( -Wno-overloaded-virtual ncrystal_compiler_supports_no_overloaded_virtual_flag )
|
|
712
|
+
if ( ncrystal_compiler_supports_no_overloaded_virtual_flag )
|
|
713
|
+
target_compile_options( G4NCrystal PUBLIC -Wno-overloaded-virtual )
|
|
714
|
+
endif()
|
|
715
|
+
|
|
716
|
+
#examples if needed:
|
|
717
|
+
if ( NCRYSTAL_ENABLE_EXAMPLES )
|
|
718
|
+
file_globsrc( EXAMPLES_NCG4 "../examples/ncrystal_example_g4*.cc")
|
|
719
|
+
foreach(ex ${EXAMPLES_NCG4})
|
|
720
|
+
get_filename_component(exbn "${ex}" NAME_WE)
|
|
721
|
+
add_executable(${exbn} "${ex}")
|
|
722
|
+
set_target_common_props( ${exbn} )
|
|
723
|
+
target_link_libraries(${exbn} G4NCrystal ncrystal_common )
|
|
724
|
+
if ( NOT "x${_nc_executable_rpath}" STREQUAL "x" )
|
|
725
|
+
set_target_properties(${exbn} PROPERTIES INSTALL_RPATH "${_nc_executable_rpath}" )
|
|
726
|
+
endif()
|
|
727
|
+
ncinstall(TARGETS ${exbn} DESTINATION ${NCrystal_BINDIR} )
|
|
728
|
+
endforeach()
|
|
729
|
+
endif()
|
|
730
|
+
endif()
|
|
731
|
+
|
|
732
|
+
#Package configuration files for downstream cmake projects:
|
|
733
|
+
ncinstall( EXPORT NCrystalTargets FILE "NCrystalTargets.cmake" NAMESPACE NCrystal:: DESTINATION ${NCrystal_CMAKEDIR} )
|
|
734
|
+
add_library(NCrystal::NCrystal ALIAS NCrystal)#always alias namespaces locally
|
|
735
|
+
|
|
736
|
+
if ( ncrystal_skbuild_shlib_in_wheel_scripts )
|
|
737
|
+
#In python wheels on windows we put NCrystal.dll in the scripts directory,
|
|
738
|
+
#which moves around upon installation. To make the imported NCrystal::NCrystal
|
|
739
|
+
#target work, we need to fix the library location at the end of the generated
|
|
740
|
+
#NCrystalTargets-*.cmake. We put those fixups in a function in
|
|
741
|
+
#NCrystalConfig.cmake, and simply add a function call here:
|
|
742
|
+
install(CODE "
|
|
743
|
+
file(
|
|
744
|
+
APPEND
|
|
745
|
+
\"${CMAKE_INSTALL_PREFIX}/${NCrystal_CMAKEDIR}/NCrystalTargets-$<LOWER_CASE:$<CONFIG>>.cmake\"
|
|
746
|
+
\"\n_ncrystal_fixup_ncrystaltargets()\n\"
|
|
747
|
+
)
|
|
748
|
+
")
|
|
749
|
+
endif()
|
|
750
|
+
|
|
751
|
+
if ( NCRYSTAL_GEANT4 )
|
|
752
|
+
#Add G4NCrystal target in separate file:
|
|
753
|
+
ncinstall( EXPORT G4NCrystalTargets FILE G4NCrystalTargets.cmake NAMESPACE NCrystal:: DESTINATION ${NCrystal_CMAKEDIR} )
|
|
754
|
+
add_library(NCrystal::G4NCrystal ALIAS G4NCrystal)#always alias namespaces locally
|
|
755
|
+
endif()
|
|
756
|
+
|
|
757
|
+
#NB: Important we do any configure_file AFTER all variables used have been set!
|
|
758
|
+
include(CMakePackageConfigHelpers)
|
|
759
|
+
write_basic_package_version_file( "${PROJECT_BINARY_DIR}/NCrystalConfigVersion.cmake"
|
|
760
|
+
VERSION ${NCrystal_VERSION} COMPATIBILITY SameMajorVersion )
|
|
761
|
+
|
|
762
|
+
#First generated a configured version of the template:
|
|
763
|
+
configure_file( "${PROJECT_SOURCE_DIR}/cmake/NCrystalConfig.cmake.in"
|
|
764
|
+
"${PROJECT_BINARY_DIR}/NCrystalConfig.cmake.pregen.in" @ONLY )
|
|
765
|
+
|
|
766
|
+
#At build-time, generate the actual files needed for inclusion, expanding any
|
|
767
|
+
#generator-expressions:
|
|
768
|
+
file( GENERATE
|
|
769
|
+
OUTPUT "${PROJECT_BINARY_DIR}/NCrystalConfig.cmake"
|
|
770
|
+
INPUT "${PROJECT_BINARY_DIR}/NCrystalConfig.cmake.pregen.in"
|
|
771
|
+
)
|
|
772
|
+
|
|
773
|
+
ncinstall( FILES "${PROJECT_BINARY_DIR}/NCrystalConfigVersion.cmake" "${PROJECT_BINARY_DIR}/NCrystalConfig.cmake"
|
|
774
|
+
DESTINATION ${NCrystal_CMAKEDIR} )
|
|
775
|
+
|
|
776
|
+
set( nccfg_expects_shlibdir_override OFF )
|
|
777
|
+
if ( DEFINED SKBUILD_PROJECT_NAME )
|
|
778
|
+
#Only if installed via scikit-build will we generate an appropriate
|
|
779
|
+
#_ncrystal_core Python module for installation. We will also copy over some
|
|
780
|
+
#metadata files which resides outside <reporoot>/ncrystal_core for inclusion
|
|
781
|
+
#in the sdist. We always regenerate this, even when running from sdist.
|
|
782
|
+
set( pymoddir "${ncrystal_skbld_autogendir}/${nccore_pymodname}" )
|
|
783
|
+
if ( IS_DIRECTORY ${pymoddir} )
|
|
784
|
+
file ( REMOVE_RECURSE ${pymoddir} )
|
|
785
|
+
endif()
|
|
786
|
+
file( MAKE_DIRECTORY "${pymoddir}" )
|
|
787
|
+
file( WRITE "${pymoddir}/__init__.py" "__version__='${NCrystal_VERSION}'\n" )
|
|
788
|
+
#First generated a configured version of the template:
|
|
789
|
+
if ( ncrystal_skbuild_shlib_in_wheel_scripts )
|
|
790
|
+
#dll is over in the wheel scripts dir, at an unknown relative location.
|
|
791
|
+
set( ncrystal_pymod_shlib_in_scripts "1" )#non-empty string
|
|
792
|
+
set( ncrystal_pymod_shlib_dirname "" )
|
|
793
|
+
set( nccfg_expects_shlibdir_override ON )
|
|
794
|
+
else()
|
|
795
|
+
set( ncrystal_pymod_shlib_in_scripts "" )#empty string
|
|
796
|
+
get_filename_component(
|
|
797
|
+
"ncrystal_pymod_shlib_dirname" "${NCrystal_SHLIBDIR}" NAME
|
|
798
|
+
)
|
|
799
|
+
endif()
|
|
800
|
+
|
|
801
|
+
configure_file(
|
|
802
|
+
"${PROJECT_SOURCE_DIR}/cmake/template_pymod.py.in"
|
|
803
|
+
"${PROJECT_BINARY_DIR}/template_pymod.py.pregen.in"
|
|
804
|
+
@ONLY
|
|
805
|
+
)
|
|
806
|
+
#At build-time, generate the actual files needed for inclusion, expanding any
|
|
807
|
+
#generator-expressions:
|
|
808
|
+
file( GENERATE
|
|
809
|
+
OUTPUT "${pymoddir}/info.py"
|
|
810
|
+
INPUT "${PROJECT_BINARY_DIR}/template_pymod.py.pregen.in"
|
|
811
|
+
)
|
|
812
|
+
endif()
|
|
813
|
+
|
|
814
|
+
if ( NCRYSTAL_ENABLE_CFGAPP )
|
|
815
|
+
include( "ncrystal_nccfgapp" )
|
|
816
|
+
create_ncrystal_config_app( ${nccfg_expects_shlibdir_override} )
|
|
817
|
+
endif()
|
|
818
|
+
|
|
819
|
+
if ( NOT NCRYSTAL_QUIET )
|
|
820
|
+
foreach( optname ${_NCrystal_all_opts} )
|
|
821
|
+
message( STATUS "NCrystal-cfg: ${optname}=${${optname}}" )
|
|
822
|
+
endforeach()
|
|
823
|
+
endif()
|