Skip to content

Commit

Permalink
Build fixes 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Young committed Oct 5, 2024
1 parent d2a86a2 commit f979284
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
22 changes: 11 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ if(APPLE)
# It seems this is only needed on MacOS. According to ./third-party/valijson/README.md we are not the only ones to
# experience this!
#
execute_process(COMMAND brew --prefix qt5 OUTPUT_VARIABLE CMAKE_PREFIX_PATH)
execute_process(COMMAND brew --prefix qt6 OUTPUT_VARIABLE CMAKE_PREFIX_PATH)
message(STATUS "CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
endif()

Expand Down Expand Up @@ -548,15 +548,15 @@ if(WIN32)
set(Platform_DLLs ${QtQWindows_location})

get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION)
get_filename_component(QT5_BIN_DIR "${_qmake_executable}" DIRECTORY)
message("QT5_BIN_DIR = ${QT5_BIN_DIR}")
get_filename_component(QT_BIN_DIR "${_qmake_executable}" DIRECTORY)
message("QT_BIN_DIR = ${QT_BIN_DIR}")

#
# Per https://doc.qt.io/qt-6/windows-deployment.html, the windeployqt executable creates all the necessary folder
# tree "containing the Qt-related dependencies (libraries, QML imports, plugins, and translations) required to run
# the application from that folder".
#
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT5_BIN_DIR}")
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}")
if(EXISTS ${WINDEPLOYQT_EXECUTABLE})
# Per https://cmake.org/cmake/help/latest/command/add_executable.html, "IMPORTED executables are useful for
# convenient reference from commands like add_custom_command()".
Expand All @@ -565,7 +565,7 @@ if(WIN32)
endif()

# International Components for Unicode
file(GLOB IcuDlls "${QT5_BIN_DIR}/libicu*.dll")
file(GLOB IcuDlls "${QT_BIN_DIR}/libicu*.dll")
elseif(APPLE)
#====================================================================================================================
#=================================================== Mac Qt Stuff ===================================================
Expand All @@ -579,7 +579,7 @@ elseif(APPLE)
# process of creating a deployable [folder / applicaiton bundle] that contains [the necessary Qt dependencies]" - ie
# so that the end user does not have to install Qt to run our software). They have completely different
# implementations and command line options, so it would be unhelpful to try to treat them identically.
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT5_BIN_DIR}")
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}")
if(EXISTS ${MACDEPLOYQT_EXECUTABLE})
# Per https://cmake.org/cmake/help/latest/command/add_executable.html, "IMPORTED executables are useful for
# convenient reference from commands like add_custom_command()".
Expand Down Expand Up @@ -926,8 +926,8 @@ include(src/CMakeLists.txt)
# - Generate the binary .qm files that ship with the application and are used at run time -- which can be done
# manually from the command line with lrelease
#
# Note that qt5_add_translation() _only_ does the latter and it is only qt5_create_translation() which does both.
# HOWEVER, there is a longstanding bug in qt5_create_translation() that means it adds all the .ts files to the list of
# Note that qt6_add_translation() _only_ does the latter and it is only qt6_create_translation() which does both.
# HOWEVER, there is a longstanding bug in qt6_create_translation() that means it adds all the .ts files to the list of
# files that get deleted when you invoke "make clean". (See https://bugreports.qt.io/browse/QTBUG-31860,
# https://bugreports.qt.io/browse/QTBUG-41736, https://bugreports.qt.io/browse/QTBUG-76410,
# https://bugreports.qt.io/browse/QTBUG-96549.)
Expand All @@ -936,14 +936,14 @@ include(src/CMakeLists.txt)
# ${repoDir}/translations directory (something which itself requires jumping through a few hoops) -- but I have not had
# success with any of them. Instead, taking inspiration from
# https://codereview.qt-project.org/c/qt/qttools/+/261912/1/src/linguist/Qt6LinguistToolsMacros.cmake, we run lupdate
# manually and then let qt5_add_translation invoke lrelease.
# manually and then let qt6_add_translation invoke lrelease.
#
# Of course we have to do declare everything backwards for the dependencies:
# - The executable will depend on translationsTarget
# - translationsTarget depends on the binary .qm files, as generated by qt5_add_translation
# - translationsTarget depends on the binary .qm files, as generated by qt6_add_translation
# - But before translationsTarget is built, we always run lupdate
#
qt5_add_translation(QM_FILES ${translationSourceFiles})
qt6_add_translation(QM_FILES ${translationSourceFiles})

# Add a target for the QM_FILES so that we can add the translations as a dependency for the executable later.
add_custom_target(translationsTarget DEPENDS ${QM_FILES})
Expand Down
5 changes: 4 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,10 @@ lupdate_executable = find_program(lupdate_name, required : true)
# We make a point here of displaying the output of run_command because we want to show message emitted by lupdate about
# what it did.
#
message('Running lupdate on the following ts files:', run_command('ls', translationSourceFiles, check: true).stdout())
message(
'Running lupdate (' + lupdate_executable + ') on the following ts files:',
run_command('ls', translationSourceFiles, check: true).stdout()
)
message(
run_command(lupdate_executable,
meson.project_source_root() + '/src',
Expand Down
1 change: 1 addition & 0 deletions scripts/buildTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ def installDependencies():
'pandoc',
'python3',
'python3-dev',
'qmake6', # Possibly needed for lupdate
'qtbase5-dev',
'qt6-l10n-tools', # Needed for lupdate
'qt6-multimedia-dev',
Expand Down

0 comments on commit f979284

Please sign in to comment.