Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify code formatting #41

Merged
merged 1 commit into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions .clang-format

This file was deleted.

12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,15 @@
* - Release
* - Debug
*/
"peakeater.config": "Debug"
"peakeater.config": "Debug",
"[cpp]": {
"editor.defaultFormatter": "zachflower.uncrustify"
},
"python.linting.pep8Enabled": true,
"python.linting.pylintEnabled": true,
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8",
"editor.formatOnSave": true
},
"python.linting.enabled": true
}
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
"command": "${workspaceFolder}/build/PeakEater_artefacts/${config:peakeater.config}/Standalone/PeakEater.app/Contents/MacOS/PeakEater"
},
{
"label": "Clang Format",
"label": "Pip: Install",
"type": "shell",
"command": "find ${workspaceFolder}/Source/ -iname *.h -o -iname *.cpp | xargs clang-format --dry-run --Werror -i"
"command": "python3 -m pip install -r ${workspaceFolder}/requirements.txt"
}
]
}
96 changes: 8 additions & 88 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,73 +1,14 @@
# Example Audio Plugin CMakeLists.txt

# To get started on a new plugin, copy this entire folder (containing this file and C++ sources) to
# a convenient location, and then start making modifications.

# The first line of any CMake project should be a call to `cmake_minimum_required`, which checks
# that the installed CMake will be able to understand the following CMakeLists, and ensures that
# CMake's behaviour is compatible with the named version. This is a standard CMake command, so more
# information can be found in the CMake docs.

cmake_minimum_required(VERSION 3.15)

# The top-level CMakeLists.txt file for a project must contain a literal, direct call to the
# `project()` command. `project()` sets up some helpful variables that describe source/binary
# directories, and the current project version. This is a standard CMake command.

project(PeakEater VERSION 0.3.0)

# If you've installed JUCE somehow (via a package manager, or directly using the CMake install
# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've
# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to
# include that subdirectory as part of the build.

# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system
# or
add_subdirectory(Dependencies/JUCE) # If you've put JUCE in a subdirectory called JUCE

# If you are building a VST2 or AAX plugin, CMake needs to be told where to find these SDKs on your
# system. This setup should be done before calling `juce_add_plugin`.

# juce_set_vst2_sdk_path(...)
# juce_set_aax_sdk_path(...)

# `juce_add_plugin` adds a static library target with the name passed as the first argument
# (AudioPluginExample here). This target is a normal CMake target, but has a lot of extra properties set
# up by default. As well as this shared code static library, this function adds targets for each of
# the formats specified by the FORMATS arguments. This function accepts many optional arguments.
# Check the readme at `docs/CMake API.md` in the JUCE repo for the full list.
add_subdirectory(Dependencies/JUCE)

juce_add_plugin(PeakEater
# VERSION ... # Set this if the plugin version is different to the project version
# ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon for the Standalone
# ICON_SMALL ...
# COMPANY_NAME ... # Specify the name of the plugin's author
# IS_SYNTH TRUE/FALSE # Is this a synth or an effect?
# NEEDS_MIDI_INPUT TRUE/FALSE # Does the plugin need midi input?
# NEEDS_MIDI_OUTPUT TRUE/FALSE # Does the plugin need midi output?
# IS_MIDI_EFFECT TRUE/FALSE # Is this plugin a MIDI effect?
# EDITOR_WANTS_KEYBOARD_FOCUS TRUE/FALSE # Does the editor need keyboard focus?
# COPY_PLUGIN_AFTER_BUILD TRUE/FALSE # Should the plugin be installed to a default location after building?
PLUGIN_MANUFACTURER_CODE Tado # A four-character manufacturer id with at least one upper-case character
PLUGIN_CODE Tape # A unique four-character plugin id with exactly one upper-case character
# GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case
FORMATS AU VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3
PLUGIN_MANUFACTURER_CODE Tado
PLUGIN_CODE Tape
FORMATS AU VST3 Standalone
COMPANY_NAME "T-Audio"
PRODUCT_NAME "PeakEater") # The name of the final executable, which can differ from the target name

