Skip to content

Commit 9c1fac4

Browse files
committed
Don't make versioning default. Separate out Benchmarks target.
1 parent 1a603ab commit 9c1fac4

13 files changed

+54
-23
lines changed

.github/workflows/cmake_ctest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
env:
13-
PROJECT_NAME: Pamplejuce_v1
13+
PROJECT_NAME: Pamplejuce
1414
BUILD_TYPE: Release
1515
BUILD_DIR: Builds
1616
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CMakeLists.txt

+20-14
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@ cmake_minimum_required(VERSION 3.24.1)
44

55
# This tells cmake we have goodies in the /cmake folder
66
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
7+
include (PamplejuceVersion)
78

89
# This is the name of your plugin
9-
# Change me! Note: It cannot have spaces (but PRODUCT_NAME can)
10+
# Change me! Note: It cannot have spaces (but JUCE's PRODUCT_NAME can)
11+
# You may want to append the major version on the end of this (and PRODUCT_NAME)
12+
# set(PROJECT_NAME "MyPlugin_v${MAJOR_VERSION}")
13+
# Doing so enables major versions to show up in IDEs and DAWs as separate plugins
14+
# allowing you to change parameters and behavior without breaking user projects
1015
set(PROJECT_NAME "Pamplejuce")
1116

12-
include (PamplejuceVersion)
13-
14-
# By default, we add the major version on the end of the plugin name like _v1
15-
# Different major versions then show up in DAWs as separate plugins
16-
# This lets you change parameters and behavior without breaking user projects
17-
# Comment the following line to disable this behavior
18-
set(PROJECT_NAME "Pamplejuce_v${MAJOR_VERSION}")
19-
2017
# Set the plugin formats you'll be building here.
2118
# Valid choices here: AAX Unity VST VST3 AU AUv3 Standalone
2219
set(FORMATS Standalone AU VST3 AUv3)
@@ -62,11 +59,13 @@ juce_add_plugin("${PROJECT_NAME}"
6259
PLUGIN_CODE P001
6360
FORMATS "${FORMATS}"
6461

65-
# Change me!
6662
# The name of your final executable
6763
# This is how it's listed in the DAW
6864
# This can be different from PROJECT_NAME and can have spaces!
69-
PRODUCT_NAME "Pamplejuce v1")
65+
# You might want to use v${MAJOR_VERSION} here once you go to v2...
66+
set(PRODUCT_NAME "${PROJECT_NAME}")
67+
68+
PRODUCT_NAME "${PRODUCT_NAME}")
7069

