From e9f3ab081137b4c888cf4bab3fc471e4e94519eb Mon Sep 17 00:00:00 2001 From: juanan Date: Fri, 21 Apr 2023 09:32:28 +0200 Subject: [PATCH 1/8] Adding uninstall target and proper handling of pcm files --- CMakeLists.txt | 40 +++++++++++++++------------------- cmake/cmake_uninstall.cmake.in | 23 +++++++++++++++++++ 2 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 cmake/cmake_uninstall.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 05fb30a8f..41a496c07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,12 +213,23 @@ include(Testing) # Start compile include(MacroRootDict) +# uninstall target +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() + # Clear the install dir if (NOT DEFINED INSTALL_CLEARDIR) set(INSTALL_CLEARDIR ON) endif () if (${INSTALL_CLEARDIR} MATCHES "ON") - install(CODE "execute_process(COMMAND rm -r ${CMAKE_INSTALL_PREFIX})") + install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -P \"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake\")" ) endif () # Compile and install for each subdir @@ -287,31 +298,19 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows") # we must call library install here in endforeach () # Copy pcm files to bin - install( - CODE " - file(GLOB PCMFiles \"\${CMAKE_CURRENT_SOURCE_DIR}/rootdict/*.pcm\") - file(COPY \${PCMFiles} DESTINATION \${CMAKE_INSTALL_PREFIX}/bin) - ") + file(GLOB PCMFILES "${CMAKE_BINARY_DIR}/rootdict/*.pcm") + install( FILES ${PCMFILES} DESTINATION bin COMPONENT install) else () # Copy pcm files to lib - install( - CODE " - file(GLOB PCMFiles \"\${CMAKE_CURRENT_SOURCE_DIR}/rootdict/*.pcm\") - file(COPY \${PCMFiles} DESTINATION \${CMAKE_INSTALL_PREFIX}/lib) - ") + file(GLOB PCMFILES "${CMAKE_BINARY_DIR}/rootdict/*.pcm") + install( FILES ${PCMFILES} DESTINATION lib COMPONENT install) add_subdirectory(python-bindings) # Create thisREST.sh include(thisREST) - # Add permissions - install( - CODE "execute_process(COMMAND chmod 755 ${CMAKE_INSTALL_PREFIX}/bin/rest-config)" - ) - install(CODE "execute_process(COMMAND chmod 755 ${CMAKE_INSTALL_PREFIX})") - endif () if (CMAKE_SYSTEM_NAME MATCHES "Darwin") # we must call library install here in @@ -333,10 +332,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin") # we must call library install here in endforeach () # Copy pcm files to bin - install( - CODE " - file(GLOB PCMFiles \"\${CMAKE_CURRENT_SOURCE_DIR}/rootdict/*.pcm\") - file(COPY \${PCMFiles} DESTINATION \${CMAKE_INSTALL_PREFIX}/bin) - ") + file(GLOB PCMFILES "${CMAKE_BINARY_DIR}/rootdict/*.pcm") + install( FILES ${PCMFILES} DESTINATION bin COMPONENT install) endif () diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in new file mode 100644 index 000000000..62fbd7b4d --- /dev/null +++ b/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,23 @@ +if(NOT EXISTS "${CMAKE_BINARY_DIR}/install_manifest.txt") + message(WARNING "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") + return() +endif() + +file(READ "${CMAKE_BINARY_DIR}/install_manifest.txt" files) +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( + "${CMAKE_COMMAND}" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif() + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif() +endforeach() + From e35dfe508ee4ab6d0a0e2bba6117a2f4f9682969 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 21 Apr 2023 07:43:36 +0000 Subject: [PATCH 2/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CMakeLists.txt | 37 ++++++++++++++++++++++------------ cmake/cmake_uninstall.cmake.in | 1 - 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41a496c07..681ea3e3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,22 +214,24 @@ include(Testing) include(MacroRootDict) # uninstall target -if(NOT TARGET uninstall) - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY) - - add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) -endif() +if (NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) + + add_custom_target( + uninstall COMMAND ${CMAKE_COMMAND} -P + ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif () # Clear the install dir if (NOT DEFINED INSTALL_CLEARDIR) set(INSTALL_CLEARDIR ON) endif () if (${INSTALL_CLEARDIR} MATCHES "ON") - install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -P \"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake\")" ) + install( + CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -P \"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake\")" + ) endif () # Compile and install for each subdir @@ -299,12 +301,18 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows") # we must call library install here in # Copy pcm files to bin file(GLOB PCMFILES "${CMAKE_BINARY_DIR}/rootdict/*.pcm") - install( FILES ${PCMFILES} DESTINATION bin COMPONENT install) + install( + FILES ${PCMFILES} + DESTINATION bin + COMPONENT install) else () # Copy pcm files to lib file(GLOB PCMFILES "${CMAKE_BINARY_DIR}/rootdict/*.pcm") - install( FILES ${PCMFILES} DESTINATION lib COMPONENT install) + install( + FILES ${PCMFILES} + DESTINATION lib + COMPONENT install) add_subdirectory(python-bindings) @@ -333,6 +341,9 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin") # we must call library install here in # Copy pcm files to bin file(GLOB PCMFILES "${CMAKE_BINARY_DIR}/rootdict/*.pcm") - install( FILES ${PCMFILES} DESTINATION bin COMPONENT install) + install( + FILES ${PCMFILES} + DESTINATION bin + COMPONENT install) endif () diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in index 62fbd7b4d..e925304f8 100644 --- a/cmake/cmake_uninstall.cmake.in +++ b/cmake/cmake_uninstall.cmake.in @@ -20,4 +20,3 @@ foreach(file ${files}) message(STATUS "File $ENV{DESTDIR}${file} does not exist.") endif() endforeach() - From 9d03826d21c0101b91b765ab7050a61539208d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Antonio=20Garc=C3=ADa?= <80903717+juanangp@users.noreply.github.com> Date: Fri, 21 Apr 2023 11:34:26 +0200 Subject: [PATCH 3/8] Reverting changes on file permissions done by mistake --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 681ea3e3c..c7889f6fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,6 +319,12 @@ else () # Create thisREST.sh include(thisREST) + # Add permissions + install( + CODE "execute_process(COMMAND chmod 755 ${CMAKE_INSTALL_PREFIX}/bin/rest-config)" + ) + install(CODE "execute_process(COMMAND chmod 755 ${CMAKE_INSTALL_PREFIX})") + endif () if (CMAKE_SYSTEM_NAME MATCHES "Darwin") # we must call library install here in From 94478cca8dcfc1b4ab52235dc6cf0afdffee8aa9 Mon Sep 17 00:00:00 2001 From: juanan Date: Fri, 21 Apr 2023 14:30:29 +0200 Subject: [PATCH 4/8] Addressing issue with pcm files not being copied --- CMakeLists.txt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c7889f6fa..8d7c649b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -299,20 +299,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows") # we must call library install here in ARCHIVE DESTINATION lib) endforeach () - # Copy pcm files to bin - file(GLOB PCMFILES "${CMAKE_BINARY_DIR}/rootdict/*.pcm") - install( - FILES ${PCMFILES} - DESTINATION bin - COMPONENT install) - else () - # Copy pcm files to lib - file(GLOB PCMFILES "${CMAKE_BINARY_DIR}/rootdict/*.pcm") - install( - FILES ${PCMFILES} - DESTINATION lib - COMPONENT install) add_subdirectory(python-bindings) @@ -345,11 +332,24 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin") # we must call library install here in ARCHIVE DESTINATION lib) endforeach () +endif () + +#Copy pcm files +if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "Windows") + # Copy pcm files to bin - file(GLOB PCMFILES "${CMAKE_BINARY_DIR}/rootdict/*.pcm") + file(GLOB PCMFILES "${CMAKE_CURRENT_BINARY_DIR}/rootdict/*.pcm") install( FILES ${PCMFILES} DESTINATION bin COMPONENT install) +else () -endif () + # Copy pcm files to lib + file(GLOB PCMFILES "${CMAKE_CURRENT_BINARY_DIR}/rootdict/*.pcm") + install( + FILES ${PCMFILES} + DESTINATION lib + COMPONENT install) + +endif() From cece78420cda2562f2d1125db79707f8a055cd95 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 21 Apr 2023 12:30:51 +0000 Subject: [PATCH 5/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d7c649b2..fbf88289c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -334,7 +334,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin") # we must call library install here in endif () -#Copy pcm files +# Copy pcm files if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "Windows") # Copy pcm files to bin @@ -352,4 +352,4 @@ else () DESTINATION lib COMPONENT install) -endif() +endif () From 8a57b55084199dd97543dfa3c0202e0c9c125b46 Mon Sep 17 00:00:00 2001 From: juanan Date: Fri, 21 Apr 2023 17:33:59 +0200 Subject: [PATCH 6/8] Replacing GLOB by directory, trying to address the pipeline issues --- CMakeLists.txt | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d7c649b2..8acdb9184 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,18 +338,12 @@ endif () if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "Windows") # Copy pcm files to bin - file(GLOB PCMFILES "${CMAKE_CURRENT_BINARY_DIR}/rootdict/*.pcm") - install( - FILES ${PCMFILES} - DESTINATION bin - COMPONENT install) + install(DIRECTORY icons ${CMAKE_CURRENT_BINARY_DIR}/rootdict/ DESTINATION bin + FILES_MATCHING PATTERN "*.pcm") else () # Copy pcm files to lib - file(GLOB PCMFILES "${CMAKE_CURRENT_BINARY_DIR}/rootdict/*.pcm") - install( - FILES ${PCMFILES} - DESTINATION lib - COMPONENT install) + install(DIRECTORY icons ${CMAKE_CURRENT_BINARY_DIR}/rootdict/ DESTINATION lib + FILES_MATCHING PATTERN "*.pcm") endif() From 1407ec3c2e1bf0cd25ff4637b996f886cc25dce6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 21 Apr 2023 15:35:23 +0000 Subject: [PATCH 7/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index af1c6e1d2..b853478e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,12 +338,18 @@ endif () if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "Windows") # Copy pcm files to bin - install(DIRECTORY icons ${CMAKE_CURRENT_BINARY_DIR}/rootdict/ DESTINATION bin - FILES_MATCHING PATTERN "*.pcm") + install( + DIRECTORY icons ${CMAKE_CURRENT_BINARY_DIR}/rootdict/ + DESTINATION bin + FILES_MATCHING + PATTERN "*.pcm") else () # Copy pcm files to lib - install(DIRECTORY icons ${CMAKE_CURRENT_BINARY_DIR}/rootdict/ DESTINATION lib - FILES_MATCHING PATTERN "*.pcm") + install( + DIRECTORY icons ${CMAKE_CURRENT_BINARY_DIR}/rootdict/ + DESTINATION lib + FILES_MATCHING + PATTERN "*.pcm") endif () From ef361804db2c1377bdc5857f9a10d6e83b22a499 Mon Sep 17 00:00:00 2001 From: juanan Date: Fri, 21 Apr 2023 17:38:50 +0200 Subject: [PATCH 8/8] Removing folder left by mistake --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b853478e6..6d4e7928f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -339,7 +339,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "Windows") # Copy pcm files to bin install( - DIRECTORY icons ${CMAKE_CURRENT_BINARY_DIR}/rootdict/ + DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/rootdict/ DESTINATION bin FILES_MATCHING PATTERN "*.pcm") @@ -347,7 +347,7 @@ else () # Copy pcm files to lib install( - DIRECTORY icons ${CMAKE_CURRENT_BINARY_DIR}/rootdict/ + DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/rootdict/ DESTINATION lib FILES_MATCHING PATTERN "*.pcm")