1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 10:42:29 +01:00

Add some basic working in installer with cmake 3.23

This commit is contained in:
Elias Steurer 2022-01-27 14:54:45 +01:00
parent c281ec5599
commit e55182cdaf
8 changed files with 87 additions and 83 deletions

View File

@ -1,7 +1,9 @@
project(CMake)
set(FILES # cmake-format: sortable
CopyRecursive.cmake QtUpdateTranslations.cmake)
CopyRecursive.cmake
CreateIFWInstaller.cmake
QtUpdateTranslations.cmake)
add_custom_target(
${PROJECT_NAME}

View File

@ -0,0 +1,68 @@
if(${SCREENPLAY_IFW_ROOT} STREQUAL "")
# Hardcoded Qt paths that are used by the QtMaintanance tool for now...
if(WIN32)
set(SCREENPLAY_IFW_ROOT "C:/Qt/Tools/QtInstallerFramework/4.2")
elseif(UNIX AND NOT APPLE)
set(SCREENPLAY_IFW_ROOT "$ENV{HOME}/Qt/Tools/QtInstallerFramework/4.2")
endif()
message(STATUS "[CPACK_IFW_ROOT] Not set. Using hardcoded value: ${SCREENPLAY_IFW_ROOT}")
message(STATUS "WARNING: MAKE SURE YOU HAVE THIS EXACT VERSION INSTALLED VIA THE QTMAINTANANCE TOOL!")
else()
message(STATUS "[CPACK_IFW_ROOT] = ${SCREENPLAY_IFW_ROOT}")
endif()
message(STATUS "[IFW INSTALLER ENABLED]: Configuring. This can take some time...")
set(CPACK_COMPONENTS_GROUPING IGNORE)
set(CPACK_PACKAGE_NAME "ScreenPlay")
set(CPACK_PACKAGE_FILE_NAME "ScreenPlay-Installer")
set(CPACK_PACKAGE_VENDOR "Elias Steurer")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}")
# Ensures that contents written to the CPack configuration files is escaped properly.
set(CPACK_VERBATIM_VARIABLES TRUE)
set(CPACK_GENERATOR "IFW")
set(CPACK_IFW_PACKAGE_NAME "ScreenPlay")
set(CPACK_IFW_ROOT ${SCREENPLAY_IFW_ROOT})
set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/Apps/ScreenPlay")
set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/ScreenPlay/assets/icons/app.ico")
set(CPACK_IFW_PACKAGE_WINDOW_ICON "${CMAKE_CURRENT_SOURCE_DIR}/ScreenPlay/assets/icons/app.ico")
set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Tools/Installer/installscript.qs")
set(CPACK_IFW_PACKAGE_GROUP ScreenPlay)
set(CPACK_IFW_VERBOSE ON)
# Override weird size defaults on 21:9 monitors
set(CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH 800)
set(CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT 506)
set(CPACK_IFW_PACKAGE_RUN_PROGRAM "@TargetDir@/ScreenPlay")
set(CPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTION "Start ScreenPlay")
set(CPACK_IFW_ARCHIVE_FORMAT "tar.bz2")
include(CPack)
include(CPackIFW)
# Install all files from /bin
install(
DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
COMPONENT ScreenPlay
DESTINATION "/")
cpack_add_component(
ScreenPlay
DISPLAY_NAME "ScreenPlay"
DESCRIPTION "This installs ScreenPlay.")
cpack_ifw_configure_component(
ScreenPlayApp FORCED_INSTALLATION
NAME "ScreenPlay"
VERSION ${PROJECT_VERSION} # Version of component
DESCRIPTION "Welcome to the K3000 installer."
# Gets ignored and I do not know why
SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Tools/Installer/installscript.qs"
CHECKABLE FALSE)

View File

