working qt6/mac deploy

This commit is contained in:
matlabbe
2024-01-15 20:51:12 -08:00
parent 7b31c737be
commit ace653593b
2 changed files with 35 additions and 33 deletions
+29 -25
View File
@@ -67,12 +67,15 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
SET(APPS "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}") SET(APPS "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
SET(plugin_dest_dir bin) SET(plugin_dest_dir bin)
SET(qtconf_dest_dir bin) SET(qtconf_dest_dir bin)
SET(openni2_dest_dir bin) SET(thirdparty_dest_dir bin)
IF(APPLE) IF(APPLE)
SET(plugin_dest_dir MacOS) SET(plugin_dest_dir MacOS/plugins)
IF(Qt6_FOUND)
SET(plugin_dest_dir PlugIns)
ENDIF()
SET(qtconf_dest_dir Resources) SET(qtconf_dest_dir Resources)
SET(openni2_dest_dir MacOS) SET(thirdparty_dest_dir MacOS)
SET(APPS "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}") SET(APPS "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}")
ENDIF(APPLE) ENDIF(APPLE)
@@ -93,7 +96,7 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
COMPONENT runtime COMPONENT runtime
REGEX ".*pdb" EXCLUDE) REGEX ".*pdb" EXCLUDE)
INSTALL(FILES "${OpenNI2_BIN_DIR}/OpenNI.ini" INSTALL(FILES "${OpenNI2_BIN_DIR}/OpenNI.ini"
DESTINATION ${openni2_dest_dir} DESTINATION ${thirdparty_dest_dir}
COMPONENT runtime) COMPONENT runtime)
ENDIF(OpenNI2_FOUND) ENDIF(OpenNI2_FOUND)
@@ -102,7 +105,7 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
IF(WIN32) IF(WIN32)
file(TO_CMAKE_PATH "$ENV{K4A_ROOT_DIR}" ENV_K4A_ROOT_DIR) file(TO_CMAKE_PATH "$ENV{K4A_ROOT_DIR}" ENV_K4A_ROOT_DIR)
INSTALL(FILES "${ENV_K4A_ROOT_DIR}/tools/depthengine_2_0.dll" INSTALL(FILES "${ENV_K4A_ROOT_DIR}/tools/depthengine_2_0.dll"
DESTINATION ${plugin_dest_dir} DESTINATION ${thirdparty_dest_dir}
COMPONENT runtime) COMPONENT runtime)
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(k4a_FOUND) ENDIF(k4a_FOUND)
@@ -117,7 +120,7 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
MESSAGE(STATUS "Found ${CUDNN_OPS_DLL}") MESSAGE(STATUS "Found ${CUDNN_OPS_DLL}")
MESSAGE(STATUS "Found ${CUDNN_CNN_DLL}") MESSAGE(STATUS "Found ${CUDNN_CNN_DLL}")
INSTALL(FILES ${CUDNN_OPS_DLL} ${CUDNN_CNN_DLL} INSTALL(FILES ${CUDNN_OPS_DLL} ${CUDNN_CNN_DLL}
DESTINATION ${plugin_dest_dir} DESTINATION ${thirdparty_dest_dir}
COMPONENT runtime) COMPONENT runtime)
ELSE() ELSE()
MESSAGE(AUTHOR_WARNING "Using Torch with CUDA, but cudnn_ops_infer64_8.dll and cudnn_cnn_infer64_8.dll are not found on the PATH, so it won't be added to package.") MESSAGE(AUTHOR_WARNING "Using Torch with CUDA, but cudnn_ops_infer64_8.dll and cudnn_cnn_infer64_8.dll are not found on the PATH, so it won't be added to package.")
@@ -135,31 +138,31 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
include(\"${QT_DEPLOY_SUPPORT}\") include(\"${QT_DEPLOY_SUPPORT}\")
qt_deploy_runtime_dependencies( qt_deploy_runtime_dependencies(
EXECUTABLE \"${APPS}\" EXECUTABLE \"${APPS}\"
PLUGINS_DIR ${plugin_dest_dir}/plugins PLUGINS_DIR ${plugin_dest_dir}
GENERATE_QT_CONF GENERATE_QT_CONF
NO_TRANSLATIONS NO_TRANSLATIONS
VERBOSE VERBOSE
)") )")
IF("${CMAKE_BUILD_TYPE}" STREQUAL "" OR "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") IF("${CMAKE_BUILD_TYPE}" STREQUAL "" OR "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/deploy_appDebug.cmake" install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/deploy_appDebug.cmake"
CONFIGURATIONS Debug CONFIGURATIONS Debug
COMPONENT runtime) COMPONENT runtime)
ENDIF() ENDIF()
IF("${CMAKE_BUILD_TYPE}" STREQUAL "" OR "${CMAKE_BUILD_TYPE}" STREQUAL "Release") IF("${CMAKE_BUILD_TYPE}" STREQUAL "" OR "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/deploy_appRelease.cmake" install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/deploy_appRelease.cmake"
CONFIGURATIONS Release CONFIGURATIONS Release
COMPONENT runtime) COMPONENT runtime)
ENDIF() ENDIF()
IF("${CMAKE_BUILD_TYPE}" STREQUAL "" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") IF("${CMAKE_BUILD_TYPE}" STREQUAL "" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/deploy_appRelWithDebInfo.cmake" install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/deploy_appRelWithDebInfo.cmake"
CONFIGURATIONS RelWithDebInfo CONFIGURATIONS RelWithDebInfo
COMPONENT runtime) COMPONENT runtime)
ENDIF() ENDIF()
IF("${CMAKE_BUILD_TYPE}" STREQUAL "" OR "${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel") IF("${CMAKE_BUILD_TYPE}" STREQUAL "" OR "${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/deploy_appMinSizeRel.cmake" install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/deploy_appMinSizeRel.cmake"
CONFIGURATIONS MinSizeRel CONFIGURATIONS MinSizeRel
COMPONENT runtime) COMPONENT runtime)
ENDIF() ENDIF()
ELSEIF(Qt5_FOUND) ELSEIF(Qt5_FOUND)
#Qt5 #Qt5
foreach(plugin ${Qt5Gui_PLUGINS}) foreach(plugin ${Qt5Gui_PLUGINS})
@@ -170,9 +173,9 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
IF(NOT plugin_root) IF(NOT plugin_root)
get_filename_component(plugin_root ${plugin_dir} DIRECTORY) get_filename_component(plugin_root ${plugin_dir} DIRECTORY)
ENDIF(NOT plugin_root) ENDIF(NOT plugin_root)
#MESSAGE(STATUS "Qt5 plugin \"${plugin_loc}\" installed in \"${plugin_dest_dir}/plugins${plugin_type}\"") #MESSAGE(STATUS "Qt5 plugin \"${plugin_loc}\" installed in \"${plugin_dest_dir}${plugin_type}\"")
INSTALL(FILES ${plugin_loc} INSTALL(FILES ${plugin_loc}
DESTINATION ${plugin_dest_dir}/plugins${plugin_type} DESTINATION ${plugin_dest_dir}${plugin_type}
COMPONENT runtime) COMPONENT runtime)
endforeach() endforeach()
IF(NOT Qt5Widgets_VERSION VERSION_LESS 5.10.0) IF(NOT Qt5Widgets_VERSION VERSION_LESS 5.10.0)
@@ -188,7 +191,7 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
INSTALL(FILES ${plugin_loc} INSTALL(FILES ${plugin_loc}
DESTINATION ${plugin_dest_dir}/plugins${plugin_type} DESTINATION ${plugin_dest_dir}/plugins${plugin_type}
COMPONENT runtime) COMPONENT runtime)
#MESSAGE(STATUS "Qt5 plugin \"${plugin_loc}\" installed in \"${plugin_dest_dir}/plugins${plugin_type}\"") #MESSAGE(STATUS "Qt5 plugin \"${plugin_loc}\" installed in \"${plugin_dest_dir}${plugin_type}\"")
ENDIF(EXISTS ${plugin_loc}) ENDIF(EXISTS ${plugin_loc})
ENDIF(NOT Qt5Widgets_VERSION VERSION_LESS 5.10.0) ENDIF(NOT Qt5Widgets_VERSION VERSION_LESS 5.10.0)
ELSEIF(QT_PLUGINS_DIR) # Qt4 ELSEIF(QT_PLUGINS_DIR) # Qt4
@@ -196,7 +199,7 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
# One can cull what gets copied by using 'REGEX "..." EXCLUDE' # One can cull what gets copied by using 'REGEX "..." EXCLUDE'
# Exclude debug libraries # Exclude debug libraries
INSTALL(DIRECTORY "${QT_PLUGINS_DIR}/imageformats" INSTALL(DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
DESTINATION ${plugin_dest_dir}/plugins DESTINATION ${plugin_dest_dir}
COMPONENT runtime COMPONENT runtime
REGEX ".*d4.dll" EXCLUDE REGEX ".*d4.dll" EXCLUDE
REGEX ".*d4.a" EXCLUDE) REGEX ".*d4.a" EXCLUDE)
@@ -215,7 +218,7 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
ENDIF() ENDIF()
# directories to look for dependencies # directories to look for dependencies
SET(DIRS ${QT_LIBRARY_DIRS} ${PROJECT_BINARY_DIR}/build/bin) SET(DIRS "${QT_LIBRARY_DIRS}" "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/lib")
IF(APPLE) IF(APPLE)
SET(DIRS ${DIRS} /usr/local /usr/local/lib /opt/homebrew /opt/homebrew/lib /opt/homebrew/lib/gcc/current) SET(DIRS ${DIRS} /usr/local /usr/local/lib /opt/homebrew /opt/homebrew/lib /opt/homebrew/lib/gcc/current)
ENDIF(APPLE) ENDIF(APPLE)
@@ -227,10 +230,11 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
# over. # over.
# To find dependencies, cmake use "otool" on Apple and "dumpbin" on Windows (make sure you have one of them). # To find dependencies, cmake use "otool" on Apple and "dumpbin" on Windows (make sure you have one of them).
install(CODE " install(CODE "
file(GLOB_RECURSE QTPLUGINS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\") file(GLOB_RECURSE QTPLUGINS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
set(BU_CHMOD_BUNDLE_ITEMS ON) set(BU_CHMOD_BUNDLE_ITEMS ON)
include(\"BundleUtilities\") include(\"BundleUtilities\")
fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\") fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\")
" COMPONENT runtime) " COMPONENT runtime)
ENDIF(BUILD_AS_BUNDLE AND (APPLE OR WIN32)) ENDIF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
-2
View File
@@ -186,11 +186,9 @@ template<class K, class V>
inline std::set<K> uKeysSet(const std::map<K, V> & m) inline std::set<K> uKeysSet(const std::map<K, V> & m)
{ {
std::set<K> s; std::set<K> s;
int i=0;
for(typename std::map<K, V>::const_iterator iter = m.begin(); iter!=m.end(); ++iter) for(typename std::map<K, V>::const_iterator iter = m.begin(); iter!=m.end(); ++iter)
{ {
s.insert(s.end(), iter->first); s.insert(s.end(), iter->first);
++i;
} }
return s; return s;
} }