Skip to content

Commit

Permalink
fix(cmake): fix go-worker cmake to fetch gpgme from correct folder on…
Browse files Browse the repository at this point in the history
… arm64.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Jan 17, 2025
1 parent 171890f commit 9f26e19
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

# From now on, we have VCPKG_ARCH variable
include(arch)

# compiler related configs
include(compiler)

Expand Down
18 changes: 18 additions & 0 deletions cmake/modules/arch.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
execute_process(
COMMAND uname -m
COMMAND sed "s/x86_64/x64/"
COMMAND sed "s/aarch64/arm64/"
OUTPUT_VARIABLE ARCH_output
ERROR_VARIABLE ARCH_error
RESULT_VARIABLE ARCH_result
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(${ARCH_result} EQUAL 0)
set(VCPKG_ARCH ${ARCH_output})
message(STATUS "Target arch: ${VCPKG_ARCH}")
else()
message(
FATAL_ERROR
"Failed to determine target architecture: ${ARCH_error}"
)
endif()
2 changes: 1 addition & 1 deletion cmake/modules/go-worker.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pkg_check_modules(GPGME REQUIRED gpgme IMPORTED_TARGET)

# Pkg config paths to all gpgme libs (libgpgme, libgpg-error and libassuan)
# to be passed down to go-worker to let it find the needed deps.
set(VCPKG_PKGCONFIG_PATH "${CMAKE_SOURCE_DIR}/vcpkg/packages/gpgme_x64-linux-release/lib/pkgconfig/:${CMAKE_SOURCE_DIR}/vcpkg/packages/libgpg-error_x64-linux-release/lib/pkgconfig/:${CMAKE_SOURCE_DIR}/vcpkg/packages/libassuan_x64-linux-release/lib/pkgconfig/")
set(VCPKG_PKGCONFIG_PATH "${CMAKE_SOURCE_DIR}/vcpkg/packages/gpgme_${VCPKG_ARCH}-linux-release/lib/pkgconfig/:${CMAE_SOURCE_DIR}/vcpkg/packages/libgpg-error_${VCPKG_ARCH}-linux-release/lib/pkgconfig/:${CMAKE_SOURCE_DIR}/vcpkg/packages/libassuan_${VCPKG_ARCH}-linux-release/lib/pkgconfig/")

ExternalProject_Add(go-worker
DEPENDS PkgConfig::GPGME
Expand Down
21 changes: 1 addition & 20 deletions cmake/modules/vcpkg.cmake
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
execute_process(
COMMAND uname -m
COMMAND sed "s/x86_64/x64/"
COMMAND sed "s/aarch64/arm64/"
OUTPUT_VARIABLE ARCH_output
ERROR_VARIABLE ARCH_error
RESULT_VARIABLE ARCH_result
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(${ARCH_result} EQUAL 0)
set(ARCH ${ARCH_output})
message(STATUS "Target arch: ${ARCH}")
else()
message(
FATAL_ERROR
"Failed to determine target architecture: ${ARCH_error}"
)
endif()

set(VCPKG_TARGET_TRIPLET "${ARCH}-linux-release")
set(VCPKG_TARGET_TRIPLET "${VCPKG_ARCH}-linux-release")
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")

0 comments on commit 9f26e19

Please sign in to comment.