Skip to content

Commit

Permalink
download skins on build
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolcha committed Aug 28, 2024
1 parent 4c0d8c9 commit 9abc92c
Show file tree
Hide file tree
Showing 5 changed files with 482 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,13 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
WIN32_EXECUTABLE TRUE
)

if (APPLE)
# unfortunately, this can't be in any other CMakeLists.txt in subdirectory :(
# also cmake copies the content of the directory, not the directory itself :(
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different
"${CMAKE_BINARY_DIR}/skins" "${PROJECT_NAME}.app/Contents/Resources/skins"
)
endif()

target_win_deploy_qt(${PROJECT_NAME} ${PROJECT_NAME}.exe)
11 changes: 11 additions & 0 deletions dist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

set(skins_archive "${CMAKE_CURRENT_BINARY_DIR}/skins.zip")

if (NOT EXISTS "${skins_archive}")
message("downloading skins archive...")
file(DOWNLOAD "https://digitalclock4.sourceforge.io/media/skins.zip" "${skins_archive}" SHOW_PROGRESS)
endif()

if (NOT EXISTS "${CMAKE_BINARY_DIR}/skins")
file(ARCHIVE_EXTRACT INPUT "${skins_archive}" DESTINATION "${CMAKE_BINARY_DIR}")
endif()

if (WIN32)
add_subdirectory(msi)
endif()
7 changes: 7 additions & 0 deletions dist/msi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(MSI_SRC_DIR "${CMAKE_BINARY_DIR}/installer_files" CACHE STRING "MSI source d
set(WIX_SRC_FILES
main.wxs
app_files.wxs
skins.wxs
)

set_property(GLOBAL PROPERTY JOB_POOLS single_job=1)
Expand All @@ -26,6 +27,12 @@ separate_arguments(WIX_LIGHT_FLAGS)

add_custom_target(deploy_qt COMMENT "Deploying Qt")

# not strictly required to be here, but just convenient
add_custom_command(TARGET deploy_qt POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different
"${CMAKE_BINARY_DIR}/skins" "${MSI_SRC_DIR}/skins"
)

function(target_win_deploy_qt _target _out_file)
add_custom_command(
OUTPUT ${MSI_SRC_DIR}/${_out_file}
Expand Down
1 change: 1 addition & 0 deletions dist/msi/main.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ SPDX-License-Identifier: MIT

<Feature Id="Complete" Level="1">
<ComponentGroupRef Id="AppFiles" />
<ComponentGroupRef Id="Skins" />
<ComponentGroupRef Id="Extras" />
</Feature>

Expand Down
Loading

0 comments on commit 9abc92c

Please sign in to comment.