diff --git a/CMakeLists.txt b/CMakeLists.txt
index ceba75d..aa07afe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,217 +1,223 @@
# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
################################################################################
# This file is part of NUISANCE.
#
# NUISANCE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NUISANCE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NUISANCE. If not, see .
################################################################################
cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
project(NUISANCE)
include(ExternalProject)
enable_language(Fortran)
set (NUISANCE_VERSION_MAJOR 2)
set (NUISANCE_VERSION_MINOR 7)
set (NUISANCE_VERSION_REVISION 0)
set (NUISANCE_VERSION_STRING "v${NUISANCE_VERSION_MAJOR}r${NUISANCE_VERSION_MINOR}")
if(${NUISANCE_VERSION_REVISION} STRGREATER "0")
set (NUISANCE_VERSION_STRING "${NUISANCE_VERSION_STRING}p${NUISANCE_VERSION_REVISION}")
endif()
#Set this to TRUE to enable build debugging messages
set(BUILD_DEBUG_MSGS TRUE)
include(${CMAKE_SOURCE_DIR}/cmake/cmessage.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/cacheVariables.cmake)
cmessage(STATUS "CMAKE_INSTALL_PREFIX: \"${CMAKE_INSTALL_PREFIX}\"")
cmessage(STATUS "CMAKE_BUILD_TYPE: \"${CMAKE_BUILD_TYPE}\"")
################################################################################
# Check Dependencies
################################################################################
################################## ROOT ######################################
include(${CMAKE_SOURCE_DIR}/cmake/ROOTSetup.cmake)
################################# HEPMC ######################################
include(${CMAKE_SOURCE_DIR}/cmake/HepMC.cmake)
############################ Reweight Engines ################################
include(${CMAKE_SOURCE_DIR}/cmake/ReweightEnginesSetup.cmake)
############################ Other Generators ################################
include(${CMAKE_SOURCE_DIR}/cmake/GiBUUSetup.cmake)
if(USE_NUANCE)
LIST(APPEND EXTRA_CXX_FLAGS -D__NUANCE_ENABLED__)
endif()
################################# Pythia6/8 ####################################
include(${CMAKE_SOURCE_DIR}/cmake/pythia6Setup.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/pythia8Setup.cmake)
################################# gperftools ###################################
include(${CMAKE_SOURCE_DIR}/cmake/gperfSetup.cmake)
if(NOT NOTEST)
enable_testing()
endif()
SET(GENERATOR_SUPPORT)
foreach(gen NEUT;NuWro;GENIE;GiBUU;NUANCE)
if(USE_${gen})
SET(GENERATOR_SUPPORT "${GENERATOR_SUPPORT}${gen} ")
endif()
endforeach(gen)
cmessage(STATUS "Generator Input Support: ${GENERATOR_SUPPORT}")
set(MINCODE
Routines
FCN)
set(CORE
MCStudies
Genie
FitBase
Config
Logger
InputHandler
Splines
Reweight
Utils
Statistical
#Devel
Smearceptance
)
LIST(APPEND ALLEXPERIMENTS
ANL
ArgoNeuT
BEBC
BNL
Electron
FNAL
GGM
K2K
MINERvA
MiniBooNE
SciBooNE
T2K)
foreach(exp ${ALLEXPERIMENTS})
if(NOT NO_${exp})
LIST(APPEND EXPERIMENTS_TO_BUILD ${exp})
else()
LIST(REVERSE EXTRA_CXX_FLAGS)
LIST(APPEND EXTRA_CXX_FLAGS -D__NO_${exp}__)
LIST(REVERSE EXTRA_CXX_FLAGS)
endif()
endforeach()
################################## COMPILER ####################################
include(${CMAKE_SOURCE_DIR}/cmake/c++CompilerSetup.cmake)
################################### doxygen ###################################
include(${CMAKE_SOURCE_DIR}/cmake/docsSetup.cmake)
################################################################################
set(MINIMUM_INCLUDE_DIRECTORIES)
LIST(APPEND MINIMUM_INCLUDE_DIRECTORIES
${RWENGINE_INCLUDE_DIRECTORIES}
${CMAKE_SOURCE_DIR}/src/FitBase
${CMAKE_SOURCE_DIR}/src/Reweight
${CMAKE_SOURCE_DIR}/src/InputHandler
${CMAKE_SOURCE_DIR}/src/Config
${CMAKE_SOURCE_DIR}/src/Logger
${CMAKE_SOURCE_DIR}/src/Statistical
${CMAKE_SOURCE_DIR}/src/Splines
${CMAKE_SOURCE_DIR}/src/Utils
${CMAKE_SOURCE_DIR}/src/Genie)
cmessage(DEBUG "Base include directories: ${MINIMUM_INCLUDE_DIRECTORIES}")
set(EXP_INCLUDE_DIRECTORIES)
foreach(edir ${EXPERIMENTS_TO_BUILD})
LIST(APPEND EXP_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/src/${edir})
endforeach()
cmessage(DEBUG "Included experiments: ${EXP_INCLUDE_DIRECTORIES}")
foreach(mdir ${MINCODE})
cmessage (DEBUG "Configuring directory: src/${mdir}")
add_subdirectory(src/${mdir})
endforeach()
foreach(edir ${EXPERIMENTS_TO_BUILD})
cmessage (DEBUG "Configuring directory: src/${edir}")
add_subdirectory(src/${edir})
endforeach()
foreach(cdir ${CORE})
cmessage (DEBUG "Configuring directory: src/${cdir}")
add_subdirectory(src/${cdir})
endforeach()
cmessage(DEBUG "Module targets: ${MODULETargets}")
add_subdirectory(app)
add_subdirectory(src/Tests)
configure_file(cmake/setup.sh.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/setup.sh" @ONLY)
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/setup.sh" DESTINATION
${CMAKE_INSTALL_PREFIX})
+configure_file(cmake/MakeBinaryBlob.in
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/MakeBinaryBlob" @ONLY)
+install(PROGRAMS
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/MakeBinaryBlob" DESTINATION
+ bin)
+
if(USE_DYNSAMPLES)
SET(ALL_INCLUDES ${MINIMUM_INCLUDE_DIRECTORIES})
LIST(APPEND ALL_INCLUDES ${CMAKE_SOURCE_DIR}/src/Smearceptance)
LIST(APPEND ALL_INCLUDES ${EXP_INCLUDE_DIRECTORIES})
string(REPLACE ";" " -I" ALL_INCLUDES_STR "${ALL_INCLUDES}")
string(REPLACE ";" " -l" ALL_MODULETARGETS_STR "${MODULETargets}")
configure_file(cmake/BuildDynamicSample.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/BuildDynamicSample" @ONLY)
install(PROGRAMS
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/BuildDynamicSample" DESTINATION
bin)
configure_file(cmake/BuildDynamicSmearcepter.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/BuildDynamicSmearcepter" @ONLY)
install(PROGRAMS
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/BuildDynamicSmearcepter" DESTINATION
bin)
endif()
install(PROGRAMS
"${PROJECT_SOURCE_DIR}/scripts/nuiscardgen" DESTINATION
bin)
install(PROGRAMS
"${PROJECT_SOURCE_DIR}/scripts/nuissamples" DESTINATION
bin)
diff --git a/cmake/BinBlobSetup.header b/cmake/BinBlobSetup.header
new file mode 100644
index 0000000..d83827c
--- /dev/null
+++ b/cmake/BinBlobSetup.header
@@ -0,0 +1,47 @@
+### Adapted from https://unix.stackexchange.com/questions/4965/keep-duplicates-out-of-path-on-source
+function add_to_PATH () {
+ for d; do
+
+ d=$(cd -- "$d" && { pwd -P || pwd; }) 2>/dev/null # canonicalize symbolic links
+ if [ -z "$d" ]; then continue; fi # skip nonexistent directory
+
+ if [ "$d" == "/usr/bin" ] || [ "$d" == "/usr/bin64" ] || [ "$d" == "/usr/local/bin" ] || [ "$d" == "/usr/local/bin64" ]; then
+ case ":$PATH:" in
+ *":$d:"*) :;;
+ *) export PATH=$PATH:$d;;
+ esac
+ else
+ case ":$PATH:" in
+ *":$d:"*) :;;
+ *) export PATH=$d:$PATH;;
+ esac
+ fi
+ done
+}
+
+function add_to_LD_LIBRARY_PATH () {
+ for d; do
+
+ d=$(cd -- "$d" && { pwd -P || pwd; }) 2>/dev/null # canonicalize symbolic links
+ if [ -z "$d" ]; then continue; fi # skip nonexistent directory
+
+ if [ "$d" == "/usr/lib" ] || [ "$d" == "/usr/lib64" ] || [ "$d" == "/usr/local/lib" ] || [ "$d" == "/usr/local/lib64" ]; then
+ case ":$LD_LIBRARY_PATH:" in
+ *":$d:"*) :;;
+ *) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$d;;
+ esac
+ else
+ case ":$LD_LIBRARY_PATH:" in
+ *":$d:"*) :;;
+ *) export LD_LIBRARY_PATH=$d:$LD_LIBRARY_PATH;;
+ esac
+ fi
+ done
+}
+
+if ! echo "${BASH_SOURCE}" | grep "/" --silent; then
+ SETUP_DIR=$(readlink -f $PWD)
+else
+ SETUP_DIR=$(readlink -f ${BASH_SOURCE%/*})
+fi
+export NUISANCE=${SETUP_DIR}
diff --git a/cmake/MakeBinaryBlob.in b/cmake/MakeBinaryBlob.in
new file mode 100644
index 0000000..7794c9a
--- /dev/null
+++ b/cmake/MakeBinaryBlob.in
@@ -0,0 +1,172 @@
+# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
+
+################################################################################
+# This file is part of NUISANCE.
+#
+# NUISANCE is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# NUISANCE is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with NUISANCE. If not, see .
+################################################################################
+
+#!/bin/sh
+
+if [ ! ${NUISANCE} ]; then
+ echo "[ERROR]; NUISANCE envrionment variable is not defined, please source NUSIANCE before trying to make a binary blob."
+ exit 1
+fi
+
+mkdir BinBlob
+cd BinBlob
+
+echo "#!/bin/sh" > setup.sh
+
+cat @PROJECT_SOURCE_DIR@/cmake/BinBlobSetup.header >> setup.sh
+
+mkdir deps exes
+
+mkdir root
+
+mkdir -p root/lib/root
+echo "[INFO]: Copying ROOT libraries from @CMAKE_ROOTSYS@/lib/root"
+cp @CMAKE_ROOTSYS@/lib/root/*.so* root/lib/root/
+
+mkdir root/bin
+echo "[INFO]: Copying ROOT binary from @CMAKE_ROOTSYS@/bin"
+cp @CMAKE_ROOTSYS@/bin/* root/bin
+
+mkdir -p root/share/man/man1
+echo "[INFO]: Copying ROOT man pages from @CMAKE_ROOTSYS@/share/man/man1"
+cp -r @CMAKE_ROOTSYS@/share/man/man1 root/share/man/man1
+
+cat root/bin/thisroot.sh | sed 's:@CMAKE_ROOTSYS@:__INST_ROOT__:g' > root/bin/thisroot.sh_tmp
+rm root/bin/thisroot.sh
+
+echo "cat \$NUISANCE/root/bin/thisroot.sh_tmp | sed \"s:__INST_ROOT__:\$NUISANCE/root:g\" > \$NUISANCE/root/bin/thisroot.sh" >> setup.sh
+
+cat root/bin/thisroot.csh | sed 's:@CMAKE_ROOTSYS@:__INST_ROOT__:g' > root/bin/thisroot.csh_tmp
+rm root/bin/thisroot.csh
+
+echo "cat \$NUISANCE/root/bin/thisroot.csh_tmp | sed \"s:__INST_ROOT__:\$NUISANCE/root:g\" > \$NUISANCE/root/bin/thisroot.csh" >> setup.csh
+
+echo "source \$NUISANCE/root/bin/thisroot.sh" >> setup.sh
+
+if [ "@USE_T2K@" != "FALSE" ]; then
+ mkdir deps/t2k
+
+ echo "[INFO]: Copying T2K libraries from @T2KREWEIGHT@"
+ cp @T2KREWEIGHT@/lib/*.so deps/t2k/
+
+ echo "add_to_LD_LIBRARY_PATH \$NUISANCE/deps/t2k" >> setup.sh
+fi
+
+
+if [ "@USE_NIWG@" != "FALSE" ]; then
+ mkdir deps/niwg
+ echo "[INFO]: Copying NIWG libraries from @NIWG@"
+ cp @NIWG@/lib/*.so deps/niwg/
+
+ echo "add_to_LD_LIBRARY_PATH \$NUISANCE/deps/niwg" >> setup.sh
+fi
+
+if [ "@USE_NEUT@" != "FALSE" ]; then
+ mkdir deps/neut
+ mkdir exes/neut
+
+ echo "[INFO]: Copying NEUT libraries from @NEUT_ROOT@"
+ cp @NEUT_ROOT@/src/reweight/*.so deps/neut
+
+ cp @NEUT_ROOT@/src/neutsmpl/neutroot2 exes/neut
+
+ echo "add_to_LD_LIBRARY_PATH \$NUISANCE/deps/neut" >> setup.sh
+fi
+
+if [ "@USE_NuWro@" != "FALSE" ]; then
+ if [ "@NUWRO_BUILT_FROM_FILE@" == "FALSE" ]; then
+ mkdir deps/nuwro
+ mkdir exes/nuwro
+ mkdir data
+ mkdir data/nuwro
+
+ echo "[INFO]: Copying NuWro libraries from @NUWRO@"
+
+ cp @NUWRO@/lib/*.so deps/nuwro
+
+ cp @NUWRO@/bin/nuwro exes/nuwro/
+ cp -r @NUWRO@/data data/nuwro
+
+ echo "add_to_LD_LIBRARY_PATH \$NUISANCE/deps/nuwro" >> setup.sh
+ echo "export NUWRO=\$NUISANCE/data/nuwro" >> setup.sh
+
+ else
+ echo "[INFO]: NuWro support included from input event file."
+ fi
+fi
+
+if [ "@NEED_PYTHIA6@" != "FALSE" ]; then
+ mkdir deps/pythia
+ echo "[INFO]: Copying PYTHIA libraries from @PYTHIA6@"
+ cp @PYTHIA6@/*.so deps/pythia/
+
+ echo "add_to_LD_LIBRARY_PATH \$NUISANCE/deps/pythia" >> setup.sh
+fi
+
+if [ "@USE_GENIE@" != "FALSE" ]; then
+ mkdir -p deps/genie/{,libxml2,lhapdf,log4cpp}
+ mkdir exes/genie
+
+ echo "[INFO]: Copying LHAPDF libraries from @LHAPDF_LIB@"
+ cp @LHAPDF_LIB@/libLHAPDF.so* deps/genie/lhapdf
+ echo "add_to_LD_LIBRARY_PATH \$NUISANCE/deps/genie/lhapdf" >> setup.sh
+
+ echo "[INFO]: Copying LIBXML2 libraries from @LIBXML2_LIB@"
+ cp @LIBXML2_LIB@/libxml2.so* deps/genie/libxml2
+ echo "add_to_LD_LIBRARY_PATH \$NUISANCE/deps/genie/libxml2" >> setup.sh
+
+ echo "[INFO]: Copying LOG4CPP libraries from @LOG4CPP_LIB@"
+ cp @LOG4CPP_LIB@/liblog4cpp.so* deps/genie/log4cpp
+ echo "add_to_LD_LIBRARY_PATH \$NUISANCE/deps/genie/log4cpp" >> setup.sh
+
+
+ if [ "@LHAPATH@" ]; then
+ mkdir -p data/genie/lhapdf
+ cp @LHAPATH@/*.LHgrid data/genie/lhapdf/
+ echo "export LHAPATH=\"\$NUISANCE/data/genie/lhapdf\"" >> setup.sh
+ fi
+
+ echo "[INFO]: Copying GENIE libraries from @GENIE@/lib"
+ cp @GENIE@/lib/*.so* deps/genie/
+ echo "add_to_LD_LIBRARY_PATH \$NUISANCE/deps/genie" >> setup.sh
+
+ echo "[INFO]: Copying GENIE binaries from @GENIE@/bin"
+ cp @GENIE@/bin/* exes/genie/
+ echo "add_to_PATH \$NUISANCE/exes/genie" >> setup.sh
+
+fi
+
+mkdir exes/nuisance
+cp @CMAKE_INSTALL_PREFIX@/bin/* exes/nuisance/
+echo "add_to_PATH \$NUISANCE/exes/nuisance" >> setup.sh
+
+rm exes/nuisance/BuildDynamic*
+
+if [ @CMAKE_BUILD_TYPE@ == "RELEASE" ]; then
+ mkdir deps/nuisance
+ echo "add_to_LD_LIBRARY_PATH \$NUISANCE/deps/nuisance" >> setup.sh
+ cp @CMAKE_INSTALL_PREFIX@/lib/*.so deps/nuisance/
+fi
+
+if [ -e data ]; then
+ tar -zcvf nuisblob.tar.gz setup.sh exes/* deps/* root/* data/*
+else
+ tar -zcvf nuisblob.tar.gz setup.sh exes/* deps/* root/*
+fi
+cd ../