You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/12/06 21:38:13 UTC

[arrow-adbc] branch main updated: ci: explicitly tell CMake to cross-compile on macOS (#223)

This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new f1d84a3  ci: explicitly tell CMake to cross-compile on macOS (#223)
f1d84a3 is described below

commit f1d84a3ba659f0c00fbc4ea5d8ae806ebab3bf28
Author: David Li <li...@gmail.com>
AuthorDate: Tue Dec 6 16:38:08 2022 -0500

    ci: explicitly tell CMake to cross-compile on macOS (#223)
---
 ci/scripts/python_util.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/ci/scripts/python_util.sh b/ci/scripts/python_util.sh
index 0d0fa67..09e0a2e 100644
--- a/ci/scripts/python_util.sh
+++ b/ci/scripts/python_util.sh
@@ -38,10 +38,19 @@ function build_drivers {
         export ADBC_POSTGRES_LIBRARY=${build_dir}/lib/libadbc_driver_postgres.so
         export ADBC_SQLITE_LIBRARY=${build_dir}/lib/libadbc_driver_sqlite.so
         export VCPKG_DEFAULT_TRIPLET="${VCPKG_ARCH}-linux-static-release"
+        export CMAKE_ARGUMENTS=""
     else # macOS
         export ADBC_POSTGRES_LIBRARY=${build_dir}/lib/libadbc_driver_postgres.dylib
         export ADBC_SQLITE_LIBRARY=${build_dir}/lib/libadbc_driver_sqlite.dylib
         export VCPKG_DEFAULT_TRIPLET="${VCPKG_ARCH}-osx-static-release"
+        if [[ "${VCPKG_ARCH}" = "x64" ]]; then
+            export CMAKE_ARGUMENTS="-DCMAKE_OSX_ARCHITECTURES=x86_64"
+        elif [[ "${VCPKG_ARCH}" = "arm64" ]]; then
+            export CMAKE_ARGUMENTS="-DCMAKE_OSX_ARCHITECTURES=arm64"
+        else
+            echo "Unknown architecture: ${VCPKG_ARCH}"
+            exit 1
+        fi
     fi
 
     pushd "${VCPKG_ROOT}"
@@ -52,7 +61,8 @@ function build_drivers {
     patch -N -p1 < "${source_dir}/ci/vcpkg/0002-Retry-downloads.patch" || true
     popd
 
-    "${VCPKG_ROOT}/vcpkg" install libpq sqlite3 \
+    # Need to install sqlite3 to make CMake be able to find it below
+    "${VCPKG_ROOT}/vcpkg" install sqlite3 \
           --overlay-triplets "${VCPKG_OVERLAY_TRIPLETS}" \
           --triplet "${VCPKG_DEFAULT_TRIPLET}"
 
@@ -67,6 +77,7 @@ function build_drivers {
         -DCMAKE_INSTALL_PREFIX=${build_dir} \
         -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \
         -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} \
+        ${CMAKE_ARGUMENTS} \
         -DVCPKG_OVERLAY_TRIPLETS="${VCPKG_OVERLAY_TRIPLETS}" \
         -DVCPKG_TARGET_TRIPLET="${VCPKG_DEFAULT_TRIPLET}" \
         ${source_dir}/c/driver/postgres
@@ -84,6 +95,7 @@ function build_drivers {
         -DCMAKE_INSTALL_PREFIX=${build_dir} \
         -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \
         -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} \
+        ${CMAKE_ARGUMENTS} \
         -DVCPKG_OVERLAY_TRIPLETS="${VCPKG_OVERLAY_TRIPLETS}" \
         -DVCPKG_TARGET_TRIPLET="${VCPKG_DEFAULT_TRIPLET}" \
         ${source_dir}/c/driver/sqlite