1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-06 09:17:07 +02:00

Add cpack based installer

This commit is contained in:
Elias Steurer 2021-12-04 10:41:21 +01:00
parent 8ea96b052e
commit 4f5bfe44d1
2 changed files with 39 additions and 23 deletions

View File

@ -102,55 +102,57 @@ message(STATUS "[PROJECT] CMAKE_TOOLCHAIN_FILE = ${CMAKE_TOOLCHAIN_FILE}")
message(STATUS "[PROJECT] VCPKG_PATH = ${VCPKG_PATH}")
message(STATUS "[PROJECT] VCPKG_TARGET_TRIPLET = ${VCPKG_TARGET_TRIPLET}")
message(STATUS "[PROJECT] CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
message(STATUS "[PROJECT] CPACK_GENERATOR = ${CPACK_GENERATOR}")
if(${SCREENPLAY_CREATE_INSTALLER})
# Hardcoded Qt paths that are used by the QtMaintanance tool for now...
if(WIN32)
set(CPACK_IFW_ROOT "C:/Qt/Tools/QtInstallerFramework/4.2")
elseif(UNIX AND NOT APPLE)
set(CPACK_IFW_ROOT "$ENV{HOME}/Qt/Tools/QtInstallerFramework/4.2")
endif()
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_INSTALL_DIRECTORY "${PROJECT_NAME}")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
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@/${CMAKE_PROJECT_NAME}")
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)
# Install Windows Universal CRT libs for app-local deployment
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Tools/Installer/installscript.qs")
set(CPACK_IFW_VERBOSE ON)
include(CPack)
include(CPackIFW)
# Install all files from /bin
install(
DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
COMPONENT ScreenPlay
DESTINATION "/")
DESTINATION ".")
cpack_add_component(
K3000
ScreenPlay
DISPLAY_NAME "ScreenPlay"
DESCRIPTION "This installs ScreenPlay.")
cpack_ifw_configure_component(
ScreenPlay FORCED_INSTALLATION
ScreenPlayApp
FORCED_INSTALLATION
NAME "ScreenPlay"
DESCRIPTION "Welcome to the ScreenPlay installer."
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

@ -39,6 +39,10 @@ parser.add_argument('-sign', action="store", dest="sign_build",
help="Enable if you want to sign the apps. This is macos only for now.")
parser.add_argument('-steam', action="store", dest="steam_build",
help="Enable if you want to build the Steam workshop plugin.")
parser.add_argument('-tests', action="store", dest="build_tests",
help="Build tests.")
parser.add_argument('-installer', action="store", dest="create_installer",
help="Create a installer.")
args = parser.parse_args()
if not args.build_type:
@ -47,9 +51,15 @@ if not args.build_type:
qt_version = "6.2.2"
steam_build = "OFF"
build_tests = "OFF"
create_installer = "OFF"
if args.steam_build:
if args.steam_build:
steam_build = "ON"
steam_build = "ON"
if args.build_tests:
build_tests = "ON"
if args.create_installer:
create_installer = "ON"
print("Starting build with type %s. Qt Version: %s" %
(args.build_type, qt_version))
@ -79,7 +89,7 @@ elif platform == "darwin":
deploy_command = "{prefix_path}/bin/macdeployqt {app}.app -qmldir=../../{app}/qml -executable={app}.app/Contents/MacOS/{app}"
cmake_target_triplet = "x64-osx"
elif platform == "linux":
deploy_command = "cqtdeployer -qmldir ../../{app}/qml -bin {app}"
deploy_command = "cqtdeployer -qmlDir ../../{app}/qml -bin {app}"
cmake_prefix_path = "~/Qt/" + qt_version + "/gcc_64"
cmake_target_triplet = "x64-linux"
@ -97,7 +107,6 @@ if os.path.isdir(build_folder):
print("Remove previous build folder: " + build_folder)
shutil.rmtree(build_folder)
os.mkdir(build_folder)
os.chdir(build_folder)
@ -106,8 +115,9 @@ cmake_configure_command = """cmake ../
-DCMAKE_BUILD_TYPE={type}
-DCMAKE_TOOLCHAIN_FILE={toolchain}
-DVCPKG_TARGET_TRIPLET={triplet}
-DTESTS_ENABLED=OFF
-DSCREENPLAY_STEAM={steam}
-DSCREENPLAY_TESTS={tests}
-DSCREENPLAY_CREATE_INSTALLER={installer}
-G "CodeBlocks - Ninja"
-B.
""".format(
@ -115,7 +125,10 @@ cmake_configure_command = """cmake ../
prefix_path=cmake_prefix_path,
triplet=cmake_target_triplet,
toolchain=cmake_toolchain_file,
steam=steam_build).replace("\n", "")
steam=steam_build,
tests = build_tests,
installer= create_installer
).replace("\n", "")
execute(cmake_configure_command)
execute("cmake --build . --target all")
@ -183,5 +196,6 @@ for filename in os.listdir(os.getcwd()):
print("Remove: %s" % full_file_path)
os.remove(full_file_path)
os.chdir("..")
execute("cpack")
if args.create_installer:
os.chdir("..")
execute("cpack")