From 50f8f6c4d224c453f167d91600b9e99d048da1e5 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 22 Mar 2023 11:18:19 +0900 Subject: [PATCH 1/2] GH-34670: [Packaging][C++] Add support for customizing gdb plugin install directory --- cpp/cmake_modules/DefineOptions.cmake | 7 +++++++ cpp/src/arrow/CMakeLists.txt | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake index d422514d134..50af2736d33 100644 --- a/cpp/cmake_modules/DefineOptions.cmake +++ b/cpp/cmake_modules/DefineOptions.cmake @@ -614,6 +614,13 @@ advised that if this is enabled 'install' will fail silently on components;\ that have not been built" OFF) + define_option_string(ARROW_GDB_INSTALL_DIR + "Use a custom install directory for GDB plugin. \ +In general, you don't need to specify this because the default \ +(CMAKE_INSTALL_FULL_BINDIR on Windows, CMAKE_INSTALL_FULL_LIBDIR otherwise) \ +is reasonable." + "") + option(ARROW_BUILD_CONFIG_SUMMARY_JSON "Summarize build configuration in a JSON file" ON) diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index 28f37af9bf1..357cb6949c7 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -659,20 +659,27 @@ add_arrow_lib(arrow # So it's disabled for now. if(ARROW_BUILD_SHARED AND NOT WIN32) configure_file(libarrow_gdb.py.in "${CMAKE_CURRENT_BINARY_DIR}/libarrow_gdb.py" @ONLY) + if(NOT ARROW_GDB_INSTALL_DIR) + if(WIN32) + set(ARROW_GDB_INSTALL_DIR ${CMAKE_INSTALL_FULL_BINDIR}) + else() + set(ARROW_GDB_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR}) + endif() + endif() set(ARROW_GDB_AUTO_LOAD_LIBARROW_GDB_INSTALL FALSE) if(WIN32) find_program(cygpath "cygpath") if(cygpath) - execute_process(COMMAND cygpath "${CMAKE_INSTALL_FULL_BINDIR}" - OUTPUT_VARIABLE MSYS2_CMAKE_INSTALL_FULL_BINDIR + execute_process(COMMAND cygpath "${ARROW_GDB_INSTALL_DIR}" + OUTPUT_VARIABLE MSYS2_ARROW_GDB_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) set(ARROW_GDB_AUTO_LOAD_LIBARROW_GDB_DIR - "${ARROW_GDB_AUTO_LOAD_DIR}${MSYS2_CMAKE_INSTALL_FULL_BINDIR}") + "${ARROW_GDB_AUTO_LOAD_DIR}${MSYS2_ARROW_GDB_INSTALL_DIR}") set(ARROW_GDB_AUTO_LOAD_LIBARROW_GDB_INSTALL TRUE) endif() else() set(ARROW_GDB_AUTO_LOAD_LIBARROW_GDB_DIR - "${ARROW_GDB_AUTO_LOAD_DIR}/${CMAKE_INSTALL_FULL_LIBDIR}") + "${ARROW_GDB_AUTO_LOAD_DIR}/${ARROW_GDB_INSTALL_DIR}") set(ARROW_GDB_AUTO_LOAD_LIBARROW_GDB_INSTALL TRUE) endif() if(ARROW_GDB_AUTO_LOAD_LIBARROW_GDB_INSTALL) From dc90ff1ab2b465d5c47635948ac53f77ad37bd49 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 24 Mar 2023 16:18:02 +0900 Subject: [PATCH 2/2] Fix newline --- cpp/cmake_modules/DefineOptions.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake index 50af2736d33..58d1c769b57 100644 --- a/cpp/cmake_modules/DefineOptions.cmake +++ b/cpp/cmake_modules/DefineOptions.cmake @@ -615,9 +615,9 @@ that have not been built" OFF) define_option_string(ARROW_GDB_INSTALL_DIR - "Use a custom install directory for GDB plugin. \ -In general, you don't need to specify this because the default \ -(CMAKE_INSTALL_FULL_BINDIR on Windows, CMAKE_INSTALL_FULL_LIBDIR otherwise) \ + "Use a custom install directory for GDB plugin.;\ +In general, you don't need to specify this because the default;\ +(CMAKE_INSTALL_FULL_BINDIR on Windows, CMAKE_INSTALL_FULL_LIBDIR otherwise);\ is reasonable." "")