From faffd5bcd65278f3a0c980d1b19c86fdafa8967c Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Thu, 31 Jan 2019 10:45:05 +0100 Subject: [PATCH 1/8] CPack post (un)install add post (un)install scripts to musrfit cpack. Currently for rpm only. Furthermore a minimal required root version is added. Will need to see if this is sufficient or if more detailed work needs to be added. --- cmake/CPackOptions.cmake.in | 7 +++++-- cmake/post_install.sh | 14 ++++++++++++++ cmake/post_uninstall.sh | 13 +++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 cmake/post_install.sh create mode 100644 cmake/post_uninstall.sh diff --git a/cmake/CPackOptions.cmake.in b/cmake/CPackOptions.cmake.in index 7654ae58..1d24ed67 100644 --- a/cmake/CPackOptions.cmake.in +++ b/cmake/CPackOptions.cmake.in @@ -24,13 +24,16 @@ set (CPACK_SET_DESTDIR "OFF") set (CPACK_PACKAGE_RELOCATABLE "true") if (${CPACK_GENERATOR} STREQUAL "RPM") - set(CPACK_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") - set(CPACK_PACKAGING_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") + set (CPACK_RPM_PACKAGE_REQUIRES "root >= 6.14.08") + set (CPACK_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") + set (CPACK_PACKAGING_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") set (CPACK_RPM_FILE_NAME "RPM-DEFAULT") set (CPACK_RPM_PACKAGE_RELEASE "1") set (CPACK_RPM_PACKAGE_LICENSE "GPLv2") set (CPACK_RPM_PACKAGE_VENDOR "Paul Scherrer Institute - LMU - LEM") set (CPACK_RPM_CHANGELOG_FILE "@PROJECT_SOURCE_DIR@/cmake/ChangeLogRPM") + set (CPACK_RPM_POST_INSTALL_SCRIPT_FILE "@PROJECT_SOURCE_DIR@/cmake/post_install.sh") + set (CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "@PROJECT_SOURCE_DIR@/cmake/post_uninstall.sh") endif () if (${CPACK_GENERATOR} STREQUAL "DEB") diff --git a/cmake/post_install.sh b/cmake/post_install.sh new file mode 100644 index 00000000..3763661a --- /dev/null +++ b/cmake/post_install.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo ">> musrfit post install script started ..." + +# test if nemu-x86_64.conf does not exist +if [ ! -f "/etc/ld.so.conf.d/nemu-x86_64.conf" ] +then + echo "/usr/local/lib" >> /etc/ld.so.conf.d/nemu-x86_64.conf + echo "/usr/local/lib64" >> /etc/ld.so.conf.d/nemu-x86_64.conf +fi +/sbin/ldconfig + +echo ">> musrfit post install script done." + diff --git a/cmake/post_uninstall.sh b/cmake/post_uninstall.sh new file mode 100644 index 00000000..51390702 --- /dev/null +++ b/cmake/post_uninstall.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +echo ">> musrfit post uninstall script started ..." + +# test if nemu-x86_64.conf does not exist +if [ -f "/etc/ld.so.conf.d/nemu-x86_64.conf" ] +then + rm -f /etc/ld.so.conf.d/nemu-x86_64.conf +fi +/sbin/ldconfig + +echo ">> musrfit post uninstall script done." + From 3cb950277f23ff88a7fe076e55c41e57b772cd7b Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Fri, 1 Feb 2019 16:05:24 +0100 Subject: [PATCH 2/8] cmake/cpack root dictionary issue fixed. In order that package assembly works, the code needs to be relocatble and any hints linking it to the original source need to be absent. The changes here do exactely this. For rootcling the '-inlineInputHeader' option is needed, otherwise the dictionary wants to load the header file from the source destination which of course will fail when installing the package on a machine without the source. --- src/classes/CMakeLists.txt | 36 +++++++++++++++---- src/external/BMWtools/CMakeLists.txt | 5 +-- src/external/MagProximity/CMakeLists.txt | 5 +++ src/external/MusrRoot/CMakeLists.txt | 8 ++++- src/external/Nonlocal/CMakeLists.txt | 17 +++++---- src/external/TLemRunHeader/CMakeLists.txt | 13 +++++-- src/external/libBNMR/CMakeLists.txt | 6 ++-- .../libCalcMeanFieldsLEM/CMakeLists.txt | 8 ++--- .../libFitPofB/classes/CMakeLists.txt | 7 ++++ src/external/libGapIntegrals/CMakeLists.txt | 3 ++ src/external/libLFRelaxation/CMakeLists.txt | 3 ++ .../libPhotoMeissner/classes/CMakeLists.txt | 5 +++ .../libSpinValve/classes/CMakeLists.txt | 5 +++ src/external/libZFRelaxation/CMakeLists.txt | 3 ++ 14 files changed, 98 insertions(+), 26 deletions(-) diff --git a/src/classes/CMakeLists.txt b/src/classes/CMakeLists.txt index 7b7e0c5f..358f9c9a 100644 --- a/src/classes/CMakeLists.txt +++ b/src/classes/CMakeLists.txt @@ -2,35 +2,41 @@ #--- generate necessary dictionaries ------------------------------------------ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( PFourierCanvasDict - -I${FFTW3_INCLUDE_DIR} ${MUSRFIT_INC}/PFourierCanvas.h + -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${PREFIX_INC} PFourierCanvas.h LINKDEF ${MUSRFIT_INC}/PFourierCanvasLinkDef.h + OPTIONS -inlineInputHeader MODULE PFourierCanvas ) root_generate_dictionary( PMusrCanvasDict - -I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE_DIR} ${MUSRFIT_INC}/PMusrCanvas.h + -I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${PREFIX_INC} PMusrCanvas.h LINKDEF ${MUSRFIT_INC}/PMusrCanvasLinkDef.h + OPTIONS -inlineInputHeader MODULE PMusrCanvas ) root_generate_dictionary( PMusrT0Dict - -I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE_DIR} ${MUSRFIT_INC}/PMusrT0.h + -I${Boost_INCLUDE_DIR} -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${PREFIX_INC} PMusrT0.h LINKDEF ${MUSRFIT_INC}/PMusrT0LinkDef.h + OPTIONS -inlineInputHeader MODULE PMusrT0 ) root_generate_dictionary( PStartupHandlerDict - -I${FFTW3_INCLUDE_DIR} ${MUSRFIT_INC}/PStartupHandler.h + -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${PREFIX_INC} PStartupHandler.h LINKDEF ${MUSRFIT_INC}/PStartupHandlerLinkDef.h + OPTIONS -inlineInputHeader MODULE PStartupHandler ) root_generate_dictionary( PUserFcnBaseDict - -I${FFTW3_INCLUDE_DIR} ${MUSRFIT_INC}/PUserFcnBase.h + -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${PREFIX_INC} PUserFcnBase.h LINKDEF ${MUSRFIT_INC}/PUserFcnBaseLinkDef.h + OPTIONS -inlineInputHeader MODULE PUserFcnBase ) @@ -160,15 +166,31 @@ install( ) #--- install headers ---------------------------------------------------------- -#--- only install headers needed for classes with dictionary install( - FILES ${MUSRFIT_INC}/PFourierCanvas.h + FILES ${MUSRFIT_INC}/PFitterFcn.h + ${MUSRFIT_INC}/PFitter.h + ${MUSRFIT_INC}/PFourierCanvas.h ${MUSRFIT_INC}/PFourier.h + ${MUSRFIT_INC}/PFunctionGrammar.h + ${MUSRFIT_INC}/PFunction.h + ${MUSRFIT_INC}/PFunctionHandler.h + ${MUSRFIT_INC}/PMsr2Data.h + ${MUSRFIT_INC}/PMsrHandler.h ${MUSRFIT_INC}/PMusrCanvas.h ${MUSRFIT_INC}/PMusr.h ${MUSRFIT_INC}/PMusrT0.h + ${MUSRFIT_INC}/PPrepFourier.h + ${MUSRFIT_INC}/PRunAsymmetry.h + ${MUSRFIT_INC}/PRunAsymmetryRRF.h + ${MUSRFIT_INC}/PRunBase.h + ${MUSRFIT_INC}/PRunDataHandler.h ${MUSRFIT_INC}/PRunListCollection.h + ${MUSRFIT_INC}/PRunMuMinus.h + ${MUSRFIT_INC}/PRunNonMusr.h + ${MUSRFIT_INC}/PRunSingleHisto.h + ${MUSRFIT_INC}/PRunSingleHistoRRF.h ${MUSRFIT_INC}/PStartupHandler.h + ${MUSRFIT_INC}/PTheory.h ${MUSRFIT_INC}/PUserFcnBase.h DESTINATION include ) diff --git a/src/external/BMWtools/CMakeLists.txt b/src/external/BMWtools/CMakeLists.txt index 3341b698..7a189984 100644 --- a/src/external/BMWtools/CMakeLists.txt +++ b/src/external/BMWtools/CMakeLists.txt @@ -3,12 +3,13 @@ #--- generate necessary dictionaries ------------------------------------------ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) set(CUBA_INC ${CMAKE_SOURCE_DIR}/src/external/libCuba/src) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( BMWStartupHandlerDict - -I${MUSRFIT_INC} - BMWStartupHandler.h + -I${MUSRFIT_INC} -I${PREFIX_INC} BMWStartupHandler.h LINKDEF BMWStartupHandlerLinkDef.h + OPTIONS -inlineInputHeader MODULE BMWStartupHandler ) diff --git a/src/external/MagProximity/CMakeLists.txt b/src/external/MagProximity/CMakeLists.txt index 1fa02e93..57d37b0d 100644 --- a/src/external/MagProximity/CMakeLists.txt +++ b/src/external/MagProximity/CMakeLists.txt @@ -2,20 +2,25 @@ #--- generate necessary dictionaries ------------------------------------------ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( PMagProximityFitterDict -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} + -I${PREFIX_INC} PMagProximityFitter.h LINKDEF PMagProximityFitterLinkDef.h + OPTIONS -inlineInputHeader MODULE PMagProximityFitter ) root_generate_dictionary( PMPStartupHandlerDict -I${MUSRFIT_INC} + -I${PREFIX_INC} PMPStartupHandler.h LINKDEF PMPStartupHandlerLinkDef.h + OPTIONS -inlineInputHeader MODULE PMPStartupHandler ) diff --git a/src/external/MusrRoot/CMakeLists.txt b/src/external/MusrRoot/CMakeLists.txt index b2112b17..9914f57e 100644 --- a/src/external/MusrRoot/CMakeLists.txt +++ b/src/external/MusrRoot/CMakeLists.txt @@ -1,8 +1,14 @@ # - TMusrRunHeader library ---------------------------------------------------- #--- generate necessary dictionaries ------------------------------------------ +set(MUSRROOT_INC ${CMAKE_SOURCE_DIR}/src/external/MusrRoot) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) + root_generate_dictionary( - TMusrRunHeaderDict TMusrRunHeader.h LINKDEF TMusrRunHeaderLinkDef.h + TMusrRunHeaderDict + -I${MUSRROOT_INC} -I${PREFIX_INC} TMusrRunHeader.h + LINKDEF TMusrRunHeaderLinkDef.h + OPTIONS -inlineInputHeader MODULE TMusrRunHeader ) diff --git a/src/external/Nonlocal/CMakeLists.txt b/src/external/Nonlocal/CMakeLists.txt index 13127cc3..89786877 100644 --- a/src/external/Nonlocal/CMakeLists.txt +++ b/src/external/Nonlocal/CMakeLists.txt @@ -2,17 +2,21 @@ #--- generate necessary dictionaries ------------------------------------------ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) +set(NONLOCAL_INC ${CMAKE_SOURCE_DIR}/src/external/Nonlocal) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( PNL_PippardFitterDict - -I${FFTW3_INCLUDE_DIR} - -I${MUSRFIT_INC} - PNL_PippardFitter.h + -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${NONLOCAL_INC} -I${PREFIX_INC} PNL_PippardFitter.h LINKDEF PNL_PippardFitterLinkDef.h + OPTIONS -inlineInputHeader MODULE PNL_PippardFitter ) root_generate_dictionary( - PNL_StartupHandlerDict PNL_StartupHandler.h LINKDEF PNL_StartupHandlerLinkDef.h + PNL_StartupHandlerDict + -I${NONLOCAL_INC} -I${PREFIX_INC} PNL_StartupHandler.h + LINKDEF PNL_StartupHandlerLinkDef.h + OPTIONS -inlineInputHeader MODULE PNL_StartupHandler ) @@ -38,7 +42,7 @@ target_include_directories( PNL_PippardFitter BEFORE PRIVATE $ $ - $ + $ ) #--- set target properties, e.g. version -------------------------------------- @@ -64,7 +68,8 @@ install( #--- install PNL_PippardFitter header ----------------------------------------- install( - FILES + FILES + PNonlocal.h PNL_PippardFitter.h PNL_RgeHandler.h PNL_StartupHandler.h diff --git a/src/external/TLemRunHeader/CMakeLists.txt b/src/external/TLemRunHeader/CMakeLists.txt index d361da50..4dbc8fe9 100644 --- a/src/external/TLemRunHeader/CMakeLists.txt +++ b/src/external/TLemRunHeader/CMakeLists.txt @@ -1,12 +1,21 @@ # -TLemRunHeader library ------------------------------------------------------ #--- generate necessary dictionaries ------------------------------------------ +set(TLEMRUNHEADER_INC ${CMAKE_SOURCE_DIR}/src/external/TLemRunHeader) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) + root_generate_dictionary( - TLemRunHeaderDict TLemRunHeader.h LINKDEF TLemRunHeaderLinkDef.h + TLemRunHeaderDict + -I${TLEMRUNHEADER_INC} -I${PREFIX_INC} TLemRunHeader.h + LINKDEF TLemRunHeaderLinkDef.h + OPTIONS -inlineInputHeader MODULE TLemRunHeader ) root_generate_dictionary( - TLemStatsDict TLemStats.h LINKDEF TLemStatsLinkDef.h + TLemStatsDict + -I${TLEMRUNHEADER_INC} -I${PREFIX_INC} TLemStats.h + LINKDEF TLemStatsLinkDef.h + OPTIONS -inlineInputHeader MODULE TLemStats ) diff --git a/src/external/libBNMR/CMakeLists.txt b/src/external/libBNMR/CMakeLists.txt index 356b61f5..de1596b1 100644 --- a/src/external/libBNMR/CMakeLists.txt +++ b/src/external/libBNMR/CMakeLists.txt @@ -5,13 +5,13 @@ add_subdirectory(libLineProfile) #--- generate necessary dictionaries ------------------------------------------ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( TBNMRDict - -I${FFTW3_INCLUDE_DIR} - -I${MUSRFIT_INC} - TBNMR.h + -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${PREFIX_INC} TBNMR.h LINKDEF TBNMRLinkDef.h + OPTIONS -inlineInputHeader MODULE TBNMR ) diff --git a/src/external/libCalcMeanFieldsLEM/CMakeLists.txt b/src/external/libCalcMeanFieldsLEM/CMakeLists.txt index c41b573c..9300811c 100644 --- a/src/external/libCalcMeanFieldsLEM/CMakeLists.txt +++ b/src/external/libCalcMeanFieldsLEM/CMakeLists.txt @@ -4,15 +4,13 @@ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools) set(POFB_INC ${CMAKE_SOURCE_DIR}/src/external/libFitPofB/include) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( TCalcMeanFieldsLEMDict - -I${FFTW3_INCLUDE_DIR} - -I${MUSRFIT_INC} - -I${BMW_TOOLS_INC} - -I${POFB_INC} - TCalcMeanFieldsLEM.h + -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${BMW_TOOLS_INC} -I${POFB_INC} -I${PREFIX_INC} TCalcMeanFieldsLEM.h LINKDEF TCalcMeanFieldsLEMLinkDef.h + OPTIONS -inlineInputHeader MODULE TCalcMeanFieldsLEM ) diff --git a/src/external/libFitPofB/classes/CMakeLists.txt b/src/external/libFitPofB/classes/CMakeLists.txt index fab6a2c1..08f2e675 100644 --- a/src/external/libFitPofB/classes/CMakeLists.txt +++ b/src/external/libFitPofB/classes/CMakeLists.txt @@ -4,6 +4,7 @@ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools) set(POFB_INC ${CMAKE_SOURCE_DIR}/src/external/libFitPofB/include) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( TLondon1DDict @@ -12,8 +13,10 @@ root_generate_dictionary( -I${BMW_TOOLS_INC} -I${POFB_INC} -I${CMAKE_CURRENT_SOURCE_DIR}/../include + -I${PREFIX_INC} TLondon1D.h LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/TLondon1DLinkDef.h + OPTIONS -inlineInputHeader MODULE TLondon1D ) root_generate_dictionary( @@ -23,8 +26,10 @@ root_generate_dictionary( -I${BMW_TOOLS_INC} -I${POFB_INC} -I${CMAKE_CURRENT_SOURCE_DIR}/../include + -I${PREFIX_INC} TVortex.h LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/TVortexLinkDef.h + OPTIONS -inlineInputHeader MODULE TVortex ) root_generate_dictionary( @@ -34,8 +39,10 @@ root_generate_dictionary( -I${BMW_TOOLS_INC} -I${POFB_INC} -I${CMAKE_CURRENT_SOURCE_DIR}/../include + -I${PREFIX_INC} TSkewedGss.h LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/TSkewedGssLinkDef.h + OPTIONS -inlineInputHeader MODULE TSkewedGss ) diff --git a/src/external/libGapIntegrals/CMakeLists.txt b/src/external/libGapIntegrals/CMakeLists.txt index 9611de12..76d191df 100644 --- a/src/external/libGapIntegrals/CMakeLists.txt +++ b/src/external/libGapIntegrals/CMakeLists.txt @@ -3,14 +3,17 @@ #--- generate necessary dictionaries ------------------------------------------ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( TGapIntegralsDict -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${BMW_TOOLS_INC} + -I${PREFIX_INC} TGapIntegrals.h LINKDEF TGapIntegralsLinkDef.h + OPTIONS -inlineInputHeader MODULE TGapIntegrals ) diff --git a/src/external/libLFRelaxation/CMakeLists.txt b/src/external/libLFRelaxation/CMakeLists.txt index 59f8bd5f..31b66b5f 100644 --- a/src/external/libLFRelaxation/CMakeLists.txt +++ b/src/external/libLFRelaxation/CMakeLists.txt @@ -3,14 +3,17 @@ #--- generate necessary dictionaries ------------------------------------------ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( TLFRelaxationDict -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${BMW_TOOLS_INC} + -I${PREFIX_INC} TLFRelaxation.h LINKDEF TLFRelaxationLinkDef.h + OPTIONS -inlineInputHeader MODULE TLFRelaxation ) diff --git a/src/external/libPhotoMeissner/classes/CMakeLists.txt b/src/external/libPhotoMeissner/classes/CMakeLists.txt index dcf94dec..93a57b46 100644 --- a/src/external/libPhotoMeissner/classes/CMakeLists.txt +++ b/src/external/libPhotoMeissner/classes/CMakeLists.txt @@ -2,6 +2,7 @@ #--- generate necessary dictionaries ------------------------------------------ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( PPhotoMeissnerDict @@ -10,16 +11,20 @@ root_generate_dictionary( -I${ROOT_INCLUDE_DIRS} -I${MUSRFIT_INC} -I${CMAKE_CURRENT_SOURCE_DIR}/../include + -I${PREFIX_INC} PPhotoMeissner.h LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PPhotoMeissnerLinkDef.h + OPTIONS -inlineInputHeader MODULE PPhotoMeissner ) root_generate_dictionary( PStartupHandler_PMDict -I${MUSRFIT_INC} -I${CMAKE_CURRENT_SOURCE_DIR}/../include + -I${PREFIX_INC} PStartupHandler_PM.h LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PStartupHandler_PMLinkDef.h + OPTIONS -inlineInputHeader MODULE PStartupHandler_PM ) diff --git a/src/external/libSpinValve/classes/CMakeLists.txt b/src/external/libSpinValve/classes/CMakeLists.txt index 09142a42..890742d8 100644 --- a/src/external/libSpinValve/classes/CMakeLists.txt +++ b/src/external/libSpinValve/classes/CMakeLists.txt @@ -2,21 +2,26 @@ #--- generate necessary dictionaries ------------------------------------------ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( PSkewedLorentzianDict -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${CMAKE_CURRENT_SOURCE_DIR}/../include + -I${PREFIX_INC} PSkewedLorentzian.h LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PSkewedLorentzianLinkDef.h + OPTIONS -inlineInputHeader MODULE PSkewedLorentzian ) root_generate_dictionary( PStartupHandler_SVDict -I${CMAKE_CURRENT_SOURCE_DIR}/../include + -I${PREFIX_INC} PStartupHandler_SV.h LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PStartupHandler_SVLinkDef.h + OPTIONS -inlineInputHeader MODULE PStartupHandler_SV ) diff --git a/src/external/libZFRelaxation/CMakeLists.txt b/src/external/libZFRelaxation/CMakeLists.txt index 8beaa49e..8b32160f 100644 --- a/src/external/libZFRelaxation/CMakeLists.txt +++ b/src/external/libZFRelaxation/CMakeLists.txt @@ -3,14 +3,17 @@ #--- generate necessary dictionaries ------------------------------------------ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include) set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( ZFRelaxationDict -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${BMW_TOOLS_INC} + -I${PREFIX_INC} ZFRelaxation.h LINKDEF ZFRelaxationLinkDef.h + OPTIONS -inlineInputHeader MODULE ZFRelaxation ) From a7806f7e02bad2ac5e335837ac627b05e29aea90 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Mon, 4 Feb 2019 10:52:37 +0100 Subject: [PATCH 3/8] added necessary CPack tag for redhat flavor. --- cmake/CPackOptions.cmake.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/CPackOptions.cmake.in b/cmake/CPackOptions.cmake.in index 1d24ed67..3a1c6a2b 100644 --- a/cmake/CPackOptions.cmake.in +++ b/cmake/CPackOptions.cmake.in @@ -29,6 +29,8 @@ if (${CPACK_GENERATOR} STREQUAL "RPM") set (CPACK_PACKAGING_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") set (CPACK_RPM_FILE_NAME "RPM-DEFAULT") set (CPACK_RPM_PACKAGE_RELEASE "1") + # next variable for RHEL, CentOS, Fedfora + set (CPACK_RPM_PACKAGE_RELEASE_DIST "") set (CPACK_RPM_PACKAGE_LICENSE "GPLv2") set (CPACK_RPM_PACKAGE_VENDOR "Paul Scherrer Institute - LMU - LEM") set (CPACK_RPM_CHANGELOG_FILE "@PROJECT_SOURCE_DIR@/cmake/ChangeLogRPM") From d48615650e4588ae03444c067e669970a99c8729 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Mon, 4 Feb 2019 10:53:35 +0100 Subject: [PATCH 4/8] adopted for yum update which calls at the end the uninstall script. --- cmake/post_install.sh | 4 +--- cmake/post_uninstall.sh | 10 +--------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/cmake/post_install.sh b/cmake/post_install.sh index 3763661a..b77b2367 100644 --- a/cmake/post_install.sh +++ b/cmake/post_install.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo ">> musrfit post install script started ..." +echo " >> musrfit post install script started ..." # test if nemu-x86_64.conf does not exist if [ ! -f "/etc/ld.so.conf.d/nemu-x86_64.conf" ] @@ -10,5 +10,3 @@ then fi /sbin/ldconfig -echo ">> musrfit post install script done." - diff --git a/cmake/post_uninstall.sh b/cmake/post_uninstall.sh index 51390702..22ee00ec 100644 --- a/cmake/post_uninstall.sh +++ b/cmake/post_uninstall.sh @@ -1,13 +1,5 @@ #!/bin/bash -echo ">> musrfit post uninstall script started ..." +echo " >> musrfit post uninstall script started ..." -# test if nemu-x86_64.conf does not exist -if [ -f "/etc/ld.so.conf.d/nemu-x86_64.conf" ] -then - rm -f /etc/ld.so.conf.d/nemu-x86_64.conf -fi /sbin/ldconfig - -echo ">> musrfit post uninstall script done." - From c64a8146b79b8170d65044c9e7826c39ec7b1ab0 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Mon, 4 Feb 2019 10:54:52 +0100 Subject: [PATCH 5/8] added the necessary header-, pcm-, and rootmap-files. This is needed when distrbuted as package. --- src/musredit_qt5/mupp/plotter/CMakeLists.txt | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/musredit_qt5/mupp/plotter/CMakeLists.txt b/src/musredit_qt5/mupp/plotter/CMakeLists.txt index 6f6cf7d7..5ae58a4b 100644 --- a/src/musredit_qt5/mupp/plotter/CMakeLists.txt +++ b/src/musredit_qt5/mupp/plotter/CMakeLists.txt @@ -25,21 +25,27 @@ set ( PLOT_DIR ${CMAKE_CURRENT_BINARY_DIR} ) +set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) + #--- generate necessary dictionaries ------------------------------------------ root_generate_dictionary( PMuppCanvasDict -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/.. + -I${PREFIX_INC} PMuppCanvas.h LINKDEF PMuppCanvasLinkDef.h + OPTIONS -inlineInputHeader MODULE PMuppCanvas ) root_generate_dictionary( PMuppStartupHandlerDict -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/.. + -I${PREFIX_INC} PMuppStartupHandler.h LINKDEF PMuppStartupHandlerLinkDef.h + OPTIONS -inlineInputHeader MODULE PMuppStartupHandler ) @@ -71,3 +77,21 @@ if (APPLE) else (APPLE) install(TARGETS mupp_plot DESTINATION bin) endif (APPLE) + +#--- install root pcm's and rootmaps ------------------------------------------ +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libPMuppCanvas_rdict.pcm + ${CMAKE_CURRENT_BINARY_DIR}/libPMuppCanvas.rootmap + ${CMAKE_CURRENT_BINARY_DIR}/libPMuppStartupHandler_rdict.pcm + ${CMAKE_CURRENT_BINARY_DIR}/libPMuppStartupHandler.rootmap + DESTINATION lib +) + +#--- install headers ---------------------------------------------------------- +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/../mupp.h + ${CMAKE_CURRENT_SOURCE_DIR}/mupp_plot.h + ${CMAKE_CURRENT_SOURCE_DIR}/PMuppCanvas.h + ${CMAKE_CURRENT_SOURCE_DIR}/PMuppStartupHandler.h + DESTINATION include +) From 29d35579a76a41b840c5848d342111c0cc10b00c Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Mon, 4 Feb 2019 19:43:31 +0100 Subject: [PATCH 6/8] added the current source code path to root_generate_dictionary. --- src/external/MagProximity/CMakeLists.txt | 2 ++ src/external/Nonlocal/CMakeLists.txt | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/external/MagProximity/CMakeLists.txt b/src/external/MagProximity/CMakeLists.txt index 57d37b0d..7aa988ee 100644 --- a/src/external/MagProximity/CMakeLists.txt +++ b/src/external/MagProximity/CMakeLists.txt @@ -8,6 +8,7 @@ root_generate_dictionary( PMagProximityFitterDict -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} + -I${CMAKE_CURRENT_SOURCE_DIR} -I${PREFIX_INC} PMagProximityFitter.h LINKDEF PMagProximityFitterLinkDef.h @@ -17,6 +18,7 @@ root_generate_dictionary( root_generate_dictionary( PMPStartupHandlerDict -I${MUSRFIT_INC} + -I${CMAKE_CURRENT_SOURCE_DIR} -I${PREFIX_INC} PMPStartupHandler.h LINKDEF PMPStartupHandlerLinkDef.h diff --git a/src/external/Nonlocal/CMakeLists.txt b/src/external/Nonlocal/CMakeLists.txt index 89786877..10d67ccb 100644 --- a/src/external/Nonlocal/CMakeLists.txt +++ b/src/external/Nonlocal/CMakeLists.txt @@ -7,14 +7,22 @@ set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include) root_generate_dictionary( PNL_PippardFitterDict - -I${FFTW3_INCLUDE_DIR} -I${MUSRFIT_INC} -I${NONLOCAL_INC} -I${PREFIX_INC} PNL_PippardFitter.h + -I${FFTW3_INCLUDE_DIR} + -I${MUSRFIT_INC} + -I${NONLOCAL_INC} + -I${CMAKE_CURRENT_SOURCE_DIR} + -I${PREFIX_INC} + PNL_PippardFitter.h LINKDEF PNL_PippardFitterLinkDef.h OPTIONS -inlineInputHeader MODULE PNL_PippardFitter ) root_generate_dictionary( PNL_StartupHandlerDict - -I${NONLOCAL_INC} -I${PREFIX_INC} PNL_StartupHandler.h + -I${NONLOCAL_INC} + -I${CMAKE_CURRENT_SOURCE_DIR} + -I${PREFIX_INC} + PNL_StartupHandler.h LINKDEF PNL_StartupHandlerLinkDef.h OPTIONS -inlineInputHeader MODULE PNL_StartupHandler From 97beb80c4bf8b79806e974028177331478d685f1 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Tue, 5 Feb 2019 09:51:30 +0100 Subject: [PATCH 7/8] Dynamic Search Path for ROOT Dictionary Added by default the dynamic search path '/usr/local/lib' to ROOT. This is needed to find the necessary dictionaries for musrfit, musrview, musrt0. Furthermore, added an option '--show-dynamic-path' to these programs which allow the user to dump the currently used dynamic search paths. This is potentially handy for diagnostics. --- src/musrfit.cpp | 14 ++++++++++++-- src/musrt0.cpp | 16 +++++++++++++--- src/musrview.cpp | 10 ++++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/musrfit.cpp b/src/musrfit.cpp index 0fceb740..59a51439 100644 --- a/src/musrfit.cpp +++ b/src/musrfit.cpp @@ -90,12 +90,13 @@ void musrfit_syntax() cout << endl << "usage: musrfit [ [-k, --keep-mn2-ouput] [-c, --chisq-only] [-t, --title-from-data-file]"; cout << endl << " [-e, --estimateN0] [-p, --per-run-block-chisq]"; cout << endl << " [--dump ] [--timeout ] |"; - cout << endl << " --nexus-support | --version | --help"; + cout << endl << " --nexus-support | --show-dynamic-path | --version | --help"; cout << endl << " : msr input file"; cout << endl << " 'musrfit ' will execute musrfit"; cout << endl << " 'musrfit' or 'musrfit --help' will show this help"; cout << endl << " 'musrfit --version' will print the musrfit version"; cout << endl << " 'musrfit --nexus-support' will print if NeXus support is available."; + cout << endl << " 'musrfit --show-dynamic-path' will print the internal dynamic library search paths."; cout << endl << " -k, --keep-mn2-output: will rename the files MINUIT2.OUTPUT and "; cout << endl << " MINUIT2.root to -mn2.output and -mn2.root,"; cout << endl << " respectively,"; @@ -456,6 +457,11 @@ int main(int argc, char *argv[]) return PMUSR_WRONG_STARTUP_SYNTAX; } + // add default shared library path /usr/local/lib if not already persent + const char *dsp = gSystem->GetDynamicPath(); + if (strstr(dsp, "/usr/local/lib") == NULL) + gSystem->AddDynamicPath("/usr/local/lib"); + if (argc == 2) { if (!strcmp(argv[1], "--version")) { #ifdef HAVE_CONFIG_H @@ -468,9 +474,13 @@ int main(int argc, char *argv[]) #ifdef PNEXUS_ENABLED cout << endl << ">> musrfit: NeXus support enabled." << endl << endl; #else - cout << endl << ">> musrfit: NeXus support NOT enabled." << endl << endl; + cout << endl << "musrfit: NeXus support NOT enabled." << endl << endl; #endif return PMUSR_SUCCESS; + } else if (!strcmp(argv[1], "--show-dynamic-path")) { + cout << endl << "musrfit: internal dynamic search paths for shared libraries/root dictionaries:"; + cout << endl << " '" << gSystem->GetDynamicPath() << "'" << endl << endl; + return PMUSR_SUCCESS; } else if (!strcmp(argv[1], "--help")) { show_syntax = true; } diff --git a/src/musrt0.cpp b/src/musrt0.cpp index dab51fa7..c260c0fe 100644 --- a/src/musrt0.cpp +++ b/src/musrt0.cpp @@ -57,7 +57,7 @@ using namespace std; void musrt0_syntax() { cout << endl << "usage: musrt0 [{--getT0FromPromptPeak | -g} []]"; - cout << endl << " [--timeout ] | --version | --help"; + cout << endl << " [--timeout ] | --show-dynamic-path | --version | --help"; cout << endl << " : msr input file"; cout << endl << " --getT0FromPromptPeak, -g with :"; cout << endl << " will, in non-interactive mode estimate the t0's from the prompt peak"; @@ -72,6 +72,7 @@ void musrt0_syntax() cout << endl << " 180 sec if not already done so."; cout << endl << " 'musrt0' or 'musrt0 --help' will show this help"; cout << endl << " 'musrt0 --version' will print the musrt0 version"; + cout << endl << " 'musrt0 --show-dynamic-path' dumps the dynamic search paths and exit."; cout << endl << endl; } @@ -228,6 +229,11 @@ Int_t main(Int_t argc, Char_t *argv[]) return PMUSR_SUCCESS; } + // add default shared library path /usr/local/lib if not already persent + const char *dsp = gSystem->GetDynamicPath(); + if (strstr(dsp, "/usr/local/lib") == NULL) + gSystem->AddDynamicPath("/usr/local/lib"); + memset(filename, '\0', sizeof(filename)); for (int i=1; iGetDynamicPath() << "'" << endl << endl; + return PMUSR_SUCCESS; } else if (strstr(argv[i], ".msr")) { // check for filename if (strlen(filename) == 0) { strcpy(filename, argv[i]); diff --git a/src/musrview.cpp b/src/musrview.cpp index bebb5d09..d23f31e5 100644 --- a/src/musrview.cpp +++ b/src/musrview.cpp @@ -62,6 +62,7 @@ void musrview_syntax() cout << endl << " Options:"; cout << endl << " --help : display this help and exit."; cout << endl << " --version : output version information and exit."; + cout << endl << " --show-dynamic-path : dumps the dynamic search paths and exit."; cout << endl << " -f, --fourier: will directly present the Fourier transform of the ."; cout << endl << " -a, --avg: will directly present the averaged data/Fourier of the ."; cout << endl << " --: "; @@ -111,6 +112,11 @@ int main(int argc, char *argv[]) memset(fileName, '\0', sizeof(fileName)); + // add default shared library path /usr/local/lib if not already persent + const char *dsp = gSystem->GetDynamicPath(); + if (strstr(dsp, "/usr/local/lib") == NULL) + gSystem->AddDynamicPath("/usr/local/lib"); + // check input arguments if (argc == 1) { musrview_syntax(); @@ -132,6 +138,10 @@ int main(int argc, char *argv[]) cout << endl << "musrview git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl; #endif return PMUSR_SUCCESS; + } else if (!strcmp(argv[i], "--show-dynamic-path")) { + cout << endl << "musrview: internal dynamic search paths for shared libraries/root dictionaries:"; + cout << endl << " '" << gSystem->GetDynamicPath() << "'" << endl << endl; + return PMUSR_SUCCESS; } else if (!strcmp(argv[i], "--help")) { show_syntax = true; break; From 64f73ffb11de8b497c505b2e080add7e79a38fd8 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Thu, 14 Feb 2019 09:35:32 +0100 Subject: [PATCH 8/8] find theme in case default channel fail. This is ugly and eventually needs a better solution. --- src/musredit_qt5/musredit/PTextEdit.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/musredit_qt5/musredit/PTextEdit.cpp b/src/musredit_qt5/musredit/PTextEdit.cpp index b88197ca..3f9d8ade 100644 --- a/src/musredit_qt5/musredit/PTextEdit.cpp +++ b/src/musredit_qt5/musredit/PTextEdit.cpp @@ -3093,8 +3093,31 @@ void PTextEdit::getTheme() fDarkToolBarIcon = false; // needed for ubuntu dark since there the menu icons are dark, however the toolbar icons are plain! QString str = QIcon::themeName(); + qDebug() << "debug> theme name=" << str << endl; - qDebug() << "debug> str=" << str << endl; + if (str.isEmpty()) { // this is ugly and eventually needs to be fixed in a more coherent way + str = QProcessEnvironment::systemEnvironment().value("HOME", QString("??")); + str += "/.kde4/share/config/kdeglobals"; + if (QFile::exists(str)) { + QFile fln(str); + fln.open(QIODevice::ReadOnly | QIODevice::Text); + QTextStream fin(&fln); + QString line(""); + bool done = false; + while (!fin.atEnd() && !done) { + line = fin.readLine(); + if (line.contains("ColorScheme")) { + if (line.contains("dark", Qt::CaseInsensitive)) { + fDarkTheme = true; + fDarkToolBarIcon = true; + } + done = true; + } + } + fln.close(); + } + return; + } if (str.contains("dark", Qt::CaseInsensitive)) { fDarkTheme = true;