Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start at adjusting dependencies to match what windeployqt suggests #537

Merged
merged 8 commits into from Jun 3, 2022
19 changes: 8 additions & 11 deletions CMakeLists.txt
Expand Up @@ -521,7 +521,7 @@ message(STATUS "QT_INSTALL_DIR=${QT_INSTALL_DIR}")

find_package(Qt6 ${QT_VERSION} COMPONENTS CoreTools GuiTools WidgetsTools QmlTools WebEngineCoreTools REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)

find_package(Qt6 ${QT_VERSION} COMPONENTS Core Core5Compat Gui Widgets Sql Network Xml Concurrent PrintSupport Quick QuickWidgets Qml WebChannel Positioning WebEngineCore WebEngineWidgets REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)
find_package(Qt6 ${QT_VERSION} COMPONENTS Core Core5Compat Gui Widgets Sql Svg Network Xml Concurrent PrintSupport Quick QuickWidgets Qml WebChannel Positioning WebEngineCore WebEngineWidgets REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aren't using QSvg nor do we have any .svg files in the repo. Why would we need it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not 100% sure, Qt might be using SVG internally, I think some of our web assests use SVG. The app does load that dll when it is installed so I figured it was good to just include it:

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked out the source code for windeployqt, what it does is to find some DLLs you do use, then it reads what this DLL depends on and includes them as well. (findDependentQtLibraries -> readExecutable -> readPeExecutable)


find_package(Qt6LinguistTools ${QT_VERSION} REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)

Expand All @@ -536,16 +536,9 @@ find_file(qweb_resources_devtools NAMES qtwebengine_devtools_resources.pak PATHS
find_file(qweb_resources_100 NAMES qtwebengine_resources_100p.pak PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)
find_file(qweb_resources_200 NAMES qtwebengine_resources_200p.pak PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)

# DLM: why do we have QT_WEB_LIBS separate from QT_LIBS? can we combine these?
# DLM: now the distincton should be between Qt libs linked by openstudio_modeleditor.so and the OS App
list(APPEND QT_WEB_LIBS Qt6::Core)
list(APPEND QT_WEB_LIBS Qt6::Core5Compat)
list(APPEND QT_WEB_LIBS Qt6::Widgets)
# QT_WEB_LIBS are linked by OS App and openstudio_lib but not by openstudio_modeleditor.so or openstudio_modeleditor
list(APPEND QT_WEB_LIBS Qt6::WebEngineCore)
list(APPEND QT_WEB_LIBS Qt6::WebEngineWidgets)
#list(APPEND QT_WEB_LIBS Qt6::3DCore)
#list(APPEND QT_WEB_LIBS Qt6::3DInput)
#list(APPEND QT_WEB_LIBS Qt6::3DRender)
set_target_properties(${QT_WEB_LIBS} PROPERTIES INTERFACE_LINK_LIBRARIES "")

if(NOT APPLE)
Expand All @@ -570,7 +563,7 @@ if(NOT APPLE)

if(UNIX)
find_package(Qt6DBus ${QT_VERSION} REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)
list(APPEND QT_WEB_LIBS Qt6::DBus)
list(APPEND QT_LIBS Qt6::DBus)

find_library(QT_QXCBQPA NAMES libQt6XcbQpa.so.${QT_VERSION} PATHS "${QT_INSTALL_DIR}/lib" NO_DEFAULT_PATH)

Expand All @@ -589,16 +582,20 @@ endif()

if(APPLE)
find_package(Qt6DBus ${QT_VERSION} REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)
list(APPEND QT_WEB_LIBS Qt6::DBus)
list(APPEND QT_LIBS Qt6::DBus)

find_program(QT_MACDEPLOY_QT NAMES macdeployqt PATHS "${QT_INSTALL_DIR}/bin" NO_DEFAULT_PATH)
endif()

# QT_LIBS are linked by OS App and by openstudio_modeleditor.so
list(APPEND QT_LIBS Qt6::Core)
list(APPEND QT_LIBS Qt6::Core5Compat)
list(APPEND QT_LIBS Qt6::Widgets)
list(APPEND QT_LIBS Qt6::Network)
list(APPEND QT_LIBS Qt6::Xml)
list(APPEND QT_LIBS Qt6::PrintSupport)
list(APPEND QT_LIBS Qt6::Gui)
list(APPEND QT_LIBS Qt6::Svg)

if(WIN32)
find_package(Qt6OpenGL ${QT_VERSION} REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)
Expand Down
16 changes: 4 additions & 12 deletions ruby/CMakeLists.txt
Expand Up @@ -41,11 +41,6 @@ else()
set_target_properties(openstudio_modeleditor_rb PROPERTIES SUFFIX ".so" )
endif()

# plugin doesn't need webengine
list(REMOVE_ITEM QT_WEB_LIBS Qt6::WebEngine)
list(REMOVE_ITEM QT_WEB_LIBS Qt6::WebEngineCore)
list(REMOVE_ITEM QT_WEB_LIBS Qt6::WebEngineWidgets)

if(MSVC)
# wd4996=no deprecated warnings ; wd5033=register
set_target_properties(openstudio_modeleditor_rb PROPERTIES COMPILE_FLAGS "/bigobj /wd4996 /wd5033")
Expand All @@ -70,6 +65,7 @@ if(APPLE)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtGui.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtGui.framework
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtNetwork.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtNetwork.framework
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtPrintSupport.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtPrintSupport.framework
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtSvg.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtSvg.framework
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtWidgets.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtWidgets.framework
COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/lib/QtXml.framework $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtXml.framework
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:openstudio::openstudiolib> $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/.
Expand All @@ -79,9 +75,7 @@ endif()

target_link_libraries(openstudio_modeleditor_rb
ruby_OpenStudioModelEditor
openstudio_lib
openstudio_bimserver
${QT_WEB_LIBS}
openstudio_modeleditor
)

if( WIN32 )
Expand All @@ -92,6 +86,7 @@ endif()

install(TARGETS openstudio_modeleditor_rb DESTINATION Ruby COMPONENT "RubyAPI")
install(FILES openstudio_modeleditor.rb DESTINATION Ruby COMPONENT "RubyAPI")

if(APPLE)
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/platforms/libqcocoa.dylib DESTINATION Ruby/platforms COMPONENT "RubyAPI")
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtCore.framework DESTINATION Ruby COMPONENT "RubyAPI")
Expand All @@ -100,15 +95,12 @@ if(APPLE)
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtGui.framework DESTINATION Ruby COMPONENT "RubyAPI")
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtNetwork.framework DESTINATION Ruby COMPONENT "RubyAPI")
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtPrintSupport.framework DESTINATION Ruby COMPONENT "RubyAPI")
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtSvg.framework DESTINATION Ruby COMPONENT "RubyAPI")
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtWidgets.framework DESTINATION Ruby COMPONENT "RubyAPI")
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/QtXml.framework DESTINATION Ruby COMPONENT "RubyAPI")
install(FILES $<TARGET_FILE_DIR:openstudio_modeleditor_rb>/$<TARGET_FILE_NAME:openstudio::openstudiolib> DESTINATION Ruby COMPONENT "RubyAPI")
endif()

