WillAyd commented on code in PR #2738:
URL: https://github.com/apache/arrow-adbc/pull/2738#discussion_r2059375495


##########
docs/source/cpp/static_linking.rst:
##########
@@ -0,0 +1,64 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+..
+..   http://www.apache.org/licenses/LICENSE-2.0
+..
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+==============
+Static Linking
+==============
+
+To statically link and use *multiple* drivers, the following limitations hold:
+
+#. You must build with these CMake options [#meson]_:
+
+   - ``-DADBC_BUILD_STATIC=ON``
+   - ``-DADBC_DEFINE_COMMON_ENTRYPOINTS=OFF``
+   - ``-DADBC_WITH_VENDORED_FMT=OFF``
+   - ``-DADBC_WITH_VENDORED_NANOARROW=OFF``
+
+#. You must provide ``fmt`` and ``nanoarrow`` dependencies.  (This may be
+   relaxed in the future.)
+#. You must explicitly link all the required transitive dependencies.  This
+   is:
+
+   - ``libpq`` for PostgreSQL
+   - ``sqlite3`` for SQLite
+   - ``adbc_driver_common``, ``adbc_driver_framework``, ``fmt``,
+     ``nanoarrow``, and the C++ standard library for either PostgreSQL or
+     SQLite.
+   - To link the C++ standard library, the easiest thing is to just use the
+     C++ linker, even if the code itself is in C, e.g.
+
+     .. code-block:: cmake
+
+        set_target_properties(myapp PROPERTIES LINKER_LANGUAGE CXX)
+
+   - Go-based drivers (BigQuery, Flight SQL, Snowflake) have no transitive
+     dependencies.
+
+#. You cannot link more than a single Go-based driver.  See `golang/go#20639
+   <go20639_>`_, `StackOverflow #67243572 <so67243572_>`_, and `StackOverflow
+   #34333107 <so34333107_>`_ for a discussion of the issues involved.  (This
+   may be relaxed in the future by providing a way to build a single driver
+   library with all driver implementations included.)
+
+An example of this can be seen with ``cpp_static_test.sh`` and
+``c/integration/static_test`` in the source tree.
+
+.. [#meson] There is currently no documentation for Meson, but in principle

Review Comment:
   Yea I think if we try to do this in the Meson configuration it should be as 
easy as:
   
   ```python
   if get_option('default_library') == 'static'
       add_project_arguments('-DADBC_NO_COMMON_ENTRYPOINTS', language: 'c')
       add_project_arguments('-DADBC_NO_COMMON_ENTRYPOINTS', language: 'cpp')
   endif
   ```
   
   There might be some extra work for MSVC where both shared and static are 
built by default. We could either punt that or ping eli on the Meson team for 
thoughts



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to