From af6661458fca0d7d723d94a3040bdec91cc434bd Mon Sep 17 00:00:00 2001 From: Javier Galan Date: Wed, 28 Feb 2024 16:16:20 +0100 Subject: [PATCH 1/6] Fixes MacOs installation by providing header directory of brew installation system --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f58e2e85e..bf4f51c22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,11 @@ endif () set(external_include_dirs) set(external_libs) +if (CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(external_include_dirs ${external_include_dirs} "/usr/local/include/") + message(STATUS "Adding BREW include directory: /usr/local/include") +endif (CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${DECAY_PATH}/cmake ${CMAKE_MODULE_PATH}) set(CMAKE_MACOSX_RPATH 1) From 538c21379d97c55e34aee86f0a989e1dea29a24f Mon Sep 17 00:00:00 2001 From: Javier Galan Date: Wed, 28 Feb 2024 17:34:00 +0100 Subject: [PATCH 2/6] CMakeLists.txt now pcm files go into the lib directory also for MacOs --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf4f51c22..e0014ad5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -361,7 +361,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin") # we must call library install here in endif () # Copy pcm files -if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "Windows") +if ( CMAKE_SYSTEM_NAME MATCHES "Windows") # Copy pcm files to bin install( From ea4e8750e1a78b425ac76ccf9529db47f808b93a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 16:35:31 +0000 Subject: [PATCH 3/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0014ad5f..557218d49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -361,7 +361,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin") # we must call library install here in endif () # Copy pcm files -if ( CMAKE_SYSTEM_NAME MATCHES "Windows") +if (CMAKE_SYSTEM_NAME MATCHES "Windows") # Copy pcm files to bin install( From 4fdcbceaf110fa1eac5c6d5144b1632adfbc9d3b Mon Sep 17 00:00:00 2001 From: Javier Galan Date: Thu, 29 Feb 2024 16:13:21 +0100 Subject: [PATCH 4/6] REST_ListMacros. Adding new arguments to restListMacros --- macros/REST_ListMacros.C | 100 ++++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 34 deletions(-) diff --git a/macros/REST_ListMacros.C b/macros/REST_ListMacros.C index 3059259af..55accbda5 100644 --- a/macros/REST_ListMacros.C +++ b/macros/REST_ListMacros.C @@ -13,51 +13,83 @@ using namespace std; //*** Lists all the official macros together with its documentation //*** //******************************************************************************************************* -Int_t REST_ListMacros() { +Int_t REST_ListMacros( int details = 0, std::string onlyThisMacro = "") { string macrosPath = (string)getenv("REST_PATH") + "/macros"; vector directories = TRestTools::GetSubdirectories(macrosPath); - cout << "Directory : " << macrosPath << endl; + cout << endl; + cout << "Entering directory : " << macrosPath << endl; vector main_files = TRestTools::GetFilesMatchingPattern(macrosPath + "/REST_*.C"); - for (int m = 0; m < main_files.size(); m++) { - cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; - cout << " ++ " - << " Macro : " << TRestTools::SeparatePathAndName(main_files[m]).second << endl; - std::ifstream t(main_files[m]); - std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); - - std::vector lines = REST_StringHelper::Split(str, "\n"); - - cout << " ++ " << endl; - for (int l = 0; l < lines.size(); l++) - if (lines[l].find("//*** ") != string::npos) - cout << " ++ " << lines[l].substr(6, -1) << endl; - cout << " ++ " << endl; + if( details ) + { + for (int m = 0; m < main_files.size(); m++) { + std::string macro = TRestTools::SeparatePathAndName(main_files[m]).second; + if( !onlyThisMacro.empty() && onlyThisMacro != macro ) + continue; + cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + cout << " ++ " + << " Macro : " << macro << endl; + std::ifstream t(main_files[m]); + std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); + + std::vector lines = REST_StringHelper::Split(str, "\n"); + + cout << " ++ " << endl; + for (int l = 0; l < lines.size(); l++) + if (lines[l].find("//*** ") != string::npos) + cout << " ++ " << lines[l].substr(6, -1) << endl; + cout << " ++ " << endl; + } + cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + } + else + { + for (int m = 0; m < main_files.size(); m++) { + cout << " + " << TRestTools::SeparatePathAndName(main_files[m]).second << endl; + } } - cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; for (int n = 0; n < directories.size(); n++) { - cout << "Directory : " << directories[n] << endl; + cout << endl; + cout << "Entering directory : " << directories[n] << endl; if (directories[n].find("pipeline") != string::npos) continue; if (directories[n].find("/macros/mac/") != string::npos) continue; vector files = TRestTools::GetFilesMatchingPattern(directories[n] + "/REST_*.C"); - for (int m = 0; m < files.size(); m++) { - cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; - cout << " ++ " - << " Macro : " << TRestTools::SeparatePathAndName(files[m]).second << endl; - std::ifstream t(files[m]); - std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); - - std::vector lines = REST_StringHelper::Split(str, "\n"); - - cout << " ++ " << endl; - for (int l = 0; l < lines.size(); l++) - if (lines[l].find("//*** ") != string::npos) - cout << " ++ " << lines[l].substr(6, -1) << endl; - cout << " ++ " << endl; - } - cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + if( details ) + { + for (int m = 0; m < files.size(); m++) { + std::string macro = TRestTools::SeparatePathAndName(files[m]).second; + if( !onlyThisMacro.empty() && onlyThisMacro != macro ) + continue; + cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + cout << " ++ Macro : " << macro << endl; + std::ifstream t(files[m]); + std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); + + std::vector lines = REST_StringHelper::Split(str, "\n"); + + cout << " ++ " << endl; + for (int l = 0; l < lines.size(); l++) + if (lines[l].find("//*** ") != string::npos) + cout << " ++ " << lines[l].substr(6, -1) << endl; + cout << " ++ " << endl; + } + cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + } + else + { + for (int m = 0; m < files.size(); m++) { + cout << " + " << TRestTools::SeparatePathAndName(files[m]).second << endl; + } + std::cout << std::endl; + std::cout << " ------- " << std::endl; + std::cout << "IMPORTANT. To get a more detailed macro documentation enable the details argument:" << std::endl; + std::cout << "Execute: restListMacros 1" << std::endl; + std::cout << "OR if you want to show only the documentation of a given macro, add the macro.C filename as argument" << std::endl; + std::cout << "Execute: restListMacros 1 REST_CheckValidRuns.C" << std::endl; + std::cout << " ------- " << std::endl; + } } return 0; } From d555ed611a69cc052bd90f4a2e17455ecf6f790c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:14:28 +0000 Subject: [PATCH 5/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- macros/REST_ListMacros.C | 112 +++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 58 deletions(-) diff --git a/macros/REST_ListMacros.C b/macros/REST_ListMacros.C index 55accbda5..4333dead8 100644 --- a/macros/REST_ListMacros.C +++ b/macros/REST_ListMacros.C @@ -13,40 +13,36 @@ using namespace std; //*** Lists all the official macros together with its documentation //*** //******************************************************************************************************* -Int_t REST_ListMacros( int details = 0, std::string onlyThisMacro = "") { +Int_t REST_ListMacros(int details = 0, std::string onlyThisMacro = "") { string macrosPath = (string)getenv("REST_PATH") + "/macros"; vector directories = TRestTools::GetSubdirectories(macrosPath); cout << endl; cout << "Entering directory : " << macrosPath << endl; vector main_files = TRestTools::GetFilesMatchingPattern(macrosPath + "/REST_*.C"); - if( details ) - { - for (int m = 0; m < main_files.size(); m++) { - std::string macro = TRestTools::SeparatePathAndName(main_files[m]).second; - if( !onlyThisMacro.empty() && onlyThisMacro != macro ) - continue; - cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; - cout << " ++ " - << " Macro : " << macro << endl; - std::ifstream t(main_files[m]); - std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); + if (details) { + for (int m = 0; m < main_files.size(); m++) { + std::string macro = TRestTools::SeparatePathAndName(main_files[m]).second; + if (!onlyThisMacro.empty() && onlyThisMacro != macro) continue; + cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + cout << " ++ " + << " Macro : " << macro << endl; + std::ifstream t(main_files[m]); + std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); - std::vector lines = REST_StringHelper::Split(str, "\n"); + std::vector lines = REST_StringHelper::Split(str, "\n"); - cout << " ++ " << endl; - for (int l = 0; l < lines.size(); l++) - if (lines[l].find("//*** ") != string::npos) - cout << " ++ " << lines[l].substr(6, -1) << endl; - cout << " ++ " << endl; - } - cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; - } - else - { - for (int m = 0; m < main_files.size(); m++) { - cout << " + " << TRestTools::SeparatePathAndName(main_files[m]).second << endl; - } + cout << " ++ " << endl; + for (int l = 0; l < lines.size(); l++) + if (lines[l].find("//*** ") != string::npos) + cout << " ++ " << lines[l].substr(6, -1) << endl; + cout << " ++ " << endl; + } + cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + } else { + for (int m = 0; m < main_files.size(); m++) { + cout << " + " << TRestTools::SeparatePathAndName(main_files[m]).second << endl; + } } for (int n = 0; n < directories.size(); n++) { @@ -56,40 +52,40 @@ Int_t REST_ListMacros( int details = 0, std::string onlyThisMacro = "") { if (directories[n].find("/macros/mac/") != string::npos) continue; vector files = TRestTools::GetFilesMatchingPattern(directories[n] + "/REST_*.C"); - if( details ) - { - for (int m = 0; m < files.size(); m++) { - std::string macro = TRestTools::SeparatePathAndName(files[m]).second; - if( !onlyThisMacro.empty() && onlyThisMacro != macro ) - continue; - cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; - cout << " ++ Macro : " << macro << endl; - std::ifstream t(files[m]); - std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); + if (details) { + for (int m = 0; m < files.size(); m++) { + std::string macro = TRestTools::SeparatePathAndName(files[m]).second; + if (!onlyThisMacro.empty() && onlyThisMacro != macro) continue; + cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + << endl; + cout << " ++ Macro : " << macro << endl; + std::ifstream t(files[m]); + std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); - std::vector lines = REST_StringHelper::Split(str, "\n"); + std::vector lines = REST_StringHelper::Split(str, "\n"); - cout << " ++ " << endl; - for (int l = 0; l < lines.size(); l++) - if (lines[l].find("//*** ") != string::npos) - cout << " ++ " << lines[l].substr(6, -1) << endl; - cout << " ++ " << endl; - } - cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; - } - else - { - for (int m = 0; m < files.size(); m++) { - cout << " + " << TRestTools::SeparatePathAndName(files[m]).second << endl; - } - std::cout << std::endl; - std::cout << " ------- " << std::endl; - std::cout << "IMPORTANT. To get a more detailed macro documentation enable the details argument:" << std::endl; - std::cout << "Execute: restListMacros 1" << std::endl; - std::cout << "OR if you want to show only the documentation of a given macro, add the macro.C filename as argument" << std::endl; - std::cout << "Execute: restListMacros 1 REST_CheckValidRuns.C" << std::endl; - std::cout << " ------- " << std::endl; - } + cout << " ++ " << endl; + for (int l = 0; l < lines.size(); l++) + if (lines[l].find("//*** ") != string::npos) + cout << " ++ " << lines[l].substr(6, -1) << endl; + cout << " ++ " << endl; + } + cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl; + } else { + for (int m = 0; m < files.size(); m++) { + cout << " + " << TRestTools::SeparatePathAndName(files[m]).second << endl; + } + std::cout << std::endl; + std::cout << " ------- " << std::endl; + std::cout << "IMPORTANT. To get a more detailed macro documentation enable the details argument:" + << std::endl; + std::cout << "Execute: restListMacros 1" << std::endl; + std::cout << "OR if you want to show only the documentation of a given macro, add the macro.C " + "filename as argument" + << std::endl; + std::cout << "Execute: restListMacros 1 REST_CheckValidRuns.C" << std::endl; + std::cout << " ------- " << std::endl; + } } return 0; } From b1b7321ce46052c9c1bf6e84d7d3a2d1fc2fd1c3 Mon Sep 17 00:00:00 2001 From: Javier Galan Date: Thu, 29 Feb 2024 22:15:21 +0100 Subject: [PATCH 6/6] Replacing obsolete cmake function --- cmake/cmake_uninstall.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in index e925304f8..dc36259c0 100644 --- a/cmake/cmake_uninstall.cmake.in +++ b/cmake/cmake_uninstall.cmake.in @@ -8,7 +8,7 @@ string(REGEX REPLACE "\n" ";" files "${files}") foreach(file ${files}) message(STATUS "Uninstalling $ENV{DESTDIR}${file}") if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - exec_program( + execute_process( "${CMAKE_COMMAND}" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval