1+ cmake_minimum_required (VERSION 3.14 )
2+ project (TemplateProject VERSION 1.0.0)
3+
4+ # Set up iPlug2 paths
5+ set (IPLUG2_DIR ${CMAKE_CURRENT_SOURCE_DIR} /../iPlug2 CACHE PATH "iPlug2 root directory" )
6+ include (${IPLUG2_DIR} /iPlug2.cmake )
7+ find_package (iPlug2 REQUIRED )
8+
9+ set (PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
10+ set (PLUG_RESOURCES_DIR ${PROJECT_DIR} /resources)
11+
12+ set (SOURCE_FILES
13+ TemplateProject.cpp
14+ TemplateProject.h
15+ resources/resource.h
16+ )
17+
18+ # create a private library target called "__${PROJECT_NAME}-base" for shared code
19+ add_library (_${PROJECT_NAME}-base INTERFACE )
20+ iplug_add_target (_${PROJECT_NAME}-base INTERFACE
21+ INCLUDE ${PROJECT_DIR} ${PROJECT_DIR} /resources
22+ LINK iPlug2::IPlug
23+ )
24+
25+ # Font resources for bundles
26+ set (FONT_FILES ${PLUG_RESOURCES_DIR} /fonts/Roboto-Regular.ttf)
27+
28+ # Helper function to add resources to plugin bundles
29+ function (iplug_add_plugin_resources target )
30+ target_sources (${target} PRIVATE ${FONT_FILES} )
31+ set_source_files_properties (${FONT_FILES} PROPERTIES
32+ MACOSX_PACKAGE_LOCATION Resources
33+ )
34+ endfunction ()
35+
36+ # ============================================================================
37+ # macOS/Windows targets (not iOS)
38+ # ============================================================================
39+ if (NOT IOS )
40+ # ============================================================================
41+ # APP Target (Standalone Application) - with IGraphics UI
42+ # ============================================================================
43+ add_executable (${PROJECT_NAME} -app ${SOURCE_FILES} )
44+ iplug_add_target (${PROJECT_NAME} -app PUBLIC
45+ LINK iPlug2::APP iPlug2::IGraphics::NanoVG::Metal _${PROJECT_NAME}-base
46+ RESOURCE ${RESOURCES}
47+ )
48+ iplug_configure_target (${PROJECT_NAME} -app APP ${PROJECT_NAME} )
49+
50+ # Add font resources to APP bundle
51+ target_sources (${PROJECT_NAME} -app PRIVATE ${FONT_FILES} )
52+ set_source_files_properties (${FONT_FILES} PROPERTIES
53+ MACOSX_PACKAGE_LOCATION Resources
54+ )
55+
56+ # ============================================================================
57+ # VST3 Target - with IGraphics UI
58+ # ============================================================================
59+ add_library (${PROJECT_NAME} -vst3 MODULE ${SOURCE_FILES} )
60+ iplug_add_target (${PROJECT_NAME} -vst3 PUBLIC
61+ LINK iPlug2::VST3 iPlug2::IGraphics::NanoVG::Metal _${PROJECT_NAME}-base
62+ )
63+ iplug_configure_target (${PROJECT_NAME} -vst3 VST3 ${PROJECT_NAME} )
64+ iplug_add_plugin_resources (${PROJECT_NAME} -vst3 )
65+
66+ # ============================================================================
67+ # CLAP Target - with IGraphics UI
68+ # ============================================================================
69+ add_library (${PROJECT_NAME} -clap MODULE ${SOURCE_FILES} )
70+ iplug_add_target (${PROJECT_NAME} -clap PUBLIC
71+ LINK iPlug2::CLAP iPlug2::IGraphics::NanoVG::Metal _${PROJECT_NAME}-base
72+ )
73+ iplug_configure_target (${PROJECT_NAME} -clap CLAP ${PROJECT_NAME} )
74+ iplug_add_plugin_resources (${PROJECT_NAME} -clap )
75+ endif ()
76+
77+ # ============================================================================
78+ # AUv2 Target (macOS only) - with IGraphics UI
79+ # ============================================================================
80+ if (APPLE AND NOT IOS )
81+ add_library (${PROJECT_NAME} -au MODULE ${SOURCE_FILES} )
82+ iplug_add_target (${PROJECT_NAME} -au PUBLIC
83+ LINK iPlug2::AUv2 iPlug2::IGraphics::NanoVG::Metal _${PROJECT_NAME}-base
84+ )
85+ iplug_configure_target (${PROJECT_NAME} -au AUv2 ${PROJECT_NAME} )
86+ iplug_add_plugin_resources (${PROJECT_NAME} -au )
87+ endif ()
88+
89+ # ============================================================================
90+ # AUv3 Targets (macOS only) - Framework + Appex embedded in APP
91+ # ============================================================================
92+ if (APPLE AND NOT IOS )
93+ # Framework containing AUv3 plugin code
94+ add_library (${PROJECT_NAME} AU-framework SHARED ${SOURCE_FILES} )
95+ iplug_add_target (${PROJECT_NAME} AU-framework PUBLIC
96+ LINK iPlug2::AUv3 iPlug2::IGraphics::NanoVG::Metal _${PROJECT_NAME}-base
97+ )
98+ iplug_configure_target (${PROJECT_NAME} AU-framework AUv3Framework ${PROJECT_NAME} )
99+ iplug_add_plugin_resources (${PROJECT_NAME} AU-framework )
100+
101+ # App Extension (appex) - executable using NSExtensionMain entry point
102+ add_executable (${PROJECT_NAME} AUv3-appex
103+ ${PLUG_RESOURCES_DIR} /${PROJECT_NAME}AUv3Appex.m
104+ )
105+ iplug_configure_target (${PROJECT_NAME} AUv3-appex AUv3Appex ${PROJECT_NAME} )
106+
107+ # Embed AUv3 appex in the existing APP target
108+ iplug_embed_auv3_in_app (${PROJECT_NAME} -app ${PROJECT_NAME} )
109+ endif ()
110+
111+ # ============================================================================
112+ # iOS Targets - AUv3 Framework + Appex + Standalone App
113+ # ============================================================================
114+ if (IOS )
115+ # iOS AUv3 Framework containing plugin code
116+ add_library (${PROJECT_NAME} AU-ios-framework SHARED ${SOURCE_FILES} )
117+ iplug_add_target (${PROJECT_NAME} AU-ios-framework PUBLIC
118+ LINK iPlug2::AUv3iOS iPlug2::IGraphics::NanoVG::Metal _${PROJECT_NAME}-base
119+ )
120+ iplug_configure_target (${PROJECT_NAME} AU-ios-framework AUv3iOSFramework ${PROJECT_NAME} )
121+ iplug_add_plugin_resources (${PROJECT_NAME} AU-ios-framework )
122+
123+ # iOS AUv3 App Extension (appex)
124+ add_executable (${PROJECT_NAME} AUv3-ios-appex
125+ ${PLUG_RESOURCES_DIR} /${PROJECT_NAME}AUv3Appex.m
126+ )
127+ iplug_configure_target (${PROJECT_NAME} AUv3-ios-appex AUv3iOSAppex ${PROJECT_NAME} )
128+
129+ # iOS Standalone App that hosts the AUv3 for testing
130+ add_executable (${PROJECT_NAME} -ios-app ${SOURCE_FILES} )
131+ iplug_add_target (${PROJECT_NAME} -ios-app PUBLIC
132+ LINK iPlug2::AUv3iOS iPlug2::IGraphics::NanoVG::Metal _${PROJECT_NAME}-base
133+ )
134+ iplug_configure_target (${PROJECT_NAME} -ios-app IOSApp ${PROJECT_NAME} )
135+ iplug_add_plugin_resources (${PROJECT_NAME} -ios-app )
136+
137+ # Embed AUv3 appex and framework in the iOS app
138+ iplug_embed_auv3ios_in_app (${PROJECT_NAME} -ios-app ${PROJECT_NAME} )
139+ endif ()
0 commit comments