1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-01 16:19:47 +02:00

Add macOS code signing

This commit is contained in:
Elias Steurer 2021-08-08 19:31:50 +02:00
parent e3a6193275
commit 2d04ce2608
5 changed files with 65 additions and 39 deletions

View File

@ -13,11 +13,13 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<string>ScreenPlay</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>0.14</string>
<key>CFBundleShortVersionString</key>
<string>0.14</string>
<key>CFBundleDisplayName</key>
<string>ScreenPlay</string>
</dict>

View File

@ -16,10 +16,12 @@
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleDisplayName</key>
<string>ScreenPlayWallpaper</string>
<key>CFBundleVersion</key>
<string>0.14</string>
<key>CFBundleShortVersionString</key>
<string>0.14</string>
<key>NSUIElement</key>
<string>1</string>
<key>LSUIElement</key>

View File

@ -16,10 +16,12 @@
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleDisplayName</key>
<string>ScreenPlayWidget</string>
<key>CFBundleVersion</key>
<string>0.14</string>
<key>CFBundleShortVersionString</key>
<string>0.14</string>
<key>NSUIElement</key>
<string>1</string>
<key>LSUIElement</key>

View File

@ -4,8 +4,11 @@ import sys
import subprocess
import shutil
import argparse
from execute_util import execute
# Based on https://gist.github.com/l2m2/0d3146c53c767841c6ba8c4edbeb4c2c
def vs_env_dict():
vsvar32 = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat'
cmd = [vsvar32, '&&', 'set']
@ -19,7 +22,6 @@ def vs_env_dict():
return dict((e[0].upper(), e[1]) for e in [p.rstrip().split("=", 1) for p in output] if len(e) == 2)
# MAIN
parser = argparse.ArgumentParser(description='Build and Package ScreenPlay')
parser.add_argument('-t', action="store", dest="build_type")
@ -40,20 +42,22 @@ cmake_build_type = ""
executable_file_ending = ""
deploy_command = ""
if platform == "win32":
print("Loading MSVC env variables via vsvars32.bat")
cmake_build_type = args.build_type
windows_msvc = "msvc2019_64"
windows_msvc = "msvc2019_64"
executable_file_ending = ".exe"
deploy_command = "windeployqt.exe --{type} --qmldir ../../{app}/qml {app}{executable_file_ending}"
dict = vs_env_dict()
dict["PATH"] = dict["PATH"] + ";C:\\Qt\\" + qt_version + "\\" + windows_msvc + "\\bin;C:\\Qt\\Tools\\QtCreator\\bin"
dict["PATH"] = dict["PATH"] + ";C:\\Qt\\" + qt_version + \
"\\" + windows_msvc + "\\bin;C:\\Qt\\Tools\\QtCreator\\bin"
os.environ.update(dict)
cmake_prefix_path = "c:/Qt/" + qt_version + "/" + windows_msvc
cmake_target_triplet = "x64-windows"
elif platform == "darwin":
cmake_prefix_path = "~/Qt/" + qt_version + "/clang_64"
deploy_command = "{prefix_path}/bin/macdeployqt {app}.app -qmldir=../../{app}/qml "
deploy_command = "{prefix_path}/bin/macdeployqt {app}.app -qmldir=../../{app} "
cmake_target_triplet = "x64-osx"
elif platform == "linux":
deploy_command = "cqtdeployer -qmldir ../../{app}/qml -bin {app}"
@ -64,7 +68,8 @@ elif platform == "linux":
cwd = os.getcwd()
root_path = os.path.abspath((cwd+"/../"))
os.chdir(root_path)
cmake_toolchain_file = ("'{root_path}/../ScreenPlay-vcpkg/scripts/buildsystems/vcpkg.cmake'").format(root_path=root_path)
cmake_toolchain_file = (
"'{root_path}/../ScreenPlay-vcpkg/scripts/buildsystems/vcpkg.cmake'").format(root_path=root_path)
print("cmake_toolchain_file: %s " % cmake_toolchain_file)
build_folder = "build-" + cmake_target_triplet + "-" + args.build_type
@ -90,39 +95,47 @@ cmake_configure_command = """cmake ../
triplet=cmake_target_triplet,
toolchain=cmake_toolchain_file).replace("\n", "")
print("cmake_configure_command: %s" % cmake_configure_command)
print("deploy_command: %s" % deploy_command)
process = subprocess.run(cmake_configure_command, capture_output=True,shell=True)
if process.returncode != 0:
print("deploy_command error: %s" % process.stderr)
sys.exit(process.returncode)
os.system("cmake --build . --target all")
execute(cmake_configure_command)
execute("cmake --build . --target all")
os.chdir("bin")
os.system((deploy_command).format(
type=cmake_build_type,
prefix_path=cmake_prefix_path,
app="ScreenPlay",
executable_file_ending=executable_file_ending))
execute(deploy_command.format(
type=cmake_build_type,
prefix_path=cmake_prefix_path,
app="ScreenPlay",
executable_file_ending=executable_file_ending))
os.system((deploy_command).format(
type=cmake_build_type,
prefix_path=cmake_prefix_path,
app="ScreenPlayWidget",
executable_file_ending=executable_file_ending))
execute(deploy_command.format(
type=cmake_build_type,
prefix_path=cmake_prefix_path,
app="ScreenPlayWidget",
executable_file_ending=executable_file_ending))
os.system((deploy_command).format(
type=cmake_build_type,
prefix_path=cmake_prefix_path,
app="ScreenPlayWallpaper",
executable_file_ending=executable_file_ending))
execute(deploy_command.format(
type=cmake_build_type,
prefix_path=cmake_prefix_path,
app="ScreenPlayWallpaper",
executable_file_ending=executable_file_ending))
if platform == "darwin":
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --options \"runtime\" \"ScreenPlay.app/\"")
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --options \"runtime\" \"ScreenPlayWallpaper.app/\"")
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --options \"runtime\" \"ScreenPlayWidget.app/\"")
execute("codesign --verify --verbose \"ScreenPlay.app/\"")
execute("codesign --verify --verbose \"ScreenPlayWallpaper.app/\"")
execute("codesign --verify --verbose \"ScreenPlayWidget.app/\"")
execute("xcnotary notarize ScreenPlay.app -d kelteseth@gmail.com -k ScreenPlay")
execute("xcnotary notarize ScreenPlayWallpaper.app -d kelteseth@gmail.com -k ScreenPlay")
execute("xcnotary notarize ScreenPlayWidget.app -d kelteseth@gmail.com -k ScreenPlay")
execute("spctl --assess --verbose \"ScreenPlay.app/\"")
execute("spctl --assess --verbose \"ScreenPlayWallpaper.app/\"")
execute("spctl --assess --verbose \"ScreenPlayWidget.app/\"")
file_endings = [".ninja_deps", ".ninja", ".ninja_log", ".lib", ".exp",
file_endings = [".ninja_deps", ".ninja", ".ninja_log", ".lib", ".a", ".dylib", ".exp",
".manifest", ".cmake", ".cbp", "CMakeCache.txt"]
for filename in os.listdir(os.getcwd()):

View File

@ -2,6 +2,8 @@ import subprocess
# Python program to print
# colored text and background
def printRed(skk): print("\033[91m {}\033[0;37;40m" .format(skk))
def printGreen(skk): print("\033[92m {}\033[0;37;40m" .format(skk))
def printYellow(skk): print("\033[93m {}\033[0;37;40m" .format(skk))
@ -11,7 +13,12 @@ def printCyan(skk): print("\033[96m {}\033[0;37;40m" .format(skk))
def printLightGray(skk): print("\033[97m {}\033[0;37;40m" .format(skk))
def printBlack(skk): print("\033[98m {}\033[0;37;40m" .format(skk))
def execute(command, workingDir=".", ignore_error=False, use_shell=True):
def execute(command, workingDir=".", ignore_error=False, use_shell=True, print_command=True):
if print_command:
print("\033[92m Executing: \033[0;37;40m", command)
process = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=use_shell, cwd=workingDir)