Skip to content

Commit f286945

Browse files
committed
Add VisageTemplate
1 parent 827a419 commit f286945

File tree

133 files changed

+13981
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+13981
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ include(${IPLUG2_DIR}/iPlug2.cmake)
66

77
find_package(iPlug2 REQUIRED)
88

9+
# Add subdirectories for each project
910
add_subdirectory(TemplateProject)
11+
add_subdirectory(VisageTemplate)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"env": {
3+
"commonIncludePaths": [
4+
"${workspaceFolder}/**",
5+
"${workspaceFolder}/../../WDL/**",
6+
"${workspaceFolder}/../../IPlug/**",
7+
"${workspaceFolder}/../../IGraphics/**",
8+
"${workspaceFolder}/../../Dependencies/**"
9+
],
10+
"commonDefs": [
11+
"APP_API",
12+
"IPLUG_DSP=1",
13+
"IPLUG_EDITOR=1",
14+
"IGRAPHICS_NANOVG",
15+
"NOMINMAX"
16+
]
17+
},
18+
"configurations": [
19+
{
20+
"name": "Mac",
21+
"includePath": [
22+
"${commonIncludePaths}",
23+
"${workspaceFolder}/../../Dependencies/Build/mac/include/**"
24+
],
25+
"defines": [
26+
"${commonDefs}",
27+
"OS_MAC",
28+
"IGRAPHICS_METAL"
29+
],
30+
"macFrameworkPath": [
31+
"/System/Library/Frameworks",
32+
"/Library/Frameworks"
33+
],
34+
"cppStandard": "c++14"
35+
},
36+
{
37+
"name": "Win32",
38+
"includePath": [
39+
"${commonIncludePaths}"
40+
],
41+
"defines": [
42+
"${commonDefs}",
43+
"OS_WIN",
44+
"IGRAPHICS_GL2"
45+
]
46+
}
47+
],
48+
"version": 4
49+
}

