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 2023/01/23 15:51:11 UTC
[arrow-adbc] branch main updated: fix(c/driver/flightsql): set GOARCH appropriately on macOS (#374)
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 502cf41 fix(c/driver/flightsql): set GOARCH appropriately on macOS (#374)
502cf41 is described below
commit 502cf41c4ff967c867a653977fc8bc60a3cf1abc
Author: David Li <li...@gmail.com>
AuthorDate: Mon Jan 23 10:51:05 2023 -0500
fix(c/driver/flightsql): set GOARCH appropriately on macOS (#374)
This will properly build binaries for the target architecture
when cross-compiling.
Fixes #373.
---
c/cmake_modules/GoUtils.cmake | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/c/cmake_modules/GoUtils.cmake b/c/cmake_modules/GoUtils.cmake
index b14e42a..7b6e65a 100644
--- a/c/cmake_modules/GoUtils.cmake
+++ b/c/cmake_modules/GoUtils.cmake
@@ -77,11 +77,19 @@ function(add_go_lib GO_MOD_DIR GO_LIBNAME)
endif()
set(LIBOUT_SHARED "${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME_SHARED}")
+ set(GO_ENV_VARS "CGO_ENABLED=1")
+
+ if(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
+ list(APPEND GO_ENV_VARS "GOARCH=amd64")
+ elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
+ list(APPEND GO_ENV_VARS "GOARCH=arm64")
+ endif()
add_custom_command(OUTPUT "${LIBOUT_SHARED}.${ADBC_FULL_SO_VERSION}"
WORKING_DIRECTORY ${GO_MOD_DIR}
DEPENDS ${ARG_SOURCES}
- COMMAND ${GO_BIN} build "${GO_BUILD_TAGS}" -o
+ COMMAND ${CMAKE_COMMAND} -E env "${GO_ENV_VARS}" ${GO_BIN} build
+ "${GO_BUILD_TAGS}" -o
"${LIBOUT_SHARED}.${ADBC_FULL_SO_VERSION}"
-buildmode=c-shared "${GO_LDFLAGS}" .
COMMAND ${CMAKE_COMMAND} -E remove -f