Fix CMake build of RockboxUtility and RockboxThemeEditor on macOS (part 1)

Create a new target dmgbuild_venv which is added as a dependency of both RockboxUtility and RockboxThemeEditor so CMake understands that it's a shared dependency.

Co-authored-by: Qwen3.7-Plus
Change-Id: I417de25356885574546a7ae2a53ddbd44f6be557
This commit is contained in:
Vencislav Atanasov 2026-06-20 00:20:57 +03:00 committed by Solomon Peachy
parent 53d2a99a2a
commit 2e126ee3ba

View file

@ -94,6 +94,15 @@ endif()
# MacOS: Build dmg
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(DMGBUILD_STAMP ${CMAKE_BINARY_DIR}/dmgbuild.stamp)
add_custom_command(
COMMENT "Setting up dmgbuild virtualenv"
OUTPUT ${DMGBUILD_STAMP}
COMMAND python3 -m venv ${CMAKE_BINARY_DIR}/venv
COMMAND ${CMAKE_BINARY_DIR}/venv/bin/python -m pip install -q dmgbuild
)
add_custom_target(dmgbuild_venv DEPENDS ${DMGBUILD_STAMP})
function(deploy_qt)
cmake_parse_arguments(deploy ""
"TARGET;DESKTOPFILE;ICONFILE;QTBINDIR;DMGBUILDCFG"
@ -103,11 +112,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
message(WARNING "Deploying a Debug build.")
endif()
set(DMGBUILD ${CMAKE_BINARY_DIR}/venv/bin/python3 -m dmgbuild)
set(DMGBUILD_STAMP ${CMAKE_BINARY_DIR}/dmgbuild.stamp)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QTBINDIR}")
# need extra rules so we can use generator expressions
# (using get_target_property() doesn't know neede values during generation)
# (using get_target_property() doesn't know needed values during generation)
set(_deploy_deps "")
foreach(_deploy_exe_tgt ${deploy_EXECUTABLES})
add_custom_command(
@ -118,20 +126,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
$<TARGET_BUNDLE_CONTENT_DIR:${deploy_TARGET}>/bin
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${_deploy_exe_tgt}.app.stamp
DEPENDS ${_deploy_exe_tgt}
)
)
add_custom_target(deploy_${deploy_TARGET}_${_deploy_exe_tgt}
DEPENDS ${CMAKE_BINARY_DIR}/${_deploy_exe_tgt}.app.stamp)
set(_deploy_deps "${_deploy_deps};deploy_${deploy_TARGET}_${_deploy_exe_tgt}")
endforeach()
add_custom_command(
COMMENT "Setting up dmgbuild virtualenv"
OUTPUT ${DMGBUILD_STAMP}
COMMAND python3 -m venv ${CMAKE_BINARY_DIR}/venv
COMMAND ${CMAKE_BINARY_DIR}/venv/bin/python -m pip install -q dmgbuild
)
add_custom_command(
# TODO: find a better way to figure the app bundle name.
OUTPUT ${CMAKE_BINARY_DIR}/${deploy_TARGET}.dmg
@ -141,9 +142,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
-Dappbundle=${deploy_TARGET}.app
${deploy_TARGET} ${CMAKE_BINARY_DIR}/${deploy_TARGET}.dmg
DEPENDS ${deploy_TARGET}
${DMGBUILD_STAMP}
dmgbuild_venv
${_deploy_deps}
)
)
add_custom_target(deploy_${deploy_TARGET}
DEPENDS ${CMAKE_BINARY_DIR}/${deploy_TARGET}.dmg)
add_dependencies(deploy deploy_${deploy_TARGET})