Skip to content

Commit

Permalink
init [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
zsliu98 committed Aug 9, 2024
1 parent 429ab92 commit e5c00ce
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 61 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ include(JUCEDefaults)
add_subdirectory(JUCE)

# Add any other modules you want modules here, before the juce_add_plugin call
juce_add_module("${CMAKE_CURRENT_LIST_DIR}/modules/friz/Source/friz")

# See `docs/CMake API.md` in the JUCE repo for all config options
juce_add_plugin("${PROJECT_NAME}"
Expand Down Expand Up @@ -173,8 +172,7 @@ target_link_libraries(SharedCode
juce_gui_extra
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
friz)
juce::juce_recommended_warning_flags)
# Boost::boost)

# Link the JUCE plugin targets our SharedCode target
Expand Down
53 changes: 0 additions & 53 deletions packaging/installer.iss

This file was deleted.

113 changes: 113 additions & 0 deletions packaging/packager_Windows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import os
import sys
import subprocess
from pathlib import PureWindowsPath


def main():
temp_dir = "./windowstmp"
subprocess.run(["mkdir", temp_dir])

project_name = os.getenv("PROJECT_NAME", "Pamplejuce")
product_name = os.getenv("PRODUCT_NAME", "Pamplejuce Demo")
version = os.getenv("VERSION", "0.0.0")
bundle_id = os.getenv("BUNDLE_ID", "")
build_dir = os.getenv("BUILD_DIR", "")
artifact_name = os.getenv("ARTIFACT_NAME", "")

outfile = open("packaging/installer.iss", "w")

outfile.write(r'''
#define Version Trim(FileRead(FileOpen("..\VERSION")))
#define ProjectName GetEnv('PROJECT_NAME')
#define ProductName GetEnv('PRODUCT_NAME')
#define Publisher GetEnv('COMPANY_NAME')
#define Year GetDateTimeString("yyyy","","")
[Setup]
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64
AppName={#ProductName}
OutputBaseFilename={#ProductName}-{#Version}-Windows
AppCopyright=Copyright (C) {#Year} {#Publisher}
AppPublisher={#Publisher}
AppVersion={#Version}
DefaultDirName="{commoncf64}\VST3\{#ProductName}.vst3"
DisableDirPage=yes
CreateAppDir=no
''')

if os.path.isfile("/packaging/icon.ico"):
outfile.write(r'SetupIconFile=..\packaging\icon.ico')
outfile.write("UninstallDisplayIcon={uninstallexe}")
if os.path.isfile("/packaging/EULA"):
outfile.write(r'LicenseFile="EULA"')
if os.path.isfile("/packaging/Readme.rtf"):
outfile.write(r'InfoBeforeFile="Readme.rtf"')

outfile.write('''
[Types]
Name: "full"; Description: "Full installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom
''')

all_install_paths = [
r'{commoncf64}\VST3',
r'{commoncf64}\LV2',
r'{commoncf64}\Avid\Audio\Plug-Ins', ]

plugin_formats, extensions, install_paths = [], [], []
for plugin_format, extension, install_path in zip(
["VST3", "LV2", "AAX"],
["vst3", "lv2", "aaxplugin"],
all_install_paths):
if plugin_format + "_PATH" in os.environ:
plugin_path = os.environ[plugin_format + "_PATH"]
if os.path.exists(plugin_path):
plugin_formats.append(plugin_format)
extensions.append(extension)
install_paths.append(install_path)

outfile.write("[Components]\n")
for plugin_format, extension, install_path in zip(plugin_formats, extensions, install_paths):
outfile.write(
'Name: "{}"; Description: {} {}; Types: full custom; Flags: checkablealone'.format(
extension, product_name, plugin_format
))
outfile.write("\n")

outfile.write("[UninstallDelete]\n")
for plugin_format, extension, install_path in zip(plugin_formats, extensions, install_paths):
outfile.write(
'Type: filesandordirs; Name: "{}"'.format(
install_path + '\\' + product_name + 'Data'
))
outfile.write("\n")

outfile.write("[Files]\n")
for plugin_format, extension, install_path in zip(plugin_formats, extensions, install_paths):
outfile.write(
'Source: "..\\{}\\*"; DestDir: "{}"; Excludes: *.ilk; Flags: ignoreversion recursesubdirs; Components: {}'.format(
str(PureWindowsPath(os.environ[plugin_format + "_PATH"])),
install_path + '\\' + product_name + "." + extension + "\\",
extension)
)
outfile.write("\n")

outfile.write("[Run]\n")
for plugin_format, extension, install_path in zip(plugin_formats, extensions, install_paths):
outfile.write('Filename: "{cmd}"; ')
outfile.write('WorkingDir:"{}"; '.format(install_path))
outfile.write('Parameters: "/C mklink /D ""{}"" ""{}"""; '
.format(install_path + '\\' + product_name + 'Data',
'{commonappdata}\\{#ProductName}'))
outfile.write("Flags: runascurrentuser; ")
outfile.write("Components: " + extension)
outfile.write("\n")

outfile.close()
return 0


if __name__ == '__main__':
sys.exit(main())
30 changes: 25 additions & 5 deletions packaging/generator.py → packaging/packager_macOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import xml.etree.cElementTree as ET
import subprocess


def main():
temp_dir = "./appletmp"
subprocess.run(["mkdir", temp_dir])
Expand All @@ -14,6 +15,7 @@ def main():
bundle_id = os.getenv("BUNDLE_ID", "")
build_dir = os.getenv("BUILD_DIR", "")
artifact_name = os.getenv("ARTIFACT_NAME", "")
developer_id_app = os.getenv("DEVELOPER_ID_APPLICATION", "")

# root
root = ET.Element("installer-gui-script", minSpecVersion="1")
Expand All @@ -40,16 +42,33 @@ def main():
# choices outline
outline = ET.SubElement(root, "choices-outline")

install_paths = [
"/Library/Audio/Plug-Ins/VST3",
"/Library/Audio/Plug-Ins/Components",
"/Library/Audio/Plug-Ins/LV2",
"/Library/Audio/Plug-Ins/CLAP",
"/Library/Application Support/Avid/Audio/Plug-Ins"
]

print("Create packages")
for plugin_format, extension, install_path in zip(
["VST3", "AU", "LV2", "CLAP"],
["vst3", "au", "lv2", "clap"],
["VST3", "Components", "LV2", "CLAP"]):
["VST3", "AU", "LV2", "CLAP", "AAX"],
["vst3", "au", "lv2", "clap", "aax"],
install_paths):
if plugin_format + "_PATH" in os.environ:
plugin_path = os.environ[plugin_format + "_PATH"]
if os.path.exists(plugin_path):
if developer_id_app != "" and extension != "aax":
subprocess.run(
'codesign --force -s "{}" -v "{}" --deep --strict --options=runtime --timestamp'.format(
developer_id_app, plugin_path), shell=True)

identifier = "{}.{}.{}.pkg".format(bundle_id, project_name, extension)
pkg_path = "{}/{}.{}.pkg".format(build_dir, product_name, extension)

subprocess.run(
'pkgbuild --identifier "{}" --version {} --component "{}" --install-location "{}" "{}"'.format(
identifier, version, plugin_path, install_path, pkg_path), shell=True)
ref = ET.SubElement(root, "pkg-ref",
id=identifier, version=version, onConclusion="none")
ref.text = pkg_path
Expand All @@ -74,7 +93,7 @@ def main():
"--package-path", build_dir,
"--resources", "packaging",
artifact_name + "_unsigned.pkg"]

subprocess.run(["productbuild"] + command_list)

if os.path.exists("packaging/icon.icns"):
Expand All @@ -88,5 +107,6 @@ def main():
print("")
return 0


if __name__ == '__main__':
sys.exit(main())
sys.exit(main())

0 comments on commit e5c00ce

Please sign in to comment.