7170
# This lets us use our code in both the JUCE targets and our Test target
7271
# Without running into ODR violations
@@ -81,7 +80,7 @@ target_compile_features(SharedCode INTERFACE cxx_std_20)
8180
# Just ensure you employ CONFIGURE_DEPENDS so the build system picks up changes
8281
# If you want to appease the CMake gods and avoid globs, manually add files like so:
8382
# set(SourceFiles Source/PluginEditor.h Source/PluginProcessor.h Source/PluginEditor.cpp Source/PluginProcessor.cpp)
84-
file(GLOB_RECURSE SourceFiles CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Source/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Source/*.h")
83+
file(GLOB_RECURSE SourceFiles CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/source/*.h")
8584
target_sources(SharedCode INTERFACE ${SourceFiles})
8685

8786
# Adds a BinaryData target for embedding assets into the binary
@@ -117,7 +116,11 @@ target_link_libraries(SharedCode
117116
INTERFACE
118117
Assets
119118
melatonin_inspector
120-
juce::juce_audio_utils
119+
juce_audio_utils
120+
juce_audio_processors
121+
juce_dsp
122+
juce_gui_basics
123+
juce_gui_extra
121124
juce::juce_recommended_config_flags
122125
juce::juce_recommended_lto_flags
123126
juce::juce_recommended_warning_flags)
@@ -128,5 +131,8 @@ target_link_libraries("${PROJECT_NAME}" PRIVATE SharedCode)
128131
# IPP support, comment out to disable
129132
include(PamplejuceIPP)
130133

131-
# Tests target, comment out to disable
134+
# Everything related to the tests target
132135
include(Tests)
136+
137+
# A separate target keeps the Tests target fast!
138+
include(Benchmarks)
File renamed without changes.

cmake/Benchmarks.cmake

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
file(GLOB_RECURSE BenchmarkFiles CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Benchmarks/*.h")
2+
3+
# Organize the test source in the Tests/ folder in the IDE
4+
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks PREFIX "" FILES ${BenchmarkFiles})
5+
6+
add_executable(Benchmarks ${BenchmarkFiles})
7+
target_compile_features(Benchmarks PRIVATE cxx_std_20)
8+
catch_discover_tests(Benchmarks)
9+
10+
# Our benchmark executable also wants to know about our plugin code...
11+
target_include_directories(Benchmarks PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Source)
12+
13+
# Copy over compile definitions from our plugin target so it has all the JUCEy goodness
14+
target_compile_definitions(Benchmarks PRIVATE $<TARGET_PROPERTY:${PROJECT_NAME},COMPILE_DEFINITIONS>)
15+
16+
# And give tests access to our shared code
17+
target_link_libraries(Benchmarks PRIVATE SharedCode Catch2::Catch2WithMain)
18+
19+
# Make an Xcode Scheme for the test executable so we can run tests in the IDE
20+
set_target_properties(Benchmarks PROPERTIES XCODE_GENERATE_SCHEME ON)
21+
22+
# When running Tests we have specific needs
23+
target_compile_definitions(Benchmarks PUBLIC
24+
JUCE_MODAL_LOOPS_PERMITTED=1 # let us run Message Manager in tests
25+
RUN_PAMPLEJUCE_TESTS=1 # also run tests in module .cpp files guarded by RUN_PAMPLEJUCE_TESTS
26+
)

cmake/Tests.cmake

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
enable_testing()
66

77
# "GLOBS ARE BAD" is brittle and silly dev UX, sorry CMake!
8-
file(GLOB_RECURSE TestFiles CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Tests/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Tests/*.h")
9-
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Tests PREFIX "" FILES ${TestFiles})
8+
file(GLOB_RECURSE TestFiles CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.h")
9+
10+
# Organize the test source in the Tests/ folder in Xcode
11+
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/tests PREFIX "" FILES ${TestFiles})
1012

1113
# Use Catch2 v3 on the devel branch
1214
Include(FetchContent)
@@ -37,12 +39,9 @@ set_target_properties(Tests PROPERTIES XCODE_GENERATE_SCHEME ON)
3739
# When running Tests we have specific needs
3840
target_compile_definitions(Tests PUBLIC
3941
JUCE_MODAL_LOOPS_PERMITTED=1 # let us run Message Manager in tests
40-
RUN_PAMPLEJUCE_TESTS=1 # lets us run tests in module .cpp files
42+
RUN_PAMPLEJUCE_TESTS=1 # also run tests in other module .cpp files guarded by RUN_PAMPLEJUCE_TESTS
4143
)
4244

43-
# Organize the test source in the Tests/ folder in the IDE
44-
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Tests PREFIX "" FILES ${TestFiles})
45-
4645
# Load and use the .cmake file provided by Catch2
4746
# https://github.com/catchorg/Catch2/blob/devel/docs/cmake-integration.md
4847
# We have to manually provide the source directory here for now

cmake/Xcode.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set_target_properties(SharedCode PROPERTIES FOLDER "")
33

44
# The Xcode source tree should uhhh, still look like the source tree, yo
5-
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Source PREFIX "" FILES ${SourceFiles})
5+
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/source PREFIX "" FILES ${SourceFiles})
66

77
# It tucks the Plugin varieties into a "Targets" folder and generate an Xcode Scheme manually
88
# Xcode scheme generation is turned off globally to limit noise from other targets
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Tests/PluginBasics.cpp tests/PluginBasics.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ PluginProcessor testPlugin;
1313
TEST_CASE("Plugin instance name", "[name]")
1414
{
1515
CHECK_THAT(testPlugin.getName().toStdString(),
16-
Catch::Matchers::Equals("Pamplejuce v1"));
16+
Catch::Matchers::Equals("Pamplejuce"));
1717
}
1818

1919
#ifdef PAMPLEJUCE_IPP

0 commit comments

Comments
 (0)