fixing packaging on mac

This commit is contained in:
matlabbe
2026-06-27 14:30:06 -07:00
parent f7a70cd19d
commit 3bc13cab98
3 changed files with 73 additions and 15 deletions
-2
View File
@@ -62,12 +62,10 @@ jobs:
./rtabmap-console --version ./rtabmap-console --version
- name: Build MacOS Package - name: Build MacOS Package
if: matrix.os == 'macos-26' || matrix.os == 'macos-26-intel'
run: | run: |
cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }} --target package cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }} --target package
- name: Upload RTABMap Artifacts (DMG) - name: Upload RTABMap Artifacts (DMG)
if: matrix.os == 'macos-26' || matrix.os == 'macos-26-intel'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: RTABMap-Binaries-${{ matrix.build_name }}-nonsigned-zip name: RTABMap-Binaries-${{ matrix.build_name }}-nonsigned-zip
+55 -1
View File
@@ -241,7 +241,42 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(Python3_FOUND) ENDIF(Python3_FOUND)
IF(Qt6_FOUND) IF(Qt6_FOUND AND APPLE)
# On macOS we do NOT use qt_deploy_runtime_dependencies (macdeployqt):
# macdeployqt cannot deploy VTK 9.6+, whose libraries reference each other
# via @rpath relative to "@loader_path/../lib". Instead we install the Qt plugins
# manually and let fixup_bundle() below deploy all libraries.
IF(TARGET Qt6::QCocoaIntegrationPlugin)
get_target_property(_qt_plugin_loc Qt6::QCocoaIntegrationPlugin LOCATION)
get_filename_component(_qt_plugins_dir "${_qt_plugin_loc}" DIRECTORY) # .../plugins/platforms
get_filename_component(_qt_plugins_dir "${_qt_plugins_dir}" DIRECTORY) # .../plugins
FOREACH(_qt_plugin_type platforms styles imageformats iconengines)
IF(EXISTS "${_qt_plugins_dir}/${_qt_plugin_type}")
# Homebrew Qt plugins are symlinks into the Cellar; resolve them to the
# real files so they aren't installed as dangling symlinks (which would
# break fixup_bundle and codesign).
FILE(GLOB _qt_plugin_files "${_qt_plugins_dir}/${_qt_plugin_type}/*${CMAKE_SHARED_LIBRARY_SUFFIX}")
SET(_qt_plugin_real "")
FOREACH(_qt_plugin_file ${_qt_plugin_files})
GET_FILENAME_COMPONENT(_qt_plugin_file "${_qt_plugin_file}" REALPATH)
LIST(APPEND _qt_plugin_real "${_qt_plugin_file}")
ENDFOREACH()
IF(_qt_plugin_real)
INSTALL(FILES ${_qt_plugin_real}
DESTINATION ${plugin_dest_dir}/${_qt_plugin_type}
COMPONENT runtime)
ENDIF()
ENDIF()
ENDFOREACH()
ELSE()
MESSAGE(WARNING "Qt6::QCocoaIntegrationPlugin target not found: Qt plugins may be missing from the bundle")
ENDIF()
# qt.conf so Qt finds the bundled plugins (path is relative to Contents/)
SET(QT_CONF_FILE [Paths]\nPlugins=${plugin_dest_dir})
INSTALL(CODE "
file(WRITE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"${QT_CONF_FILE}\")
" COMPONENT runtime)
ELSEIF(Qt6_FOUND)
# Reference: https://doc-snapshots.qt.io/qt6-6.4/qt-deploy-runtime-dependencies.html # Reference: https://doc-snapshots.qt.io/qt6-6.4/qt-deploy-runtime-dependencies.html
# The following script must only be executed at install time # The following script must only be executed at install time
set(deploy_script "${CMAKE_CURRENT_BINARY_DIR}/deploy_app$<CONFIG>.cmake") set(deploy_script "${CMAKE_CURRENT_BINARY_DIR}/deploy_app$<CONFIG>.cmake")
@@ -364,5 +399,24 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
fixup_bundle(\"${APPS}\" \"\${ALL_LIBS}\" \"${DIRS}\") fixup_bundle(\"${APPS}\" \"\${ALL_LIBS}\" \"${DIRS}\")
" COMPONENT runtime) " COMPONENT runtime)
IF(APPLE)
# Re-sign ad-hoc AFTER fixup_bundle has finished all its install_name_tool
# edits.
install(CODE "
set(_contents \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")
get_filename_component(_app \"\${_contents}\" DIRECTORY)
file(GLOB_RECURSE _nested \"\${_contents}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
foreach(_f \${_nested})
execute_process(COMMAND codesign --force --sign - --timestamp=none \"\${_f}\")
endforeach()
file(GLOB _frameworks \"\${_contents}/Frameworks/*.framework\")
foreach(_f \${_frameworks})
execute_process(COMMAND codesign --force --sign - --timestamp=none \"\${_f}\")
endforeach()
message(STATUS \"Ad-hoc re-signing bundle: \${_app}\")
execute_process(COMMAND codesign --force --sign - --timestamp=none \"\${_app}\")
" COMPONENT runtime)
ENDIF(APPLE)
ENDIF(BUILD_AS_BUNDLE AND (APPLE OR WIN32)) ENDIF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
+7 -1
View File
@@ -40,7 +40,13 @@ if(NOT Eigen3_FIND_VERSION)
endif() endif()
macro(_eigen3_check_version) macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header) # Since Eigen 5.0.0 the version macros moved from Eigen/src/Core/util/Macros.h
# to a dedicated Eigen/Version header, so check the new location first.
if(EXISTS "${EIGEN3_INCLUDE_DIR}/Eigen/Version")
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/Version" _eigen3_version_header)
else()
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
endif()
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}") string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}") set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")