# `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated
# into your build tree. This should be included with `#include <JuceHeader.h>`. The include path for
# this header will be automatically added to the target. The main function of the JuceHeader is to
# include all your JUCE module headers; if you're happy to include module headers directly, you
# probably don't need to call this.

# Add modules Example
# juce_add_module(Dependencies/sound_meter)

# `target_sources` adds source files to a target. We pass the target that needs the sources as the
# first argument, then a visibility parameter for the sources which should normally be PRIVATE.
# Finally, we supply a list of source files that will be built into the target. This is a standard
# CMake command.
PRODUCT_NAME "PeakEater")

target_sources(PeakEater
PRIVATE
Expand Down Expand Up @@ -97,28 +38,13 @@ target_sources(PeakEater
Source/PluginEditor.cpp
Source/PluginProcessor.cpp)

# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer
# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use
# of compile definitions to switch certain features on/off, so if there's a particular feature you
# need that's not on by default, check the module header for the correct flag to set here. These
# definitions will be visible both to your code, and also the JUCE module code, so for new
# definitions, pick unique names that are unlikely to collide! This is a standard CMake command.

target_compile_definitions(PeakEater
PUBLIC
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_DISPLAY_SPLASH_SCREEN=0 # Since its non-commercial project under GPL
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_plugin` call
JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_plugin` call
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_VST3_CAN_REPLACE_VST2=0)

# If your target needs extra binary assets, you can add them here. The first argument is the name of
# a new static library target that will include all the binary resources. There is an optional
# `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally,
# the SOURCES argument should be followed by a list of source files that should be built into the
# static library. These source files can be of any kind (wav data, images, fonts, icons etc.).
# Conversion to binary-data will happen when your target is built.

juce_add_binary_data(AudioPluginData SOURCES
Resources/link.png
Resources/bypass.png
Expand All @@ -127,12 +53,6 @@ juce_add_binary_data(AudioPluginData SOURCES
Resources/logo_plugin.png
Resources/WalkwayUpperBold.ttf)

# `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here,
# we're linking our executable target to the `juce::juce_audio_utils` module. Inter-module
# dependencies are resolved automatically, so `juce_core`, `juce_events` and so on will also be
# linked automatically. If we'd generated a binary data target above, we would need to link to it
# here too. This is a standard CMake command.

target_link_libraries(PeakEater
PRIVATE
AudioPluginData # If we'd created a binary data target, we'd link to it here
Expand Down
79 changes: 41 additions & 38 deletions Scripts/Release/MacOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,57 @@
Create DMG Image(for MacOS) that contains release artifacts.
@note Python v3.8+ is required for this to run.
"""
from ctypes import util
import utils
import argparse
import utils

# Parse input arguments
argument_parser = argparse.ArgumentParser()
argument_parser.add_argument('--force_upgrade_dependencies', type=bool,
default=False, help='Force update global env dependencies live xcode, brew, node, etc')
argument_parser.add_argument('--release_type', type=utils.ReleaseType, default=utils.ReleaseType.release,
choices=list(utils.ReleaseType), help='Type of release package, e.g. Release or Debug')
argument_parser.add_argument('--preserve_tmp', type=bool, default=False,
argument_parser.add_argument('--release_type',
type=utils.ReleaseType, default=utils.ReleaseType.release,
choices=list(utils.ReleaseType),
help='Type of release package, e.g. Release or Debug')
argument_parser.add_argument('--preserve_tmp',
type=bool,
default=False,
help='Preserve temp dir after script executed')
args = argument_parser.parse_args()

# Print arguments
utils.logVerbose("Arguments: ", args)
# Conditionally, force install env dependencies
if (args.force_upgrade_dependencies):
utils.logInfo("Force upgrading dependencies...")
utils.execCommand("softwareupdate --all --install --force")
utils.execCommand("brew update")
utils.execCommand("brew upgrade")
utils.execCommand("brew install node")
utils.log_verbose("Arguments: ", args)

# Ensure appdmg installed
utils.logInfo("Installing appdmg...")
utils.execCommand("npm install -g appdmg")
utils.log_info("Installing appdmg...")
utils.exec_command("npm install -g appdmg")

# Create tmp dir
utils.logInfo("Ensuring tmp and release dirs are clean and esists...")
TMP_DIR_PATH = utils.getTmpDirPath()
utils.ensureDirEmpty(TMP_DIR_PATH)
RELEASE_DIR_PATH = utils.getReleaseDirPath()
utils.ensureDirEmpty(RELEASE_DIR_PATH)
utils.log_info("Ensuring tmp and release dirs are clean and esists...")
TMP_DIR_PATH = utils.get_tmp_dir_path()
utils.ensure_dir_empty(TMP_DIR_PATH)
RELEASE_DIR_PATH = utils.get_release_dir_path()
utils.ensure_dir_empty(RELEASE_DIR_PATH)

# Copy VST3, AU, configs and assets into it
utils.logInfo("Copying VST3, AU, release assets and configs to tmo dir...")
utils.copyDirContentRecursive(
utils.getBuildVST3DirPath(args.release_type), TMP_DIR_PATH)
utils.copyDirContentRecursive(
utils.getBuildAUDirPath(args.release_type), TMP_DIR_PATH)
utils.copyDirContentRecursive(
utils.getProjectReleaseAssetsDirPath(), TMP_DIR_PATH)
utils.copyDirContentRecursive(
utils.getProjectReleaseConfigsDirPath(), TMP_DIR_PATH)
utils.log_info("Copying VST3, AU, release assets and configs to tmo dir...")
utils.copy_dir_content_recursive(
utils.get_build_vst3_dir_path(args.release_type), TMP_DIR_PATH)
utils.copy_dir_content_recursive(
utils.get_build_au_dir_path(args.release_type), TMP_DIR_PATH)
utils.copy_dir_content_recursive(
utils.get_project_release_assets_dir_path(), TMP_DIR_PATH)
utils.copy_dir_content_recursive(
utils.get_project_release_configs_dir_path(), TMP_DIR_PATH)

# Create DMG
utils.logInfo("Creating release image...")
appDmgConfigFilePath = str(TMP_DIR_PATH) + "/appdmg-config.json"
outputDmgFilePath = str(RELEASE_DIR_PATH) + "/PeakEater.dmg"
utils.execCommand("appdmg " + appDmgConfigFilePath + " " + outputDmgFilePath)
utils.log_info("Creating release image...")
APP_DMG_CONFIG_FILE_PATH = str(TMP_DIR_PATH) + "/appdmg-config.json"
OUTPUT_DMG_FILE_PATH = str(RELEASE_DIR_PATH) + "/PeakEater.dmg"
utils.exec_command("appdmg " + APP_DMG_CONFIG_FILE_PATH +
" " + OUTPUT_DMG_FILE_PATH)

# Conditionally, cleanup tmp
if not args.preserve_tmp:
utils.logInfo("Cleaning up tmp dir...")
utils.rmDir(TMP_DIR_PATH)
utils.log_info("Cleaning up tmp dir...")
utils.rm_dir(TMP_DIR_PATH)

# Done, print where DMG is located
utils.logInfo("Done! Dmg file may be found at: " + outputDmgFilePath)
utils.log_info("Done! Dmg file may be found at: " + OUTPUT_DMG_FILE_PATH)
56 changes: 31 additions & 25 deletions Scripts/Release/Windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
Create executable(for Windows) that installs VST3.
@note Python v3.8+ is required for this to run.
"""
from ctypes import util
import utils
import argparse
from pathlib import Path
import utils

# WiX Default Configuration
WIX_COMPILER_DEFAULT_PATH = "C:\Program Files (x86)\\WiX Toolset v3.11\\bin\\candle.exe"
WIX_LINKER_DEFAULT_PATH = "C:\Program Files (x86)\\WiX Toolset v3.11\\bin\\light.exe"
WIX_COMPILER_DEFAULT_PATH = "C:\\Program Files (x86)\\WiX Toolset v3.11\\bin\\candle.exe"
WIX_LINKER_DEFAULT_PATH = "C:\\Program Files (x86)\\WiX Toolset v3.11\\bin\\light.exe"

# Parse input arguments
argument_parser = argparse.ArgumentParser()
argument_parser.add_argument(
Expand All @@ -20,34 +20,40 @@
argument_parser.add_argument('--preserve_tmp', type=bool, default=False,
help='Preserve temp dir after script executed')
args = argument_parser.parse_args()

# Print arguments
utils.logVerbose("Arguments: ", args)
utils.log_verbose("Arguments: ", args)

# Create tmp dir
utils.logInfo("Ensuring tmp and release dirs are clean and esists...")
TMP_DIR_PATH = utils.getTmpDirPath()
utils.ensureDirEmpty(TMP_DIR_PATH)
RELEASE_DIR_PATH = utils.getReleaseDirPath()
utils.ensureDirEmpty(RELEASE_DIR_PATH)
utils.log_info("Ensuring tmp and release dirs are clean and esists...")

TMP_DIR_PATH = utils.get_tmp_dir_path()
utils.ensure_dir_empty(TMP_DIR_PATH)
RELEASE_DIR_PATH = utils.get_release_dir_path()
utils.ensure_dir_empty(RELEASE_DIR_PATH)

# Copy VST3, AU, configs and assets into it
utils.logInfo("Copying VST3, release assets and configs to tmp dir...")
utils.copyDirContentRecursive(
utils.getBuildVST3DirPath(args.release_type), TMP_DIR_PATH)
utils.copyDirContentRecursive(
utils.getProjectReleaseAssetsDirPath(), TMP_DIR_PATH)
utils.copyDirContentRecursive(
utils.getProjectReleaseConfigsDirPath(), TMP_DIR_PATH)
utils.log_info("Copying VST3, release assets and configs to tmp dir...")
utils.copy_dir_content_recursive(
utils.get_build_vst3_dir_path(args.release_type), TMP_DIR_PATH)
utils.copy_dir_content_recursive(
utils.get_project_release_assets_dir_path(), TMP_DIR_PATH)
utils.copy_dir_content_recursive(
utils.get_project_release_configs_dir_path(), TMP_DIR_PATH)

# Create installer
utils.logInfo("Creating installer...")
wixCompilerFullPath = utils.createPath(args.wix_compiler_path)
wixLinkerFullPath = utils.createPath(args.wix_linker_path)
utils.log_info("Creating installer...")
wixCompilerFullPath = utils.create_path(args.wix_compiler_path)
wixLinkerFullPath = utils.create_path(args.wix_linker_path)
wixConfigFullPath = TMP_DIR_PATH.joinpath("wix-config.wxs").resolve()
wixObjectFullPath = TMP_DIR_PATH.joinpath("wix-config.wixobj").resolve()
msiBuildFullPath = RELEASE_DIR_PATH.joinpath("PeakEater.msi").resolve()
utils.execCommand(
utils.exec_command(
f'""{str(wixCompilerFullPath)}" "{str(wixConfigFullPath)}" -o "{str(wixObjectFullPath)}" -arch "x64""')
utils.execCommand(
utils.exec_command(
f'""{str(wixLinkerFullPath)}" "{str(wixObjectFullPath)}" -o "{str(msiBuildFullPath)}" -ext "WixUIExtension""')

# Conditionally, cleanup tmp
if not args.preserve_tmp:
utils.logInfo("Cleaning up tmp dir...")
utils.rmDir(TMP_DIR_PATH)
utils.log_info("Cleaning up tmp dir...")
utils.rm_dir(TMP_DIR_PATH)
Loading