-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from mach3-software/feature_BagofTricks
Bag of tricks I learned from Luke
- Loading branch information
Showing
12 changed files
with
398 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
include(CPM) | ||
|
||
#Luke's handing cmake modules which Neutrino hep experiments might want | ||
CPMFindPackage( | ||
NAME CMakeModules | ||
GIT_TAG stable | ||
GITHUB_REPOSITORY NuHepMC/CMakeModules | ||
DOWNLOAD_ONLY | ||
) | ||
include(${CMakeModules_SOURCE_DIR}/NuHepMCModules.cmake) | ||
include(NuHepMCUtils) | ||
|
||
# Check if CUDA was found | ||
if(MaCh3_GPU_ENABLED) | ||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/CUDASetup.cmake) | ||
endif() | ||
|
||
include(ROOT) | ||
if(NOT TARGET ROOT::ROOT) | ||
cmessage(FATAL_ERROR "MaCh3 Expected dependency target: ROOT::ROOT") | ||
endif() | ||
|
||
if(ROOT_VERSION VERSION_LESS 6.18.00) | ||
cmessage(FATAL_ERROR "Using ROOT version smaller than 6.18.0, this may lead to unexpected results") | ||
endif() | ||
|
||
# KS: Since ROOT 6.32.0 Minuit is turned on by default | ||
SET(MaCh3_MINUIT2_ENABLED FALSE) | ||
if(ROOT_VERSION GREATER_EQUAL 6.32.00 OR ROOT_CXX_FLAGS MATCHES "-DMINUIT2_ENABLED") | ||
SET(MaCh3_MINUIT2_ENABLED TRUE) | ||
endif() | ||
|
||
#YAML for reading in config files | ||
set(YAML_CPP_VERSION 0.7.0) #KS: We need it for version.h file also define this number olny once | ||
set(YAML_CPP_GIT_TAG "yaml-cpp-${YAML_CPP_VERSION}") | ||
CPMAddPackage( | ||
NAME yaml-cpp | ||
VERSION ${YAML_CPP_VERSION} | ||
GITHUB_REPOSITORY "jbeder/yaml-cpp" | ||
GIT_TAG "${YAML_CPP_GIT_TAG}" | ||
OPTIONS | ||
"YAML_BUILD_SHARED_LIBS ON" | ||
) | ||
|
||
if(NOT TARGET yaml-cpp::yaml-cpp) | ||
cmessage(FATAL_ERROR "MaCh3 Expected dependency target: yaml-cpp::yaml-cpp") | ||
endif() | ||
|
||
#KS: Not being used right now so commenting it out. | ||
#CPMAddPackage( | ||
# NAME Eigen | ||
# VERSION 3.2.8 | ||
# URL https://gitlab.com/libeigen/eigen/-/archive/3.2.8/eigen-3.2.8.tar.gz | ||
# # Eigen's CMakelists are not intended for library use | ||
# DOWNLOAD_ONLY YES | ||
#) | ||
|
||
#if(Eigen_ADDED) | ||
# add_library(Eigen INTERFACE IMPORTED) | ||
# target_include_directories(Eigen INTERFACE ${Eigen_SOURCE_DIR}) | ||
#endif() | ||
|
||
|
||
SET(MaCh3_Fitter_ENABLED "MR2T2") | ||
LIST(APPEND MaCh3_Fitter_ENABLED " PSO") | ||
if(MaCh3_MINUIT2_ENABLED) | ||
LIST(APPEND MaCh3_Fitter_ENABLED " Minuit2") | ||
endif() | ||
|
||
################################## Oscillation ################################ | ||
#KS: All of these should be moved to separate cmake and be handled by osc class, keep it for now | ||
#If USE_PROB3 not defined turn it off by default | ||
DefineEnabledRequiredSwitch(USE_PROB3 FALSE) | ||
|
||
# Oscillation calculation | ||
# In the future which osc calc we use might be set with a flag | ||
SET(MaCh3_Oscillator_ENABLED "") | ||
if (USE_PROB3) | ||
CPMFindPackage( | ||
NAME Prob3plusplus | ||
VERSION 3.10.3 | ||
GITHUB_REPOSITORY "mach3-software/Prob3plusplus" | ||
GIT_TAG v3.10.3 | ||
) | ||
LIST(APPEND MaCh3_Oscillator_ENABLED "Prob3++") | ||
else() | ||
CPMFindPackage( | ||
NAME CUDAProb3 | ||
GITHUB_REPOSITORY "mach3-software/CUDAProb3" | ||
GIT_TAG "feature_cleanup" | ||
DOWNLOAD_ONLY YES | ||
) | ||
LIST(APPEND MaCh3_Oscillator_ENABLED "CUDAProb3") | ||
endif() | ||
|
||
#dump_cmake_variables(Prob3plusplus) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#KS: Inspired by Nuisance code | ||
if(NOT COMMAND DefineEnabledRequiredSwitch) | ||
function(DefineEnabledRequiredSwitch VARNAME DEFAULTVALUE) | ||
if(NOT DEFINED ${VARNAME} OR "${${VARNAME}}x" STREQUAL "x") | ||
SET(${VARNAME} ${DEFAULTVALUE} PARENT_SCOPE) | ||
SET(${VARNAME} ${DEFAULTVALUE}) | ||
else() | ||
SET(${VARNAME}_REQUIRED ${${VARNAME}} PARENT_SCOPE) | ||
SET(${VARNAME}_REQUIRED ${${VARNAME}}) | ||
endif() | ||
endfunction() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.