if( BUILD_PAT )
# don't need modeleditor libs in pat
endif()

###############################################################################
# T E S T I N G: C T E S T S #
###############################################################################
Expand Down
17 changes: 17 additions & 0 deletions src/openstudio_app/CMakeLists.txt
Expand Up @@ -177,6 +177,11 @@ if( APPLE )
VERBATIM
)

#add_custom_command(TARGET ${target_name}
# POST_BUILD
# COMMAND ${QT_MACDEPLOY_QT} $<TARGET_BUNDLE_DIR:${target_name}> -verbose=2
#)
Comment on lines +180 to +183
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use macdeployqt, and linuxdeployqt?

Copy link
Collaborator Author

@macumber macumber May 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually I think so. When I ran macdeployqt (and kept all the other remaining install steps) the app in the resulting package crashed, I don't know why.


elseif( UNIX )

foreach(LIB ${QT_LIBS} ${QT_WEB_LIBS})
Expand Down Expand Up @@ -350,10 +355,22 @@ if( NOT APPLE )

install(PROGRAMS ${QtWebEngineProcess} DESTINATION bin COMPONENT OpenStudioApp )

install(PROGRAMS $<TARGET_FILE_DIR:${target_name}>/D3Dcompiler_47.dll DESTINATION bin/ COMPONENT OpenStudioApp)
install(PROGRAMS $<TARGET_FILE_DIR:${target_name}>/opengl32sw.dll DESTINATION bin/ COMPONENT OpenStudioApp)

foreach(LIB ${QT_LIBS} ${QT_WEB_LIBS})
install(PROGRAMS $<TARGET_FILE_DIR:${target_name}>/$<TARGET_FILE_NAME:${LIB}> DESTINATION bin/ COMPONENT OpenStudioApp)
endforeach()

list(APPEND QT_DIRS iconengines)
list(APPEND QT_DIRS imageformats)
list(APPEND QT_DIRS networkinformation)
list(APPEND QT_DIRS position)
list(APPEND QT_DIRS tls)
foreach(DIR ${QT_DIRS})
install(DIRECTORY $<TARGET_FILE_DIR:${target_name}>/${DIR} DESTINATION bin/ COMPONENT OpenStudioApp)
endforeach()
Comment on lines +365 to +372
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are those needed? are they needed on other platforms?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see your comment above, "Those all seem plausible (except maybe Qt6SerialPort) but I am not sure if it is too heavy. Total extra size is 2.67 MB so maybe best to just add them."


elseif(UNIX)
# Let fixup_bundle do that for us
#install(PROGRAMS $<TARGET_FILE:openstudio::openstudiolib> DESTINATION bin COMPONENT OpenStudioApp )
Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/CMakeLists.txt
Expand Up @@ -738,6 +738,7 @@ set(${target_name}_depends
openstudio_modeleditor
openstudio::openstudiolib
${QT_LIBS}
${QT_WEB_LIBS}
)
if(WIN32)
list(APPEND ${target_name}_depends qtwinmigrate)
Expand Down Expand Up @@ -765,7 +766,6 @@ set(${target_name}_test_src

set(${target_name}_test_depends
${${target_name}_depends}
${QT_WEB_LIBS}
)


Expand Down