Skip to content

Commit 2cec3ba

Browse files
committed
WIP: Add CMake scripts
1 parent 8e938a3 commit 2cec3ba

File tree

4 files changed

+118
-1
lines changed

4 files changed

+118
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ build-*
99
*/.vs
1010
*.pem
1111
mkcert*
12+
build/*

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(iPlug2OOS)
3+
4+
5+
# Disable deprecated warnings
6+
if(MSVC)
7+
add_compile_options(/wd4996)
8+
else()
9+
add_compile_options(-Wno-deprecated-declarations)
10+
endif()
11+
12+
set(IPLUG2_DIR ${CMAKE_SOURCE_DIR}/iPlug2)
13+
include(${IPLUG2_DIR}/iPlug2.cmake)
14+
15+
find_package(iPlug2 REQUIRED COMPONENTS IPlug APP)
16+
17+
# # # Add subdirectories for each project
18+
add_subdirectory(TemplateProject)
19+
# add_subdirectory(TemplateProject2)

TemplateProject/CMakeLists.txt

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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()

iPlug2

Submodule iPlug2 updated 197 files

0 commit comments

Comments
 (0)