Skip to content

Commit

Permalink
Fix packaging scripts on MacOS (#698)
Browse files Browse the repository at this point in the history
  • Loading branch information
avsej authored Nov 21, 2024
1 parent 3f21222 commit 450c9e0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ include(cmake/OpenSSL.cmake)

include(cmake/VersionInfo.cmake)

include(cmake/RPath.cmake)

add_subdirectory(core/platform)
set(couchbase_cxx_client_FILES
${CMAKE_CURRENT_BINARY_DIR}/generated/mozilla_ca_bundle.cxx
Expand Down
5 changes: 0 additions & 5 deletions cmake/CompilerWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ function(set_project_warnings project_name)
)

set(CLANG_WARNINGS ${COMMON_WARNINGS})
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL "17.0.0")
set(CLANG_WARNINGS ${CLANG_WARNINGS} -Wshadow # warn the user if a variable declaration shadows one from a parent
# context
)
endif()

if(MSVC)
set(PROJECT_WARNINGS ${MSVC_WARNINGS})
Expand Down
8 changes: 6 additions & 2 deletions cmake/Packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ set(COUCHBASE_CXX_CLIENT_MANIFEST "${PROJECT_BINARY_DIR}/packaging/MANIFEST")
if(APPLE)
find_program(TAR gtar)
find_program(SED gsed)
find_program(XARGS gxargs)
find_program(CP gcp)
else()
find_program(TAR tar)
find_program(SED sed)
find_program(XARGS xargs)
find_program(CP cp)
endif()

add_custom_command(
Expand Down Expand Up @@ -86,12 +90,12 @@ add_custom_command(
-DCPM_USE_LOCAL_PACKAGES=OFF -DCOUCHBASE_CXX_CLIENT_BUILD_STATIC=OFF -DCOUCHBASE_CXX_CLIENT_INSTALL=ON
-DCOUCHBASE_CXX_RECORD_BUILD_INFO_FOR_TARBALL=ON
COMMAND
xargs --arg-file=${COUCHBASE_CXX_TARBALL_THIRD_PARTY_GLOB_FILE} -I {} find
${XARGS} --arg-file=${COUCHBASE_CXX_TARBALL_THIRD_PARTY_GLOB_FILE} -I {} find
"${COUCHBASE_CXX_CLIENT_TARBALL_NAME}/tmp/cache" -wholename "${COUCHBASE_CXX_CLIENT_TARBALL_NAME}/tmp/cache/{}"
-type f | grep -v "crypto_test_data\\|googletest" | uniq >
"${COUCHBASE_CXX_CLIENT_TARBALL_NAME}/tmp/third_party_manifest.txt"
COMMAND ${CMAKE_COMMAND} -E make_directory "${COUCHBASE_CXX_CLIENT_TARBALL_NAME}/tmp/filtered_cache"
COMMAND xargs --arg-file="${COUCHBASE_CXX_CLIENT_TARBALL_NAME}/tmp/third_party_manifest.txt" -I {} cp --parents {}
COMMAND ${XARGS} --arg-file="${COUCHBASE_CXX_CLIENT_TARBALL_NAME}/tmp/third_party_manifest.txt" -I {} ${CP} --parents {}
"${COUCHBASE_CXX_CLIENT_TARBALL_NAME}/tmp/filtered_cache"
COMMAND
${CMAKE_COMMAND} -E rename
Expand Down
10 changes: 10 additions & 0 deletions cmake/RPath.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(NOT MSVC)
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
endif()
endif()

0 comments on commit 450c9e0

Please sign in to comment.