1414
1515cmake_minimum_required (VERSION 3.30.0 )
1616
17- if (WIN32 )
18- # Disable vcpkg automatic DLL copying (applocal) - it fails without dumpbin in PATH
19- set (X_VCPKG_APPLOCAL_DEPS_INSTALL OFF CACHE BOOL "" )
20-
21- # Increase stack size to 16MB to prevent stack overflows
22- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:16777216" )
23- endif ()
17+ #====================================================================
18+ #Cmake Policies
19+ #====================================================================
20+ cmake_policy (SET CMP0167 NEW )
21+ cmake_policy (SET CMP0077 NEW )
22+ cmake_policy (SET CMP0169 OLD )
2423
24+ #====================================================================
2525# Disable vcpkg from finding Boost and Protobuf (provided by libiamf)
26+ #====================================================================
2627set (CMAKE_DISABLE_FIND_PACKAGE_Boost ON CACHE BOOL "" FORCE )
2728set (CMAKE_DISABLE_FIND_PACKAGE_Protobuf ON CACHE BOOL "" FORCE )
2829
30+ #====================================================================
2931# Clear any cached Protobuf references
32+ #====================================================================
3033unset (Protobuf_INCLUDE_DIRS CACHE )
3134unset (Protobuf_LIBRARIES CACHE )
3235unset (Protobuf_DIR CACHE )
3336unset (Protobuf_FOUND CACHE )
3437unset (Protobuf_PROTOC_EXECUTABLE CACHE )
3538
36- cmake_policy (SET CMP0167 NEW )
37- cmake_policy (SET CMP0077 NEW )
38- cmake_policy (SET CMP0169 OLD )
39- set (CMAKE_CXX_EXTENSIONS OFF )
40-
41- # Configure release or debug builds
42- set (BUILD_LIB_DIR "$<IF :$<CONFIG :Debug >,Debug ,Release >" )
43-
44- # Windows vcpkg setup
45- if (WIN32 AND NOT DEFINED CMAKE_TOOLCHAIN_FILE )
46- # Try environment variable first (respects user's existing setup)
47- if (DEFINED ENV{VCPKG_ROOT})
48- set (VCPKG_ROOT "$ENV{VCPKG_ROOT} " CACHE PATH "Path to vcpkg root" )
49- endif ()
50-
51- # Configure vcpkg if VCPKG_ROOT is set
52- if (DEFINED VCPKG_ROOT)
53- set (CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT} /scripts/buildsystems/vcpkg.cmake" CACHE FILEPATH "vcpkg toolchain file" )
54-
55- # Validate toolchain file exists
56- if (NOT EXISTS "${CMAKE_TOOLCHAIN_FILE} " )
57- message (FATAL_ERROR "vcpkg toolchain file not found at: ${CMAKE_TOOLCHAIN_FILE} " )
58- endif ()
59-
60- # Set default triplet if not specified
61- if (NOT DEFINED VCPKG_TARGET_TRIPLET)
62- set (VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet" )
63- endif ()
64-
65- message (WARNING "vcpkg toolchain: ${CMAKE_TOOLCHAIN_FILE} " )
66- message (WARNING "vcpkg triplet: ${VCPKG_TARGET_TRIPLET} " )
67- else ()
68- message (WARNING "vcpkg not configured. Please either:" )
69- message (WARNING " 1. Set VCPKG_ROOT environment variable, or" )
70- message (WARNING " 2. Pass -DVCPKG_ROOT=<path> to CMake" )
71- message (WARNING "Build will continue without vcpkg - dependencies must be installed manually" )
72- endif ()
73- endif ()
74-
39+ #====================================================================
7540# Version configuration
7641# The version can be set in multiple ways (in order of precedence):
7742# 1. Pass via command line: cmake -DECLIPSA_VERSION=1.2.3 ...
@@ -84,66 +49,72 @@ endif()
8449# - Or extract from git tag in your build script and pass it to CMake
8550#
8651# The version appears as a watermark in the bottom-left corner of both plugins.
87- if (NOT DEFINED ECLIPSA_VERSION)
52+ #====================================================================
53+ if (NOT DEFINED ECLIPSA_VERSION)
8854 set (ECLIPSA_VERSION "0.0.1" CACHE STRING "Version for Eclipsa project" )
89- endif ()
55+ endif ()
9056
9157project (Eclipsa LANGUAGES C CXX VERSION ${ECLIPSA_VERSION} )
9258
59+ #====================================================================
60+ # Compiler Settings
61+ #====================================================================
62+ set (CMAKE_CXX_STANDARD 20)
63+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
64+ set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
65+ set (CMAKE_CXX_EXTENSIONS OFF )
66+
67+ #====================================================================
68+ # Plugin Formats
69+ #====================================================================
70+ set (ECLIPSA_PLUGIN_FORMATS Standalone)
71+
72+ if (BUILD_VST3)
73+ list (APPEND ECLIPSA_PLUGIN_FORMATS VST3)
74+ endif ()
75+ if (BUILD_AAX)
76+ list (APPEND ECLIPSA_PLUGIN_FORMATS AAX)
77+ endif ()
78+
79+ list (APPEND ECLIPSA_PLUGIN_FORMATS ${ECLIPSA_PLATFORM_PLUGIN_FORMATS} )
80+
81+ #====================================================================
82+ # Build Configuration
83+ #====================================================================
84+ set (BUILD_LIB_DIR "$<IF :$<CONFIG :Debug >,Debug ,Release >" )
9385add_compile_definitions (ECLIPSA_VERSION= "${ECLIPSA_VERSION} " )
9486
87+ #====================================================================
88+ # Plugin Naming
89+ #====================================================================
9590# Make company name configurable via command line with a default value
96- if (NOT DEFINED ECLIPSA_COMPANY_NAME)
91+ if (NOT DEFINED ECLIPSA_COMPANY_NAME)
9792 set (ECLIPSA_COMPANY_NAME "Eclipsa Project" CACHE STRING "Company name for Eclipsa project" )
98- endif ()
99-
100- if (WIN32 AND NOT CMAKE_RC_COMPILER)
101- find_program (CMAKE_RC_COMPILER rc.exe
102- HINTS "C:/Program Files (x86)/Windows Kits/10/bin/*/x64" )
103- endif ()
104-
93+ endif ()
10594# Make manufacturer code configurable via command line with a default value
106- if (NOT DEFINED ECLIPSA_MANUFACTURER_CODE)
95+ if (NOT DEFINED ECLIPSA_MANUFACTURER_CODE)
10796 set (ECLIPSA_MANUFACTURER_CODE "Eclp" CACHE STRING "Manufacturer code for Eclipsa project" )
108- endif ()
109-
97+ endif ()
11098# Make bundle IDs configurable via command line with default values
111- if (NOT DEFINED ECLIPSA_RENDERER_BUNDLE_ID)
99+ if (NOT DEFINED ECLIPSA_RENDERER_BUNDLE_ID)
112100 set (ECLIPSA_RENDERER_BUNDLE_ID "com.eclipsaproject.renderer" CACHE STRING "Bundle ID for the renderer plugin" )
113- endif ()
114-
115- if (NOT DEFINED ECLIPSA_PANNER_BUNDLE_ID)
101+ endif ()
102+ if (NOT DEFINED ECLIPSA_PANNER_BUNDLE_ID)
116103 set (ECLIPSA_PANNER_BUNDLE_ID "com.eclipsaproject.panner" CACHE STRING "Bundle ID for the panner plugin" )
117- endif ()
104+ endif ()
118105
119- # Build configuration for different DAW targets
106+ #====================================================================
107+ # Build Options
108+ #====================================================================
120109option (ECLIPSA_LOGIC_PRO_BUILD "Build AU plugin optimized for Logic Pro (7.1.4 layout)" OFF )
121-
122- set (CMAKE_CXX_STANDARD 20)
123- set (CMAKE_CXX_STANDARD_REQUIRED ON )
124- set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
125- set (CMAKE_BUILD_RPATH "@loader_path/../Resources;${CMAKE_SOURCE_DIR} " )
126-
127- # Set default plugin formats per platform
128- if (APPLE )
129- set (PLUGIN_FORMATS "AU" )
130- elseif (WIN32 )
131- set (PLUGIN_FORMATS "Standalone" )
132- else ()
133- set (PLUGIN_FORMATS "" )
134- endif ()
135-
136110option (INTERNAL_TEST OFF )
137111option (CI_TEST OFF )
138112option (JUCE_COPY_PLUGIN_AFTER_BUILD "Automatically copy built plugins to standard locations after build" ON )
139113
140- if (APPLE )
141- # Add vendored libraries path (for CI/GitHub Actions)
142- set (VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR} /third_party/libiamf/lib/macos" )
143- link_directories (${VENDOR_LIB_PATH} )
144- endif ()
145-
146- if (CI_TEST OR INTERNAL_TEST)
114+ #====================================================================
115+ # Testing
116+ #====================================================================
117+ if (CI_TEST OR INTERNAL_TEST)
147118 message (STATUS "Unit tests enabled" )
148119 include (FetchContent )
149120 FetchContent_Declare (
@@ -162,60 +133,86 @@ if(CI_TEST OR INTERNAL_TEST)
162133 if (FFMPEG_TOOLS_FOUND)
163134 message (STATUS "FFmpeg found. Enabling tests that require FFmpeg." )
164135 add_compile_definitions (ECLIPSA_FFMPEG_AVAILABLE=1 )
165- else ()
136+ else ()
166137 message (STATUS "FFmpeg not found. Tests requiring FFmpeg will be disabled." )
167- endif ()
138+ endif ()
168139
169140 # FFmpeg is required for CI tests
170- if (CI_TEST AND NOT FFMPEG_TOOLS_FOUND)
141+ if (CI_TEST AND NOT FFMPEG_TOOLS_FOUND)
171142 message (FATAL_ERROR "FFmpeg tools not found. Required for CI tests." )
172- endif ()
173- endif ()
143+ endif ()
144+ endif ()
174145
175- add_subdirectory (third_party )
146+ #====================================================================
147+ # Cmake Functions
148+ #====================================================================
149+ include ("${CMAKE_SOURCE_DIR} /cmake/copy_resources.cmake" )
150+ include ("${CMAKE_SOURCE_DIR} /cmake/eclipsa_plugin_defaults.cmake" )
176151
177- # ZLIB configuration for Windows builds
152+ #====================================================================
153+ # Dependencies
154+ #====================================================================
155+ add_subdirectory (third_party )
178156if (WIN32 )
179157 find_package (ZLIB REQUIRED )
180- message (STATUS "ZLIB found at: ${ZLIB_LIBRARIES} " )
181- # Fix link targets that request 'z'
182158 link_libraries (ZLIB::ZLIB )
183159endif ()
160+ #====================================================================
161+ # AAX Setup
162+ #====================================================================
163+ if (BUILD_AAX)
164+ find_path (AAX_SDK_ROOT
165+ NAMES "Interfaces/AAX_Exports.cpp"
166+ HINTS "${AAX_SDK_SEARCH_HINT} "
167+ DOC "Path to AAX SDK"
168+ )
184169
185- include ("${CMAKE_SOURCE_DIR} /cmake/copy_resources.cmake" )
186-
187- if (BUILD_AAX)
188- if (WIN32 )
189- set (AAX_SDK_VER "2-8-1" CACHE STRING "AAX SDK Version" )
190- list (APPEND PLUGIN_FORMATS "AAX" )
191-
192- # Allow team members to specify their own AAX SDK path
193- if (NOT DEFINED AAX_SDK_ROOT)
194- set (AAX_SDK_ROOT "C:/Code/Repos/aax-sdk-${AAX_SDK_VER} " CACHE PATH "Path to AAX SDK" )
195- endif ()
196- else ()
197- set (AAX_SDK_VER "2-7-0" CACHE STRING "Default AAX SDK Version" )
198- list (APPEND PLUGIN_FORMATS "AAX" )
199- find_path (AAX_SDK_ROOT NAMES "aax-sdk-${AAX_SDK_VER} " HINTS "/opt" "/usr/local" )
200- set (AAX_SDK_ROOT "${AAX_SDK_ROOT} /aax-sdk-${AAX_SDK_VER} " )
201- endif ()
202-
203- if (EXISTS "${AAX_SDK_ROOT} " )
204- message (STATUS "Using AAX SDK at ${AAX_SDK_ROOT} " )
170+ if (AAX_SDK_ROOT)
171+ message (STATUS "AAX SDK found: ${AAX_SDK_ROOT} " )
205172 juce_set_aax_sdk_path ("${AAX_SDK_ROOT} " )
206- else ()
207- message (FATAL_ERROR "AAX SDK not found at ${AAX_SDK_ROOT} . Set AAX_SDK_ROOT to the correct path." )
208- endif ()
209- endif ()
210-
211- if (BUILD_VST3)
212- list (APPEND PLUGIN_FORMATS "VST3" )
213- endif ()
214-
173+ else ()
174+ message (FATAL_ERROR "AAX SDK not found. Please set AAX_SDK_ROOT." )
175+ endif ()
176+ endif ()
177+
178+ #====================================================================
179+ # Add Sub Directories
180+ #====================================================================
215181add_subdirectory (common )
182+ message (STATUS "ECLIPSA_PLUGIN_FORMATS = ${ECLIPSA_PLUGIN_FORMATS} " )
216183add_subdirectory (rendererplugin )
217184add_subdirectory (audioelementplugin )
218185
186+ #====================================================================
187+ # Dependency List
188+ #====================================================================
189+ if (NOT DEFINED ECLIPSA_PLATFORM_LIBS)
190+ message (WARNING "ECLIPSA_PLATFORM_LIBS not set—are you using a platform toolchain?" )
191+ set (ECLIPSA_PLATFORM_LIBS "" )
192+ endif ()
193+
194+ add_library (eclipsa_dependencies INTERFACE )
195+
196+ target_link_libraries (eclipsa_dependencies INTERFACE
197+ # Vendored shared libs
198+ vendored_gpac
199+ vendored_iamf_tools
200+ libzmq
201+
202+ # Static libs from third_party
203+ saf
204+ Libear
205+ LUFSMeter
206+ spatialaudiolib
207+ ${IAMF_LIB_NAME}
208+
209+ # Platform-specific (from toolchain)
210+ ${ECLIPSA_PLATFORM_LIBS}
211+ )
212+
213+ #====================================================================
214+ # Testing #2
215+ #====================================================================
219216if (CI_TEST OR INTERNAL_TEST)
220217 eclipsa_build_tests ()
221- endif ()
218+ endif ()
0 commit comments