Page MenuHomeHEPForge

No OneTemporary

diff --git a/cmake/GENIESetup.cmake b/cmake/GENIESetup.cmake
index 09d6572..3d22ddb 100644
--- a/cmake/GENIESetup.cmake
+++ b/cmake/GENIESetup.cmake
@@ -1,227 +1,231 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
# TODO
# check system for libxml2
# check whether we need the includes
# check if we can use a subset of the GENIE libraries
+include(${CMAKE_SOURCE_DIR}/cmake/parseConfigApp.cmake)
################################################################################
# Check Dependencies
################################################################################
################################# GENIE ######################################
if(GENIE STREQUAL "")
cmessage(FATAL_ERROR "Variable GENIE is not defined. "
"The location of a pre-built GENIE install must be defined either as"
- " $ cmake -DGENIE=/path/to/GENIE or as and environment vairable"
+ " $ cmake -DGENIE=/path/to/GENIE or as an environment variable"
" $ export GENIE=/path/to/GENIE")
endif()
if (BUILD_GEVGEN)
cmessage(STATUS "Building custom gevgen")
LIST(APPEND EXTRA_CXX_FLAGS -D__GEVGEN_ENABLED__)
endif()
if(GENIE_EMPMEC_REWEIGHT)
cmessage(STATUS "Enable EMPMEC dials")
LIST(APPEND EXTRA_CXX_FLAGS -D__GENIE_EMP_MECRW_ENABLED)
endif()
# Extract GENIE VERSION
if (GENIE_VERSION STREQUAL "AUTO")
execute_process (COMMAND ${CMAKE_SOURCE_DIR}/cmake/getgenieversion.sh ${GENIE}
OUTPUT_VARIABLE GENIE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
execute_process(COMMAND genie-config --version
OUTPUT_VARIABLE GENIE_VER OUTPUT_STRIP_TRAILING_WHITESPACE)
cmessage(STATUS "genie_ver: ${GENIE_VER}")
if(GENIE_VER VERSION_GREATER 3.0.0)
set(GENIE_POST_R3 1)
string(REPLACE "." "" GENIE_VERSION ${GENIE_VER})
cmessage(STATUS "set genie_post_r3")
endif()
if(NOT GENIE_POST_R3)
LIST(APPEND EXTRA_CXX_FLAGS -DGENIE_PRE_R3)
cmessage(STATUS "setting genie_pre_r3 ${EXTRA_CXX_FLAGS}")
endif()
-execute_process (COMMAND genie-config
- --libs OUTPUT_VARIABLE GENIE_LD_FLAGS_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
+GETLIBDIR(genie-config --libs GENIE_LIB_DIR)
+
execute_process (COMMAND genie-config
--topsrcdir OUTPUT_VARIABLE GENIE_INCLUDES_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
-string(REGEX MATCH "-L\([^ ]+\) \(.*\)$" PARSE_GENIE_LIBS_MATCH ${GENIE_LD_FLAGS_STR})
-
-cmessage(DEBUG "genie-config --libs: ${GENIE_LD_FLAGS_STR}")
-
-if(NOT PARSE_GENIE_LIBS_MATCH)
- cmessage(FATAL_ERROR "Expected to be able to parse the result of genie-config --libs to a lib directory and a list of libraries to include, but got: \"${GENIE_LD_FLAGS_STR}\"")
-endif()
-
-if(${CMAKE_MATCH_1})
- set(GENIE_LIB_DIR ${CMAKE_MATCH_1})
-else()
- set(GENIE_LIB_DIR $ENV{GENIE_LIB})
-endif()
-
-set(GENIE_LIBS_RAW ${CMAKE_MATCH_2})
-string(REPLACE "-l" "" GENIE_LIBS_STRIPED "${GENIE_LIBS_RAW}")
+GETLIBDIRS(genie-config --libs GENIE_LIB_DIR)
+GETLIBS(genie-config --libs GENIE_LIBS)
cmessage(STATUS "GENIE version : ${GENIE_VERSION}")
cmessage(STATUS "GENIE libdir : ${GENIE_LIB_DIR}")
-cmessage(STATUS "GENIE libs : ${GENIE_LIBS_STRIPED}")
+cmessage(STATUS "GENIE libs : ${GENIE_LIBS}")
-string(REGEX MATCH "ReinSeghal" WASMATCHED ${GENIE_LIBS_STRIPED})
+string(REGEX MATCH "ReinSeghal" WASMATCHED ${GENIE_LIBS})
if(WASMATCHED AND GENIE_VERSION STREQUAL "210")
- set(GENIE_SEHGAL ${GENIE_LIBS_STRIPED})
- STRING(REPLACE "ReinSeghal" "ReinSehgal" GENIE_LIBS_STRIPED ${GENIE_SEHGAL})
- cmessage(DEBUG "Fixed inconsistency in library naming: ${GENIE_LIBS_STRIPED}")
+ set(GENIE_SEHGAL ${GENIE_LIBS})
+ STRING(REPLACE "ReinSeghal" "ReinSehgal" GENIE_LIBS ${GENIE_SEHGAL})
+ cmessage(DEBUG "Fixed inconsistency in library naming: ${GENIE_LIBS}")
endif()
if(NOT GENIE_POST_R3)
- string(REGEX MATCH "ReWeight" WASMATCHED ${GENIE_LIBS_STRIPED})
- if(NOT WASMATCHED)
- set(GENIE_LIBS_STRIPED "GReWeight ${GENIE_LIBS_STRIPED}")
- cmessage(DEBUG "Force added ReWeight library: ${GENIE_LIBS_STRIPED}")
+ LIST(FIND GENIE_LIBS GReWeight WAS_FOUND)
+ if(WAS_FOUND STREQUAL "-1")
+ LIST(APPEND GENIE_LIBS GReWeight)
+ cmessage(DEBUG "Force added ReWeight library: ${GENIE_LIBS}")
endif()
else()
- string(REGEX MATCH "RwFwk" WASMATCHED ${GENIE_LIBS_STRIPED})
- if(NOT WASMATCHED)
- set(GENIE_LIBS_STRIPED "GRwClc GRwFwk GRwIO ${GENIE_LIBS_STRIPED}")
- cmessage(DEBUG "Force added ReWeight library: ${GENIE_LIBS_STRIPED}")
+ LIST(FIND GENIE_LIBS GRwFwk WAS_FOUND)
+ if(WAS_FOUND STREQUAL "-1")
+ LIST(APPEND GENIE_LIBS GRwClc GRwFwk GRwIO)
+ cmessage(DEBUG "Force added ReWeight library: ${GENIE_LIBS}")
endif()
endif()
-string(REPLACE " " ";" GENIE_LIBS_LIST "-Wl,--no-as-needed -Wl,--start-group ${GENIE_LIBS_STRIPED} -Wl,--end-group")
-cmessage(DEBUG "genie-config --libs -- MATCH1: ${CMAKE_MATCH_1}")
-cmessage(DEBUG "genie-config --libs -- MATCH2: ${CMAKE_MATCH_2}")
-cmessage(DEBUG "genie-config --libs -- libs stripped: ${GENIE_LIBS_STRIPED}")
-cmessage(DEBUG "genie-config --libs -- libs list: ${GENIE_LIBS_LIST}")
+LIST(APPEND GENIE_LIBS -Wl,--end-group )
+LIST(REVERSE GENIE_LIBS)
+LIST(APPEND GENIE_LIBS -Wl,--start-group -Wl,--no-as-needed )
+LIST(REVERSE GENIE_LIBS)
+
+cmessage(DEBUG "GENIE_LIBS: ${GENIE_LIBS}")
################################ LHAPDF ######################################
if(LHAPDF_LIB STREQUAL "")
- cmessage(FATAL_ERROR "Variable LHAPDF_LIB is not defined. The location of a pre-built lhapdf install must be defined either as $ cmake -DLHAPDF_LIB=/path/to/LHAPDF_libraries or as and environment vairable $ export LHAPDF_LIB=/path/to/LHAPDF_libraries")
+ cmessage(FATAL_ERROR "Variable LHAPDF_LIB is not defined. The location of a pre-built lhapdf install must be defined either as $ cmake -DLHAPDF_LIB=/path/to/LHAPDF_libraries or as an environment variable $ export LHAPDF_LIB=/path/to/LHAPDF_libraries")
endif()
if(LHAPDF_INC STREQUAL "")
- cmessage(FATAL_ERROR "Variable LHAPDF_INC is not defined. The location of a pre-built lhapdf install must be defined either as $ cmake -DLHAPDF_INC=/path/to/LHAPDF_includes or as and environment vairable $ export LHAPDF_INC=/path/to/LHAPDF_includes")
+ cmessage(FATAL_ERROR "Variable LHAPDF_INC is not defined. The location of a pre-built lhapdf install must be defined either as $ cmake -DLHAPDF_INC=/path/to/LHAPDF_includes or as an environment variable $ export LHAPDF_INC=/path/to/LHAPDF_includes")
endif()
if(LHAPATH STREQUAL "")
- cmessage(FATAL_ERROR "Variable LHAPATH is not defined. The location of a the LHAPATH directory must be defined either as $ cmake -DLHAPATH=/path/to/LHAPATH or as and environment variable $ export LHAPATH=/path/to/LHAPATH")
+ cmessage(FATAL_ERROR "Variable LHAPATH is not defined. The location of a the LHAPATH directory must be defined either as $ cmake -DLHAPATH=/path/to/LHAPATH or as an environment variable $ export LHAPATH=/path/to/LHAPATH")
endif()
################################ LIBXML ######################################
if(LIBXML2_LIB STREQUAL "")
- # Check for xml2-config
- find_program(LIBXMLCFGLIBS xml2-config)
- if(NOT LIBXMLCFGLIBS STREQUAL "LIBXMLLIBS-NOTFOUND")
- execute_process (COMMAND ${LIBXMLCFGLIBS} --libs
- OUTPUT_VARIABLE LIBXML2_LIB OUTPUT_STRIP_TRAILING_WHITESPACE)
- else()
- message(FATAL_ERROR "Variable LIBXML2_LIB is not defined and could not find xml2-config. The location of a pre-built libxml2 install must be defined either as $ cmake -DLIBXML2_LIB=/path/to/LIBXML2_libraries or as and environment vairable $ export LIBXML2_LIB=/path/to/LIBXML2_libraries")
+ GETLIBDIR(xml2-config --libs LIBXML2_LIB IGNORE_EMPTY_RESPONSE)
+ if(LIBXML2_LIB STREQUAL "")
+ message(WARNING "Variable LIBXML2_LIB is not defined, as xml2-config was found and didn't report a library include path, it is likely that libxml2.so can be found in the standard system location, lets hope so.")
endif()
endif()
if(LIBXML2_INC STREQUAL "")
- # Check for xml2-config
- find_program(LIBXMLCFGINCS xml2-config)
- if(NOT LIBXMLCFGINCS STREQUAL "LIBXMLINCS-NOTFOUND")
- execute_process (COMMAND ${LIBXMLCFGINCS} --cflags
- OUTPUT_VARIABLE LIBXML2_INC OUTPUT_STRIP_TRAILING_WHITESPACE)
- else()
- message(FATAL_ERROR "Variable LIBXML2_INC is not defined and could not find xml2-config. The location of a pre-built libxml2 install must be defined either as $ cmake -DLIBXML2_INC=/path/to/LIBXML2_libraries or as and environment vairable $ export LIBXML2_INC=/path/to/LIBXML2_libraries")
+ GETINCDIR(xml2-config --cflags LIBXML2_INC)
+ if(LIBXML2_INC STREQUAL "")
+ message(FATAL_ERROR "Variable LIBXML2_INC is not defined and could not be found with xml2-config. The location of a pre-built libxml2 install must be defined either as $ cmake -DLIBXML2_INC=/path/to/LIBXML2_includes or as an environment variable $ export LIBXML2_INC=/path/to/LIBXML2_includes")
endif()
endif()
-string(REPLACE "-llzma" "" LIBXML2_LIB ${LIBXML2_LIB})
-
############################### log4cpp ######################################
if(LOG4CPP_LIB STREQUAL "")
- find_program(LOG4CPPCFG log4cpp-config)
- if(NOT LOG4CPPCFG STREQUAL "LOG4CPPCFG-NOTFOUND")
- execute_process (COMMAND ${LOG4CPPCFG}
- --pkglibdir OUTPUT_VARIABLE LOG4CPP_LIB OUTPUT_STRIP_TRAILING_WHITESPACE)
- else()
- message(FATAL_ERROR "Variable LOG4CPP_LIB is not defined. The location of a pre-built log4cpp install must be defined either as $ cmake -DLOG4CPP_LIB=/path/to/LOG4CPP_libraries or as and environment vairable $ export LOG4CPP_LIB=/path/to/LOG4CPP_libraries")
+ GETLIBDIR(log4cpp-config --libs LOG4CPP_LIB)
+ if(LOG4CPP_LIB STREQUAL "")
+ message(FATAL_ERROR "Variable LOG4CPP_LIB is not defined and could not be found with log4cpp-config. The location of a pre-built log4cpp install must be defined either as $ cmake -DLOG4CPP_LIB=/path/to/LOG4CPP_libraries or as an environment variable $ export LOG4CPP_LIB=/path/to/LOG4CPP_libraries")
endif()
endif()
-if(LOG4CPP_INC STREQUAL "")
- find_program(LOG4CPPCFG log4cpp-config)
- if(NOT LOG4CPPCFG STREQUAL "LOG4CPPCFG-NOTFOUND")
- execute_process (COMMAND ${LOG4CPPCFG}
- --pkgincludedir OUTPUT_VARIABLE LOG4CPP_INC OUTPUT_STRIP_TRAILING_WHITESPACE)
- else()
- message(FATAL_ERROR "Variable LOG4CPP_INC is not defined. The location of a pre-built log4cpp install must be defined either as $ cmake -DGENIE_LOG4CPP_INC=/path/to/LOG4CPP_includes or as and environment vairable $ export LOG4CPP_INC=/path/to/LOG4CPP_includes")
+if(LOG4CPP_INC STREQUAL "")
+ GETINCDIR(log4cpp-config --cflags LOG4CPP_INC)
+ if(LOG4CPP_INC STREQUAL "")
+ message(FATAL_ERROR "Variable LOG4CPP_INC is not defined and could not be found with log4cpp-config. The location of a pre-built log4cpp install must be defined either as $ cmake -DLOG4CPP_INC=/path/to/LOG4CPP_includes or as an environment variable $ export LOG4CPP_INC=/path/to/LOG4CPP_includes")
endif()
endif()
################################################################################
LIST(APPEND EXTRA_CXX_FLAGS -D__GENIE_ENABLED__ -D__GENIE_VERSION__=${GENIE_VERSION})
-LIST(APPEND EXTRA_LIBS ${GENIE_LIBS_LIST})
+LIST(APPEND EXTRA_LIBS ${GENIE_LIBS})
+
+############################### GSL ######################################
+if(GENIE_POST_R3)
+ if(GSL_LIB STREQUAL "")
+ GETLIBDIR(gsl-config --libs GSL_LIB)
+ if(GSL_LIB STREQUAL "")
+ message(FATAL_ERROR "Variable GSL_LIB is not defined and could not be found with gsl-config. The location of a pre-built gsl install must be defined either as $ cmake -DGSL_LIB=/path/to/GSL_libraries or as an environment variable $ export GSL_LIB=/path/to/GSL_libraries")
+ endif()
+ endif()
+
+ if(GSL_INC STREQUAL "")
+ GETINCDIR(gsl-config --cflags GSL_INC)
+ if(GSL_INC STREQUAL "")
+ message(FATAL_ERROR "Variable GSL_INC is not defined and could not be found with gsl-config. The location of a pre-built gsl install must be defined either as $ cmake -DGSL_INC=/path/to/GSL_includes or as an environment variable $ export GSL_INC=/path/to/GSL_includes")
+ endif()
+ endif()
+
+ GETLIBS(gsl-config --libs GSL_LIB_LIST)
+
+ if(GENIE_REWEIGHT STREQUAL "")
+ message(FATAL_ERROR "Variable GENIE_REWEIGHT is not defined. When using GENIE v3+, we require the reweight product to be built and accessible via the environment variable GENIE_REWEIGHT")
+ endif()
+endif()
+################################################################################
LIST(APPEND EXTRA_LIBS LHAPDF xml2 log4cpp)
LIST(APPEND EXTRA_LINK_DIRS
${GENIE_LIB_DIR}
${LHAPDF_LIB}
- ${LIBXML2_LIB}
${LOG4CPP_LIB})
if(NOT GENIE_POST_R3)
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES
${GENIE_INCLUDES_DIR}
${GENIE_INCLUDES_DIR}/GHEP
${GENIE_INCLUDES_DIR}/Ntuple
${GENIE_INCLUDES_DIR}/ReWeight
${GENIE_INCLUDES_DIR}/Apps
${GENIE_INCLUDES_DIR}/FluxDrivers
${GENIE_INCLUDES_DIR}/EVGDrivers
${LHAPDF_INC}
${LIBXML2_INC}
${LOG4CPP_INC})
else()
LIST(APPEND RWENGINE_INCLUDE_DIRECTORIES
${GENIE_INCLUDES_DIR}
- $ENV{GENIE_REWEIGHT}/src
+ ${GENIE_REWEIGHT}/src
${GSL_INC}
${LHAPDF_INC}
${LIBXML2_INC}
${LOG4CPP_INC})
- LIST(APPEND EXTRA_LINK_DIRS $ENV{GSL_LIB})
- LIST(APPEND EXTRA_LIBS gsl gslcblas)
+
+ LIST(APPEND EXTRA_LINK_DIRS
+ ${GENIE_REWEIGHT}/lib
+ ${GSL_LIB}
+ )
+
+ LIST(APPEND EXTRA_LIBS ${GSL_LIB_LIST})
+
endif()
+cmessage(WARNING ${EXTRA_LINK_DIRS})
+cmessage(WARNING ${EXTRA_LIBS})
+
SAYVARS()
if(USE_PYTHIA8)
set(NEED_PYTHIA8 TRUE)
set(NEED_ROOTPYTHIA8 TRUE)
else()
set(NEED_PYTHIA6 TRUE)
set(NEED_ROOTPYTHIA6 TRUE)
endif()
set(NEED_ROOTEVEGEN TRUE)
SET(USE_GENIE TRUE CACHE BOOL "Whether to enable GENIE (reweight) support. Requires external libraries. <FALSE>" FORCE)
diff --git a/cmake/ReweightEnginesSetup.cmake b/cmake/ReweightEnginesSetup.cmake
index 16b9e85..753c11a 100644
--- a/cmake/ReweightEnginesSetup.cmake
+++ b/cmake/ReweightEnginesSetup.cmake
@@ -1,87 +1,86 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
################################## T2K ######################################
if(USE_T2K)
include(${CMAKE_SOURCE_DIR}/cmake/T2KSetup.cmake)
cmessage(STATUS "Using T2K Reweight engine.")
set(USE_T2K TRUE CACHE BOOL "Whether to enable T2KReWeight support. Requires external libraries. <FALSE>" FORCE)
endif()
################################## NIWG ######################################
if(USE_NIWG)
include(${CMAKE_SOURCE_DIR}/cmake/NIWGSetup.cmake)
cmessage(STATUS "Using NIWG Reweight engine.")
set(USE_NIWG TRUE CACHE BOOL "Whether to enable (T2K) NIWG ReWeight support. Requires external libraries. <FALSE>" FORCE)
endif()
################################## MINERvA ######################################
if(USE_MINERvA_RW)
include(${CMAKE_SOURCE_DIR}/cmake/MINERvASetup.cmake)
cmessage(STATUS "Using MINERvA Reweight engine.")
set(USE_MINERvA_RW TRUE CACHE BOOL "Whether to enable MINERvA ReWeight support. <FALSE>" FORCE)
endif()
################################## NEUT ######################################
if(USE_NEUT)
include(${CMAKE_SOURCE_DIR}/cmake/NEUTSetup.cmake)
cmessage(STATUS "Using NEUT Reweight engine.")
set(USE_NEUT TRUE CACHE BOOL "Whether to enable NEUT (reweight) support. Requires external libraries. <FALSE>" FORCE)
endif()
################################# NuWro ######################################
if(USE_NuWro)
include(${CMAKE_SOURCE_DIR}/cmake/NuWroSetup.cmake)
cmessage(STATUS "Using NuWro Reweight engine.")
set(USE_NuWro TRUE CACHE BOOL "Whether to enable NuWro support. <FALSE>" FORCE)
endif()
################################## GENIE #####################################
if(USE_GENIE)
include(${CMAKE_SOURCE_DIR}/cmake/GENIESetup.cmake)
cmessage(STATUS "Using GENIE Reweight engine.")
set(USE_GENIE TRUE CACHE BOOL "Whether to enable GENIE (reweight) support. Requires external libraries. <FALSE>" FORCE)
endif()
################################################################################
################################ Prob3++ ####################################
include(${CMAKE_SOURCE_DIR}/cmake/Prob3++Setup.cmake)
################################################################################
cmessage(STATUS "Reweight engine include directories: ${RWENGINE_INCLUDE_DIRECTORIES}")
if(NEED_ROOTEVEGEN)
cmessage(STATUS "Require ROOT eve generation libraries")
LIST(REVERSE ROOT_LIBS)
LIST(APPEND ROOT_LIBS
Gui
Ged
Geom
TreePlayer
EG
Eve)
LIST(REVERSE ROOT_LIBS)
endif()
if(NEED_ROOTPYTHIA6)
cmessage(STATUS "Require ROOT Pythia6 libraries")
LIST(APPEND ROOT_LIBS
- EGPythia6
- Pythia6)
+ EGPythia6)
endif()
LIST(APPEND EXTRA_LIBS ${ROOT_LIBS})
diff --git a/cmake/c++CompilerSetup.cmake b/cmake/c++CompilerSetup.cmake
index 9b95a37..34e0adc 100644
--- a/cmake/c++CompilerSetup.cmake
+++ b/cmake/c++CompilerSetup.cmake
@@ -1,117 +1,119 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
if(USE_OMP)
LIST(APPEND EXTRA_CXX_FLAGS -fopenmp)
endif()
if(USE_DYNSAMPLES)
LIST(APPEND EXTRA_LIBS dl)
LIST(APPEND EXTRA_CXX_FLAGS -D__USE_DYNSAMPLES__)
endif()
set(CXX_WARNINGS -Wall )
cmessage(DEBUG "EXTRA_CXX_FLAGS: ${EXTRA_CXX_FLAGS}")
string(REPLACE ";" " " STR_EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${STR_EXTRA_CXX_FLAGS} ${CXX_WARNINGS}")
set(CMAKE_Fortran_FLAGS_RELEASE "-fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
if(USE_DYNSAMPLES)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC")
set(CMAKE_Fortran_FLAGS_DEBUG "-fPIC")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC -O3")
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
set(CURRENT_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_DEBUG})
elseif(CMAKE_BUILD_TYPE MATCHES RELEASE)
set(CURRENT_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_RELEASE})
else()
cmessage(FATAL_ERROR "[ERROR]: Unknown CMAKE_BUILD_TYPE (\"${CMAKE_BUILD_TYPE}\"): Should be \"DEBUG\" or \"RELEASE\".")
endif()
SET(STR_EXTRA_LINK_DIRS)
if(NOT EXTRA_LINK_DIRS STREQUAL "")
string(REPLACE ";" " -L" STR_EXTRA_LINK_DIRS "-L${EXTRA_LINK_DIRS}")
endif()
SET(STR_EXTRA_LIBS)
if(NOT EXTRA_LIBS STREQUAL "")
SET(STR_EXTRA_LIBS_NO_SCRUB_LINKOPTS)
string(REPLACE ";" " -l" STR_EXTRA_LIBS_NO_SCRUB_LINKOPTS "-l${EXTRA_LIBS}")
string(REPLACE "-l-" "-" STR_EXTRA_LIBS ${STR_EXTRA_LIBS_NO_SCRUB_LINKOPTS})
endif()
SET(STR_EXTRA_SHAREDOBJS)
if(NOT EXTRA_SHAREDOBJS STREQUAL "")
string(REPLACE ";" " " STR_EXTRA_SHAREDOBJS "${EXTRA_SHAREDOBJS}")
endif()
SET(STR_EXTRA_LINK_FLAGS)
if(NOT EXTRA_LINK_FLAGS STREQUAL "")
string(REPLACE ";" " " STR_EXTRA_LINK_FLAGS "${EXTRA_LINK_FLAGS}")
endif()
cmessage(DEBUG "EXTRA_LINK_DIRS: ${STR_EXTRA_LINK_DIRS}")
cmessage(DEBUG "EXTRA_LIBS: ${STR_EXTRA_LIBS}")
cmessage(DEBUG "EXTRA_SHAREDOBJS: ${STR_EXTRA_SHAREDOBJS}")
cmessage(DEBUG "EXTRA_LINK_FLAGS: ${STR_EXTRA_LINK_FLAGS}")
if(NOT STR_EXTRA_LINK_DIRS STREQUAL "" AND NOT STR_EXTRA_LIBS STREQUAL "")
SET(CMAKE_DEPENDLIB_FLAGS "${STR_EXTRA_LINK_DIRS} ${STR_EXTRA_LIBS}")
endif()
if(NOT EXTRA_SHAREDOBJS STREQUAL "")
SET(CMAKE_DEPENDLIB_FLAGS "${CMAKE_DEPENDLIB_FLAGS} ${EXTRA_SHAREDOBJS}")
endif()
if(NOT EXTRA_SHAREDOBJS STREQUAL "")
if(NOT STR_EXTRA_LINK_FLAGS STREQUAL "")
SET(STR_EXTRA_LINK_FLAGS "${STR_EXTRA_SHAREDOBJS} ${STR_EXTRA_LINK_FLAGS}")
else()
SET(STR_EXTRA_LINK_FLAGS "${STR_EXTRA_SHAREDOBJS}")
endif()
endif()
if(NOT EXTRA_LINK_FLAGS STREQUAL "")
if(NOT CMAKE_LINK_FLAGS STREQUAL "")
SET(CMAKE_LINK_FLAGS "${CMAKE_LINK_FLAGS} ${STR_EXTRA_LINK_FLAGS}")
else()
SET(CMAKE_LINK_FLAGS "${STR_EXTRA_LINK_FLAGS}")
endif()
endif()
if(USE_OMP)
cmessage(FATAL_ERROR "No OMP features currently enabled so this is a FATAL_ERROR to let you know that you don't gain anything with this declaration.")
endif()
+STRING(REGEX REPLACE " $" "" CMAKE_DEPENDLIB_FLAGS "${CMAKE_DEPENDLIB_FLAGS}")
+
if (VERBOSE)
cmessage (STATUS "C++ Compiler : ${CXX_COMPILER_NAME}")
cmessage (STATUS " flags : ${CMAKE_CXX_FLAGS}")
cmessage (STATUS " Release flags : ${CMAKE_CXX_FLAGS_RELEASE}")
cmessage (STATUS " Debug flags : ${CMAKE_CXX_FLAGS_DEBUG}")
cmessage (STATUS " Link Flags : ${CMAKE_LINK_FLAGS}")
cmessage (STATUS " Lib Flags : ${CMAKE_DEPENDLIB_FLAGS}")
endif()
diff --git a/cmake/cacheVariables.cmake b/cmake/cacheVariables.cmake
index c7155b3..52d5ea1 100644
--- a/cmake/cacheVariables.cmake
+++ b/cmake/cacheVariables.cmake
@@ -1,217 +1,220 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
function(CheckAndSetDefaultEnv VARNAME DEFAULT CACHETYPE DOCSTRING ENVNAME)
#cmessage(DEBUG "Trying to assign variable ${VARNAME} into the cache.")
if(NOT DEFINED ${VARNAME})
if(DEFINED ENV{${ENVNAME}} AND NOT $ENV{${ENVNAME}} STREQUAL "")
set(${VARNAME} $ENV{${ENVNAME}} CACHE ${CACHETYPE} ${DOCSTRING})
cmessage(DEBUG " Read ${VARNAME} from ENVVAR ${ENVNAME} as $ENV{${ENVNAME}}.")
else()
set(${VARNAME} ${DEFAULT} CACHE ${CACHETYPE} ${DOCSTRING})
endif()
else()
set(${VARNAME} ${${VARNAME}} CACHE ${CACHETYPE} ${DOCSTRING})
unset(${VARNAME})
endif()
cmessage(CACHE "--Set cache variable: \"${VARNAME}\" to \"${${VARNAME}}\", in cache ${CACHETYPE}.")
endfunction()
function(CheckAndSetDefaultCache VARNAME DEFAULT CACHETYPE DOCSTRING)
# cmessage(DEBUG "Trying to assign variable ${VARNAME} into the cache.")
if(NOT DEFINED ${VARNAME})
set(${VARNAME} ${DEFAULT} CACHE ${CACHETYPE} ${DOCSTRING})
else()
set(${VARNAME} ${${VARNAME}} CACHE ${CACHETYPE} ${DOCSTRING})
unset(${VARNAME})
endif()
cmessage(CACHE "--Set cache variable: \"${VARNAME}\" to \"${${VARNAME}}\", in cache ${CACHETYPE}.")
endfunction()
function(CheckAndSetDefault VARNAME DEFAULT)
# cmessage(DEBUG "Trying to assign variable ${VARNAME}.")
if(NOT DEFINED ${VARNAME})
set(${VARNAME} ${DEFAULT} PARENT_SCOPE)
set(${VARNAME} ${DEFAULT})
endif()
cmessage(CACHE "--Set variable: \"${VARNAME}\" to \"${${VARNAME}}\".")
endfunction()
CheckAndSetDefaultCache(VERBOSE TRUE BOOL "Whether to configure loudly.")
set (CMAKE_SKIP_BUILD_RPATH TRUE)
#Changes default install path to be a subdirectory of the build dir.
#Can set build dir at configure time with -DCMAKE_INSTALL_PREFIX=/install/path
if(CMAKE_INSTALL_PREFIX STREQUAL "" OR CMAKE_INSTALL_PREFIX STREQUAL
"/usr/local")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
elseif(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE DEBUG)
elseif(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG)
endif()
CheckAndSetDefaultCache(EXTRA_SETUP_SCRIPT "" PATH "The path to an extra script to inject into the NUISANCE setup script. <>")
CheckAndSetDefaultCache(USE_MINIMIZER TRUE INTERNAL "Whether we are using the ROOT minimization libraries. <TRUE>")
CheckAndSetDefaultCache(USE_ROOT6 FALSE INTERNAL "Whether we are using the ROOT 6. <FALSE>")
CheckAndSetDefaultCache(USE_HEPMC FALSE BOOL "Whether to enable HepMC input support. <FALSE>")
CheckAndSetDefaultEnv(HEPMC "" PATH "Path to HepMC source tree root directory. Overrides environment variable \$HEPMC <>" HEPMC)
CheckAndSetDefaultCache(HEPMC_MOMUNIT "GEV" STRING "HepMC momentum units [MEV|GEV]. <GEV>")
CheckAndSetDefaultCache(HEPMC_LENUNIT "CM" STRING "HepMC momentum units [MM|CM]. <CM>")
CheckAndSetDefaultCache(HEPMC_USED_EP FALSE INTERNAL "Whether we built HepMC or not. <FALSE>")
CheckAndSetDefaultCache(USE_NEUT FALSE BOOL "Whether to enable NEUT (reweight) support. Requires external libraries. <FALSE>")
CheckAndSetDefaultEnv(NEUT_VERSION FALSE STRING "NEUT version string, e.g. 5.4.0. <5.4.0>" NEUT_VERSION)
CheckAndSetDefaultEnv(NEUT_ROOT "" PATH "Path to NEUT source tree root directory. Overrides environment variable \$NEUT_ROOT <>" NEUT_ROOT)
CheckAndSetDefaultEnv(CERN "" PATH "Path to CERNLIB source tree root directory that NEUT was built against. Overrides environment variable \$CERN <>" CERN)
CheckAndSetDefaultEnv(CERN_LEVEL "" STRING "CERNLIB Library version. Overrides environment variable \$CERN_LEVEL <>" CERN_LEVEL)
CheckAndSetDefaultCache(USE_NuWro FALSE BOOL "Whether to enable NuWro support. <FALSE>")
CheckAndSetDefaultEnv(NUWRO "" PATH "Path to NuWro source tree root directory. Overrides environment variable \$NUWRO <>" NUWRO)
CheckAndSetDefaultEnv(NUWRO_INC "" PATH "Path to NuWro installed includes directory, needs to contain \"params_all.h\". Overrides environment variable \$NUWRO_INC <>" NUWRO_INC)
CheckAndSetDefaultCache(NUWRO_INPUT_FILE "" FILEPATH "Path to an input NuWro event vector, which can be used to build NuWro i/o libraries. <>")
CheckAndSetDefaultCache(NUWRO_BUILT_FROM_FILE FALSE INTERNAL "Whether the NuWro libraries were built by NUISANCE. <FALSE>")
CheckAndSetDefaultCache(USE_NuWro_RW FALSE BOOL "Whether to try and build support for NuWro reweighting. <FALSE>")
CheckAndSetDefaultCache(USE_NuWro_SRW_Event FALSE BOOL "Whether to use cut down NuWro reweight event format. Requires NuWro reweight. <FALSE>")
CheckAndSetDefaultCache(USE_GENIE FALSE BOOL "Whether to enable GENIE (reweight) support. Requires external libraries. <FALSE>")
CheckAndSetDefaultCache(GENIE_VERSION "AUTO" STRING "GENIE Version <AUTO>")
CheckAndSetDefaultEnv(GENIE "" PATH "Path to GENIE source tree root directory. Overrides environment variable \$GENIE <>" GENIE)
+CheckAndSetDefaultEnv(GENIE_REWEIGHT "" PATH "Path to GENIE ReWeight directory. Only relevant for GENIE v3+. Overrides environment variable \$GENIE_REWEIGHT <>" GENIE_REWEIGHT)
CheckAndSetDefaultCache(GENIE_EMPMEC_REWEIGHT FALSE BOOL "Whether to use GENIE EMP MEC reweight (requires custom GENIE) <FALSE>")
CheckAndSetDefaultEnv(LHAPDF_LIB "" PATH "Path to pre-built LHAPDF libraries. Overrides environment variable \$LHAPDF_LIB. <>" LHAPDF_LIB)
CheckAndSetDefaultEnv(LHAPDF_INC "" PATH "Path to installed LHAPDF headers. Overrides environment variable \$LHAPDF_INC. <>" LHAPDF_INC)
CheckAndSetDefaultEnv(LHAPATH "" PATH "Path to LHA PDF inputs. Overrides environment variable \$LHAPATH. <>" LHAPATH)
CheckAndSetDefaultEnv(LIBXML2_LIB "" PATH "Path to pre-built LIBXML2 libraries. Overrides environment variable \$LIBXML2_LIB. <>" LIBXML2_LIB)
CheckAndSetDefaultEnv(LIBXML2_INC "" PATH "Path to installed LIBXML2 headers. Overrides environment variable \$LIBXML2_INC. <>" LIBXML2_INC)
CheckAndSetDefaultEnv(LOG4CPP_LIB "" PATH "Path to pre-built LOG4CPP libraries. Overrides environment variable \$LOG4CPP_LIB. <>" LOG4CPP_LIB)
CheckAndSetDefaultEnv(LOG4CPP_INC "" PATH "Path to installed LOG4CPP headers. Overrides environment variable \$LOG4CPP_INC. <>" LOG4CPP_INC)
+CheckAndSetDefaultEnv(GSL_LIB "" PATH "Path to pre-built gsl libraries. Overrides environment variable \$GSL_LIB. <>" GSL_LIB)
+CheckAndSetDefaultEnv(GSL_INC "" PATH "Path to installed gsl headers. Overrides environment variable \$GSL_INC. <>" GSL_INC)
CheckAndSetDefaultCache(BUILD_GEVGEN FALSE BOOL "Whether to build nuisance_gevgen app.")
CheckAndSetDefaultCache(USE_T2K FALSE BOOL "Whether to enable T2KReWeight support. Requires external libraries. <FALSE>")
CheckAndSetDefaultEnv(T2KREWEIGHT "" PATH "Path to installed T2KREWEIGHTReWeight. Overrides environment variable \$T2KREWEIGHT. <>" T2KREWEIGHT)
CheckAndSetDefaultCache(USE_NIWG FALSE BOOL "Whether to enable (T2K) NIWG ReWeight support. Requires external libraries. <FALSE>")
CheckAndSetDefaultEnv(NIWG_ROOT "" PATH "Path to installed NIWGReWeight. Overrides environment variable \$NIWG. <>" NIWG)
CheckAndSetDefaultCache(USE_MINERvA_RW FALSE BOOL "Whether to enable MINERvA ReWeight support. <FALSE>")
CheckAndSetDefaultEnv(PYTHIA6 "" PATH "Path to directory containing libPythia6.so. Overrides environment variable \$PYTHIA6 <>" PYTHIA6)
CheckAndSetDefaultEnv(PYTHIA8 "" PATH "Path to directory containing libPythia8.so. Overrides environment variable \$PYTHIA8 <>" PYTHIA8)
CheckAndSetDefaultCache(USE_PYTHIA8 FALSE BOOL "Whether to enable PYTHIA8 event support. <FALSE>")
CheckAndSetDefaultCache(USE_GiBUU TRUE BOOL "Whether to enable GiBUU event support. <TRUE>")
CheckAndSetDefaultCache(BUILD_GiBUU FALSE BOOL "Whether to build supporting GiBUU event tools along with a patched version of GiBUU. <FALSE>")
CheckAndSetDefaultCache(USE_NUANCE TRUE BOOL "Whether to enable NUANCE event support. <TRUE>")
CheckAndSetDefaultCache(USE_PROB3PP FALSE BOOL "Whether to download and compile in Prob3++ support. <FALSE>")
CheckAndSetDefaultCache(NO_EXTERNAL_UPDATE FALSE BOOL "Whether to perform the update target for external dependencies. Note this may produce errors for CMake < 3.8 where a bug was fixed for the feature that this option invokes. <FALSE>")
CheckAndSetDefaultCache(USE_GPERFTOOLS FALSE BOOL "Whether to compile in google performance tools. <FALSE>")
CheckAndSetDefault(NEED_PYTHIA6 FALSE)
CheckAndSetDefault(NEED_PYTHIA8 FALSE)
CheckAndSetDefault(NEED_ROOTEVEGEN FALSE)
CheckAndSetDefault(NEED_ROOTPYTHIA6 FALSE)
CheckAndSetDefaultCache(USE_OMP FALSE BOOL "Whether to enable multicore features (there currently are none...). <FALSE>")
CheckAndSetDefaultCache(USE_DYNSAMPLES TRUE BOOL "Whether to enable the dynamic sample loader. <TRUE>")
CheckAndSetDefault(NO_EXPERIMENTS FALSE)
cmessage(STATUS "NO_EXPERIMENTS: ${NO_EXPERIMENTS}")
CheckAndSetDefaultCache(NO_ANL ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build ANL samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_ArgoNeuT ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build ArgoNeuT samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_BEBC ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build BEBC samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_BNL ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build BNL samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_FNAL ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build FNAL samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_GGM ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build GGM samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_K2K ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build K2K samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_MINERvA ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build MINERvA samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_MiniBooNE ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build MiniBooNE samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_T2K ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build T2K samples. <-DNO_EXPERIMENTS=FALSE>")
CheckAndSetDefaultCache(NO_SciBooNE ${NO_EXPERIMENTS} BOOL "Whether to *NOT* build SciBooNE samples. <-DNO_EXPERIMENTS=FALSE>")
function(SAYVARS)
LIST(APPEND VARS
USE_HEPMC
HEPMC
HEPMC_MOMUNIT
HEPMC_LENUNIT
HEPMC_USED_EP
USE_NEUT
NEUT_ROOT
CERN
CERN_LEVEL
USE_NuWro
NUWRO
NUWRO_INC
NUWRO_INPUT_FILE
NUWRO_BUILT_FROM_FILE
USE_GENIE
GENIE
LHAPDF_LIB
LHAPDF_INC
LIBXML2_LIB
LIBXML2_INC
LOG4CPP_LIB
GENIE_LOG4CPP_INC
BUILD_GEVGEN
USE_T2K
USE_NIWG
USE_GiBUU
BUILD_GiBUU
USE_NUANCE
NO_EXTERNAL_UPDATE
USE_GPERFTOOLS
NO_ANL
NO_ArgoNeuT
NO_BEBC
NO_BNL
NO_FNAL
NO_GGM
NO_K2K
NO_MINERvA
NO_MiniBooNE
NO_T2K
NO_SciBooNE)
foreach(v ${VARS})
if(DEFINED ${v})
cmessage(DEBUG "VARIABLE: \"${v}\" = \"${${v}}\"")
endif()
endforeach(v)
endfunction()
diff --git a/cmake/parseConfigApp.cmake b/cmake/parseConfigApp.cmake
new file mode 100644
index 0000000..222b0ec
--- /dev/null
+++ b/cmake/parseConfigApp.cmake
@@ -0,0 +1,141 @@
+function(GETFIRSTMATCHINGDELMIMMEDDIR DELIM CONFIGAPP ARG DIR_OUT FAILURE_IS_NOT_ERROR)
+
+ cmessage(DEBUG "CONFIGAPP: ${CONFIGAPP}, ARG: ${ARG} DIR_OUT: ${DIR_OUT}, FAILURE_IS_NOT_ERROR: ${FAILURE_IS_NOT_ERROR}")
+
+ if(DELIM STREQUAL "")
+ cmessage(FATAL_ERROR "GETFIRSTMATCHINGDELMIMMEDDIR Passed no delimiter. This is a build configuration bug in NUISANCE, please report to the developers.")
+ endif()
+
+ if(CONFIGAPP STREQUAL "")
+ cmessage(FATAL_ERROR "GETFIRSTMATCHINGDELMIMMEDDIR Passed no configuration application. This is a build configuration bug in NUISANCE, please report to the developers.")
+ endif()
+
+ SET(CONFIGAPP_LOCATION "CONFIGAPP_LOCATION-NOTFOUND")
+ find_program(CONFIGAPP_LOCATION ${CONFIGAPP})
+ if(NOT CONFIGAPP_LOCATION STREQUAL "CONFIGAPP_LOCATION-NOTFOUND")
+ execute_process (COMMAND ${CONFIGAPP_LOCATION}
+ ${ARG} OUTPUT_VARIABLE CONFIGAPP_RESPONSE_RAW OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ cmessage(DEBUG "${CONFIGAPP_LOCATION} ${ARG} responded with: \"${CONFIGAPP_RESPONSE_RAW}\"")
+
+ if(CONFIGAPP_RESPONSE_RAW STREQUAL "")
+ if(FAILURE_IS_NOT_ERROR)
+ cmessage(DEBUG "\"${CONFIGAPP_LOCATION} ${ARG}\" produced no output and was expected to.")
+ set(${DIR_OUT} "" PARENT_SCOPE)
+ else()
+ cmessage(FATAL_ERROR "\"${CONFIGAPP_LOCATION} ${ARG}\" produced no output and was required to.")
+ endif()
+ else()
+ string(REGEX MATCH "${DELIM}\([^ ]+\)" PARSE_CONFIGAPP_RESPONSE_MATCH ${CONFIGAPP_RESPONSE_RAW})
+
+ if(NOT PARSE_CONFIGAPP_RESPONSE_MATCH)
+ if(FAILURE_IS_NOT_ERROR)
+ cmessage(DEBUG "Couldn't find ${DELIM} flag, found: \"${CONFIGAPP_RESPONSE_RAW}\"")
+ set(${CMAKE_MATCH_1} "")
+ else()
+ cmessage(FATAL_ERROR "Expected to be able to parse the result of ${CONFIGAPP} ${ARG} to a lib directory, but couldn't find a ${DELIM} flag, found: \"${CONFIGAPP_RESPONSE_RAW}\"")
+ endif()
+ endif()
+
+ set(${DIR_OUT} ${CMAKE_MATCH_1} PARENT_SCOPE)
+ endif()
+ else()
+ cmessage(FATAL_ERROR "[ERROR]: Failed to find dependency configuration application: \"${CONFIGAPP}\"")
+ endif()
+endfunction()
+
+#Uselike GETLIBDIR(gsl-config --libs GSL_LIB_DIR)
+function(GETLIBDIR CONFIGAPP ARG LIBDIR_OUT)
+ if(ARGN)
+ set(FAILURE_IS_NOT_ERROR TRUE)
+ else()
+ set(FAILURE_IS_NOT_ERROR FALSE)
+ endif()
+ GETFIRSTMATCHINGDELMIMMEDDIR(
+ "-L"
+ ${CONFIGAPP}
+ ${ARG}
+ MATCHING_DIR
+ ${FAILURE_IS_NOT_ERROR})
+ set(${LIBDIR_OUT} ${MATCHING_DIR} PARENT_SCOPE)
+endfunction()
+
+#Uselike GETINCDIR(gsl-config --cflags GSL_INC_DIR)
+function(GETINCDIR CONFIGAPP ARG INCDIR_OUT)
+ if(ARGN)
+ set(FAILURE_IS_NOT_ERROR TRUE)
+ else()
+ set(FAILURE_IS_NOT_ERROR FALSE)
+ endif()
+ GETFIRSTMATCHINGDELMIMMEDDIR(
+ "-I"
+ ${CONFIGAPP}
+ ${ARG}
+ MATCHING_DIR
+ ${FAILURE_IS_NOT_ERROR})
+ set(${INCDIR_OUT} ${MATCHING_DIR} PARENT_SCOPE)
+endfunction()
+
+function(GETALLMATCHINGDELMIMMEDDIR DELIM CONFIGAPP ARG LIST_OUT)
+ if(DELIM STREQUAL "")
+ cmessage(FATAL_ERROR "GETALLMATCHINGDELMIMMEDDIR Passed no delimiter. This is a build configuration bug in NUISANCE, please report to the developers.")
+ endif()
+
+ if(CONFIGAPP STREQUAL "")
+ cmessage(FATAL_ERROR "GETALLMATCHINGDELMIMMEDDIR Passed no configuration application. This is a build configuration bug in NUISANCE, please report to the developers.")
+ endif()
+
+ find_program(CONFIGAPP_LOCATION ${CONFIGAPP})
+ if(NOT CONFIGAPP_LOCATION STREQUAL "CONFIGAPP_LOCATION-NOTFOUND")
+ execute_process (COMMAND ${CONFIGAPP_LOCATION}
+ ${ARG} OUTPUT_VARIABLE CONFIGAPP_RESPONSE_RAW OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(REPLACE " " ";" CONFIGAPP_RESPONSE_LIST "${CONFIGAPP_RESPONSE_RAW}")
+
+ set(LIST_BUILD)
+
+ foreach(I ${CONFIGAPP_RESPONSE_LIST})
+ if(I)
+ string(REGEX MATCH "^${DELIM}" WASMATCHED ${I})
+ if(WASMATCHED)
+ string(REPLACE "${DELIM}" "" I_STRIPPED "${I}")
+ LIST(APPEND LIST_BUILD ${I_STRIPPED})
+ endif()
+ endif()
+ endforeach()
+
+ set(${LIST_OUT} ${LIST_BUILD} PARENT_SCOPE)
+ else()
+ cmessage(FATAL_ERROR "[ERROR]: Failed to find dependency configuration application: \"${CONFIGAPP}\"")
+ endif()
+endfunction()
+
+#Uselike GETLIBDIRS(gsl-config --libs GSL_LIB_DIR)
+function(GETLIBDIRS CONFIGAPP ARG LIBDIR_OUT)
+ GETALLMATCHINGDELMIMMEDDIR(
+ "-L"
+ ${CONFIGAPP}
+ ${ARG}
+ MATCHING_DIR)
+ set(${LIBDIR_OUT} ${MATCHING_DIR} PARENT_SCOPE)
+endfunction()
+
+#Uselike GETINCDIRS(gsl-config --cflags GSL_INC_DIR)
+function(GETINCDIRS CONFIGAPP ARG INCDIR_OUT)
+ GETALLMATCHINGDELMIMMEDDIR(
+ "-I"
+ ${CONFIGAPP}
+ ${ARG}
+ MATCHING_DIR)
+ set(${INCDIR_OUT} ${MATCHING_DIR} PARENT_SCOPE)
+endfunction()
+
+#Uselike GETLIBS(gsl-config --libs GSL_LIB_DIR)
+function(GETLIBS CONFIGAPP ARG LIBLIST_OUT)
+ GETALLMATCHINGDELMIMMEDDIR(
+ "-l"
+ ${CONFIGAPP}
+ ${ARG}
+ MATCHING_ITEMS)
+ set(${LIBLIST_OUT} ${MATCHING_ITEMS} PARENT_SCOPE)
+endfunction()
diff --git a/cmake/pythia6Setup.cmake b/cmake/pythia6Setup.cmake
index 012fa34..1a89b0c 100644
--- a/cmake/pythia6Setup.cmake
+++ b/cmake/pythia6Setup.cmake
@@ -1,31 +1,29 @@
# 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 <http://www.gnu.org/licenses/>.
################################################################################
if(NEED_PYTHIA6)
if(PYTHIA6 STREQUAL "")
cmessage(FATAL_ERROR "Variable PYTHIA6 is not defined. This must be set to point to a prebuilt PYTHIA6 instance, please set the \$PYTHIA6 environment variable or configure with -DPYTHIA6=/path/to/pythia6.")
endif()
LIST(APPEND EXTRA_LINK_DIRS ${PYTHIA6})
- LIST(REVERSE EXTRA_LIBS)
LIST(APPEND EXTRA_LIBS Pythia6 gfortran)
- LIST(REVERSE EXTRA_LIBS)
endif()

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 9:13 PM (22 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3806216
Default Alt Text
(41 KB)

Event Timeline