VisageTemplate/CMakeLists.txt

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(VisageTemplate VERSION 1.0.0)
3+
4+
# Use static runtime on Windows to match iPlug2 (must be set before any targets)
5+
if(MSVC)
6+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "" FORCE)
7+
endif()
8+
9+
# Set up iPlug2 paths
10+
set(IPLUG2_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../iPlug2 CACHE PATH "iPlug2 root directory")
11+
include(${IPLUG2_DIR}/iPlug2.cmake)
12+
find_package(iPlug2 REQUIRED)
13+
14+
# Include Visage support from iPlug2
15+
include(${IPLUG2_DIR}/Scripts/cmake/Visage.cmake)
16+
17+
# Visage UI Library via FetchContent
18+
include(FetchContent)
19+
FetchContent_Declare(visage
20+
GIT_REPOSITORY https://github.com/iPlug2/visage.git
21+
GIT_TAG claude/compile-with-mt-flag-01GA2wfzj1g7Ki8NgB2SLGWA
22+
EXCLUDE_FROM_ALL
23+
)
24+
set(VISAGE_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
25+
set(VISAGE_BUILD_TESTS OFF CACHE BOOL "" FORCE)
26+
set(VISAGE_ENABLE_WIDGETS ON CACHE BOOL "" FORCE)
27+
FetchContent_MakeAvailable(visage)
28+
29+
# Link visage to iPlug2::Visage so the delegate can find it
30+
target_link_libraries(iPlug2_Visage PUBLIC visage)
31+
32+
# ============================================================================
33+
# Visage Libraries Target - builds only static libraries for non-CMake linking
34+
# ============================================================================
35+
# Output directory for collected static libraries
36+
set(VISAGE_LIB_OUTPUT_DIR ${CMAKE_BINARY_DIR}/visage-libs/$<CONFIG>)
37+
38+
# Custom target to build all visage static libraries
39+
add_custom_target(visage-libs
40+
COMMENT "Building Visage static libraries for external linking"
41+
)
42+
43+
# Depend on all visage and dependency targets (only actual STATIC library targets)
44+
add_dependencies(visage-libs
45+
visage
46+
VisageEmbeddedFonts
47+
VisageEmbeddedIcons
48+
VisageEmbeddedShaders
49+
bgfx
50+
bimg
51+
bimg_decode
52+
bimg_encode
53+
bx
54+
freetype
55+
)
56+
57+
# Copy all static libraries to output directory after build
58+
add_custom_command(TARGET visage-libs POST_BUILD
59+
COMMAND ${CMAKE_COMMAND} -E make_directory "${VISAGE_LIB_OUTPUT_DIR}"
60+
# Visage main library (contains all object libraries)
61+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:visage> "${VISAGE_LIB_OUTPUT_DIR}/"
62+
# Visage embedded resources
63+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:VisageEmbeddedFonts> "${VISAGE_LIB_OUTPUT_DIR}/"
64+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:VisageEmbeddedIcons> "${VISAGE_LIB_OUTPUT_DIR}/"
65+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:VisageEmbeddedShaders> "${VISAGE_LIB_OUTPUT_DIR}/"
66+
# bgfx/bx/bimg dependencies
67+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:bgfx> "${VISAGE_LIB_OUTPUT_DIR}/"
68+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:bimg> "${VISAGE_LIB_OUTPUT_DIR}/"
69+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:bimg_decode> "${VISAGE_LIB_OUTPUT_DIR}/"
70+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:bimg_encode> "${VISAGE_LIB_OUTPUT_DIR}/"
71+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:bx> "${VISAGE_LIB_OUTPUT_DIR}/"
72+
# freetype (rename to consistent name regardless of config since freetype adds 'd' suffix for debug)
73+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:freetype> "${VISAGE_LIB_OUTPUT_DIR}/$<IF:$<BOOL:${WIN32}>,freetype.lib,libfreetype.a>"
74+
COMMENT "Copying Visage libraries to ${VISAGE_LIB_OUTPUT_DIR}"
75+
)
76+
77+
set(PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
78+
set(PLUG_RESOURCES_DIR ${PROJECT_DIR}/resources)
79+
80+
set(SOURCE_FILES
81+
VisageTemplate.cpp
82+
VisageTemplate.h
83+
resources/resource.h
84+
)
85+
86+
# create a private library target called "__${PROJECT_NAME}-base" for shared code
87+
add_library(_${PROJECT_NAME}-base INTERFACE)
88+
iplug_add_target(_${PROJECT_NAME}-base INTERFACE
89+
INCLUDE ${PROJECT_DIR} ${PROJECT_DIR}/resources
90+
LINK iPlug2::Visage
91+
)
92+
93+
# ============================================================================
94+
# macOS/Windows targets (not iOS, not Emscripten)
95+
# ============================================================================
96+
if(NOT IOS AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
97+
# ============================================================================
98+
# APP Target (Standalone Application) - with Visage UI
99+
# ============================================================================
100+
set(APP_SOURCES ${SOURCE_FILES})
101+
102+
# Add Windows resource file for dialog/menu resources
103+
if(WIN32)
104+
list(APPEND APP_SOURCES ${PLUG_RESOURCES_DIR}/main.rc)
105+
endif()
106+
107+
add_executable(${PROJECT_NAME}-app ${APP_SOURCES})
108+
iplug_add_target(${PROJECT_NAME}-app PUBLIC
109+
LINK iPlug2::APP _${PROJECT_NAME}-base
110+
RESOURCE ${RESOURCES}
111+
)
112+
iplug_configure_target(${PROJECT_NAME}-app APP ${PROJECT_NAME})
113+
114+
# ============================================================================
115+
# VST3 Target - with Visage UI
116+
# ============================================================================
117+
add_library(${PROJECT_NAME}-vst3 MODULE ${SOURCE_FILES})
118+
iplug_add_target(${PROJECT_NAME}-vst3 PUBLIC
119+
LINK iPlug2::VST3 _${PROJECT_NAME}-base
120+
)
121+
iplug_configure_target(${PROJECT_NAME}-vst3 VST3 ${PROJECT_NAME})
122+
123+
# ============================================================================
124+
# CLAP Target - with Visage UI
125+
# ============================================================================
126+
add_library(${PROJECT_NAME}-clap MODULE ${SOURCE_FILES})
127+
iplug_add_target(${PROJECT_NAME}-clap PUBLIC
128+
LINK iPlug2::CLAP _${PROJECT_NAME}-base
129+
)
130+
iplug_configure_target(${PROJECT_NAME}-clap CLAP ${PROJECT_NAME})
131+
132+
# ============================================================================
133+
# AAX Target - with Visage UI
134+
# ============================================================================
135+
add_library(${PROJECT_NAME}-aax MODULE ${SOURCE_FILES})
136+
iplug_add_target(${PROJECT_NAME}-aax PUBLIC
137+
LINK iPlug2::AAX _${PROJECT_NAME}-base
138+
)
139+
iplug_configure_target(${PROJECT_NAME}-aax AAX ${PROJECT_NAME})
140+
141+
# ============================================================================
142+
# CLI Target (Command Line Interface) - NO UI, for offline processing
143+
# ============================================================================
144+
add_executable(${PROJECT_NAME}-cli
145+
VisageTemplate.cpp
146+
VisageTemplate.h
147+
resources/resource.h
148+
)
149+
iplug_add_target(${PROJECT_NAME}-cli PUBLIC
150+
INCLUDE ${PROJECT_DIR} ${PROJECT_DIR}/resources
151+
LINK iPlug2::CLI
152+
)
153+
iplug_configure_cli(${PROJECT_NAME}-cli ${PROJECT_NAME})
154+
endif()
155+
156+
# ============================================================================
157+
# AUv2 Target (macOS only) - with Visage UI
158+
# ============================================================================
159+
if(APPLE AND NOT IOS)
160+
add_library(${PROJECT_NAME}-au MODULE ${SOURCE_FILES})
161+
iplug_add_target(${PROJECT_NAME}-au PUBLIC
162+
LINK iPlug2::AUv2 _${PROJECT_NAME}-base
163+
)
164+
iplug_configure_target(${PROJECT_NAME}-au AUv2 ${PROJECT_NAME})
165+
endif()
166+
167+
# ============================================================================
168+
# AUv3 Targets (macOS only) - Framework + Appex embedded in APP
169+
# ============================================================================
170+
if(APPLE AND NOT IOS)
171+
# Framework containing AUv3 plugin code
172+
add_library(${PROJECT_NAME}AU-framework SHARED ${SOURCE_FILES})
173+
iplug_add_target(${PROJECT_NAME}AU-framework PUBLIC
174+
LINK iPlug2::AUv3 _${PROJECT_NAME}-base
175+
)
176+
iplug_configure_target(${PROJECT_NAME}AU-framework AUv3Framework ${PROJECT_NAME})
177+
178+
# App Extension (appex) - executable using NSExtensionMain entry point
179+
add_executable(${PROJECT_NAME}AUv3-appex
180+
${PLUG_RESOURCES_DIR}/${PROJECT_NAME}AUv3Appex.m
181+
)
182+
iplug_configure_target(${PROJECT_NAME}AUv3-appex AUv3Appex ${PROJECT_NAME})
183+
184+
# Embed AUv3 appex in the existing APP target
185+
iplug_embed_auv3_in_app(${PROJECT_NAME}-app ${PROJECT_NAME})
186+
endif()
187+
188+
# ============================================================================
189+
# iOS Targets - AUv3 Framework + Appex + Standalone App (Visage UI)
190+
# ============================================================================
191+
if(IOS)
192+
# iOS AUv3 Framework containing plugin code
193+
add_library(${PROJECT_NAME}AU-ios-framework SHARED ${SOURCE_FILES})
194+
iplug_add_target(${PROJECT_NAME}AU-ios-framework PUBLIC
195+
LINK iPlug2::AUv3iOS _${PROJECT_NAME}-base
196+
)
197+
iplug_configure_target(${PROJECT_NAME}AU-ios-framework AUv3iOSFramework ${PROJECT_NAME})
198+
199+
# iOS AUv3 App Extension (appex)
200+
add_executable(${PROJECT_NAME}AUv3-ios-appex
201+
${PLUG_RESOURCES_DIR}/${PROJECT_NAME}AUv3Appex.m
202+
)
203+
iplug_configure_target(${PROJECT_NAME}AUv3-ios-appex AUv3iOSAppex ${PROJECT_NAME})
204+
205+
# iOS Standalone App that hosts the AUv3 for testing
206+
add_executable(${PROJECT_NAME}-ios-app ${SOURCE_FILES})
207+
iplug_add_target(${PROJECT_NAME}-ios-app PUBLIC
208+
LINK iPlug2::AUv3iOS _${PROJECT_NAME}-base
209+
)
210+
iplug_configure_target(${PROJECT_NAME}-ios-app IOSApp ${PROJECT_NAME})
211+
212+
# Embed AUv3 appex and framework in the iOS app
213+
iplug_embed_auv3ios_in_app(${PROJECT_NAME}-ios-app ${PROJECT_NAME})
214+
endif()
215+
216+
# ============================================================================
217+
# WAM/Web Targets (Emscripten only)
218+
# ============================================================================
219+
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
220+
# WAM Processor target (DSP/audio worklet)
221+
add_executable(${PROJECT_NAME}-wam ${SOURCE_FILES})
222+
iplug_add_target(${PROJECT_NAME}-wam PUBLIC
223+
LINK iPlug2::WAM _${PROJECT_NAME}-base
224+
)
225+
iplug_configure_target(${PROJECT_NAME}-wam WAM ${PROJECT_NAME})
226+
227+
# Web Controller target (UI/graphics)
228+
add_executable(${PROJECT_NAME}-web ${SOURCE_FILES})
229+
iplug_add_target(${PROJECT_NAME}-web PUBLIC
230+
LINK iPlug2::Web _${PROJECT_NAME}-base
231+
)
232+
iplug_configure_target(${PROJECT_NAME}-web Web ${PROJECT_NAME})
233+
234+
# Combined WAM distribution target (bundles resources, templates, etc.)
235+
iplug_build_wam_dist(${PROJECT_NAME}
236+
WAM_TARGET ${PROJECT_NAME}-wam
237+
WEB_TARGET ${PROJECT_NAME}-web
238+
SITE_ORIGIN "/"
239+
)
240+
endif()

VisageTemplate/README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# VisageTemplate
2+
3+
iPlug2 template project using Visage UI library instead of IGraphics.
4+
5+
## Building
6+
7+
This project supports two build approaches:
8+
9+
### Option 1: CMake (Recommended)
10+
11+
Build everything with CMake - this automatically downloads and builds Visage and its dependencies.
12+
13+
```bash
14+
# Configure
15+
cmake -S . -B build-cmake -G "Visual Studio 17 2022" -A x64 # Windows
16+
cmake -S . -B build-cmake -G Xcode # macOS
17+
18+
# Build
19+
cmake --build build-cmake --config Release
20+
```
21+
22+
### Option 2: Visual Studio / Xcode (Traditional iPlug2 workflow)
23+
24+
Use the native IDE projects but requires pre-building Visage static libraries via CMake first.
25+
26+
#### Step 1: Build Visage static libraries
27+
28+
```bash
29+
# Configure CMake
30+
cmake -S . -B build-cmake -G "Visual Studio 17 2022" -A x64 # Windows
31+
cmake -S . -B build-cmake -G Xcode # macOS
32+
33+
# Build Visage libraries only
34+
cmake --build build-cmake --target visage-libs --config Release
35+
cmake --build build-cmake --target visage-libs --config Debug
36+
```
37+
38+
This outputs static libraries to:
39+
- `build-cmake/visage-libs/Release/`
40+
- `build-cmake/visage-libs/Debug/`
41+
42+
#### Step 2: Build with IDE
43+
44+
- **Windows**: Open `VisageTemplate.sln` in Visual Studio
45+
- **macOS**: Open `VisageTemplate.xcworkspace` in Xcode
46+
47+
The project configs are already set up to link against the Visage libraries from `build-cmake/visage-libs/`.
48+
49+
## Visage Libraries
50+
51+
The `visage-libs` CMake target builds and collects these static libraries:
52+
53+
| Library | Description |
54+
|---------|-------------|
55+
| `visage.lib` | Main Visage UI library |
56+
| `VisageEmbeddedFonts.lib` | Embedded font resources |
57+
| `VisageEmbeddedIcons.lib` | Embedded icon resources |
58+
| `VisageEmbeddedShaders.lib` | Compiled bgfx shaders |
59+
| `bgfx.lib` | Graphics abstraction layer |
60+
| `bimg.lib` | Image loading/processing |
61+
| `bimg_decode.lib` | Image decoding |
62+
| `bimg_encode.lib` | Image encoding |
63+
| `bx.lib` | Base library utilities |
64+
| `freetype.lib` | Font rendering |
65+
66+
## System Dependencies
67+
68+
### macOS
69+
Required frameworks (automatically linked via xcconfig):
70+
- Metal, MetalKit
71+
- Cocoa, QuartzCore
72+
- IOKit, CoreFoundation
73+
74+
### Windows
75+
Standard Windows libraries (automatically linked via props):
76+
- wininet.lib, comctl32.lib, Shlwapi.lib

0 commit comments

Comments
 (0)