@ -107,67 +107,6 @@ message(STATUS "[PROJECT] VCPKG_TARGET_TRIPLET = ${VCPKG_TARGET_TRIPLET}")
message(STATUS "[PROJECT] CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
if(${SCREENPLAY_CREATE_INSTALLER})
message(STATUS "[INSTALLER] CPACK_GENERATOR = ${CPACK_GENERATOR}")
if(${SCREENPLAY_IFW_ROOT} STREQUAL "")
# Hardcoded Qt paths that are used by the QtMaintanance tool for now...
if(WIN32)
set(SCREENPLAY_IFW_ROOT "C:/Qt/Tools/QtInstallerFramework/4.2")
elseif(UNIX AND NOT APPLE)
set(SCREENPLAY_IFW_ROOT "$ENV{HOME}/Qt/Tools/QtInstallerFramework/4.2")
endif()
message(STATUS "[CPACK_IFW_ROOT] Not set. Using hardcoded value: ${SCREENPLAY_IFW_ROOT}")
message(STATUS "WARNING: MAKE SURE YOU HAVE THIS EXACT VERSION INSTALLED VIA THE QTMAINTANANCE TOOL!")
else()
message(STATUS "[CPACK_IFW_ROOT] = ${SCREENPLAY_IFW_ROOT}")
endif()
message(STATUS "[IFW INSTALLER ENABLED]: Configuring. This can take some time...")
set(CPACK_IFW_ROOT ${SCREENPLAY_IFW_ROOT})
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-Installer")
set(CPACK_PACKAGE_VENDOR "Elias Steurer")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}")
# Ensures that contents written to the CPack configuration files is escaped properly.
set(CPACK_VERBATIM_VARIABLES TRUE)
set(CPACK_GENERATOR "IFW")
set(CPACK_IFW_PACKAGE_START_MENU_DIRECTORY "") # empty => default is install to top-level (?)
set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/Apps/${CMAKE_PROJECT_NAME}")
set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/ScreenPlay/assets/icons/app.ico")
set(CPACK_IFW_PACKAGE_WINDOW_ICON "${CMAKE_CURRENT_SOURCE_DIR}/ScreenPlay/assets/icons/app.ico")
set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Tools/Installer/installscript.qs")
set(CPACK_COMPONENTS_GROUPING IGNORE)
set(CPACK_IFW_PACKAGE_GROUP ScreenPlay)
set(CPACK_IFW_VERBOSE ON)
include(CPack)
include(CPackIFW)
# Install all files from /bin
install(
DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
COMPONENT ScreenPlay
DESTINATION "/")
cpack_add_component(
ScreenPlay
DISPLAY_NAME "ScreenPlay"
DESCRIPTION "This installs ScreenPlay.")
cpack_ifw_configure_component(
ScreenPlayApp FORCED_INSTALLATION
NAME "ScreenPlay"
VERSION ${PROJECT_VERSION} # Version of component
DESCRIPTION "Welcome to the K3000 installer."
# Gets ignored and I do not know why
SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Tools/Installer/installscript.qs"
CHECKABLE FALSE)
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CreateIFWInstaller.cmake)
endif()

View File

@ -237,6 +237,9 @@ if(WIN32)
# Icon
target_sources(${PROJECT_NAME} PRIVATE ScreenPlay.rc)
# Needed for the installscript.qs Windows entry
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/assets/icons/app.ico ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
# Disable console window on Windows
# https://stackoverflow.com/questions/8249028/how-do-i-keep-my-qt-c-program-from-opening-a-console-in-windows
set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true)

View File

@ -3,7 +3,8 @@ project(Tools LANGUAGES CXX)
file(GLOB PYTHON *.py)
set(FILES # cmake-format: sortable
Installer/package.xml Installer/installscript.qs)
Installer/package.xml
Installer/installscript.qs)
add_custom_target(
${PROJECT_NAME}

View File

@ -1,14 +1,7 @@
function Component()
{
// Install to @RootDir@ instead of @HomeDir@ on Windows
if (installer.value("os") === "win") {
var homeDir = installer.value("HomeDir");
var targetDir = installer.value("TargetDir").replace(homeDir, "@RootDir@");
installer.setValue("TargetDir", targetDir);
}
function Component() {
// do not show component selection page
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
// do not show component selection page
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
// no startmenu entry so no need to ask where to create it
installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
}

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package>
<DisplayName>Register a file extension</DisplayName>
<Description>Register a randomly generated file extension to open with notepad.exe</Description>
<Version>1.0.0-1</Version>
<ReleaseDate>2020-01-01</ReleaseDate>
<DisplayName>ScreenPlay</DisplayName>
<Description>ScreenPlay is an Open Source cross-platform app for displaying Video Wallpaper & Widgets.</Description>
<Version>0.15.0</Version>
<ReleaseDate>2022-01-01</ReleaseDate>
<Default>true</Default>
<Script>installscript.qs</Script>
</Package>

View File

@ -238,9 +238,7 @@ if __name__ == "__main__":
if args.create_installer:
os.chdir(build_folder)
print("Running cpack at: ", os.getcwd())
print("SKIP INSTALLER UNTIL CMAKE OUT OF SPACE ERROR IS FIXED IN 3.23")
print("https://cmake.org/cmake/help/git-stage/cpack_gen/ifw.html#variable:CPACK_IFW_ARCHIVE_FORMAT")
#run("cpack", cwd=build_folder)
run("cpack", cwd=build_folder)
print("Time taken: {}s".format(time.time() - start_time))