1
+ cmake_minimum_required (VERSION 3.11 FATAL_ERROR)
2
+ cmake_policy (SET CMP0091 NEW)
3
+
4
+ project (TemplateProject VERSION 1.0.0 LANGUAGES C CXX)
5
+
6
+ # Set iPlug2 directory and include iPlug2 CMake files
7
+ set (IPLUG2_DIR ${CMAKE_SOURCE_DIR} /../iPlug2)
8
+ include (${IPLUG2_DIR} /iPlug2.cmake)
9
+ find_package (iPlug2 REQUIRED)
10
+
11
+ # Uncomment the following line if you need Skia support
12
+ # find_package(iPlug2 REQUIRED COMPONENTS Skia)
13
+
14
+ # Set project directories and source files
15
+ set (PROJECT_DIR "${CMAKE_SOURCE_DIR} " )
16
+ set (SRC_FILES
17
+ "${PROJECT_DIR} /config.h"
18
+ "${PROJECT_DIR} /TemplateProject.h"
19
+ "${PROJECT_DIR} /TemplateProject.cpp"
20
+ )
21
+ source_group (TREE ${PROJECT_DIR} FILES ${SRC_FILES} )
22
+
23
+ # Set resource files
24
+ set (RESOURCES
25
+ "${PROJECT_DIR} /resources/fonts/Roboto-Regular.ttf"
26
+ )
27
+
28
+ if (APPLE )
29
+ # Enable universal binary build for Release builds on macOS
30
+ if (CMAKE_BUILD_TYPE STREQUAL "Release" )
31
+ set (CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Build architectures for macOS" FORCE)
32
+ else ()
33
+ set (CMAKE_OSX_ARCHITECTURES "${CMAKE_HOST_SYSTEM_PROCESSOR} " CACHE STRING "Build architectures for macOS" FORCE)
34
+ endif ()
35
+ # Set Xcode attributes for universal binary build
36
+ set_target_properties (${TARGET} PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH [variant=Debug] YES )
37
+
38
+ # Set Xcode attributes for code signing
39
+ # set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM 686EDA2T8T)
40
+ # set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Developer ID Application")
41
+ # set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE "Manual")
42
+
43
+ endif ()
44
+
45
+ # Create base interface library for common settings
46
+ add_library (_base INTERFACE )
47
+ iplug_target_add(_base INTERFACE
48
+ INCLUDE ${PROJECT_DIR} ${PROJECT_DIR} /resources
49
+ # Replace with e.g. iPlug2_Skia_GL2 if you need Skia support
50
+ LINK iPlug2_NanoVG_GL2
51
+ FEATURE cxx_std_17
52
+ )
53
+
54
+ # APP target configuration
55
+ set (TARGET app)
56
+ add_executable (${TARGET} WIN32 MACOSX_BUNDLE ${SRC_FILES} )
57
+ iplug_target_add(${TARGET} PUBLIC
58
+ LINK iPlug2_APP _base
59
+ RESOURCE ${RESOURCES}
60
+ )
61
+ iplug_configure_target(${TARGET} app)
62
+
63
+ # CLAP target configuration
64
+ set (TARGET clap)
65
+ add_library (${TARGET} MODULE ${SRC_FILES} )
66
+ iplug_target_add(${TARGET} PUBLIC
67
+ LINK iPlug2_CLAP _base
68
+ RESOURCE ${RESOURCES}
69
+ )
70
+ iplug_configure_target(${TARGET} clap)
71
+
72
+ # VST2 target configuration
73
+ # set(TARGET vst2)
74
+ # add_library(${TARGET} MODULE ${SRC_FILES})
75
+ # iplug_target_add(${TARGET} PUBLIC
76
+ # LINK iPlug2_VST2 _base
77
+ # RESOURCE ${RESOURCES}
78
+ # )
79
+ # iplug_configure_target(${TARGET} vst2)
80
+
81
+ # VST3 target configuration
82
+ set (TARGET vst3)
83
+ add_library (${TARGET} MODULE ${SRC_FILES} )
84
+ iplug_target_add(${TARGET} PUBLIC
85
+ LINK iPlug2_VST3 _base
86
+ RESOURCE ${RESOURCES}
87
+ )
88
+ iplug_configure_target(${TARGET} vst3)
89
+
90
+ # AUv2 target configuration (macOS only)
91
+ if (APPLE )
92
+ set (TARGET auv2)
93
+ add_library (${TARGET} MODULE ${SRC_FILES} )
94
+ iplug_target_add(${TARGET} PUBLIC
95
+ LINK iPlug2_AUv2 _base
96
+ RESOURCE ${RESOURCES}
97
+ )
98
+ iplug_configure_target(${TARGET} auv2)
99
+ endif ()
100
+
101
+ # Windows-specific resource configuration
102
+ if (WIN32 )
103
+ set (CMAKE_RC_FLAGS "/I${PROJECT_DIR} /resources /I${PROJECT_DIR} /resources/fonts /I${PROJECT_DIR} /resources/img ${CMAKE_RC_FLAGS} " )
104
+ endif ()
0 commit comments