1+ cmake_minimum_required (VERSION 3.14 )
2+ project (TemplateProject VERSION 1.0.0)
3+
4+ set (PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
5+ set (PLUG_RESOURCES_DIR ${PROJECT_DIR} /resources)
6+
7+ set (SOURCE_FILES
8+ TemplateProject.cpp
9+ TemplateProject.h
10+ resources/resource.h
11+ )
12+
13+ # create a private library target called "__${PROJECT_NAME}-base" for shared code
14+ add_library (_${PROJECT_NAME}-base INTERFACE )
15+ iplug_add_target (_${PROJECT_NAME}-base INTERFACE
16+ INCLUDE ${PROJECT_DIR} ${PROJECT_DIR} /resources
17+ LINK iPlug2::IPlug
18+ )
19+
20+ # ============================================================================
21+ # APP Target (Standalone Application) - with IGraphics UI
22+ # ============================================================================
23+ add_executable (${PROJECT_NAME} -app ${SOURCE_FILES} )
24+ iplug_add_target (${PROJECT_NAME} -app PUBLIC
25+ LINK iPlug2::APP iPlug2::IGraphics::NanoVG _${PROJECT_NAME}-base
26+ RESOURCE ${RESOURCES}
27+ )
28+ iplug_configure_target (${PROJECT_NAME} -app APP ${PROJECT_NAME} )
29+
30+ # Add font resources to APP bundle
31+ set (FONT_FILES ${PLUG_RESOURCES_DIR} /fonts/Roboto-Regular.ttf)
32+ target_sources (${PROJECT_NAME} -app PRIVATE ${FONT_FILES} )
33+ set_source_files_properties (${FONT_FILES} PROPERTIES
34+ MACOSX_PACKAGE_LOCATION Resources
35+ )
36+
37+ # Helper function to add resources to plugin bundles
38+ function (iplug_add_plugin_resources target )
39+ target_sources (${target} PRIVATE ${FONT_FILES} )
40+ set_source_files_properties (${FONT_FILES} PROPERTIES
41+ MACOSX_PACKAGE_LOCATION Resources
42+ )
43+ endfunction ()
44+
45+ # ============================================================================
46+ # VST3 Target - with IGraphics UI
47+ # ============================================================================
48+ add_library (${PROJECT_NAME} -vst3 MODULE ${SOURCE_FILES} )
49+ iplug_add_target (${PROJECT_NAME} -vst3 PUBLIC
50+ LINK iPlug2::VST3 iPlug2::IGraphics::NanoVG _${PROJECT_NAME}-base
51+ )
52+ iplug_configure_target (${PROJECT_NAME} -vst3 VST3 ${PROJECT_NAME} )
53+ iplug_add_plugin_resources (${PROJECT_NAME} -vst3 )
54+
55+ # ============================================================================
56+ # CLAP Target - with IGraphics UI
57+ # ============================================================================
58+ add_library (${PROJECT_NAME} -clap MODULE ${SOURCE_FILES} )
59+ iplug_add_target (${PROJECT_NAME} -clap PUBLIC
60+ LINK iPlug2::CLAP iPlug2::IGraphics::NanoVG _${PROJECT_NAME}-base
61+ )
62+ iplug_configure_target (${PROJECT_NAME} -clap CLAP ${PROJECT_NAME} )
63+ iplug_add_plugin_resources (${PROJECT_NAME} -clap )
64+
65+ # ============================================================================
66+ # AUv2 Target (macOS only) - with IGraphics UI
67+ # ============================================================================
68+ if (APPLE )
69+ add_library (${PROJECT_NAME} -au MODULE ${SOURCE_FILES} )
70+ iplug_add_target (${PROJECT_NAME} -au PUBLIC
71+ LINK iPlug2::AUv2 iPlug2::IGraphics::NanoVG _${PROJECT_NAME}-base
72+ )
73+ iplug_configure_target (${PROJECT_NAME} -au AUv2 ${PROJECT_NAME} )
74+ iplug_add_plugin_resources (${PROJECT_NAME} -au )
75+ endif ()
76+
77+ # ============================================================================
78+ # AUv3 Targets (macOS only) - Framework + Appex embedded in APP
79+ # ============================================================================
80+ if (APPLE )
81+ # Framework containing AUv3 plugin code
82+ add_library (${PROJECT_NAME} AU-framework SHARED ${SOURCE_FILES} )
83+ iplug_add_target (${PROJECT_NAME} AU-framework PUBLIC
84+ LINK iPlug2::AUv3 iPlug2::IGraphics::NanoVG _${PROJECT_NAME}-base
85+ )
86+ iplug_configure_target (${PROJECT_NAME} AU-framework AUv3Framework ${PROJECT_NAME} )
87+ iplug_add_plugin_resources (${PROJECT_NAME} AU-framework )
88+
89+ # App Extension (appex) - executable using NSExtensionMain entry point
90+ add_executable (${PROJECT_NAME} AUv3-appex
91+ ${PLUG_RESOURCES_DIR} /${PROJECT_NAME}AUv3Appex.m
92+ )
93+ iplug_configure_target (${PROJECT_NAME} AUv3-appex AUv3Appex ${PROJECT_NAME} )
94+
95+ # Embed AUv3 appex in the existing APP target
96+ iplug_embed_auv3_in_app (${PROJECT_NAME} -app ${PROJECT_NAME} )
97+ endif ()
0 commit comments