Skip to content

Commit

Permalink
Use configure.py and updated version
Browse files Browse the repository at this point in the history
  • Loading branch information
ypujante committed Aug 26, 2020
1 parent 060ac8a commit ae4ee9d
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 89 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ option(JAMBA_ENABLE_AUDIO_UNIT "Enable Audio Unit" ON)

set(PLUGIN_MAJOR_VERSION 1)
set(PLUGIN_MINOR_VERSION 2)
set(PLUGIN_PATCH_VERSION 5)
set(PLUGIN_PATCH_VERSION 6)
set(PLUGIN_VERSION "${PLUGIN_MAJOR_VERSION}.${PLUGIN_MINOR_VERSION}.${PLUGIN_PATCH_VERSION}")

project("jamba-sample-gain")
Expand Down Expand Up @@ -83,7 +83,7 @@ set(test_case_sources
jamba_add_vst_plugin(
TARGET "pongasoft_JambaSampleGain" # name of CMake target for the plugin
RELEASE_FILENAME "JambaSampleGain" # filename for the plugin (JambaSampleGain.vst3)
TARGETS_PREFIX "jsg_" # prefix used by all targets directly linked to this plugin
TARGETS_PREFIX "jmb_" # prefix used by all targets directly linked to this plugin
VST_SOURCES "${vst_sources}" "${vst2_sources}" # the source files that compose the plugin
INCLUDE_DIRECTORIES "${VERSION_DIR}" # we add the version folder to the list of includes
UIDESC "${RES_DIR}/JSGain.uidesc" # the main xml file for the GUI
Expand Down
154 changes: 98 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,79 +92,121 @@ The VST SDK will be automatically downloaded during the configure phase. This pr
Build this project
------------------

The following steps describes (for each platform) how to build the plugin.
The following steps describes how to build the plugin:

### macOS
1. Invoke the `configure.py` python script to configure the project
2. Run the `jamba.sh` (resp. `jamba.bat`) command line to build, test validate...

### macOS:

- For simplicity I am creating the build at the root of the source tree, but can obviously be *outside* the source tree entirely by running the script from anywhere

./configure.sh
cd build
> ./configure.py -h
usage: configure.py [-h] [-n] [-f] [-r] [--vst3 VST3_SDK_ROOT] [--vst2 VST2_SDK_ROOT]
[-G GENERATOR] [-B BUILD_DIR] [-- <cmake_options>]
positional arguments:
cmake_options Any options for cmake
optional arguments:
-h, --help show this help message and exit
-n, --dry-run Dry run (prints what it is going to do)
-f, --force Force a regeneration (delete and recreate build folder)
--vst3 VST3_SDK_ROOT Path to the VST3 SDK (optional)
--vst2 VST2_SDK_ROOT Path to the VST2 SDK (optional)
-r, --release Use CMake Release build type (for single-config generators)
-G GENERATOR, --generator GENERATOR
CMake generator (optional)
-B BUILD_DIR, --build-dir BUILD_DIR
Build folder (defaults to ./build)
Notes
---vst3 defaults to /Users/Shared/Steinberg/VST_SDK.<JAMBA_VST3SDK_VERSION>
---vst2 defaults to /Users/Shared/Steinberg/VST_SDK.<JAMBA_VST2SDK_VERSION>
-G defaults to "Xcode" on macOS and "Visual Studio 16 2019" for Windows10
run 'cmake --help' to get the list of generators supported
For single-config generators, Debug is used by default and can be changed with -r for Release
For multi-config generators, -r is ignored
To provide extra options to CMake you do it this way
python3 configure.py -- -Wdev
Examples
# Specify an explicit path to the VST3 sdk and uses default generator
python3 configure.py ---vst3 /opt/local/VST_SDK.3.7.0
# Use default paths and uses another generator
python3 configure.py -G "CodeBlocks - Unix Makefiles"
# Use defaults
> ./configure.py
> cd build

- In order to build, test, validate, etc... simply use the `jamba.sh` script like this:

./jamba.sh -h
Usage: jamba.sh [-hdrn] <command>

-h : usage help
-d : use Debug build config (default)
-r : use Release build config (Debug if not defined)
-n : dry run (prints what it is going to do)

Commands:
---- VST Commands ----
clean : clean all builds
build : build the VST plugin
edit : start the GUI editor (Debug only)
install : install the VST plugin in their default location
test : run the unit tests
validate : run the VST3 validator
---- Audio Unit Commands ----
build-au : build the Audio Unit wrapper plugin
install-au : install the Audio Unit plugin in its default location
validate-au : run the Audio Unit validator
---- Generic Commands ----
archive : generate the zip file containing the plugin(s) and README/License
prod : run test/validate/archive (default to Release, override with -d)
---- CMake target ----
<target> : invoke cmake with the provided target
> ./jamba.sh -h
usage: jamba.sh [-hnvbdr] <command> [<command> ...] [-- [native-options]]
positional arguments:
command See "Commands" section
optional arguments:
-h, --help show this help message and exit
-n, --dry-run Dry run (prints what it is going to do)
-v, --verbose Verbose build
-b, --banner Display a banner before every command
-d, --debug use Debug build config
-r, --release use Release build config
Commands
---- Main commands ----
clean : clean all builds
build : build the plugin
test : run the tests for the plugin
validate : run the validator for the vst3 plugin
edit : run the editor (full editing available in Debug config only)
install : build and install all the plugins (vst2/vst3/audio unit)
uninstall : delete the installed plugins (vst2/vst3/audio unit)
archive : create an archive containing the plugins
---- VST3 commands ----
install-vst3 : install the vst3 plugin only
uninstall-vst3 : uninstall the vst3 plugin only
---- VST2 commands ----
install-vst2 : install the vst2 plugin only
uninstall-vst2 : uninstall the vst2 plugin only
---- Audio Unit commands ----
build-au : builds the Audio Unit wrapper
install-au : install the vst2 plugin only
uninstall-au : uninstall the vst2 plugin only
---- CMake target ----
<command> : Any unknown <command> is treated as a cmake target
--- Native options ----
Pass remaining options to the native tool (ex: -- -j 8 for parallel build)

Note: You can load the project directly in CLion (since CLion does not support the Xcode cmake generator, you can still work on the plugin but in order to build and install the Audio Unit wrapper you will need to use the command line).

### Windows

- For simplicity I am creating the build at the root of the source tree, but can obviously be *outside* the source tree entirely by running the script from anywhere. Note that PowerShell is highly recommended.

.\configure.bat
cd build

- In order to build, test, validate, etc... simply use the `jamba.bat` script like this:
For windows, follow the same steps for macOS with the following changes:

.\jamba.bat -h
Usage: jamba.bat [-hdrn] <command>

-h : usage help
-d : use Debug build config (default)
-r : use Release build config (Debug if not defined)
-n : dry run (prints what it is going to do)

Commands:
---- VST Commands ----
clean : clean all builds
build : build the VST plugin
edit : start the GUI editor (Debug only)
install : install the VST plugin in their default location
test : run the unit tests
validate : run the VST3 validator
---- Generic Commands ----
archive : generate the zip file containing the plugin(s) and README/License
prod : run test/validate/archive (default to Release, override with -d)
---- CMake target ----
<target> : invoke cmake with the provided target
* In order to invoke `configure.py` you need to use `python configure.py`
* The script is called `jamba.bat` (instead of `jamba.sh`)

Release Notes
-------------

### 2020-08-26 - `v1.2.6`
* use latest version of Jamba (v5.0.0)
* use `configure.py` instead of shell scripts

### 2020-04-26 - `v1.2.5`
* use latest version of Jamba (v4.4.0)
* changed sliders to respond only when the handle is dragged
Expand Down
11 changes: 0 additions & 11 deletions configure.bat

This file was deleted.

115 changes: 115 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/usr/bin/env python3

# Copyright (c) 2020 pongasoft
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# @author Yan Pujante

import argparse
import os
import sys
import platform

parser = argparse.ArgumentParser(allow_abbrev=False,
usage='configure.py [-h] [-n] [-f] [-r] [--vst3 VST3_SDK_ROOT] [--vst2 VST2_SDK_ROOT] [-G GENERATOR] [-B BUILD_DIR] [-- <cmake_options>]',
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog='''
Notes
---vst3 defaults to /Users/Shared/Steinberg/VST_SDK.<JAMBA_VST3SDK_VERSION>
---vst2 defaults to /Users/Shared/Steinberg/VST_SDK.<JAMBA_VST2SDK_VERSION>
-G defaults to "Xcode" on macOS and "Visual Studio 16 2019" for Windows10
run 'cmake --help' to get the list of generators supported
For single-config generators, Debug is used by default and can be changed with -r for Release
For multi-config generators, -r is ignored
To provide extra options to CMake you do it this way
python3 configure.py -- -Wdev
Examples
# Specify an explicit path to the VST3 sdk and uses default generator
python3 configure.py ---vst3 /opt/local/VST_SDK.3.7.0
# Use default paths and uses another generator
python3 configure.py -G "CodeBlocks - Unix Makefiles"
# Use defaults
python3 configure.py
''')
parser.add_argument("-n", "--dry-run", help="Dry run (prints what it is going to do)", action="store_true", dest="dry_run")
parser.add_argument("-f", "--force", help="Force a regeneration (delete and recreate build folder)", action="store_true")
parser.add_argument("--vst3", help="Path to the VST3 SDK (optional)", dest="vst3_sdk_root")
parser.add_argument("--vst2", help="Path to the VST2 SDK (optional)", dest="vst2_sdk_root")
parser.add_argument("-r", "--release", help="Use CMake Release build type (for single-config generators)", action="store_true")
parser.add_argument("-G", "--generator", help="CMake generator (optional)")
parser.add_argument("-B", "--build-dir", help="Build folder (defaults to ./build)", dest="build_dir")
parser.add_argument('cmake_options', help="Any options for cmake", nargs=argparse.REMAINDER)

args = parser.parse_args()

# The CMakeLists.txt file is a sibling of this script
this_script_root_dir = os.path.dirname(os.path.realpath(sys.argv[0]))

# VST3_SDK_ROOT
vst3_sdk_root = [f'-DVST3_SDK_ROOT:PATH={args.vst3_sdk_root}'] if args.vst3_sdk_root else []

# VST2_SDK_ROOT
vst2_sdk_root = [f'-DVST2_SDK_ROOT:PATH={args.vst2_sdk_root}'] if args.vst2_sdk_root else []

# CMake generator
cmake_generator = ['-G']
if args.generator:
cmake_generator.append(args.generator)
else:
if platform.system() == 'Darwin':
cmake_generator.append('Xcode')
else:
cmake_generator.append('Visual Studio 16 2019')

# CMake options
cmake_options = [] if not args.cmake_options else args.cmake_options[1:]

# CMake build type (for single config generators)
cmake_build_type = [f'-DCMAKE_BUILD_TYPE={"Release" if args.release else "Debug"}']

# CMake build directory
build_dir = args.build_dir if args.build_dir else 'build'
cmake_build_dir = ['-B', build_dir]

# CMake command
cmake_command = ['cmake',
*cmake_build_dir,
*vst3_sdk_root, *vst2_sdk_root,
*cmake_build_type,
*cmake_generator,
*cmake_options,
this_script_root_dir]

if args.dry_run:
escaped_command = ' '.join([f'"{x}"' for x in cmake_command[1:]])
print(f'cmake {escaped_command}')
else:
if args.force:
import shutil
if os.path.exists(build_dir):
shutil.rmtree(build_dir)

import subprocess
subprocess.run(cmake_command)





20 changes: 0 additions & 20 deletions configure.sh

This file was deleted.

0 comments on commit ae4ee9d

Please sign in to comment.