From e9d9fc296919f1b27b41be1b9d62d269bf408fb5 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Wed, 13 Aug 2025 15:04:39 -0700 Subject: [PATCH 01/22] Draft ODBC installer code Running `cpack` with NSIS installed creates an installer, but the installer misses dll dependencies. --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 29495eb0fe3..70a82827ad6 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -91,3 +91,28 @@ add_arrow_lib(arrow_flight_sql_odbc foreach(LIB_TARGET ${ARROW_FLIGHT_SQL_ODBC_LIBRARIES}) target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_SQL_ODBC_EXPORTING) endforeach() + +# -AL- code for CPack installer. +# Let's make ODBC Windows installer +#add_executable(coolstuff coolstuff.cxx) + +## -AL- nevermind this won't work since we have a dll. not an executable +#install(TARGETS arrow_flight_sql_odbc RUNTIME DESTINATION bin) +include(InstallRequiredSystemLibraries) + +# -AL- I see `install(TARGETS ${LIB_NAME}_shared` is run as part of `add_arrow_lib` +#install(TARGETS arrow_flight_sql_odbc DESTINATION bin) + +#install(TARGETS ArrowFlightSqlOdbc DESTINATION bin) + +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt") +# Tentative version 1.0.0 (patch version is not set) +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "0") + +set(CPACK_PACKAGE_NAME "Apache Arrow Flight SQL ODBC") +set(CPACK_PACKAGE_VENDOR "Apache Arrow") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver") +set(CPACK_PACKAGE_CONTACT "#TODO arrow maintainers") + +include(CPack) From e21f616740481c55d985ddd63b8c131c38c643c6 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Thu, 14 Aug 2025 14:56:07 -0700 Subject: [PATCH 02/22] Add prints for values Trying to find the path to release/Release folder --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 70a82827ad6..69bd057bf71 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -115,4 +115,22 @@ set(CPACK_PACKAGE_VENDOR "Apache Arrow") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver") set(CPACK_PACKAGE_CONTACT "#TODO arrow maintainers") +# Include all dependent dll files in bin + +# -AL- try to find the path for "release/Release" +message(STATUS "-AL- CMAKE_INSTALL_LIBDIR = ${CMAKE_INSTALL_LIBDIR}") +message(STATUS "-AL- CMAKE_INSTALL_INCLUDEDIR = ${CMAKE_INSTALL_INCLUDEDIR}") +message(STATUS "-AL- CMAKE_INSTALL_BINDIR = ${CMAKE_INSTALL_BINDIR}") +message(STATUS "-AL- ARROW_CMAKE_DIR = ${ARROW_CMAKE_DIR}") +message(STATUS "-AL- ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_PACKAGE_NAME}") +message(STATUS "-AL- ARROW_CMAKE_DIR/ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}") +message(STATUS "-AL- CMAKE_RUNTIME_OUTPUT_DIRECTORY = ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +message(STATUS "-AL- BUILD_OUTPUT_ROOT_DIRECTORY = ${BUILD_OUTPUT_ROOT_DIRECTORY}") +message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") + +#install(DIRECTORY ${CMAKE_SOURCE_DIR}/external/bin/ +# DESTINATION bin +# FILES_MATCHING +# PATTERN "*.dll") + include(CPack) From 0cad6f425fc6502f98f20895ebe419b573e4df94 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Thu, 14 Aug 2025 15:10:43 -0700 Subject: [PATCH 03/22] fix for getting dependency dll files --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 69bd057bf71..7f9fb7f1b3e 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -127,10 +127,12 @@ message(STATUS "-AL- ARROW_CMAKE_DIR/ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_DI message(STATUS "-AL- CMAKE_RUNTIME_OUTPUT_DIRECTORY = ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") message(STATUS "-AL- BUILD_OUTPUT_ROOT_DIRECTORY = ${BUILD_OUTPUT_ROOT_DIRECTORY}") message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") +message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}") -#install(DIRECTORY ${CMAKE_SOURCE_DIR}/external/bin/ -# DESTINATION bin -# FILES_MATCHING -# PATTERN "*.dll") +install(DIRECTORY ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE} + # DESTINATION ${CMAKE_INSTALL_BINDIR} #-AL- didn't work + DESTINATION bin + FILES_MATCHING + PATTERN "*.dll") include(CPack) From 23e8f3017dcae90285d62dc2dc5349641bc8cf7f Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Fri, 15 Aug 2025 13:11:14 -0700 Subject: [PATCH 04/22] Install files directly instead of using directory --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 7f9fb7f1b3e..da4098c1143 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -129,10 +129,16 @@ message(STATUS "-AL- BUILD_OUTPUT_ROOT_DIRECTORY = ${BUILD_OUTPUT_ROOT_DIRECTORY message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}") -install(DIRECTORY ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE} - # DESTINATION ${CMAKE_INSTALL_BINDIR} #-AL- didn't work - DESTINATION bin - FILES_MATCHING - PATTERN "*.dll") +file(GLOB FLIGHT_SQL_ODBC_DLL_FILES "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/*.dll") + +install(FILES ${FLIGHT_SQL_ODBC_DLL_FILES} + DESTINATION bin) + +# Copies entire `CMAKE_BUILD_TYPE` directory instead of just the dll files +#install(FILES ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE} + ##### DESTINATION ${CMAKE_INSTALL_BINDIR} #-AL- didn't work +# DESTINATION bin +# FILES_MATCHING +# PATTERN "*.dll") include(CPack) From f29c1405ffadcfe0a12e7fdcf8dae0583fb9f161 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Fri, 15 Aug 2025 13:30:08 -0700 Subject: [PATCH 05/22] Fix to use correct way to load dll This reverts commit 23e8f3017dcae90285d62dc2dc5349641bc8cf7f. --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index da4098c1143..a6153a18feb 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -129,16 +129,9 @@ message(STATUS "-AL- BUILD_OUTPUT_ROOT_DIRECTORY = ${BUILD_OUTPUT_ROOT_DIRECTORY message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}") -file(GLOB FLIGHT_SQL_ODBC_DLL_FILES "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/*.dll") - -install(FILES ${FLIGHT_SQL_ODBC_DLL_FILES} - DESTINATION bin) - -# Copies entire `CMAKE_BUILD_TYPE` directory instead of just the dll files -#install(FILES ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE} - ##### DESTINATION ${CMAKE_INSTALL_BINDIR} #-AL- didn't work -# DESTINATION bin -# FILES_MATCHING -# PATTERN "*.dll") +install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" + DESTINATION bin + FILES_MATCHING + PATTERN "*.dll") include(CPack) From 7e3f171d71ccd90ff7945ea264b76f34821fd2d9 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Mon, 18 Aug 2025 13:18:18 -0700 Subject: [PATCH 06/22] Draft for filtering files --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 30 +++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index a6153a18feb..dee32678a8e 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -93,18 +93,10 @@ foreach(LIB_TARGET ${ARROW_FLIGHT_SQL_ODBC_LIBRARIES}) endforeach() # -AL- code for CPack installer. -# Let's make ODBC Windows installer -#add_executable(coolstuff coolstuff.cxx) +# Construct ODBC Windows installer -## -AL- nevermind this won't work since we have a dll. not an executable -#install(TARGETS arrow_flight_sql_odbc RUNTIME DESTINATION bin) include(InstallRequiredSystemLibraries) -# -AL- I see `install(TARGETS ${LIB_NAME}_shared` is run as part of `add_arrow_lib` -#install(TARGETS arrow_flight_sql_odbc DESTINATION bin) - -#install(TARGETS ArrowFlightSqlOdbc DESTINATION bin) - set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt") # Tentative version 1.0.0 (patch version is not set) set(CPACK_PACKAGE_VERSION_MAJOR "1") @@ -115,10 +107,15 @@ set(CPACK_PACKAGE_VENDOR "Apache Arrow") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver") set(CPACK_PACKAGE_CONTACT "#TODO arrow maintainers") +# SET(CPACK_INSTALL_CMAKE_PROJECTS "bin;arrow_flight_sql_odbc;ALL;/") +# -AL- above line causes error: +# CPack Error: Error when generating package: Apache Arrow Flight SQL ODBC + # Include all dependent dll files in bin # -AL- try to find the path for "release/Release" message(STATUS "-AL- CMAKE_INSTALL_LIBDIR = ${CMAKE_INSTALL_LIBDIR}") +message(STATUS "-AL- CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}") message(STATUS "-AL- CMAKE_INSTALL_INCLUDEDIR = ${CMAKE_INSTALL_INCLUDEDIR}") message(STATUS "-AL- CMAKE_INSTALL_BINDIR = ${CMAKE_INSTALL_BINDIR}") message(STATUS "-AL- ARROW_CMAKE_DIR = ${ARROW_CMAKE_DIR}") @@ -128,10 +125,17 @@ message(STATUS "-AL- CMAKE_RUNTIME_OUTPUT_DIRECTORY = ${CMAKE_RUNTIME_OUTPUT_DIR message(STATUS "-AL- BUILD_OUTPUT_ROOT_DIRECTORY = ${BUILD_OUTPUT_ROOT_DIRECTORY}") message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}") +message(STATUS "-AL- CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") + +#install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" +# DESTINATION bin +# FILES_MATCHING +# PATTERN "*.dll") + +set(FILTERED_INSTALL_DIR "${BUILD_OUTPUT_ROOT_DIRECTORY}_install_odbc_filtered") # Only DLLs copied here +file(GLOB ODBC_DLL_FILES "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/*.dll") +file(COPY ${ODBC_DLL_FILES} DESTINATION ${FILTERED_INSTALL_DIR}) -install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" - DESTINATION bin - FILES_MATCHING - PATTERN "*.dll") +SET(CPACK_INSTALLED_DIRECTORIES "${FILTERED_INSTALL_DIR};bin") include(CPack) From 4b840f710b55d4060632396d5df39a07556a5b17 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Mon, 18 Aug 2025 15:49:12 -0700 Subject: [PATCH 07/22] Attempt to set `CPACK_COMPONENTS_ALL` This doesn't work as expected --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 29 ++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index dee32678a8e..8017d89fe05 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -127,15 +127,28 @@ message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}") message(STATUS "-AL- CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") -#install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" -# DESTINATION bin -# FILES_MATCHING -# PATTERN "*.dll") +install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" + DESTINATION bin + COMPONENT libraries + FILES_MATCHING + PATTERN "*.dll") -set(FILTERED_INSTALL_DIR "${BUILD_OUTPUT_ROOT_DIRECTORY}_install_odbc_filtered") # Only DLLs copied here -file(GLOB ODBC_DLL_FILES "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/*.dll") -file(COPY ${ODBC_DLL_FILES} DESTINATION ${FILTERED_INSTALL_DIR}) +# Create folder of dll files -AL- +# set(FILTERED_INSTALL_DIR "${BUILD_OUTPUT_ROOT_DIRECTORY}_install_odbc_filtered") # Only DLLs copied here +# file(GLOB ODBC_DLL_FILES "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/*.dll") +# file(COPY ${ODBC_DLL_FILES} DESTINATION ${FILTERED_INSTALL_DIR}) -SET(CPACK_INSTALLED_DIRECTORIES "${FILTERED_INSTALL_DIR};bin") +# -AL- use folder of dll files to extra directories (not recommended) +# SET(CPACK_INSTALLED_DIRECTORIES "${FILTERED_INSTALL_DIR};bin") include(CPack) + +cpack_add_component(libraries) + +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) +get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) +# Returns: 1>-- -AL- CPACK_COMPONENTS_ALL = Unspecified +message(STATUS "-AL- CPACK_COMPONENTS_ALL before = ${CPACK_COMPONENTS_ALL}") +list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified") + +message(STATUS "-AL- CPACK_COMPONENTS_ALL after = ${CPACK_COMPONENTS_ALL}") From 49c4a2afd4f10cd7d5f90a52c38fa130d2691d47 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Mon, 18 Aug 2025 16:55:19 -0700 Subject: [PATCH 08/22] Remove cpack usage * Do not use cpack, since cpack brings in unwanted files from `install` commands --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 45 ++------------------ 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 8017d89fe05..fcb264f3d29 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -92,27 +92,8 @@ foreach(LIB_TARGET ${ARROW_FLIGHT_SQL_ODBC_LIBRARIES}) target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_SQL_ODBC_EXPORTING) endforeach() -# -AL- code for CPack installer. # Construct ODBC Windows installer -include(InstallRequiredSystemLibraries) - -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt") -# Tentative version 1.0.0 (patch version is not set) -set(CPACK_PACKAGE_VERSION_MAJOR "1") -set(CPACK_PACKAGE_VERSION_MINOR "0") - -set(CPACK_PACKAGE_NAME "Apache Arrow Flight SQL ODBC") -set(CPACK_PACKAGE_VENDOR "Apache Arrow") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver") -set(CPACK_PACKAGE_CONTACT "#TODO arrow maintainers") - -# SET(CPACK_INSTALL_CMAKE_PROJECTS "bin;arrow_flight_sql_odbc;ALL;/") -# -AL- above line causes error: -# CPack Error: Error when generating package: Apache Arrow Flight SQL ODBC - -# Include all dependent dll files in bin - # -AL- try to find the path for "release/Release" message(STATUS "-AL- CMAKE_INSTALL_LIBDIR = ${CMAKE_INSTALL_LIBDIR}") message(STATUS "-AL- CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}") @@ -127,28 +108,8 @@ message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}") message(STATUS "-AL- CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") -install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" - DESTINATION bin - COMPONENT libraries - FILES_MATCHING - PATTERN "*.dll") - # Create folder of dll files -AL- -# set(FILTERED_INSTALL_DIR "${BUILD_OUTPUT_ROOT_DIRECTORY}_install_odbc_filtered") # Only DLLs copied here -# file(GLOB ODBC_DLL_FILES "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/*.dll") -# file(COPY ${ODBC_DLL_FILES} DESTINATION ${FILTERED_INSTALL_DIR}) - -# -AL- use folder of dll files to extra directories (not recommended) -# SET(CPACK_INSTALLED_DIRECTORIES "${FILTERED_INSTALL_DIR};bin") - -include(CPack) - -cpack_add_component(libraries) - -set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) -get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) -# Returns: 1>-- -AL- CPACK_COMPONENTS_ALL = Unspecified -message(STATUS "-AL- CPACK_COMPONENTS_ALL before = ${CPACK_COMPONENTS_ALL}") -list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified") +set(FILTERED_INSTALL_DIR "${BUILD_OUTPUT_ROOT_DIRECTORY}_install_odbc_filtered") # Only DLLs copied here +file(GLOB ODBC_DLL_FILES "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/*.dll") +file(COPY ${ODBC_DLL_FILES} DESTINATION ${FILTERED_INSTALL_DIR}) -message(STATUS "-AL- CPACK_COMPONENTS_ALL after = ${CPACK_COMPONENTS_ALL}") From 9aa2e7e391ac1ed890b036747c43e3d7016da39d Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Mon, 18 Aug 2025 17:05:57 -0700 Subject: [PATCH 09/22] Use nsis installer file Initial nsis installer file --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index fcb264f3d29..cad07c2ef54 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -107,9 +107,13 @@ message(STATUS "-AL- BUILD_OUTPUT_ROOT_DIRECTORY = ${BUILD_OUTPUT_ROOT_DIRECTORY message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}") message(STATUS "-AL- CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") +message(STATUS "-AL- CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}") # Create folder of dll files -AL- set(FILTERED_INSTALL_DIR "${BUILD_OUTPUT_ROOT_DIRECTORY}_install_odbc_filtered") # Only DLLs copied here file(GLOB ODBC_DLL_FILES "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/*.dll") file(COPY ${ODBC_DLL_FILES} DESTINATION ${FILTERED_INSTALL_DIR}) +add_custom_target(build_odbc_nsis_installer + COMMAND makensis "${CMAKE_CURRENT_LIST_DIR}/installer.nsi" +) From 3a0f9baff5727320171198307a43660e0eaf3a88 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Mon, 18 Aug 2025 17:53:47 -0700 Subject: [PATCH 10/22] Draft NSI script --- .gitignore | 3 + cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 9 + .../flight/sql/odbc/NSIS.InstallOptions.ini | 46 + .../arrow/flight/sql/odbc/installer.nsi.in | 1034 +++++++++++++++++ 4 files changed, 1092 insertions(+) create mode 100644 cpp/src/arrow/flight/sql/odbc/NSIS.InstallOptions.ini create mode 100644 cpp/src/arrow/flight/sql/odbc/installer.nsi.in diff --git a/.gitignore b/.gitignore index 11b1a616c51..269c97c9757 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,6 @@ java/.mvn/.develocity/ # rat filtered_rat.txt rat.txt + +# odbc +cpp/src/arrow/flight/sql/odbc/installer.nsi diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index cad07c2ef54..b24d04724ad 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -109,6 +109,15 @@ message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUT message(STATUS "-AL- CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") message(STATUS "-AL- CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}") +# Update nsi variables +set(ODBC_DLL_DIR "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}") + +configure_file( + "${CMAKE_CURRENT_LIST_DIR}/installer.nsi.in" + "${CMAKE_CURRENT_LIST_DIR}/installer.nsi" + @ONLY +) + # Create folder of dll files -AL- set(FILTERED_INSTALL_DIR "${BUILD_OUTPUT_ROOT_DIRECTORY}_install_odbc_filtered") # Only DLLs copied here file(GLOB ODBC_DLL_FILES "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/*.dll") diff --git a/cpp/src/arrow/flight/sql/odbc/NSIS.InstallOptions.ini b/cpp/src/arrow/flight/sql/odbc/NSIS.InstallOptions.ini new file mode 100644 index 00000000000..43d5611d148 --- /dev/null +++ b/cpp/src/arrow/flight/sql/odbc/NSIS.InstallOptions.ini @@ -0,0 +1,46 @@ +[Settings] +NumFields=5 + +[Field 1] +Type=label +Text=By default Apache Arrow Flight SQL ODBC 1.0.0 does not add its directory to the system PATH. +Left=0 +Right=-1 +Top=0 +Bottom=20 + +[Field 2] +Type=radiobutton +Text=Do not add Apache Arrow Flight SQL ODBC to the system PATH +Left=0 +Right=-1 +Top=30 +Bottom=40 +State=1 + +[Field 3] +Type=radiobutton +Text=Add Apache Arrow Flight SQL ODBC to the system PATH for all users +Left=0 +Right=-1 +Top=40 +Bottom=50 +State=0 + +[Field 4] +Type=radiobutton +Text=Add Apache Arrow Flight SQL ODBC to the system PATH for current user +Left=0 +Right=-1 +Top=50 +Bottom=60 +State=0 + +[Field 5] +Type=CheckBox +Text=Create Apache Arrow Flight SQL ODBC Desktop Icon +Left=0 +Right=-1 +Top=80 +Bottom=90 +State=0 diff --git a/cpp/src/arrow/flight/sql/odbc/installer.nsi.in b/cpp/src/arrow/flight/sql/odbc/installer.nsi.in new file mode 100644 index 00000000000..d64c06a21ed --- /dev/null +++ b/cpp/src/arrow/flight/sql/odbc/installer.nsi.in @@ -0,0 +1,1034 @@ +; CPack install script designed for a nmake build + +;-------------------------------- +; You must define these values + + !define VERSION "1.0.0" + !define PATCH "0" + +;-------------------------------- +;Variables + + Var MUI_TEMP + Var STARTMENU_FOLDER + Var SV_ALLUSERS + Var START_MENU + Var DO_NOT_ADD_TO_PATH + Var ADD_TO_PATH_ALL_USERS + Var ADD_TO_PATH_CURRENT_USER + Var INSTALL_DESKTOP + Var IS_DEFAULT_INSTALLDIR +;-------------------------------- +;Include Modern UI + + !include "MUI.nsh" + + ;Default installation folder + InstallDir "$PROGRAMFILES64\Apache Arrow Flight SQL ODBC 1.0.0" + +;-------------------------------- +;General + + ;Name and file + Name "Apache Arrow Flight SQL ODBC 1.0.0" + OutFile "Apache Arrow Flight SQL ODBC-1.0.0-win64.exe" + + ;Set compression + SetCompressor lzma + + ;Require administrator access + RequestExecutionLevel admin + + + + + + !include Sections.nsh + +;--- Component support macros: --- +; The code for the add/remove functionality is from: +; https://nsis.sourceforge.io/Add/Remove_Functionality +; It has been modified slightly and extended to provide +; inter-component dependencies. +Var AR_SecFlags +Var AR_RegFlags +Var libraries_selected +Var libraries_was_installed + + +; Loads the "selected" flag for the section named SecName into the +; variable VarName. +!macro LoadSectionSelectedIntoVar SecName VarName + SectionGetFlags ${${SecName}} $${VarName} + IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits +!macroend + +; Loads the value of a variable... can we get around this? +!macro LoadVar VarName + IntOp $R0 0 + $${VarName} +!macroend + +; Sets the value of a variable +!macro StoreVar VarName IntValue + IntOp $${VarName} 0 + ${IntValue} +!macroend + +!macro InitSection SecName + ; This macro reads component installed flag from the registry and + ;changes checked state of the section on the components page. + ;Input: section index constant name specified in Section command. + + ClearErrors + ;Reading component status from registry + ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0\Components\${SecName}" "Installed" + IfErrors "default_${SecName}" + ;Status will stay default if registry value not found + ;(component was never installed) + IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits + SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags + IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off + IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit + + ; Note whether this component was installed before + !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags + IntOp $R0 $AR_RegFlags & $AR_RegFlags + + ;Writing modified flags + SectionSetFlags ${${SecName}} $AR_SecFlags + + "default_${SecName}:" + !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected +!macroend + +!macro FinishSection SecName + ; This macro reads section flag set by user and removes the section + ;if it is not selected. + ;Then it writes component installed flag to registry + ;Input: section index constant name specified in Section command. + + SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags + ;Checking lowest bit: + IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED} + IntCmp $AR_SecFlags 1 "leave_${SecName}" + ;Section is not selected: + ;Calling Section uninstall macro and writing zero installed flag + !insertmacro "Remove_${${SecName}}" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0\Components\${SecName}" \ + "Installed" 0 + Goto "exit_${SecName}" + + "leave_${SecName}:" + ;Section is selected: + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0\Components\${SecName}" \ + "Installed" 1 + + "exit_${SecName}:" +!macroend + +!macro RemoveSection_CPack SecName + ; This macro is used to call section's Remove_... macro + ;from the uninstaller. + ;Input: section index constant name specified in Section command. + + !insertmacro "Remove_${${SecName}}" +!macroend + +; Determine whether the selection of SecName changed +!macro MaybeSelectionChanged SecName + !insertmacro LoadVar ${SecName}_selected + SectionGetFlags ${${SecName}} $R1 + IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits + + ; See if the status has changed: + IntCmp $R0 $R1 "${SecName}_unchanged" + !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected + + IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected" + !insertmacro "Deselect_required_by_${SecName}" + goto "${SecName}_unchanged" + + "${SecName}_was_selected:" + !insertmacro "Select_${SecName}_depends" + + "${SecName}_unchanged:" +!macroend +;--- End of Add/Remove macros --- + +;-------------------------------- +;Interface Settings + + !define MUI_HEADERIMAGE + !define MUI_ABORTWARNING + +;---------------------------------------- +; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02" +;---------------------------------------- +!verbose 3 +!include "WinMessages.NSH" +!verbose 4 +;==================================================== +; get_NT_environment +; Returns: the selected environment +; Output : head of the stack +;==================================================== +!macro select_NT_profile UN +Function ${UN}select_NT_profile + StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single + DetailPrint "Selected environment for all users" + Push "all" + Return + environment_single: + DetailPrint "Selected environment for current user only." + Push "current" + Return +FunctionEnd +!macroend +!insertmacro select_NT_profile "" +!insertmacro select_NT_profile "un." +;---------------------------------------------------- +!define NT_current_env 'HKCU "Environment"' +!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' + +!ifndef WriteEnvStr_RegKey + !ifdef ALL_USERS + !define WriteEnvStr_RegKey \ + 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' + !else + !define WriteEnvStr_RegKey 'HKCU "Environment"' + !endif +!endif + +; AddToPath - Adds the given dir to the search path. +; Input - head of the stack +; Note - Win9x systems requires reboot + +Function AddToPath + Exch $0 + Push $1 + Push $2 + Push $3 + + # don't add if the path doesn't exist + IfFileExists "$0\*.*" "" AddToPath_done + + ReadEnvStr $1 PATH + ; if the path is too long for a NSIS variable NSIS will return a 0 + ; length string. If we find that, then warn and skip any path + ; modification as it will trash the existing path. + StrLen $2 $1 + IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done + CheckPathLength_ShowPathWarning: + Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!" + Goto AddToPath_done + CheckPathLength_Done: + Push "$1;" + Push "$0;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + Push "$1;" + Push "$0\;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + GetFullPathName /SHORT $3 $0 + Push "$1;" + Push "$3;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + Push "$1;" + Push "$3\;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + + Call IsNT + Pop $1 + StrCmp $1 1 AddToPath_NT + ; Not on NT + StrCpy $1 $WINDIR 2 + FileOpen $1 "$1\autoexec.bat" a + FileSeek $1 -1 END + FileReadByte $1 $2 + IntCmp $2 26 0 +2 +2 # DOS EOF + FileSeek $1 -1 END # write over EOF + FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n" + FileClose $1 + SetRebootFlag true + Goto AddToPath_done + + AddToPath_NT: + StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey + ReadRegStr $1 ${NT_current_env} "PATH" + Goto DoTrim + ReadAllKey: + ReadRegStr $1 ${NT_all_env} "PATH" + DoTrim: + StrCmp $1 "" AddToPath_NTdoIt + Push $1 + Call Trim + Pop $1 + StrCpy $0 "$1;$0" + AddToPath_NTdoIt: + StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey + WriteRegExpandStr ${NT_current_env} "PATH" $0 + Goto DoSend + WriteAllKey: + WriteRegExpandStr ${NT_all_env} "PATH" $0 + DoSend: + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + AddToPath_done: + Pop $3 + Pop $2 + Pop $1 + Pop $0 +FunctionEnd + + +; RemoveFromPath - Remove a given dir from the path +; Input: head of the stack + +Function un.RemoveFromPath + Exch $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $5 + Push $6 + + IntFmt $6 "%c" 26 # DOS EOF + + Call un.IsNT + Pop $1 + StrCmp $1 1 unRemoveFromPath_NT + ; Not on NT + StrCpy $1 $WINDIR 2 + FileOpen $1 "$1\autoexec.bat" r + GetTempFileName $4 + FileOpen $2 $4 w + GetFullPathName /SHORT $0 $0 + StrCpy $0 "SET PATH=%PATH%;$0" + Goto unRemoveFromPath_dosLoop + + unRemoveFromPath_dosLoop: + FileRead $1 $3 + StrCpy $5 $3 1 -1 # read last char + StrCmp $5 $6 0 +2 # if DOS EOF + StrCpy $3 $3 -1 # remove DOS EOF so we can compare + StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "" unRemoveFromPath_dosLoopEnd + FileWrite $2 $3 + Goto unRemoveFromPath_dosLoop + unRemoveFromPath_dosLoopRemoveLine: + SetRebootFlag true + Goto unRemoveFromPath_dosLoop + + unRemoveFromPath_dosLoopEnd: + FileClose $2 + FileClose $1 + StrCpy $1 $WINDIR 2 + Delete "$1\autoexec.bat" + CopyFiles /SILENT $4 "$1\autoexec.bat" + Delete $4 + Goto unRemoveFromPath_done + + unRemoveFromPath_NT: + StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey + ReadRegStr $1 ${NT_current_env} "PATH" + Goto unDoTrim + unReadAllKey: + ReadRegStr $1 ${NT_all_env} "PATH" + unDoTrim: + StrCpy $5 $1 1 -1 # copy last char + StrCmp $5 ";" +2 # if last char != ; + StrCpy $1 "$1;" # append ; + Push $1 + Push "$0;" + Call un.StrStr ; Find `$0;` in $1 + Pop $2 ; pos of our dir + StrCmp $2 "" unRemoveFromPath_done + ; else, it is in path + # $0 - path to add + # $1 - path var + StrLen $3 "$0;" + StrLen $4 $2 + StrCpy $5 $1 -$4 # $5 is now the part before the path to remove + StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove + StrCpy $3 $5$6 + + StrCpy $5 $3 1 -1 # copy last char + StrCmp $5 ";" 0 +2 # if last char == ; + StrCpy $3 $3 -1 # remove last char + + StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey + WriteRegExpandStr ${NT_current_env} "PATH" $3 + Goto unDoSend + unWriteAllKey: + WriteRegExpandStr ${NT_all_env} "PATH" $3 + unDoSend: + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + unRemoveFromPath_done: + Pop $6 + Pop $5 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 +FunctionEnd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Uninstall stuff +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +########################################### +# Utility Functions # +########################################### + +;==================================================== +; IsNT - Returns 1 if the current system is NT, 0 +; otherwise. +; Output: head of the stack +;==================================================== +; IsNT +; no input +; output, top of the stack = 1 if NT or 0 if not +; +; Usage: +; Call IsNT +; Pop $R0 +; ($R0 at this point is 1 or 0) + +!macro IsNT un +Function ${un}IsNT + Push $0 + ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + StrCmp $0 "" 0 IsNT_yes + ; we are not NT. + Pop $0 + Push 0 + Return + + IsNT_yes: + ; NT!!! + Pop $0 + Push 1 +FunctionEnd +!macroend +!insertmacro IsNT "" +!insertmacro IsNT "un." + +; StrStr +; input, top of stack = string to search for +; top of stack-1 = string to search in +; output, top of stack (replaces with the portion of the string remaining) +; modifies no other variables. +; +; Usage: +; Push "this is a long ass string" +; Push "ass" +; Call StrStr +; Pop $R0 +; ($R0 at this point is "ass string") + +!macro StrStr un +Function ${un}StrStr +Exch $R1 ; st=haystack,old$R1, $R1=needle + Exch ; st=old$R1,haystack + Exch $R2 ; st=old$R1,old$R2, $R2=haystack + Push $R3 + Push $R4 + Push $R5 + StrLen $R3 $R1 + StrCpy $R4 0 + ; $R1=needle + ; $R2=haystack + ; $R3=len(needle) + ; $R4=cnt + ; $R5=tmp + loop: + StrCpy $R5 $R2 $R3 $R4 + StrCmp $R5 $R1 done + StrCmp $R5 "" done + IntOp $R4 $R4 + 1 + Goto loop +done: + StrCpy $R1 $R2 "" $R4 + Pop $R5 + Pop $R4 + Pop $R3 + Pop $R2 + Exch $R1 +FunctionEnd +!macroend +!insertmacro StrStr "" +!insertmacro StrStr "un." + +Function Trim ; Added by Pelaca + Exch $R1 + Push $R2 +Loop: + StrCpy $R2 "$R1" 1 -1 + StrCmp "$R2" " " RTrim + StrCmp "$R2" "$\n" RTrim + StrCmp "$R2" "$\r" RTrim + StrCmp "$R2" ";" RTrim + GoTo Done +RTrim: + StrCpy $R1 "$R1" -1 + Goto Loop +Done: + Pop $R2 + Exch $R1 +FunctionEnd + +Function ConditionalAddToRegistry + Pop $0 + Pop $1 + StrCmp "$0" "" ConditionalAddToRegistry_EmptyString + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" \ + "$1" "$0" + ;MessageBox MB_OK "Set Registry: '$1' to '$0'" + DetailPrint "Set install registry entry: '$1' to '$0'" + ConditionalAddToRegistry_EmptyString: +FunctionEnd + +;-------------------------------- + +!ifdef CPACK_USES_DOWNLOAD +Function DownloadFile + IfFileExists $INSTDIR\* +2 + CreateDirectory $INSTDIR + Pop $0 + + ; Skip if already downloaded + IfFileExists $INSTDIR\$0 0 +2 + Return + + StrCpy $1 "" + + try_again: + NSISdl::download "$1/$0" "$INSTDIR\$0" + + Pop $1 + StrCmp $1 "success" success + StrCmp $1 "Cancelled" cancel + MessageBox MB_OK "Download failed: $1" + cancel: + Return + success: +FunctionEnd +!endif + +;-------------------------------- +; Define some macro setting for the gui + + + + + + +;-------------------------------- +;Pages + + + !insertmacro MUI_PAGE_WELCOME + + !insertmacro MUI_PAGE_LICENSE "../../../../../../LICENSE.txt" + + Page custom InstallOptionsPage + !insertmacro MUI_PAGE_DIRECTORY + + ;Start Menu Folder Page Configuration + !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" + !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Apache Arrow\Apache Arrow Flight SQL ODBC 1.0.0" + !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" + !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER + + !insertmacro MUI_PAGE_COMPONENTS + + !insertmacro MUI_PAGE_INSTFILES + + + !insertmacro MUI_PAGE_FINISH + + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + +;-------------------------------- +;Languages + + !insertmacro MUI_LANGUAGE "English" ;first language is the default language + !insertmacro MUI_LANGUAGE "Afrikaans" + !insertmacro MUI_LANGUAGE "Albanian" + !insertmacro MUI_LANGUAGE "Arabic" + !insertmacro MUI_LANGUAGE "Asturian" + !insertmacro MUI_LANGUAGE "Basque" + !insertmacro MUI_LANGUAGE "Belarusian" + !insertmacro MUI_LANGUAGE "Bosnian" + !insertmacro MUI_LANGUAGE "Breton" + !insertmacro MUI_LANGUAGE "Bulgarian" + !insertmacro MUI_LANGUAGE "Catalan" + !insertmacro MUI_LANGUAGE "Corsican" + !insertmacro MUI_LANGUAGE "Croatian" + !insertmacro MUI_LANGUAGE "Czech" + !insertmacro MUI_LANGUAGE "Danish" + !insertmacro MUI_LANGUAGE "Dutch" + !insertmacro MUI_LANGUAGE "Esperanto" + !insertmacro MUI_LANGUAGE "Estonian" + !insertmacro MUI_LANGUAGE "Farsi" + !insertmacro MUI_LANGUAGE "Finnish" + !insertmacro MUI_LANGUAGE "French" + !insertmacro MUI_LANGUAGE "Galician" + !insertmacro MUI_LANGUAGE "German" + !insertmacro MUI_LANGUAGE "Greek" + !insertmacro MUI_LANGUAGE "Hebrew" + !insertmacro MUI_LANGUAGE "Hungarian" + !insertmacro MUI_LANGUAGE "Icelandic" + !insertmacro MUI_LANGUAGE "Indonesian" + !insertmacro MUI_LANGUAGE "Irish" + !insertmacro MUI_LANGUAGE "Italian" + !insertmacro MUI_LANGUAGE "Japanese" + !insertmacro MUI_LANGUAGE "Korean" + !insertmacro MUI_LANGUAGE "Kurdish" + !insertmacro MUI_LANGUAGE "Latvian" + !insertmacro MUI_LANGUAGE "Lithuanian" + !insertmacro MUI_LANGUAGE "Luxembourgish" + !insertmacro MUI_LANGUAGE "Macedonian" + !insertmacro MUI_LANGUAGE "Malay" + !insertmacro MUI_LANGUAGE "Mongolian" + !insertmacro MUI_LANGUAGE "Norwegian" + !insertmacro MUI_LANGUAGE "NorwegianNynorsk" + !insertmacro MUI_LANGUAGE "Pashto" + !insertmacro MUI_LANGUAGE "Polish" + !insertmacro MUI_LANGUAGE "Portuguese" + !insertmacro MUI_LANGUAGE "PortugueseBR" + !insertmacro MUI_LANGUAGE "Romanian" + !insertmacro MUI_LANGUAGE "Russian" + !insertmacro MUI_LANGUAGE "ScotsGaelic" + !insertmacro MUI_LANGUAGE "Serbian" + !insertmacro MUI_LANGUAGE "SerbianLatin" + !insertmacro MUI_LANGUAGE "SimpChinese" + !insertmacro MUI_LANGUAGE "Slovak" + !insertmacro MUI_LANGUAGE "Slovenian" + !insertmacro MUI_LANGUAGE "Spanish" + !insertmacro MUI_LANGUAGE "SpanishInternational" + !insertmacro MUI_LANGUAGE "Swedish" + !insertmacro MUI_LANGUAGE "Tatar" + !insertmacro MUI_LANGUAGE "Thai" + !insertmacro MUI_LANGUAGE "TradChinese" + !insertmacro MUI_LANGUAGE "Turkish" + !insertmacro MUI_LANGUAGE "Ukrainian" + !insertmacro MUI_LANGUAGE "Uzbek" + !insertmacro MUI_LANGUAGE "Vietnamese" + !insertmacro MUI_LANGUAGE "Welsh" + +;-------------------------------- +;Reserve Files + + ;These files should be inserted before other files in the data block + ;Keep these lines before any File command + ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA) + + ReserveFile "NSIS.InstallOptions.ini" + !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS + + ; for UserInfo::GetName and UserInfo::GetAccountType + ReserveFile /plugin 'UserInfo.dll' + +;-------------------------------- +; Installation types + +!define MUI_COMPONENTSPAGE_NODESC +;-------------------------------- +;Installer Sections + +Section "-Core installation" + ;Use the entire tree produced by the INSTALL target. Keep the + ;list of directories here in sync with the RMDir commands below. + SetOutPath "$INSTDIR" + + + + ;Store installation folder + WriteRegStr SHCTX "Software\Apache Arrow\Apache Arrow Flight SQL ODBC 1.0.0" "" $INSTDIR + + ;Create uninstaller + WriteUninstaller "$INSTDIR\Uninstall.exe" + Push "DisplayName" + Push "Apache Arrow Flight SQL ODBC 1.0.0" + Call ConditionalAddToRegistry + Push "DisplayVersion" + Push "1.0.0" + Call ConditionalAddToRegistry + Push "Publisher" + Push "Apache Arrow" + Call ConditionalAddToRegistry + Push "UninstallString" + Push "$\"$INSTDIR\Uninstall.exe$\"" + Call ConditionalAddToRegistry + Push "NoRepair" + Push "1" + Call ConditionalAddToRegistry + + !ifdef CPACK_NSIS_ADD_REMOVE + ;Create add/remove functionality + Push "ModifyPath" + Push "$INSTDIR\AddRemove.exe" + Call ConditionalAddToRegistry + !else + Push "NoModify" + Push "1" + Call ConditionalAddToRegistry + !endif + + ; Optional registration + Push "DisplayIcon" + Push "$INSTDIR\" + Call ConditionalAddToRegistry + Push "HelpLink" + Push "" + Call ConditionalAddToRegistry + Push "URLInfoAbout" + Push "" + Call ConditionalAddToRegistry + Push "Contact" + Push "" + Call ConditionalAddToRegistry + !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State" + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + + ;Create shortcuts + CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" + + + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" + + ;Read a value from an InstallOptions INI file + !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State" + + ; Write special uninstall registry entries + Push "StartMenu" + Push "$STARTMENU_FOLDER" + Call ConditionalAddToRegistry + Push "DoNotAddToPath" + Push "$DO_NOT_ADD_TO_PATH" + Call ConditionalAddToRegistry + Push "AddToPathAllUsers" + Push "$ADD_TO_PATH_ALL_USERS" + Call ConditionalAddToRegistry + Push "AddToPathCurrentUser" + Push "$ADD_TO_PATH_CURRENT_USER" + Call ConditionalAddToRegistry + Push "InstallToDesktop" + Push "$INSTALL_DESKTOP" + Call ConditionalAddToRegistry + + !insertmacro MUI_STARTMENU_WRITE_END + + + +SectionEnd + +Section "-Add to path" + Push $INSTDIR\bin + StrCmp "" "ON" 0 doNotAddToPath + StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0 + Call AddToPath + doNotAddToPath: +SectionEnd + +;-------------------------------- +; Create custom pages +Function InstallOptionsPage + !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing Apache Arrow Flight SQL ODBC 1.0.0" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini" + +FunctionEnd + +;-------------------------------- +; determine admin versus local install +Function un.onInit + + ClearErrors + UserInfo::GetName + IfErrors noLM + Pop $0 + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" 0 +3 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Admin group' + Goto done + StrCmp $1 "Power" 0 +3 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Power Users group' + Goto done + + noLM: + ;Get installation folder from registry if available + + done: + +FunctionEnd + +;--- Add/Remove callback functions: --- +!macro SectionList MacroName + ;This macro used to perform operation on multiple sections. + ;List all of your components in following manner here. + !insertmacro "${MacroName}" "libraries" + +!macroend + +Section -FinishComponents + ;Removes unselected components and writes component status to registry + !insertmacro SectionList "FinishSection" + +!ifdef CPACK_NSIS_ADD_REMOVE + ; Get the name of the installer executable + System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1' + StrCpy $R3 $R0 + + ; Strip off the last 13 characters, to see if we have AddRemove.exe + StrLen $R1 $R0 + IntOp $R1 $R0 - 13 + StrCpy $R2 $R0 13 $R1 + StrCmp $R2 "AddRemove.exe" addremove_installed + + ; We're not running AddRemove.exe, so install it + CopyFiles $R3 $INSTDIR\AddRemove.exe + + addremove_installed: +!endif +SectionEnd +;--- End of Add/Remove callback functions --- + +;-------------------------------- +; Component dependencies +Function .onSelChange + !insertmacro SectionList MaybeSelectionChanged +FunctionEnd + +;-------------------------------- +;Uninstaller Section + +Section "Uninstall" + ReadRegStr $START_MENU SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "StartMenu" + ;MessageBox MB_OK "Start menu is in: $START_MENU" + ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "DoNotAddToPath" + ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "AddToPathAllUsers" + ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "AddToPathCurrentUser" + ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" + ReadRegStr $INSTALL_DESKTOP SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "InstallToDesktop" + ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP " + + + + ;Remove files we installed. + ;Keep the list of directories here in sync with the File commands above. + Delete "$INSTDIR\bin" + Delete "$INSTDIR\bin\abseil_dll.dll" + Delete "$INSTDIR\bin\arrow.dll" + Delete "$INSTDIR\bin\arrow_compute.dll" + Delete "$INSTDIR\bin\arrow_flight.dll" + Delete "$INSTDIR\bin\arrow_flight_sql.dll" + Delete "$INSTDIR\bin\arrow_flight_sql_odbc.dll" + Delete "$INSTDIR\bin\arrow_flight_testing.dll" + Delete "$INSTDIR\bin\arrow_testing.dll" + Delete "$INSTDIR\bin\boost_filesystem-vc143-mt-x64-1_87.dll" + Delete "$INSTDIR\bin\boost_locale-vc143-mt-x64-1_87.dll" + Delete "$INSTDIR\bin\cares.dll" + Delete "$INSTDIR\bin\gflags.dll" + Delete "$INSTDIR\bin\gmock.dll" + Delete "$INSTDIR\bin\gtest.dll" + Delete "$INSTDIR\bin\gtest_main.dll" + Delete "$INSTDIR\bin\libcrypto-3-x64.dll" + Delete "$INSTDIR\bin\libprotobuf.dll" + Delete "$INSTDIR\bin\libssl-3-x64.dll" + Delete "$INSTDIR\bin\re2.dll" + Delete "$INSTDIR\bin\sqlite3.dll" + Delete "$INSTDIR\bin\utf8proc.dll" + Delete "$INSTDIR\bin\zlib1.dll" + Delete "$INSTDIR\bin\concrt140.dll" + Delete "$INSTDIR\bin\msvcp140.dll" + Delete "$INSTDIR\bin\msvcp140_1.dll" + Delete "$INSTDIR\bin\msvcp140_2.dll" + Delete "$INSTDIR\bin\msvcp140_atomic_wait.dll" + Delete "$INSTDIR\bin\msvcp140_codecvt_ids.dll" + Delete "$INSTDIR\bin\vcruntime140.dll" + Delete "$INSTDIR\bin\vcruntime140_1.dll" + + RMDir "$INSTDIR\bin" + + +!ifdef CPACK_NSIS_ADD_REMOVE + ;Remove the add/remove program + Delete "$INSTDIR\AddRemove.exe" +!endif + + ;Remove the uninstaller itself. + Delete "$INSTDIR\Uninstall.exe" + DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" + + ;Remove the installation directory if it is empty. + RMDir "$INSTDIR" + + ; Remove the registry entries. + DeleteRegKey SHCTX "Software\Apache Arrow\Apache Arrow Flight SQL ODBC 1.0.0" + + ; Removes all optional components + !insertmacro SectionList "RemoveSection_CPack" + + !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP + + Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" + + + + ;Delete empty start menu parent directories + StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" + + startMenuDeleteLoop: + ClearErrors + RMDir $MUI_TEMP + GetFullPathName $MUI_TEMP "$MUI_TEMP\.." + + IfErrors startMenuDeleteLoopDone + + StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop + startMenuDeleteLoopDone: + + ; If the user changed the shortcut, then uninstall may not work. This should + ; try to fix it. + StrCpy $MUI_TEMP "$START_MENU" + Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" + + + ;Delete empty start menu parent directories + StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" + + secondStartMenuDeleteLoop: + ClearErrors + RMDir $MUI_TEMP + GetFullPathName $MUI_TEMP "$MUI_TEMP\.." + + IfErrors secondStartMenuDeleteLoopDone + + StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop + secondStartMenuDeleteLoopDone: + + DeleteRegKey /ifempty SHCTX "Software\Apache Arrow\Apache Arrow Flight SQL ODBC 1.0.0" + + Push $INSTDIR\bin + StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0 + Call un.RemoveFromPath + doNotRemoveFromPath: +SectionEnd + +;-------------------------------- +; determine admin versus local install +; Is install for "AllUsers" or "JustMe"? +; Default to "JustMe" - set to "AllUsers" if admin or on Win9x +; This function is used for the very first "custom page" of the installer. +; This custom page does not show up visibly, but it executes prior to the +; first visible page and sets up $INSTDIR properly... +; Choose different default installation folder based on SV_ALLUSERS... +; "Program Files" for AllUsers, "My Documents" for JustMe... + +Function .onInit + StrCmp "" "ON" 0 inst + + ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "UninstallString" + StrCmp $0 "" inst + + MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \ + "Apache Arrow Flight SQL ODBC 1.0.0 is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \ + /SD IDYES IDYES uninst IDNO inst + Abort + +;Run the uninstaller +uninst: + ClearErrors + # $0 should _always_ be quoted, however older versions of CMake did not + # do this. We'll conditionally remove the begin/end quotes. + # Remove first char if quote + StrCpy $2 $0 1 0 # copy first char + StrCmp $2 "$\"" 0 +2 # if char is quote + StrCpy $0 $0 "" 1 # remove first char + # Remove last char if quote + StrCpy $2 $0 1 -1 # copy last char + StrCmp $2 "$\"" 0 +2 # if char is quote + StrCpy $0 $0 -1 # remove last char + + StrLen $2 "\Uninstall.exe" + StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path + ExecWait '"$0" /S _?=$3' ;Do not copy the uninstaller to a temp file + + IfErrors uninst_failed inst +uninst_failed: + MessageBox MB_OK|MB_ICONSTOP "Uninstall failed." + Abort + + +inst: + ; Reads components status for registry + !insertmacro SectionList "InitSection" + + ; check to see if /D has been used to change + ; the install directory by comparing it to the + ; install directory that is expected to be the + ; default + StrCpy $IS_DEFAULT_INSTALLDIR 0 + StrCmp "$INSTDIR" "$PROGRAMFILES64\Apache Arrow Flight SQL ODBC 1.0.0" 0 +2 + StrCpy $IS_DEFAULT_INSTALLDIR 1 + + StrCpy $SV_ALLUSERS "JustMe" + ; if default install dir then change the default + ; if it is installed for JustMe + StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 + StrCpy $INSTDIR "$DOCUMENTS\Apache Arrow Flight SQL ODBC 1.0.0" + + ClearErrors + UserInfo::GetName + IfErrors noLM + Pop $0 + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" 0 +4 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Admin group' + StrCpy $SV_ALLUSERS "AllUsers" + Goto done + StrCmp $1 "Power" 0 +3 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Power Users group' + StrCpy $SV_ALLUSERS "AllUsers" + Goto done + + noLM: + StrCpy $SV_ALLUSERS "AllUsers" + ;Get installation folder from registry if available + + done: + StrCmp $SV_ALLUSERS "AllUsers" 0 +3 + StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 + StrCpy $INSTDIR "$PROGRAMFILES64\Apache Arrow Flight SQL ODBC 1.0.0" + + StrCmp "" "ON" 0 noOptionsPage + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" + + noOptionsPage: +FunctionEnd From 41fd01c5aa2192065cb5da60a60118ba233c705f Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Mon, 18 Aug 2025 17:57:40 -0700 Subject: [PATCH 11/22] Switch back to use cpack This reverts commit 3a0f9baff5727320171198307a43660e0eaf3a88. --- .gitignore | 3 - cpp/cmake_modules/BuildUtils.cmake | 7 +- cpp/cmake_modules/ThirdpartyToolchain.cmake | 3 +- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 42 +- .../flight/sql/odbc/NSIS.InstallOptions.ini | 46 - .../arrow/flight/sql/odbc/installer.nsi.in | 1034 ----------------- 6 files changed, 32 insertions(+), 1103 deletions(-) delete mode 100644 cpp/src/arrow/flight/sql/odbc/NSIS.InstallOptions.ini delete mode 100644 cpp/src/arrow/flight/sql/odbc/installer.nsi.in diff --git a/.gitignore b/.gitignore index 269c97c9757..11b1a616c51 100644 --- a/.gitignore +++ b/.gitignore @@ -109,6 +109,3 @@ java/.mvn/.develocity/ # rat filtered_rat.txt rat.txt - -# odbc -cpp/src/arrow/flight/sql/odbc/installer.nsi diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index db760400f7c..8a42da82cdc 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -405,8 +405,10 @@ function(ADD_ARROW_LIB LIB_NAME) ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} + COMPONENT ${LIB_NAME}_shared INCLUDES - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ${LIB_NAME}_shared) endif() if(BUILD_STATIC) @@ -474,7 +476,8 @@ function(ADD_ARROW_LIB LIB_NAME) LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} INCLUDES - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT ${LIB_NAME}_static) endif() if(ARG_CMAKE_PACKAGE_NAME) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 3f6b5bf4162..3517a7b0725 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -2365,7 +2365,8 @@ function(build_gtest) EXPORT arrow_testing_targets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT gtest) if(MSVC) install(FILES $ $ $ $ diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index b24d04724ad..b911cb5c091 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -109,20 +109,28 @@ message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUT message(STATUS "-AL- CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") message(STATUS "-AL- CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}") -# Update nsi variables -set(ODBC_DLL_DIR "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}") - -configure_file( - "${CMAKE_CURRENT_LIST_DIR}/installer.nsi.in" - "${CMAKE_CURRENT_LIST_DIR}/installer.nsi" - @ONLY -) - -# Create folder of dll files -AL- -set(FILTERED_INSTALL_DIR "${BUILD_OUTPUT_ROOT_DIRECTORY}_install_odbc_filtered") # Only DLLs copied here -file(GLOB ODBC_DLL_FILES "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/*.dll") -file(COPY ${ODBC_DLL_FILES} DESTINATION ${FILTERED_INSTALL_DIR}) - -add_custom_target(build_odbc_nsis_installer - COMMAND makensis "${CMAKE_CURRENT_LIST_DIR}/installer.nsi" -) +include(InstallRequiredSystemLibraries) + +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt") +# Tentative version 1.0.0 (patch version is not set) +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "0") + +set(CPACK_PACKAGE_NAME "Apache Arrow Flight SQL ODBC") +set(CPACK_PACKAGE_VENDOR "Apache Arrow") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver") +set(CPACK_PACKAGE_CONTACT "#TODO arrow maintainers") + +install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" + DESTINATION bin + COMPONENT library + FILES_MATCHING + PATTERN "*.dll") + +get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) +# Returns: 1>-- -AL- CPACK_COMPONENTS_ALL before = Unspecified;arrow_compute_shared;arrow_flight_shared;arrow_flight_sql_odbc_shared;arrow_flight_sql_shared;arrow_flight_testing_shared;arrow_shared;arrow_testing_shared;library +message(STATUS "-AL- CPACK_COMPONENTS_ALL before = ${CPACK_COMPONENTS_ALL}") +list(REMOVE_ITEM CPACK_COMPONENTS_ALL "arrow_compute_shared" "arrow_flight_shared" "arrow_flight_sql_odbc_shared" "arrow_flight_sql_shared" "arrow_flight_testing_shared" "arrow_shared" "arrow_testing_shared") +message(STATUS "-AL- CPACK_COMPONENTS_ALL after = ${CPACK_COMPONENTS_ALL}") + +include(CPack) diff --git a/cpp/src/arrow/flight/sql/odbc/NSIS.InstallOptions.ini b/cpp/src/arrow/flight/sql/odbc/NSIS.InstallOptions.ini deleted file mode 100644 index 43d5611d148..00000000000 --- a/cpp/src/arrow/flight/sql/odbc/NSIS.InstallOptions.ini +++ /dev/null @@ -1,46 +0,0 @@ -[Settings] -NumFields=5 - -[Field 1] -Type=label -Text=By default Apache Arrow Flight SQL ODBC 1.0.0 does not add its directory to the system PATH. -Left=0 -Right=-1 -Top=0 -Bottom=20 - -[Field 2] -Type=radiobutton -Text=Do not add Apache Arrow Flight SQL ODBC to the system PATH -Left=0 -Right=-1 -Top=30 -Bottom=40 -State=1 - -[Field 3] -Type=radiobutton -Text=Add Apache Arrow Flight SQL ODBC to the system PATH for all users -Left=0 -Right=-1 -Top=40 -Bottom=50 -State=0 - -[Field 4] -Type=radiobutton -Text=Add Apache Arrow Flight SQL ODBC to the system PATH for current user -Left=0 -Right=-1 -Top=50 -Bottom=60 -State=0 - -[Field 5] -Type=CheckBox -Text=Create Apache Arrow Flight SQL ODBC Desktop Icon -Left=0 -Right=-1 -Top=80 -Bottom=90 -State=0 diff --git a/cpp/src/arrow/flight/sql/odbc/installer.nsi.in b/cpp/src/arrow/flight/sql/odbc/installer.nsi.in deleted file mode 100644 index d64c06a21ed..00000000000 --- a/cpp/src/arrow/flight/sql/odbc/installer.nsi.in +++ /dev/null @@ -1,1034 +0,0 @@ -; CPack install script designed for a nmake build - -;-------------------------------- -; You must define these values - - !define VERSION "1.0.0" - !define PATCH "0" - -;-------------------------------- -;Variables - - Var MUI_TEMP - Var STARTMENU_FOLDER - Var SV_ALLUSERS - Var START_MENU - Var DO_NOT_ADD_TO_PATH - Var ADD_TO_PATH_ALL_USERS - Var ADD_TO_PATH_CURRENT_USER - Var INSTALL_DESKTOP - Var IS_DEFAULT_INSTALLDIR -;-------------------------------- -;Include Modern UI - - !include "MUI.nsh" - - ;Default installation folder - InstallDir "$PROGRAMFILES64\Apache Arrow Flight SQL ODBC 1.0.0" - -;-------------------------------- -;General - - ;Name and file - Name "Apache Arrow Flight SQL ODBC 1.0.0" - OutFile "Apache Arrow Flight SQL ODBC-1.0.0-win64.exe" - - ;Set compression - SetCompressor lzma - - ;Require administrator access - RequestExecutionLevel admin - - - - - - !include Sections.nsh - -;--- Component support macros: --- -; The code for the add/remove functionality is from: -; https://nsis.sourceforge.io/Add/Remove_Functionality -; It has been modified slightly and extended to provide -; inter-component dependencies. -Var AR_SecFlags -Var AR_RegFlags -Var libraries_selected -Var libraries_was_installed - - -; Loads the "selected" flag for the section named SecName into the -; variable VarName. -!macro LoadSectionSelectedIntoVar SecName VarName - SectionGetFlags ${${SecName}} $${VarName} - IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits -!macroend - -; Loads the value of a variable... can we get around this? -!macro LoadVar VarName - IntOp $R0 0 + $${VarName} -!macroend - -; Sets the value of a variable -!macro StoreVar VarName IntValue - IntOp $${VarName} 0 + ${IntValue} -!macroend - -!macro InitSection SecName - ; This macro reads component installed flag from the registry and - ;changes checked state of the section on the components page. - ;Input: section index constant name specified in Section command. - - ClearErrors - ;Reading component status from registry - ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0\Components\${SecName}" "Installed" - IfErrors "default_${SecName}" - ;Status will stay default if registry value not found - ;(component was never installed) - IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits - SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags - IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off - IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit - - ; Note whether this component was installed before - !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags - IntOp $R0 $AR_RegFlags & $AR_RegFlags - - ;Writing modified flags - SectionSetFlags ${${SecName}} $AR_SecFlags - - "default_${SecName}:" - !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected -!macroend - -!macro FinishSection SecName - ; This macro reads section flag set by user and removes the section - ;if it is not selected. - ;Then it writes component installed flag to registry - ;Input: section index constant name specified in Section command. - - SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags - ;Checking lowest bit: - IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED} - IntCmp $AR_SecFlags 1 "leave_${SecName}" - ;Section is not selected: - ;Calling Section uninstall macro and writing zero installed flag - !insertmacro "Remove_${${SecName}}" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0\Components\${SecName}" \ - "Installed" 0 - Goto "exit_${SecName}" - - "leave_${SecName}:" - ;Section is selected: - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0\Components\${SecName}" \ - "Installed" 1 - - "exit_${SecName}:" -!macroend - -!macro RemoveSection_CPack SecName - ; This macro is used to call section's Remove_... macro - ;from the uninstaller. - ;Input: section index constant name specified in Section command. - - !insertmacro "Remove_${${SecName}}" -!macroend - -; Determine whether the selection of SecName changed -!macro MaybeSelectionChanged SecName - !insertmacro LoadVar ${SecName}_selected - SectionGetFlags ${${SecName}} $R1 - IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits - - ; See if the status has changed: - IntCmp $R0 $R1 "${SecName}_unchanged" - !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected - - IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected" - !insertmacro "Deselect_required_by_${SecName}" - goto "${SecName}_unchanged" - - "${SecName}_was_selected:" - !insertmacro "Select_${SecName}_depends" - - "${SecName}_unchanged:" -!macroend -;--- End of Add/Remove macros --- - -;-------------------------------- -;Interface Settings - - !define MUI_HEADERIMAGE - !define MUI_ABORTWARNING - -;---------------------------------------- -; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02" -;---------------------------------------- -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 -;==================================================== -; get_NT_environment -; Returns: the selected environment -; Output : head of the stack -;==================================================== -!macro select_NT_profile UN -Function ${UN}select_NT_profile - StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single - DetailPrint "Selected environment for all users" - Push "all" - Return - environment_single: - DetailPrint "Selected environment for current user only." - Push "current" - Return -FunctionEnd -!macroend -!insertmacro select_NT_profile "" -!insertmacro select_NT_profile "un." -;---------------------------------------------------- -!define NT_current_env 'HKCU "Environment"' -!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' - -!ifndef WriteEnvStr_RegKey - !ifdef ALL_USERS - !define WriteEnvStr_RegKey \ - 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' - !else - !define WriteEnvStr_RegKey 'HKCU "Environment"' - !endif -!endif - -; AddToPath - Adds the given dir to the search path. -; Input - head of the stack -; Note - Win9x systems requires reboot - -Function AddToPath - Exch $0 - Push $1 - Push $2 - Push $3 - - # don't add if the path doesn't exist - IfFileExists "$0\*.*" "" AddToPath_done - - ReadEnvStr $1 PATH - ; if the path is too long for a NSIS variable NSIS will return a 0 - ; length string. If we find that, then warn and skip any path - ; modification as it will trash the existing path. - StrLen $2 $1 - IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done - CheckPathLength_ShowPathWarning: - Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!" - Goto AddToPath_done - CheckPathLength_Done: - Push "$1;" - Push "$0;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - Push "$1;" - Push "$0\;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - GetFullPathName /SHORT $3 $0 - Push "$1;" - Push "$3;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - Push "$1;" - Push "$3\;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - - Call IsNT - Pop $1 - StrCmp $1 1 AddToPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" a - FileSeek $1 -1 END - FileReadByte $1 $2 - IntCmp $2 26 0 +2 +2 # DOS EOF - FileSeek $1 -1 END # write over EOF - FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n" - FileClose $1 - SetRebootFlag true - Goto AddToPath_done - - AddToPath_NT: - StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey - ReadRegStr $1 ${NT_current_env} "PATH" - Goto DoTrim - ReadAllKey: - ReadRegStr $1 ${NT_all_env} "PATH" - DoTrim: - StrCmp $1 "" AddToPath_NTdoIt - Push $1 - Call Trim - Pop $1 - StrCpy $0 "$1;$0" - AddToPath_NTdoIt: - StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey - WriteRegExpandStr ${NT_current_env} "PATH" $0 - Goto DoSend - WriteAllKey: - WriteRegExpandStr ${NT_all_env} "PATH" $0 - DoSend: - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - AddToPath_done: - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - - -; RemoveFromPath - Remove a given dir from the path -; Input: head of the stack - -Function un.RemoveFromPath - Exch $0 - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - Push $6 - - IntFmt $6 "%c" 26 # DOS EOF - - Call un.IsNT - Pop $1 - StrCmp $1 1 unRemoveFromPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" r - GetTempFileName $4 - FileOpen $2 $4 w - GetFullPathName /SHORT $0 $0 - StrCpy $0 "SET PATH=%PATH%;$0" - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoop: - FileRead $1 $3 - StrCpy $5 $3 1 -1 # read last char - StrCmp $5 $6 0 +2 # if DOS EOF - StrCpy $3 $3 -1 # remove DOS EOF so we can compare - StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "" unRemoveFromPath_dosLoopEnd - FileWrite $2 $3 - Goto unRemoveFromPath_dosLoop - unRemoveFromPath_dosLoopRemoveLine: - SetRebootFlag true - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoopEnd: - FileClose $2 - FileClose $1 - StrCpy $1 $WINDIR 2 - Delete "$1\autoexec.bat" - CopyFiles /SILENT $4 "$1\autoexec.bat" - Delete $4 - Goto unRemoveFromPath_done - - unRemoveFromPath_NT: - StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey - ReadRegStr $1 ${NT_current_env} "PATH" - Goto unDoTrim - unReadAllKey: - ReadRegStr $1 ${NT_all_env} "PATH" - unDoTrim: - StrCpy $5 $1 1 -1 # copy last char - StrCmp $5 ";" +2 # if last char != ; - StrCpy $1 "$1;" # append ; - Push $1 - Push "$0;" - Call un.StrStr ; Find `$0;` in $1 - Pop $2 ; pos of our dir - StrCmp $2 "" unRemoveFromPath_done - ; else, it is in path - # $0 - path to add - # $1 - path var - StrLen $3 "$0;" - StrLen $4 $2 - StrCpy $5 $1 -$4 # $5 is now the part before the path to remove - StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove - StrCpy $3 $5$6 - - StrCpy $5 $3 1 -1 # copy last char - StrCmp $5 ";" 0 +2 # if last char == ; - StrCpy $3 $3 -1 # remove last char - - StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey - WriteRegExpandStr ${NT_current_env} "PATH" $3 - Goto unDoSend - unWriteAllKey: - WriteRegExpandStr ${NT_all_env} "PATH" $3 - unDoSend: - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - unRemoveFromPath_done: - Pop $6 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Uninstall stuff -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -########################################### -# Utility Functions # -########################################### - -;==================================================== -; IsNT - Returns 1 if the current system is NT, 0 -; otherwise. -; Output: head of the stack -;==================================================== -; IsNT -; no input -; output, top of the stack = 1 if NT or 0 if not -; -; Usage: -; Call IsNT -; Pop $R0 -; ($R0 at this point is 1 or 0) - -!macro IsNT un -Function ${un}IsNT - Push $0 - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $0 "" 0 IsNT_yes - ; we are not NT. - Pop $0 - Push 0 - Return - - IsNT_yes: - ; NT!!! - Pop $0 - Push 1 -FunctionEnd -!macroend -!insertmacro IsNT "" -!insertmacro IsNT "un." - -; StrStr -; input, top of stack = string to search for -; top of stack-1 = string to search in -; output, top of stack (replaces with the portion of the string remaining) -; modifies no other variables. -; -; Usage: -; Push "this is a long ass string" -; Push "ass" -; Call StrStr -; Pop $R0 -; ($R0 at this point is "ass string") - -!macro StrStr un -Function ${un}StrStr -Exch $R1 ; st=haystack,old$R1, $R1=needle - Exch ; st=old$R1,haystack - Exch $R2 ; st=old$R1,old$R2, $R2=haystack - Push $R3 - Push $R4 - Push $R5 - StrLen $R3 $R1 - StrCpy $R4 0 - ; $R1=needle - ; $R2=haystack - ; $R3=len(needle) - ; $R4=cnt - ; $R5=tmp - loop: - StrCpy $R5 $R2 $R3 $R4 - StrCmp $R5 $R1 done - StrCmp $R5 "" done - IntOp $R4 $R4 + 1 - Goto loop -done: - StrCpy $R1 $R2 "" $R4 - Pop $R5 - Pop $R4 - Pop $R3 - Pop $R2 - Exch $R1 -FunctionEnd -!macroend -!insertmacro StrStr "" -!insertmacro StrStr "un." - -Function Trim ; Added by Pelaca - Exch $R1 - Push $R2 -Loop: - StrCpy $R2 "$R1" 1 -1 - StrCmp "$R2" " " RTrim - StrCmp "$R2" "$\n" RTrim - StrCmp "$R2" "$\r" RTrim - StrCmp "$R2" ";" RTrim - GoTo Done -RTrim: - StrCpy $R1 "$R1" -1 - Goto Loop -Done: - Pop $R2 - Exch $R1 -FunctionEnd - -Function ConditionalAddToRegistry - Pop $0 - Pop $1 - StrCmp "$0" "" ConditionalAddToRegistry_EmptyString - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" \ - "$1" "$0" - ;MessageBox MB_OK "Set Registry: '$1' to '$0'" - DetailPrint "Set install registry entry: '$1' to '$0'" - ConditionalAddToRegistry_EmptyString: -FunctionEnd - -;-------------------------------- - -!ifdef CPACK_USES_DOWNLOAD -Function DownloadFile - IfFileExists $INSTDIR\* +2 - CreateDirectory $INSTDIR - Pop $0 - - ; Skip if already downloaded - IfFileExists $INSTDIR\$0 0 +2 - Return - - StrCpy $1 "" - - try_again: - NSISdl::download "$1/$0" "$INSTDIR\$0" - - Pop $1 - StrCmp $1 "success" success - StrCmp $1 "Cancelled" cancel - MessageBox MB_OK "Download failed: $1" - cancel: - Return - success: -FunctionEnd -!endif - -;-------------------------------- -; Define some macro setting for the gui - - - - - - -;-------------------------------- -;Pages - - - !insertmacro MUI_PAGE_WELCOME - - !insertmacro MUI_PAGE_LICENSE "../../../../../../LICENSE.txt" - - Page custom InstallOptionsPage - !insertmacro MUI_PAGE_DIRECTORY - - ;Start Menu Folder Page Configuration - !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" - !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Apache Arrow\Apache Arrow Flight SQL ODBC 1.0.0" - !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" - !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER - - !insertmacro MUI_PAGE_COMPONENTS - - !insertmacro MUI_PAGE_INSTFILES - - - !insertmacro MUI_PAGE_FINISH - - !insertmacro MUI_UNPAGE_CONFIRM - !insertmacro MUI_UNPAGE_INSTFILES - -;-------------------------------- -;Languages - - !insertmacro MUI_LANGUAGE "English" ;first language is the default language - !insertmacro MUI_LANGUAGE "Afrikaans" - !insertmacro MUI_LANGUAGE "Albanian" - !insertmacro MUI_LANGUAGE "Arabic" - !insertmacro MUI_LANGUAGE "Asturian" - !insertmacro MUI_LANGUAGE "Basque" - !insertmacro MUI_LANGUAGE "Belarusian" - !insertmacro MUI_LANGUAGE "Bosnian" - !insertmacro MUI_LANGUAGE "Breton" - !insertmacro MUI_LANGUAGE "Bulgarian" - !insertmacro MUI_LANGUAGE "Catalan" - !insertmacro MUI_LANGUAGE "Corsican" - !insertmacro MUI_LANGUAGE "Croatian" - !insertmacro MUI_LANGUAGE "Czech" - !insertmacro MUI_LANGUAGE "Danish" - !insertmacro MUI_LANGUAGE "Dutch" - !insertmacro MUI_LANGUAGE "Esperanto" - !insertmacro MUI_LANGUAGE "Estonian" - !insertmacro MUI_LANGUAGE "Farsi" - !insertmacro MUI_LANGUAGE "Finnish" - !insertmacro MUI_LANGUAGE "French" - !insertmacro MUI_LANGUAGE "Galician" - !insertmacro MUI_LANGUAGE "German" - !insertmacro MUI_LANGUAGE "Greek" - !insertmacro MUI_LANGUAGE "Hebrew" - !insertmacro MUI_LANGUAGE "Hungarian" - !insertmacro MUI_LANGUAGE "Icelandic" - !insertmacro MUI_LANGUAGE "Indonesian" - !insertmacro MUI_LANGUAGE "Irish" - !insertmacro MUI_LANGUAGE "Italian" - !insertmacro MUI_LANGUAGE "Japanese" - !insertmacro MUI_LANGUAGE "Korean" - !insertmacro MUI_LANGUAGE "Kurdish" - !insertmacro MUI_LANGUAGE "Latvian" - !insertmacro MUI_LANGUAGE "Lithuanian" - !insertmacro MUI_LANGUAGE "Luxembourgish" - !insertmacro MUI_LANGUAGE "Macedonian" - !insertmacro MUI_LANGUAGE "Malay" - !insertmacro MUI_LANGUAGE "Mongolian" - !insertmacro MUI_LANGUAGE "Norwegian" - !insertmacro MUI_LANGUAGE "NorwegianNynorsk" - !insertmacro MUI_LANGUAGE "Pashto" - !insertmacro MUI_LANGUAGE "Polish" - !insertmacro MUI_LANGUAGE "Portuguese" - !insertmacro MUI_LANGUAGE "PortugueseBR" - !insertmacro MUI_LANGUAGE "Romanian" - !insertmacro MUI_LANGUAGE "Russian" - !insertmacro MUI_LANGUAGE "ScotsGaelic" - !insertmacro MUI_LANGUAGE "Serbian" - !insertmacro MUI_LANGUAGE "SerbianLatin" - !insertmacro MUI_LANGUAGE "SimpChinese" - !insertmacro MUI_LANGUAGE "Slovak" - !insertmacro MUI_LANGUAGE "Slovenian" - !insertmacro MUI_LANGUAGE "Spanish" - !insertmacro MUI_LANGUAGE "SpanishInternational" - !insertmacro MUI_LANGUAGE "Swedish" - !insertmacro MUI_LANGUAGE "Tatar" - !insertmacro MUI_LANGUAGE "Thai" - !insertmacro MUI_LANGUAGE "TradChinese" - !insertmacro MUI_LANGUAGE "Turkish" - !insertmacro MUI_LANGUAGE "Ukrainian" - !insertmacro MUI_LANGUAGE "Uzbek" - !insertmacro MUI_LANGUAGE "Vietnamese" - !insertmacro MUI_LANGUAGE "Welsh" - -;-------------------------------- -;Reserve Files - - ;These files should be inserted before other files in the data block - ;Keep these lines before any File command - ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA) - - ReserveFile "NSIS.InstallOptions.ini" - !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS - - ; for UserInfo::GetName and UserInfo::GetAccountType - ReserveFile /plugin 'UserInfo.dll' - -;-------------------------------- -; Installation types - -!define MUI_COMPONENTSPAGE_NODESC -;-------------------------------- -;Installer Sections - -Section "-Core installation" - ;Use the entire tree produced by the INSTALL target. Keep the - ;list of directories here in sync with the RMDir commands below. - SetOutPath "$INSTDIR" - - - - ;Store installation folder - WriteRegStr SHCTX "Software\Apache Arrow\Apache Arrow Flight SQL ODBC 1.0.0" "" $INSTDIR - - ;Create uninstaller - WriteUninstaller "$INSTDIR\Uninstall.exe" - Push "DisplayName" - Push "Apache Arrow Flight SQL ODBC 1.0.0" - Call ConditionalAddToRegistry - Push "DisplayVersion" - Push "1.0.0" - Call ConditionalAddToRegistry - Push "Publisher" - Push "Apache Arrow" - Call ConditionalAddToRegistry - Push "UninstallString" - Push "$\"$INSTDIR\Uninstall.exe$\"" - Call ConditionalAddToRegistry - Push "NoRepair" - Push "1" - Call ConditionalAddToRegistry - - !ifdef CPACK_NSIS_ADD_REMOVE - ;Create add/remove functionality - Push "ModifyPath" - Push "$INSTDIR\AddRemove.exe" - Call ConditionalAddToRegistry - !else - Push "NoModify" - Push "1" - Call ConditionalAddToRegistry - !endif - - ; Optional registration - Push "DisplayIcon" - Push "$INSTDIR\" - Call ConditionalAddToRegistry - Push "HelpLink" - Push "" - Call ConditionalAddToRegistry - Push "URLInfoAbout" - Push "" - Call ConditionalAddToRegistry - Push "Contact" - Push "" - Call ConditionalAddToRegistry - !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State" - !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - - ;Create shortcuts - CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" - - - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" - - ;Read a value from an InstallOptions INI file - !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" - !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State" - !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State" - - ; Write special uninstall registry entries - Push "StartMenu" - Push "$STARTMENU_FOLDER" - Call ConditionalAddToRegistry - Push "DoNotAddToPath" - Push "$DO_NOT_ADD_TO_PATH" - Call ConditionalAddToRegistry - Push "AddToPathAllUsers" - Push "$ADD_TO_PATH_ALL_USERS" - Call ConditionalAddToRegistry - Push "AddToPathCurrentUser" - Push "$ADD_TO_PATH_CURRENT_USER" - Call ConditionalAddToRegistry - Push "InstallToDesktop" - Push "$INSTALL_DESKTOP" - Call ConditionalAddToRegistry - - !insertmacro MUI_STARTMENU_WRITE_END - - - -SectionEnd - -Section "-Add to path" - Push $INSTDIR\bin - StrCmp "" "ON" 0 doNotAddToPath - StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0 - Call AddToPath - doNotAddToPath: -SectionEnd - -;-------------------------------- -; Create custom pages -Function InstallOptionsPage - !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing Apache Arrow Flight SQL ODBC 1.0.0" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini" - -FunctionEnd - -;-------------------------------- -; determine admin versus local install -Function un.onInit - - ClearErrors - UserInfo::GetName - IfErrors noLM - Pop $0 - UserInfo::GetAccountType - Pop $1 - StrCmp $1 "Admin" 0 +3 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Admin group' - Goto done - StrCmp $1 "Power" 0 +3 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Power Users group' - Goto done - - noLM: - ;Get installation folder from registry if available - - done: - -FunctionEnd - -;--- Add/Remove callback functions: --- -!macro SectionList MacroName - ;This macro used to perform operation on multiple sections. - ;List all of your components in following manner here. - !insertmacro "${MacroName}" "libraries" - -!macroend - -Section -FinishComponents - ;Removes unselected components and writes component status to registry - !insertmacro SectionList "FinishSection" - -!ifdef CPACK_NSIS_ADD_REMOVE - ; Get the name of the installer executable - System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1' - StrCpy $R3 $R0 - - ; Strip off the last 13 characters, to see if we have AddRemove.exe - StrLen $R1 $R0 - IntOp $R1 $R0 - 13 - StrCpy $R2 $R0 13 $R1 - StrCmp $R2 "AddRemove.exe" addremove_installed - - ; We're not running AddRemove.exe, so install it - CopyFiles $R3 $INSTDIR\AddRemove.exe - - addremove_installed: -!endif -SectionEnd -;--- End of Add/Remove callback functions --- - -;-------------------------------- -; Component dependencies -Function .onSelChange - !insertmacro SectionList MaybeSelectionChanged -FunctionEnd - -;-------------------------------- -;Uninstaller Section - -Section "Uninstall" - ReadRegStr $START_MENU SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "StartMenu" - ;MessageBox MB_OK "Start menu is in: $START_MENU" - ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "DoNotAddToPath" - ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "AddToPathAllUsers" - ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "AddToPathCurrentUser" - ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" - ReadRegStr $INSTALL_DESKTOP SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "InstallToDesktop" - ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP " - - - - ;Remove files we installed. - ;Keep the list of directories here in sync with the File commands above. - Delete "$INSTDIR\bin" - Delete "$INSTDIR\bin\abseil_dll.dll" - Delete "$INSTDIR\bin\arrow.dll" - Delete "$INSTDIR\bin\arrow_compute.dll" - Delete "$INSTDIR\bin\arrow_flight.dll" - Delete "$INSTDIR\bin\arrow_flight_sql.dll" - Delete "$INSTDIR\bin\arrow_flight_sql_odbc.dll" - Delete "$INSTDIR\bin\arrow_flight_testing.dll" - Delete "$INSTDIR\bin\arrow_testing.dll" - Delete "$INSTDIR\bin\boost_filesystem-vc143-mt-x64-1_87.dll" - Delete "$INSTDIR\bin\boost_locale-vc143-mt-x64-1_87.dll" - Delete "$INSTDIR\bin\cares.dll" - Delete "$INSTDIR\bin\gflags.dll" - Delete "$INSTDIR\bin\gmock.dll" - Delete "$INSTDIR\bin\gtest.dll" - Delete "$INSTDIR\bin\gtest_main.dll" - Delete "$INSTDIR\bin\libcrypto-3-x64.dll" - Delete "$INSTDIR\bin\libprotobuf.dll" - Delete "$INSTDIR\bin\libssl-3-x64.dll" - Delete "$INSTDIR\bin\re2.dll" - Delete "$INSTDIR\bin\sqlite3.dll" - Delete "$INSTDIR\bin\utf8proc.dll" - Delete "$INSTDIR\bin\zlib1.dll" - Delete "$INSTDIR\bin\concrt140.dll" - Delete "$INSTDIR\bin\msvcp140.dll" - Delete "$INSTDIR\bin\msvcp140_1.dll" - Delete "$INSTDIR\bin\msvcp140_2.dll" - Delete "$INSTDIR\bin\msvcp140_atomic_wait.dll" - Delete "$INSTDIR\bin\msvcp140_codecvt_ids.dll" - Delete "$INSTDIR\bin\vcruntime140.dll" - Delete "$INSTDIR\bin\vcruntime140_1.dll" - - RMDir "$INSTDIR\bin" - - -!ifdef CPACK_NSIS_ADD_REMOVE - ;Remove the add/remove program - Delete "$INSTDIR\AddRemove.exe" -!endif - - ;Remove the uninstaller itself. - Delete "$INSTDIR\Uninstall.exe" - DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" - - ;Remove the installation directory if it is empty. - RMDir "$INSTDIR" - - ; Remove the registry entries. - DeleteRegKey SHCTX "Software\Apache Arrow\Apache Arrow Flight SQL ODBC 1.0.0" - - ; Removes all optional components - !insertmacro SectionList "RemoveSection_CPack" - - !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP - - Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" - - - - ;Delete empty start menu parent directories - StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - - startMenuDeleteLoop: - ClearErrors - RMDir $MUI_TEMP - GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - - IfErrors startMenuDeleteLoopDone - - StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop - startMenuDeleteLoopDone: - - ; If the user changed the shortcut, then uninstall may not work. This should - ; try to fix it. - StrCpy $MUI_TEMP "$START_MENU" - Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" - - - ;Delete empty start menu parent directories - StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - - secondStartMenuDeleteLoop: - ClearErrors - RMDir $MUI_TEMP - GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - - IfErrors secondStartMenuDeleteLoopDone - - StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop - secondStartMenuDeleteLoopDone: - - DeleteRegKey /ifempty SHCTX "Software\Apache Arrow\Apache Arrow Flight SQL ODBC 1.0.0" - - Push $INSTDIR\bin - StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0 - Call un.RemoveFromPath - doNotRemoveFromPath: -SectionEnd - -;-------------------------------- -; determine admin versus local install -; Is install for "AllUsers" or "JustMe"? -; Default to "JustMe" - set to "AllUsers" if admin or on Win9x -; This function is used for the very first "custom page" of the installer. -; This custom page does not show up visibly, but it executes prior to the -; first visible page and sets up $INSTDIR properly... -; Choose different default installation folder based on SV_ALLUSERS... -; "Program Files" for AllUsers, "My Documents" for JustMe... - -Function .onInit - StrCmp "" "ON" 0 inst - - ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Arrow Flight SQL ODBC 1.0.0" "UninstallString" - StrCmp $0 "" inst - - MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \ - "Apache Arrow Flight SQL ODBC 1.0.0 is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \ - /SD IDYES IDYES uninst IDNO inst - Abort - -;Run the uninstaller -uninst: - ClearErrors - # $0 should _always_ be quoted, however older versions of CMake did not - # do this. We'll conditionally remove the begin/end quotes. - # Remove first char if quote - StrCpy $2 $0 1 0 # copy first char - StrCmp $2 "$\"" 0 +2 # if char is quote - StrCpy $0 $0 "" 1 # remove first char - # Remove last char if quote - StrCpy $2 $0 1 -1 # copy last char - StrCmp $2 "$\"" 0 +2 # if char is quote - StrCpy $0 $0 -1 # remove last char - - StrLen $2 "\Uninstall.exe" - StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path - ExecWait '"$0" /S _?=$3' ;Do not copy the uninstaller to a temp file - - IfErrors uninst_failed inst -uninst_failed: - MessageBox MB_OK|MB_ICONSTOP "Uninstall failed." - Abort - - -inst: - ; Reads components status for registry - !insertmacro SectionList "InitSection" - - ; check to see if /D has been used to change - ; the install directory by comparing it to the - ; install directory that is expected to be the - ; default - StrCpy $IS_DEFAULT_INSTALLDIR 0 - StrCmp "$INSTDIR" "$PROGRAMFILES64\Apache Arrow Flight SQL ODBC 1.0.0" 0 +2 - StrCpy $IS_DEFAULT_INSTALLDIR 1 - - StrCpy $SV_ALLUSERS "JustMe" - ; if default install dir then change the default - ; if it is installed for JustMe - StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 - StrCpy $INSTDIR "$DOCUMENTS\Apache Arrow Flight SQL ODBC 1.0.0" - - ClearErrors - UserInfo::GetName - IfErrors noLM - Pop $0 - UserInfo::GetAccountType - Pop $1 - StrCmp $1 "Admin" 0 +4 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Admin group' - StrCpy $SV_ALLUSERS "AllUsers" - Goto done - StrCmp $1 "Power" 0 +3 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Power Users group' - StrCpy $SV_ALLUSERS "AllUsers" - Goto done - - noLM: - StrCpy $SV_ALLUSERS "AllUsers" - ;Get installation folder from registry if available - - done: - StrCmp $SV_ALLUSERS "AllUsers" 0 +3 - StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 - StrCpy $INSTDIR "$PROGRAMFILES64\Apache Arrow Flight SQL ODBC 1.0.0" - - StrCmp "" "ON" 0 noOptionsPage - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" - - noOptionsPage: -FunctionEnd From f008c9a29c1b46082549018377f67574436bd808 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Mon, 18 Aug 2025 19:04:50 -0700 Subject: [PATCH 12/22] Add component section --- cpp/CMakeLists.txt | 8 +++++-- cpp/cmake_modules/BuildUtils.cmake | 23 +++++++++++++++----- cpp/cmake_modules/ThirdpartyToolchain.cmake | 10 +++++---- cpp/src/arrow/CMakeLists.txt | 13 +++++++---- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 13 ++++++----- 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index bef1c841583..0d26a980117 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -717,9 +717,13 @@ endif() install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE.txt ${CMAKE_CURRENT_SOURCE_DIR}/../NOTICE.txt - ${CMAKE_CURRENT_SOURCE_DIR}/README.md DESTINATION "${ARROW_DOC_DIR}") + ${CMAKE_CURRENT_SOURCE_DIR}/README.md + DESTINATION "${ARROW_DOC_DIR}" + COMPONENT arrow_doc) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gdb_arrow.py DESTINATION "${ARROW_GDB_DIR}") +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gdb_arrow.py + DESTINATION "${ARROW_GDB_DIR}" + COMPONENT arrow_gdb) # # Validate and print out Arrow configuration options diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index 8a42da82cdc..35a846ec1bb 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -178,10 +178,12 @@ function(arrow_install_cmake_package PACKAGE_NAME EXPORT_NAME) write_basic_package_version_file("${BUILT_CONFIG_VERSION_CMAKE}" COMPATIBILITY SameMajorVersion) install(FILES "${BUILT_CONFIG_CMAKE}" "${BUILT_CONFIG_VERSION_CMAKE}" - DESTINATION "${ARROW_CMAKE_DIR}/${PACKAGE_NAME}") + DESTINATION "${ARROW_CMAKE_DIR}/${PACKAGE_NAME}" + COMPONENT config_cmake_file) set(TARGETS_CMAKE "${PACKAGE_NAME}Targets.cmake") install(EXPORT ${EXPORT_NAME} DESTINATION "${ARROW_CMAKE_DIR}/${PACKAGE_NAME}" + COMPONENT config_cmake_export NAMESPACE "${PACKAGE_NAME}::" FILE "${TARGETS_CMAKE}") endfunction() @@ -403,12 +405,15 @@ function(ADD_ARROW_LIB LIB_NAME) install(TARGETS ${LIB_NAME}_shared ${INSTALL_IS_OPTIONAL} EXPORT ${LIB_NAME}_targets ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} + COMPONENT ${LIB_NAME}_shared_archive LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} + COMPONENT ${LIB_NAME}_shared_library RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} - COMPONENT ${LIB_NAME}_shared + COMPONENT ${LIB_NAME}_shared_runtime INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - ${LIB_NAME}_shared) + ${LIB_NAME}_shared + COMPONENT ${LIB_NAME}_shared_includedir) endif() if(BUILD_STATIC) @@ -473,11 +478,14 @@ function(ADD_ARROW_LIB LIB_NAME) install(TARGETS ${LIB_NAME}_static ${INSTALL_IS_OPTIONAL} EXPORT ${LIB_NAME}_targets ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} + COMPONENT ${LIB_NAME}_static_library LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} + COMPONENT ${LIB_NAME}_static_library RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} + COMPONENT ${LIB_NAME}_static_library INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT ${LIB_NAME}_static) + COMPONENT ${LIB_NAME}_static_includedir) endif() if(ARG_CMAKE_PACKAGE_NAME) @@ -937,7 +945,9 @@ function(ARROW_INSTALL_ALL_HEADERS PATH) endif() list(APPEND PUBLIC_HEADERS ${HEADER}) endforeach() - install(FILES ${PUBLIC_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PATH}") + install(FILES ${PUBLIC_HEADERS} + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PATH}" + COMPONENT ${HEADER}_header) endfunction() function(ARROW_ADD_PKG_CONFIG MODULE) @@ -947,7 +957,8 @@ function(ARROW_ADD_PKG_CONFIG MODULE) OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$/${MODULE}.pc" INPUT "${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.pc.generate.in") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/$/${MODULE}.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/") + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/" + COMPONENT ${MODULE}_pkg_config) endfunction() # Implementations of lisp "car" and "cdr" functions diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 3517a7b0725..217c622b289 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -236,7 +236,8 @@ function(provide_cmake_module MODULE_NAME ARROW_CMAKE_PACKAGE_NAME) message(STATUS "Providing CMake module for ${MODULE_NAME} as part of ${ARROW_CMAKE_PACKAGE_NAME} CMake package" ) install(FILES "${module}" - DESTINATION "${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}") + DESTINATION "${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}" + COMPONENT ${MODULE_NAME}_module) endif() endfunction() @@ -2356,7 +2357,8 @@ function(build_gtest) endforeach() install(DIRECTORY "${googletest_SOURCE_DIR}/googlemock/include/" "${googletest_SOURCE_DIR}/googletest/include/" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + COMPONENT gtest_dir) add_library(arrow::GTest::gtest_headers INTERFACE IMPORTED) target_include_directories(arrow::GTest::gtest_headers INTERFACE "${googletest_SOURCE_DIR}/googlemock/include/" @@ -2365,12 +2367,12 @@ function(build_gtest) EXPORT arrow_testing_targets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - COMPONENT gtest) + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT gtest_target) if(MSVC) install(FILES $ $ $ $ DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT gtest_pdb OPTIONAL) endif() add_library(arrow::GTest::gmock ALIAS gmock) diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index 42b0bcc151c..9b2a6567508 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -345,7 +345,8 @@ endmacro() configure_file("util/config.h.cmake" "util/config.h" ESCAPE_QUOTES) configure_file("util/config_internal.h.cmake" "util/config_internal.h" ESCAPE_QUOTES) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/util/config.h" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/util") + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/util" + COMPONENT arrow_config) set(ARROW_SRCS builder.cc @@ -1039,7 +1040,8 @@ if(ARROW_BUILD_BUNDLED_DEPENDENCIES) get_target_property(arrow_bundled_dependencies_path arrow_bundled_dependencies IMPORTED_LOCATION) install(FILES ${arrow_bundled_dependencies_path} ${INSTALL_IS_OPTIONAL} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT arrow_bundled_dependencies) string(PREPEND ARROW_PC_LIBS_PRIVATE " -larrow_bundled_dependencies") list(INSERT ARROW_STATIC_INSTALL_INTERFACE_LIBS 0 "Arrow::arrow_bundled_dependencies") endif() @@ -1156,6 +1158,7 @@ if(ARROW_BUILD_SHARED AND NOT WIN32) if(ARROW_GDB_AUTO_LOAD_LIBARROW_GDB_INSTALL) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libarrow_gdb.py" DESTINATION "${ARROW_GDB_AUTO_LOAD_LIBARROW_GDB_DIR}" + COMPONENT arrow_gdb RENAME "$-gdb.py") endif() endif() @@ -1219,11 +1222,13 @@ arrow_install_all_headers("arrow") config_summary_cmake_setters("${CMAKE_CURRENT_BINARY_DIR}/ArrowOptions.cmake") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ArrowOptions.cmake - DESTINATION "${ARROW_CMAKE_DIR}/Arrow") + DESTINATION "${ARROW_CMAKE_DIR}/Arrow" + COMPONENT arrow_options_cmake) # For backward compatibility for find_package(arrow) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arrow-config.cmake - DESTINATION "${ARROW_CMAKE_DIR}/Arrow") + DESTINATION "${ARROW_CMAKE_DIR}/Arrow" + COMPONENT arrow_config_cmake) # # Unit tests diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index b911cb5c091..ea1a93acae3 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -101,17 +101,20 @@ message(STATUS "-AL- CMAKE_INSTALL_INCLUDEDIR = ${CMAKE_INSTALL_INCLUDEDIR}") message(STATUS "-AL- CMAKE_INSTALL_BINDIR = ${CMAKE_INSTALL_BINDIR}") message(STATUS "-AL- ARROW_CMAKE_DIR = ${ARROW_CMAKE_DIR}") message(STATUS "-AL- ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_PACKAGE_NAME}") -message(STATUS "-AL- ARROW_CMAKE_DIR/ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}") +message(STATUS "-AL- ARROW_CMAKE_DIR/ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}" +) message(STATUS "-AL- CMAKE_RUNTIME_OUTPUT_DIRECTORY = ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") message(STATUS "-AL- BUILD_OUTPUT_ROOT_DIRECTORY = ${BUILD_OUTPUT_ROOT_DIRECTORY}") message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") -message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}") +message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}" +) message(STATUS "-AL- CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") message(STATUS "-AL- CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}") include(InstallRequiredSystemLibraries) -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt") +set(CPACK_RESOURCE_FILE_LICENSE + "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt") # Tentative version 1.0.0 (patch version is not set) set(CPACK_PACKAGE_VERSION_MAJOR "1") set(CPACK_PACKAGE_VERSION_MINOR "0") @@ -123,14 +126,14 @@ set(CPACK_PACKAGE_CONTACT "#TODO arrow maintainers") install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" DESTINATION bin - COMPONENT library FILES_MATCHING PATTERN "*.dll") get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) # Returns: 1>-- -AL- CPACK_COMPONENTS_ALL before = Unspecified;arrow_compute_shared;arrow_flight_shared;arrow_flight_sql_odbc_shared;arrow_flight_sql_shared;arrow_flight_testing_shared;arrow_shared;arrow_testing_shared;library message(STATUS "-AL- CPACK_COMPONENTS_ALL before = ${CPACK_COMPONENTS_ALL}") -list(REMOVE_ITEM CPACK_COMPONENTS_ALL "arrow_compute_shared" "arrow_flight_shared" "arrow_flight_sql_odbc_shared" "arrow_flight_sql_shared" "arrow_flight_testing_shared" "arrow_shared" "arrow_testing_shared") +# list(REMOVE_ITEM CPACK_COMPONENTS_ALL "arrow_compute_shared" "arrow_flight_shared" "arrow_flight_sql_odbc_shared" "arrow_flight_sql_shared" "arrow_flight_testing_shared" "arrow_shared" "arrow_testing_shared") +set(CPACK_COMPONENTS_ALL Unspecified) message(STATUS "-AL- CPACK_COMPONENTS_ALL after = ${CPACK_COMPONENTS_ALL}") include(CPack) From 3e4b5308b27d7b94c741fddd422e2daea1f4907b Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 19 Aug 2025 09:27:23 -0700 Subject: [PATCH 13/22] Exclude unwanted dll files --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index ea1a93acae3..0708e9f1165 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -127,7 +127,13 @@ set(CPACK_PACKAGE_CONTACT "#TODO arrow maintainers") install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" DESTINATION bin FILES_MATCHING - PATTERN "*.dll") + PATTERN "*.dll" + PATTERN "arrow_flight_testing.dll" EXCLUDE + PATTERN "arrow_testing.dll" EXCLUDE + PATTERN "gflags.dll" EXCLUDE + PATTERN "gmock.dll" EXCLUDE + PATTERN "gtest.dll" EXCLUDE + PATTERN "gtest_main.dll" EXCLUDE) get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) # Returns: 1>-- -AL- CPACK_COMPONENTS_ALL before = Unspecified;arrow_compute_shared;arrow_flight_shared;arrow_flight_sql_odbc_shared;arrow_flight_sql_shared;arrow_flight_testing_shared;arrow_shared;arrow_testing_shared;library From 2470f0c38b6c65161111f0a844f850c659f7736e Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 19 Aug 2025 11:13:26 -0700 Subject: [PATCH 14/22] Fix C++ build --- cpp/cmake_modules/BuildUtils.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index 35a846ec1bb..fa60ec60444 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -412,7 +412,6 @@ function(ADD_ARROW_LIB LIB_NAME) COMPONENT ${LIB_NAME}_shared_runtime INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - ${LIB_NAME}_shared COMPONENT ${LIB_NAME}_shared_includedir) endif() From 9d190e8b50b64378c4bd690afb8b89ec72b9f6b2 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 19 Aug 2025 11:30:44 -0700 Subject: [PATCH 15/22] Continue Fix for C++ build --- cpp/cmake_modules/BuildUtils.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index fa60ec60444..305546572c4 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -411,8 +411,7 @@ function(ADD_ARROW_LIB LIB_NAME) RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${LIB_NAME}_shared_runtime INCLUDES - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT ${LIB_NAME}_shared_includedir) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) endif() if(BUILD_STATIC) @@ -483,8 +482,7 @@ function(ADD_ARROW_LIB LIB_NAME) RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${LIB_NAME}_static_library INCLUDES - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT ${LIB_NAME}_static_includedir) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) endif() if(ARG_CMAKE_PACKAGE_NAME) From 56a418cb707c7531ab4a136876643bfef061711c Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 19 Aug 2025 11:34:04 -0700 Subject: [PATCH 16/22] Wrap installer code with `ARROW_FLIGHT_SQL_ODBC_INSTALLER` environment variable --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 6 +- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 101 ++++++++++--------- 2 files changed, 55 insertions(+), 52 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 217c622b289..ba63c7c22f4 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -2365,9 +2365,9 @@ function(build_gtest) "${googletest_SOURCE_DIR}/googletest/include/") install(TARGETS gmock gmock_main gtest gtest_main EXPORT arrow_testing_targets - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT gtest_target) + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT gtest_runtime + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT gtest_archive + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT gtest_library) if(MSVC) install(FILES $ $ $ $ diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 0708e9f1165..5abd5ba6978 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -94,52 +94,55 @@ endforeach() # Construct ODBC Windows installer -# -AL- try to find the path for "release/Release" -message(STATUS "-AL- CMAKE_INSTALL_LIBDIR = ${CMAKE_INSTALL_LIBDIR}") -message(STATUS "-AL- CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}") -message(STATUS "-AL- CMAKE_INSTALL_INCLUDEDIR = ${CMAKE_INSTALL_INCLUDEDIR}") -message(STATUS "-AL- CMAKE_INSTALL_BINDIR = ${CMAKE_INSTALL_BINDIR}") -message(STATUS "-AL- ARROW_CMAKE_DIR = ${ARROW_CMAKE_DIR}") -message(STATUS "-AL- ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_PACKAGE_NAME}") -message(STATUS "-AL- ARROW_CMAKE_DIR/ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}" -) -message(STATUS "-AL- CMAKE_RUNTIME_OUTPUT_DIRECTORY = ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") -message(STATUS "-AL- BUILD_OUTPUT_ROOT_DIRECTORY = ${BUILD_OUTPUT_ROOT_DIRECTORY}") -message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") -message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}" -) -message(STATUS "-AL- CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") -message(STATUS "-AL- CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}") - -include(InstallRequiredSystemLibraries) - -set(CPACK_RESOURCE_FILE_LICENSE - "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt") -# Tentative version 1.0.0 (patch version is not set) -set(CPACK_PACKAGE_VERSION_MAJOR "1") -set(CPACK_PACKAGE_VERSION_MINOR "0") - -set(CPACK_PACKAGE_NAME "Apache Arrow Flight SQL ODBC") -set(CPACK_PACKAGE_VENDOR "Apache Arrow") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver") -set(CPACK_PACKAGE_CONTACT "#TODO arrow maintainers") - -install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" - DESTINATION bin - FILES_MATCHING - PATTERN "*.dll" - PATTERN "arrow_flight_testing.dll" EXCLUDE - PATTERN "arrow_testing.dll" EXCLUDE - PATTERN "gflags.dll" EXCLUDE - PATTERN "gmock.dll" EXCLUDE - PATTERN "gtest.dll" EXCLUDE - PATTERN "gtest_main.dll" EXCLUDE) - -get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) -# Returns: 1>-- -AL- CPACK_COMPONENTS_ALL before = Unspecified;arrow_compute_shared;arrow_flight_shared;arrow_flight_sql_odbc_shared;arrow_flight_sql_shared;arrow_flight_testing_shared;arrow_shared;arrow_testing_shared;library -message(STATUS "-AL- CPACK_COMPONENTS_ALL before = ${CPACK_COMPONENTS_ALL}") -# list(REMOVE_ITEM CPACK_COMPONENTS_ALL "arrow_compute_shared" "arrow_flight_shared" "arrow_flight_sql_odbc_shared" "arrow_flight_sql_shared" "arrow_flight_testing_shared" "arrow_shared" "arrow_testing_shared") -set(CPACK_COMPONENTS_ALL Unspecified) -message(STATUS "-AL- CPACK_COMPONENTS_ALL after = ${CPACK_COMPONENTS_ALL}") - -include(CPack) +if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) + # -AL- try to find the path for "release/Release" + message(STATUS "-AL- CMAKE_INSTALL_LIBDIR = ${CMAKE_INSTALL_LIBDIR}") + message(STATUS "-AL- CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}") + message(STATUS "-AL- CMAKE_INSTALL_INCLUDEDIR = ${CMAKE_INSTALL_INCLUDEDIR}") + message(STATUS "-AL- CMAKE_INSTALL_BINDIR = ${CMAKE_INSTALL_BINDIR}") + message(STATUS "-AL- ARROW_CMAKE_DIR = ${ARROW_CMAKE_DIR}") + message(STATUS "-AL- ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_PACKAGE_NAME}") + message(STATUS "-AL- ARROW_CMAKE_DIR/ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}" + ) + message(STATUS "-AL- CMAKE_RUNTIME_OUTPUT_DIRECTORY = ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" + ) + message(STATUS "-AL- BUILD_OUTPUT_ROOT_DIRECTORY = ${BUILD_OUTPUT_ROOT_DIRECTORY}") + message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") + message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}" + ) + message(STATUS "-AL- CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") + message(STATUS "-AL- CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}") + + include(InstallRequiredSystemLibraries) + + set(CPACK_RESOURCE_FILE_LICENSE + "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt") + # Tentative version 1.0.0 (patch version is not set) + set(CPACK_PACKAGE_VERSION_MAJOR "1") + set(CPACK_PACKAGE_VERSION_MINOR "0") + + set(CPACK_PACKAGE_NAME "Apache Arrow Flight SQL ODBC") + set(CPACK_PACKAGE_VENDOR "Apache Arrow") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver") + set(CPACK_PACKAGE_CONTACT "#TODO arrow maintainers") + + install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" + DESTINATION bin + FILES_MATCHING + PATTERN "*.dll" + PATTERN "arrow_flight_testing.dll" EXCLUDE + PATTERN "arrow_testing.dll" EXCLUDE + PATTERN "gflags.dll" EXCLUDE + PATTERN "gmock.dll" EXCLUDE + PATTERN "gtest.dll" EXCLUDE + PATTERN "gtest_main.dll" EXCLUDE) + + get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) + # Returns: 1>-- -AL- CPACK_COMPONENTS_ALL before = Unspecified;arrow_compute_shared;arrow_flight_shared;arrow_flight_sql_odbc_shared;arrow_flight_sql_shared;arrow_flight_testing_shared;arrow_shared;arrow_testing_shared;library + message(STATUS "-AL- CPACK_COMPONENTS_ALL before = ${CPACK_COMPONENTS_ALL}") + # list(REMOVE_ITEM CPACK_COMPONENTS_ALL "arrow_compute_shared" "arrow_flight_shared" "arrow_flight_sql_odbc_shared" "arrow_flight_sql_shared" "arrow_flight_testing_shared" "arrow_shared" "arrow_testing_shared") + set(CPACK_COMPONENTS_ALL Unspecified) + message(STATUS "-AL- CPACK_COMPONENTS_ALL after = ${CPACK_COMPONENTS_ALL}") + + include(CPack) +endif() From 424755390b277683cf64615714c5d6f4f3f16d25 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 19 Aug 2025 12:02:12 -0700 Subject: [PATCH 17/22] Add component flightsqlodbc --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 5abd5ba6978..6c758712190 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -128,6 +128,7 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" DESTINATION bin + COMPONENT flight_sql_odbc_lib FILES_MATCHING PATTERN "*.dll" PATTERN "arrow_flight_testing.dll" EXCLUDE @@ -142,7 +143,16 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) message(STATUS "-AL- CPACK_COMPONENTS_ALL before = ${CPACK_COMPONENTS_ALL}") # list(REMOVE_ITEM CPACK_COMPONENTS_ALL "arrow_compute_shared" "arrow_flight_shared" "arrow_flight_sql_odbc_shared" "arrow_flight_sql_shared" "arrow_flight_testing_shared" "arrow_shared" "arrow_testing_shared") set(CPACK_COMPONENTS_ALL Unspecified) + list(APPEND CPACK_COMPONENTS_ALL "flight_sql_odbc_lib") + message(STATUS "-AL- CPACK_COMPONENTS_ALL after = ${CPACK_COMPONENTS_ALL}") include(CPack) + + cpack_add_component(flight_sql_odbc_lib DISPLAY_NAME "ODBC library" + DESCRIPTION + "ODBC library bin, required to install" + REQUIRED) + + message(STATUS "-AL- CPACK_COMPONENTS_ALL last = ${CPACK_COMPONENTS_ALL}") endif() From 9d5bb2e869555df3803673a45f6616b86d421dc0 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 19 Aug 2025 14:00:48 -0700 Subject: [PATCH 18/22] Draft use WiX installer package * By default, if `CPACK_GENERATOR` is not set, `NSIS` is used --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 43 ++++++++++++-------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 6c758712190..e802d29ef69 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -126,17 +126,21 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver") set(CPACK_PACKAGE_CONTACT "#TODO arrow maintainers") - install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" - DESTINATION bin - COMPONENT flight_sql_odbc_lib - FILES_MATCHING - PATTERN "*.dll" - PATTERN "arrow_flight_testing.dll" EXCLUDE - PATTERN "arrow_testing.dll" EXCLUDE - PATTERN "gflags.dll" EXCLUDE - PATTERN "gmock.dll" EXCLUDE - PATTERN "gtest.dll" EXCLUDE - PATTERN "gtest_main.dll" EXCLUDE) + # TODO: set up `flight_sql_odbc_lib` component for macOS Installer + # TODO: set up `flight_sql_odbc_lib` component for Linux Installer + if(WIN32) + install(DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}/" + DESTINATION bin + COMPONENT flight_sql_odbc_lib + FILES_MATCHING + PATTERN "*.dll" + PATTERN "arrow_flight_testing.dll" EXCLUDE + PATTERN "arrow_testing.dll" EXCLUDE + PATTERN "gflags.dll" EXCLUDE + PATTERN "gmock.dll" EXCLUDE + PATTERN "gtest.dll" EXCLUDE + PATTERN "gtest_main.dll" EXCLUDE) + endif() get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) # Returns: 1>-- -AL- CPACK_COMPONENTS_ALL before = Unspecified;arrow_compute_shared;arrow_flight_shared;arrow_flight_sql_odbc_shared;arrow_flight_sql_shared;arrow_flight_testing_shared;arrow_shared;arrow_testing_shared;library @@ -147,12 +151,19 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) message(STATUS "-AL- CPACK_COMPONENTS_ALL after = ${CPACK_COMPONENTS_ALL}") - include(CPack) + if(WIN32) + # Use WiX V.6 + set(CPACK_GENERATOR "WIX") + set(CPACK_WIX_VERSION 4) - cpack_add_component(flight_sql_odbc_lib DISPLAY_NAME "ODBC library" - DESCRIPTION - "ODBC library bin, required to install" - REQUIRED) + endif() + + include(CPack) + #-AL- todo set CPACK_WIX_UPGRADE_GUID + cpack_add_component(flight_sql_odbc_lib + DISPLAY_NAME "ODBC library" + DESCRIPTION "ODBC library bin, required to install" + REQUIRED) message(STATUS "-AL- CPACK_COMPONENTS_ALL last = ${CPACK_COMPONENTS_ALL}") endif() From a265c162d40e1adf32debd9b97bb0cfba80d4057 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 19 Aug 2025 14:10:41 -0700 Subject: [PATCH 19/22] Set CPACK_WIX_UPGRADE_GUID --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index e802d29ef69..a4d3cbbe634 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -156,10 +156,11 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) set(CPACK_GENERATOR "WIX") set(CPACK_WIX_VERSION 4) + # Upgrade GUID is required to be unchanged for ODBC installer to upgrade + set(CPACK_WIX_UPGRADE_GUID "DBF27A18-F8BF-423F-9E3A-957414D52C4B") endif() include(CPack) - #-AL- todo set CPACK_WIX_UPGRADE_GUID cpack_add_component(flight_sql_odbc_lib DISPLAY_NAME "ODBC library" DESCRIPTION "ODBC library bin, required to install" From 223361903306c052ff9529553ab6b4cc0aa908f1 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 19 Aug 2025 14:56:31 -0700 Subject: [PATCH 20/22] Add comments --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index a4d3cbbe634..46e6099e1f7 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -92,8 +92,7 @@ foreach(LIB_TARGET ${ARROW_FLIGHT_SQL_ODBC_LIBRARIES}) target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_SQL_ODBC_EXPORTING) endforeach() -# Construct ODBC Windows installer - +# Construct ODBC Windows installer. Only Release installer is supported if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) # -AL- try to find the path for "release/Release" message(STATUS "-AL- CMAKE_INSTALL_LIBDIR = ${CMAKE_INSTALL_LIBDIR}") @@ -152,13 +151,16 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) message(STATUS "-AL- CPACK_COMPONENTS_ALL after = ${CPACK_COMPONENTS_ALL}") if(WIN32) - # Use WiX V.6 + # WiX msi installer on Windows + # CPack is compatible with WiX V.5 and V.6 set(CPACK_GENERATOR "WIX") set(CPACK_WIX_VERSION 4) # Upgrade GUID is required to be unchanged for ODBC installer to upgrade set(CPACK_WIX_UPGRADE_GUID "DBF27A18-F8BF-423F-9E3A-957414D52C4B") endif() + # TODO: create macOS Installer using cpack + # TODO: create Linux Installer using cpack include(CPack) cpack_add_component(flight_sql_odbc_lib From c467e53e816864a064d850eacb5c7d660435ca8e Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 19 Aug 2025 16:34:36 -0700 Subject: [PATCH 21/22] Clean up PR --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 25 +------------------- 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 46e6099e1f7..d84f4934006 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -94,23 +94,6 @@ endforeach() # Construct ODBC Windows installer. Only Release installer is supported if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) - # -AL- try to find the path for "release/Release" - message(STATUS "-AL- CMAKE_INSTALL_LIBDIR = ${CMAKE_INSTALL_LIBDIR}") - message(STATUS "-AL- CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}") - message(STATUS "-AL- CMAKE_INSTALL_INCLUDEDIR = ${CMAKE_INSTALL_INCLUDEDIR}") - message(STATUS "-AL- CMAKE_INSTALL_BINDIR = ${CMAKE_INSTALL_BINDIR}") - message(STATUS "-AL- ARROW_CMAKE_DIR = ${ARROW_CMAKE_DIR}") - message(STATUS "-AL- ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_PACKAGE_NAME}") - message(STATUS "-AL- ARROW_CMAKE_DIR/ARROW_CMAKE_PACKAGE_NAME = ${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}" - ) - message(STATUS "-AL- CMAKE_RUNTIME_OUTPUT_DIRECTORY = ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" - ) - message(STATUS "-AL- BUILD_OUTPUT_ROOT_DIRECTORY = ${BUILD_OUTPUT_ROOT_DIRECTORY}") - message(STATUS "-AL- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") - message(STATUS "-AL- $BUILD_OUTPUT_ROOT_DIRECTORY$CMAKE_BUILD_TYPE = ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_BUILD_TYPE}" - ) - message(STATUS "-AL- CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") - message(STATUS "-AL- CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}") include(InstallRequiredSystemLibraries) @@ -142,14 +125,9 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) endif() get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) - # Returns: 1>-- -AL- CPACK_COMPONENTS_ALL before = Unspecified;arrow_compute_shared;arrow_flight_shared;arrow_flight_sql_odbc_shared;arrow_flight_sql_shared;arrow_flight_testing_shared;arrow_shared;arrow_testing_shared;library - message(STATUS "-AL- CPACK_COMPONENTS_ALL before = ${CPACK_COMPONENTS_ALL}") - # list(REMOVE_ITEM CPACK_COMPONENTS_ALL "arrow_compute_shared" "arrow_flight_shared" "arrow_flight_sql_odbc_shared" "arrow_flight_sql_shared" "arrow_flight_testing_shared" "arrow_shared" "arrow_testing_shared") set(CPACK_COMPONENTS_ALL Unspecified) list(APPEND CPACK_COMPONENTS_ALL "flight_sql_odbc_lib") - message(STATUS "-AL- CPACK_COMPONENTS_ALL after = ${CPACK_COMPONENTS_ALL}") - if(WIN32) # WiX msi installer on Windows # CPack is compatible with WiX V.5 and V.6 @@ -162,11 +140,10 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) # TODO: create macOS Installer using cpack # TODO: create Linux Installer using cpack + # Load CPack after all CPACK* variables are set include(CPack) cpack_add_component(flight_sql_odbc_lib DISPLAY_NAME "ODBC library" DESCRIPTION "ODBC library bin, required to install" REQUIRED) - - message(STATUS "-AL- CPACK_COMPONENTS_ALL last = ${CPACK_COMPONENTS_ALL}") endif() From fc0bd0007199b4af631725cf005f41468fce939c Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 19 Aug 2025 16:38:40 -0700 Subject: [PATCH 22/22] Enable ODBC installer in builds --- .github/workflows/cpp.yml | 1 + ci/scripts/cpp_build.sh | 1 + cpp/CMakePresets.json | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index b29b55d5586..e95666dab7e 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -398,6 +398,7 @@ jobs: ARROW_FLIGHT: ON ARROW_FLIGHT_SQL: ON ARROW_FLIGHT_SQL_ODBC: ON + ARROW_FLIGHT_SQL_ODBC_INSTALLER: ON ARROW_GANDIVA: ON ARROW_GCS: ON ARROW_HDFS: OFF diff --git a/ci/scripts/cpp_build.sh b/ci/scripts/cpp_build.sh index 2d0a0f89975..ed33aac3373 100755 --- a/ci/scripts/cpp_build.sh +++ b/ci/scripts/cpp_build.sh @@ -208,6 +208,7 @@ else -DARROW_FLIGHT=${ARROW_FLIGHT:-OFF} \ -DARROW_FLIGHT_SQL=${ARROW_FLIGHT_SQL:-OFF} \ -DARROW_FLIGHT_SQL_ODBC=${ARROW_FLIGHT_SQL_ODBC:-OFF} \ + -DARROW_FLIGHT_SQL_ODBC_INSTALLER=${ARROW_FLIGHT_SQL_ODBC_INSTALLER:-OFF} \ -DARROW_FUZZING=${ARROW_FUZZING:-OFF} \ -DARROW_GANDIVA_PC_CXX_FLAGS=${ARROW_GANDIVA_PC_CXX_FLAGS:-} \ -DARROW_GANDIVA=${ARROW_GANDIVA:-OFF} \ diff --git a/cpp/CMakePresets.json b/cpp/CMakePresets.json index 66550f128fe..31c270ff511 100644 --- a/cpp/CMakePresets.json +++ b/cpp/CMakePresets.json @@ -179,6 +179,7 @@ "ARROW_BUILD_EXAMPLES": "ON", "ARROW_BUILD_UTILITIES": "ON", "ARROW_FLIGHT_SQL_ODBC": "ON", + "ARROW_FLIGHT_SQL_ODBC_INSTALLER": "ON", "ARROW_SKYHOOK": "ON", "ARROW_TENSORFLOW": "ON", "PARQUET_BUILD_EXAMPLES": "ON",