Skip to content

Commit 4e1f297

Browse files
authored
Register ODBC Driver on Windows in installer
* In `wxs`, cannot use `package`, need to use `fragment` instead * Use component as feature will automatically be generated * Set Patch version + add installer instructions
1 parent 9657afe commit 4e1f297

File tree

4 files changed

+88
-8
lines changed

4 files changed

+88
-8
lines changed

cpp/src/arrow/flight/sql/odbc/CMakeLists.txt

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
9999

100100
set(CPACK_RESOURCE_FILE_LICENSE
101101
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt")
102-
# Tentative version 1.0.0 (patch version is not set)
102+
# Tentative version 1.0.0
103103
set(CPACK_PACKAGE_VERSION_MAJOR "1")
104104
set(CPACK_PACKAGE_VERSION_MINOR "0")
105+
set(CPACK_PACKAGE_VERSION_PATCH "0")
105106

106107
set(CPACK_PACKAGE_NAME "Apache Arrow Flight SQL ODBC")
107108
set(CPACK_PACKAGE_VENDOR "Apache Arrow")
@@ -115,13 +116,26 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
115116
DESTINATION bin
116117
COMPONENT flight_sql_odbc_lib
117118
FILES_MATCHING
118-
PATTERN "*.dll"
119-
PATTERN "arrow_flight_testing.dll" EXCLUDE
120-
PATTERN "arrow_testing.dll" EXCLUDE
121-
PATTERN "gflags.dll" EXCLUDE
122-
PATTERN "gmock.dll" EXCLUDE
123-
PATTERN "gtest.dll" EXCLUDE
124-
PATTERN "gtest_main.dll" EXCLUDE)
119+
# Use regex for dll name patterns with versions
120+
PATTERN "abseil_dll.dll"
121+
PATTERN "arrow.dll"
122+
PATTERN "arrow_compute.dll"
123+
PATTERN "arrow_flight.dll"
124+
PATTERN "arrow_flight_sql.dll"
125+
PATTERN "arrow_flight_sql_odbc.dll"
126+
PATTERN "boost_locale*.dll"
127+
PATTERN "cares.dll"
128+
PATTERN "libcrypto*.dll"
129+
PATTERN "libprotobuf.dll"
130+
PATTERN "libssl*.dll"
131+
PATTERN "re2.dll"
132+
PATTERN "utf8proc.dll"
133+
PATTERN "zlib1.dll")
134+
135+
set(CPACK_WIX_EXTRA_SOURCES
136+
"${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-flight-sql-odbc.wxs")
137+
set(CPACK_WIX_PATCH_FILE
138+
"${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-flight-sql-odbc-patch.xml")
125139
endif()
126140

127141
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)

cpp/src/arrow/flight/sql/odbc/README

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ After the build succeeds, the ODBC DLL will be located in
1717

1818
If the registration is successful, then Apache Arrow Flight SQL ODBC Driver
1919
should show as an available ODBC driver in the x64 ODBC Driver Manager.
20+
21+
Steps to Generate Windows Installer
22+
1. Build with `ARROW_FLIGHT_SQL_ODBC=ON` and `ARROW_FLIGHT_SQL_ODBC_INSTALLER=ON`.
23+
2. `cd` to `build` folder.
24+
3. Run `cpack`.
25+
26+
If the generation is successful, you will find `Apache Arrow Flight SQL ODBC-<version>-win64.msi` generated under the `build` folder.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
18+
<CPackWiXPatch>
19+
<CPackWiXFragment Id="#PRODUCTFEATURE">
20+
<ComponentRef Id="ODBCRegistryEntries"/>
21+
</CPackWiXFragment>
22+
</CPackWiXPatch>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="windows-1252"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one or more
5+
contributor license agreements. See the NOTICE file distributed with
6+
this work for additional information regarding copyright ownership.
7+
The ASF licenses this file to You under the Apache License, Version 2.0
8+
(the "License"); you may not use this file except in compliance with
9+
the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
-->
19+
20+
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
21+
<Fragment>
22+
<DirectoryRef Id="TARGETDIR">
23+
<Component Id="ODBCRegistryEntries" Guid="C348B9F7-5E8D-415D-A001-D92F2D4EA013">
24+
<RegistryValue Root='HKLM' Key='Software\ODBC\ODBCINST.INI\ODBC Drivers' Name='Apache Arrow Flight SQL ODBC Driver' Type='string' Value='Installed'/>
25+
26+
<RegistryKey Root="HKLM"
27+
Key="Software\ODBC\ODBCINST.INI\Apache Arrow Flight SQL ODBC Driver">
28+
<!-- CM_FP_flight_sql_odbc_lib.bin.arrow_flight_sql_odbc.dll is a generated variable value from build\_CPack_Packages\win64\WIX\files.wxs -->
29+
<RegistryValue Type="string" Name="DriverODBCVer" Value="03.00"/>
30+
<RegistryValue Type="string" Name="Driver" Value="[#CM_FP_flight_sql_odbc_lib.bin.arrow_flight_sql_odbc.dll]"/>
31+
<RegistryValue Type="string" Name="Setup" Value="[#CM_FP_flight_sql_odbc_lib.bin.arrow_flight_sql_odbc.dll]"/>
32+
<RegistryValue Type="integer" Name="UsageCount" Value="1"/>
33+
</RegistryKey>
34+
</Component>
35+
</DirectoryRef>
36+
</Fragment>
37+
</Wix>

0 commit comments

Comments
 (0)