From 82149643997b250f2e66be2505aa805e23058e36 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 19 Jan 2026 13:14:31 -0800 Subject: [PATCH 01/43] Added windows toolchain to cmake\toolchains --- CMakeLists.txt | 108 +++++++++++++++------------------ cmake/toolchains/windows.cmake | 10 +++ 2 files changed, 60 insertions(+), 58 deletions(-) create mode 100644 cmake/toolchains/windows.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a0abc1f..8d636862 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,14 +14,6 @@ cmake_minimum_required(VERSION 3.30.0) -if(WIN32) - # Disable vcpkg automatic DLL copying (applocal) - it fails without dumpbin in PATH - set(X_VCPKG_APPLOCAL_DEPS_INSTALL OFF CACHE BOOL "") - - # Increase stack size to 16MB to prevent stack overflows - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:16777216") -endif() - # Disable vcpkg from finding Boost and Protobuf (provided by libiamf) set(CMAKE_DISABLE_FIND_PACKAGE_Boost ON CACHE BOOL "" FORCE) set(CMAKE_DISABLE_FIND_PACKAGE_Protobuf ON CACHE BOOL "" FORCE) @@ -42,35 +34,35 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(BUILD_LIB_DIR "$,Debug,Release>") # Windows vcpkg setup -if(WIN32 AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) +if (WIN32 AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) # Try environment variable first (respects user's existing setup) - if(DEFINED ENV{VCPKG_ROOT}) + if (DEFINED ENV{VCPKG_ROOT}) set(VCPKG_ROOT "$ENV{VCPKG_ROOT}" CACHE PATH "Path to vcpkg root") - endif() + endif () # Configure vcpkg if VCPKG_ROOT is set - if(DEFINED VCPKG_ROOT) + if (DEFINED VCPKG_ROOT) set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE FILEPATH "vcpkg toolchain file") # Validate toolchain file exists - if(NOT EXISTS "${CMAKE_TOOLCHAIN_FILE}") + if (NOT EXISTS "${CMAKE_TOOLCHAIN_FILE}") message(FATAL_ERROR "vcpkg toolchain file not found at: ${CMAKE_TOOLCHAIN_FILE}") - endif() + endif () # Set default triplet if not specified - if(NOT DEFINED VCPKG_TARGET_TRIPLET) + if (NOT DEFINED VCPKG_TARGET_TRIPLET) set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet") - endif() + endif () message(WARNING "vcpkg toolchain: ${CMAKE_TOOLCHAIN_FILE}") message(WARNING "vcpkg triplet: ${VCPKG_TARGET_TRIPLET}") - else() + else () message(WARNING "vcpkg not configured. Please either:") message(WARNING " 1. Set VCPKG_ROOT environment variable, or") message(WARNING " 2. Pass -DVCPKG_ROOT= to CMake") message(WARNING "Build will continue without vcpkg - dependencies must be installed manually") - endif() -endif() + endif () +endif () # Version configuration # The version can be set in multiple ways (in order of precedence): @@ -84,37 +76,37 @@ endif() # - Or extract from git tag in your build script and pass it to CMake # # The version appears as a watermark in the bottom-left corner of both plugins. -if(NOT DEFINED ECLIPSA_VERSION) +if (NOT DEFINED ECLIPSA_VERSION) set(ECLIPSA_VERSION "0.0.1" CACHE STRING "Version for Eclipsa project") -endif() +endif () project(Eclipsa LANGUAGES C CXX VERSION ${ECLIPSA_VERSION}) add_compile_definitions(ECLIPSA_VERSION="${ECLIPSA_VERSION}") # Make company name configurable via command line with a default value -if(NOT DEFINED ECLIPSA_COMPANY_NAME) +if (NOT DEFINED ECLIPSA_COMPANY_NAME) set(ECLIPSA_COMPANY_NAME "Eclipsa Project" CACHE STRING "Company name for Eclipsa project") -endif() +endif () -if(WIN32 AND NOT CMAKE_RC_COMPILER) +if (WIN32 AND NOT CMAKE_RC_COMPILER) find_program(CMAKE_RC_COMPILER rc.exe HINTS "C:/Program Files (x86)/Windows Kits/10/bin/*/x64") -endif() +endif () # Make manufacturer code configurable via command line with a default value -if(NOT DEFINED ECLIPSA_MANUFACTURER_CODE) +if (NOT DEFINED ECLIPSA_MANUFACTURER_CODE) set(ECLIPSA_MANUFACTURER_CODE "Eclp" CACHE STRING "Manufacturer code for Eclipsa project") -endif() +endif () # Make bundle IDs configurable via command line with default values -if(NOT DEFINED ECLIPSA_RENDERER_BUNDLE_ID) +if (NOT DEFINED ECLIPSA_RENDERER_BUNDLE_ID) set(ECLIPSA_RENDERER_BUNDLE_ID "com.eclipsaproject.renderer" CACHE STRING "Bundle ID for the renderer plugin") -endif() +endif () -if(NOT DEFINED ECLIPSA_PANNER_BUNDLE_ID) +if (NOT DEFINED ECLIPSA_PANNER_BUNDLE_ID) set(ECLIPSA_PANNER_BUNDLE_ID "com.eclipsaproject.panner" CACHE STRING "Bundle ID for the panner plugin") -endif() +endif () # Build configuration for different DAW targets option(ECLIPSA_LOGIC_PRO_BUILD "Build AU plugin optimized for Logic Pro (7.1.4 layout)" OFF) @@ -125,25 +117,25 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_BUILD_RPATH "@loader_path/../Resources;${CMAKE_SOURCE_DIR}") # Set default plugin formats per platform -if(APPLE) +if (APPLE) set(PLUGIN_FORMATS "AU") -elseif(WIN32) +elseif (WIN32) set(PLUGIN_FORMATS "Standalone") -else() +else () set(PLUGIN_FORMATS "") -endif() +endif () option(INTERNAL_TEST OFF) option(CI_TEST OFF) option(JUCE_COPY_PLUGIN_AFTER_BUILD "Automatically copy built plugins to standard locations after build" ON) -if(APPLE) +if (APPLE) # Add vendored libraries path (for CI/GitHub Actions) set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") link_directories(${VENDOR_LIB_PATH}) -endif() +endif () -if(CI_TEST OR INTERNAL_TEST) +if (CI_TEST OR INTERNAL_TEST) message(STATUS "Unit tests enabled") include(FetchContent) FetchContent_Declare( @@ -162,55 +154,55 @@ if(CI_TEST OR INTERNAL_TEST) if (FFMPEG_TOOLS_FOUND) message(STATUS "FFmpeg found. Enabling tests that require FFmpeg.") add_compile_definitions(ECLIPSA_FFMPEG_AVAILABLE=1) - else() + else () message(STATUS "FFmpeg not found. Tests requiring FFmpeg will be disabled.") - endif() + endif () # FFmpeg is required for CI tests - if(CI_TEST AND NOT FFMPEG_TOOLS_FOUND) + if (CI_TEST AND NOT FFMPEG_TOOLS_FOUND) message(FATAL_ERROR "FFmpeg tools not found. Required for CI tests.") - endif() -endif() + endif () +endif () add_subdirectory(third_party) # ZLIB configuration for Windows builds -if(WIN32) +if (WIN32) find_package(ZLIB REQUIRED) message(STATUS "ZLIB found at: ${ZLIB_LIBRARIES}") # Fix link targets that request 'z' link_libraries(ZLIB::ZLIB) -endif() +endif () include("${CMAKE_SOURCE_DIR}/cmake/copy_resources.cmake") -if(BUILD_AAX) - if(WIN32) +if (BUILD_AAX) + if (WIN32) set(AAX_SDK_VER "2-8-1" CACHE STRING "AAX SDK Version") list(APPEND PLUGIN_FORMATS "AAX") # Allow team members to specify their own AAX SDK path - if(NOT DEFINED AAX_SDK_ROOT) + if (NOT DEFINED AAX_SDK_ROOT) set(AAX_SDK_ROOT "C:/Code/Repos/aax-sdk-${AAX_SDK_VER}" CACHE PATH "Path to AAX SDK") - endif() - else() + endif () + else () set(AAX_SDK_VER "2-7-0" CACHE STRING "Default AAX SDK Version") list(APPEND PLUGIN_FORMATS "AAX") find_path(AAX_SDK_ROOT NAMES "aax-sdk-${AAX_SDK_VER}" HINTS "/opt" "/usr/local") set(AAX_SDK_ROOT "${AAX_SDK_ROOT}/aax-sdk-${AAX_SDK_VER}") - endif() + endif () - if(EXISTS "${AAX_SDK_ROOT}") + if (EXISTS "${AAX_SDK_ROOT}") message(STATUS "Using AAX SDK at ${AAX_SDK_ROOT}") juce_set_aax_sdk_path("${AAX_SDK_ROOT}") - else() + else () message(FATAL_ERROR "AAX SDK not found at ${AAX_SDK_ROOT}. Set AAX_SDK_ROOT to the correct path.") - endif() -endif() + endif () +endif () -if(BUILD_VST3) +if (BUILD_VST3) list(APPEND PLUGIN_FORMATS "VST3") -endif() +endif () add_subdirectory(common) add_subdirectory(rendererplugin) @@ -218,4 +210,4 @@ add_subdirectory(audioelementplugin) if (CI_TEST OR INTERNAL_TEST) eclipsa_build_tests() -endif() \ No newline at end of file +endif () \ No newline at end of file diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake new file mode 100644 index 00000000..2ad2c48d --- /dev/null +++ b/cmake/toolchains/windows.cmake @@ -0,0 +1,10 @@ +set(CMAKE_SYSTEM_NAME Windows) + +set(PLATFORM_IS_WINDOWS TRUE CACHE BOOL "" FORCE) +set(PLATFORM_IS_LINUX FALSE CACHE BOOL "" FORCE) + +# Stack size +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:16777216") + +# Disable vcpkg applocal copy +set(X_VCPKG_APPLOCAL_DEPS_INSTALL OFF CACHE BOOL "") From 0206ec76491784ee3dbe02e4ea001254fe7a344d Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 2 Feb 2026 11:40:56 -0800 Subject: [PATCH 02/43] initial windows toolchain setup verified --- cmake/toolchains/windows.cmake | 35 +++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index 2ad2c48d..a4119a2b 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -1,10 +1,39 @@ -set(CMAKE_SYSTEM_NAME Windows) +# windows.cmake + +if (DEFINED _WINDOWS_TOOLCHAIN_INCLUDED) + return() +endif () +set(_WINDOWS_TOOLCHAIN_INCLUDED TRUE) -set(PLATFORM_IS_WINDOWS TRUE CACHE BOOL "" FORCE) -set(PLATFORM_IS_LINUX FALSE CACHE BOOL "" FORCE) +set(CMAKE_SYSTEM_NAME Windows) # Stack size set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:16777216") # Disable vcpkg applocal copy set(X_VCPKG_APPLOCAL_DEPS_INSTALL OFF CACHE BOOL "") + +# Try environment variable first (same behavior as before) +if (NOT DEFINED VCPKG_ROOT AND DEFINED ENV{VCPKG_ROOT}) + set(VCPKG_ROOT "$ENV{VCPKG_ROOT}" CACHE PATH "Path to vcpkg root") +endif () + +if (DEFINED VCPKG_ROOT) + set(_VCPKG_TOOLCHAIN "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake") + + if (NOT EXISTS "${_VCPKG_TOOLCHAIN}") + message(FATAL_ERROR "vcpkg toolchain file not found at: ${_VCPKG_TOOLCHAIN}") + endif () + + if (NOT DEFINED VCPKG_TARGET_TRIPLET) + set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet") + endif () + + message(STATUS "vcpkg toolchain: ${_VCPKG_TOOLCHAIN}") + message(STATUS "vcpkg triplet: ${VCPKG_TARGET_TRIPLET}") + + # Chain load (this replaces setting CMAKE_TOOLCHAIN_FILE) + include("${_VCPKG_TOOLCHAIN}") +else () + message(WARNING "vcpkg not configured. Set VCPKG_ROOT or pass -DVCPKG_ROOT.") +endif () From 10b0eecdfa154412d05c1ff0b5979b64f3a94ce6 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 2 Feb 2026 11:49:33 -0800 Subject: [PATCH 03/43] Removed root-level Cmake Windows setup --- CMakeLists.txt | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d636862..efb3d8b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,37 +33,6 @@ set(CMAKE_CXX_EXTENSIONS OFF) # Configure release or debug builds set(BUILD_LIB_DIR "$,Debug,Release>") -# Windows vcpkg setup -if (WIN32 AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) - # Try environment variable first (respects user's existing setup) - if (DEFINED ENV{VCPKG_ROOT}) - set(VCPKG_ROOT "$ENV{VCPKG_ROOT}" CACHE PATH "Path to vcpkg root") - endif () - - # Configure vcpkg if VCPKG_ROOT is set - if (DEFINED VCPKG_ROOT) - set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE FILEPATH "vcpkg toolchain file") - - # Validate toolchain file exists - if (NOT EXISTS "${CMAKE_TOOLCHAIN_FILE}") - message(FATAL_ERROR "vcpkg toolchain file not found at: ${CMAKE_TOOLCHAIN_FILE}") - endif () - - # Set default triplet if not specified - if (NOT DEFINED VCPKG_TARGET_TRIPLET) - set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet") - endif () - - message(WARNING "vcpkg toolchain: ${CMAKE_TOOLCHAIN_FILE}") - message(WARNING "vcpkg triplet: ${VCPKG_TARGET_TRIPLET}") - else () - message(WARNING "vcpkg not configured. Please either:") - message(WARNING " 1. Set VCPKG_ROOT environment variable, or") - message(WARNING " 2. Pass -DVCPKG_ROOT= to CMake") - message(WARNING "Build will continue without vcpkg - dependencies must be installed manually") - endif () -endif () - # Version configuration # The version can be set in multiple ways (in order of precedence): # 1. Pass via command line: cmake -DECLIPSA_VERSION=1.2.3 ... @@ -114,8 +83,9 @@ option(ECLIPSA_LOGIC_PRO_BUILD "Build AU plugin optimized for Logic Pro (7.1.4 l set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -set(CMAKE_BUILD_RPATH "@loader_path/../Resources;${CMAKE_SOURCE_DIR}") - +if (APPLE) + set(CMAKE_BUILD_RPATH "@loader_path/../Resources;${CMAKE_SOURCE_DIR}") +endif () # Set default plugin formats per platform if (APPLE) set(PLUGIN_FORMATS "AU") From 015a21a16de3bec33e3b25a0b784a81c6a1f48bc Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 2 Feb 2026 12:10:57 -0800 Subject: [PATCH 04/43] Updated windows toolchain with third-party cmake commands --- CMakeLists.txt | 19 +++--------- cmake/toolchains/windows.cmake | 13 ++++++-- third_party/CMakeLists.txt | 56 ++++++++++++++-------------------- 3 files changed, 39 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index efb3d8b3..466b2a9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,11 +58,6 @@ if (NOT DEFINED ECLIPSA_COMPANY_NAME) set(ECLIPSA_COMPANY_NAME "Eclipsa Project" CACHE STRING "Company name for Eclipsa project") endif () -if (WIN32 AND NOT CMAKE_RC_COMPILER) - find_program(CMAKE_RC_COMPILER rc.exe - HINTS "C:/Program Files (x86)/Windows Kits/10/bin/*/x64") -endif () - # Make manufacturer code configurable via command line with a default value if (NOT DEFINED ECLIPSA_MANUFACTURER_CODE) set(ECLIPSA_MANUFACTURER_CODE "Eclp" CACHE STRING "Manufacturer code for Eclipsa project") @@ -83,12 +78,14 @@ option(ECLIPSA_LOGIC_PRO_BUILD "Build AU plugin optimized for Logic Pro (7.1.4 l set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -if (APPLE) - set(CMAKE_BUILD_RPATH "@loader_path/../Resources;${CMAKE_SOURCE_DIR}") -endif () + # Set default plugin formats per platform if (APPLE) + set(CMAKE_BUILD_RPATH "@loader_path/../Resources;${CMAKE_SOURCE_DIR}") set(PLUGIN_FORMATS "AU") + # Add vendored libraries path (for CI/GitHub Actions) + set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") + link_directories(${VENDOR_LIB_PATH}) elseif (WIN32) set(PLUGIN_FORMATS "Standalone") else () @@ -99,12 +96,6 @@ option(INTERNAL_TEST OFF) option(CI_TEST OFF) option(JUCE_COPY_PLUGIN_AFTER_BUILD "Automatically copy built plugins to standard locations after build" ON) -if (APPLE) - # Add vendored libraries path (for CI/GitHub Actions) - set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") - link_directories(${VENDOR_LIB_PATH}) -endif () - if (CI_TEST OR INTERNAL_TEST) message(STATUS "Unit tests enabled") include(FetchContent) diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index a4119a2b..5c556875 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -7,8 +7,11 @@ set(_WINDOWS_TOOLCHAIN_INCLUDED TRUE) set(CMAKE_SYSTEM_NAME Windows) -# Stack size -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:16777216") +# Find resource compiler +if (NOT CMAKE_RC_COMPILER) + find_program(CMAKE_RC_COMPILER rc.exe + HINTS "C:/Program Files (x86)/Windows Kits/10/bin/*/x64") +endif () # Disable vcpkg applocal copy set(X_VCPKG_APPLOCAL_DEPS_INSTALL OFF CACHE BOOL "") @@ -37,3 +40,9 @@ if (DEFINED VCPKG_ROOT) else () message(WARNING "vcpkg not configured. Set VCPKG_ROOT or pass -DVCPKG_ROOT.") endif () + +#Add math defines +add_compile_definitions(_USE_MATH_DEFINES) + +# Reduce optimization to avoid MSVC compiler crash on SAF +set(CMAKE_C_FLAGS_RELEASE "/O1 /MD /DNDEBUG" CACHE STRING "" FORCE) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 6c8e7802..d296cd44 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -40,11 +40,11 @@ if (WIN32) # MSVC builds iamf.lib (no 'lib' prefix) set(IAMF_LIB_NAME iamf) set(IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build/$") -else() +else () # UNIX builds libiamf.a set(IAMF_LIB_NAME libiamf) set(IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build") -endif() +endif () # Make sure all subprojects can find it link_directories(${IAMF_LIB_DIR}) @@ -63,23 +63,23 @@ set(saf_example_list ambi_dec CACHE STRING "" FORCE) # Default performance library (fallback) set(SAF_PERFORMANCE_LIB "SAF_USE_OPEN_BLAS_AND_LAPACKE") -if(APPLE) +if (APPLE) message(STATUS "SAF: Using Apple Accelerate") set(SAF_PERFORMANCE_LIB "SAF_USE_APPLE_ACCELERATE") -elseif(WIN32) +elseif (WIN32) # Use system Intel MKL directly message(STATUS "SAF: Attempting to use system Intel MKL") # Allow user to specify MKL root, or use environment variable set(MKL_ROOT "$ENV{MKLROOT}" CACHE PATH "Path to Intel MKL root directory") - if(NOT MKL_ROOT OR NOT EXISTS "${MKL_ROOT}") + if (NOT MKL_ROOT OR NOT EXISTS "${MKL_ROOT}") message(WARNING "SAF: Intel MKL not found. MKLROOT is not set or invalid: '${MKL_ROOT}'") message(WARNING " Set MKL_ROOT variable or source the Intel oneAPI setvars script") message(WARNING " Falling back to OpenBLAS/LAPACKE") set(SAF_PERFORMANCE_LIB "SAF_USE_OPENBLAS_AND_LAPACKE") - else() + else () message(STATUS "SAF: Found Intel MKL at: ${MKL_ROOT}") set(SAF_PERFORMANCE_LIB "SAF_USE_INTEL_MKL_LP64") @@ -93,24 +93,19 @@ elseif(WIN32) CACHE STRING "" FORCE) # Validate that critical files exist - if(NOT EXISTS "${INTEL_MKL_HEADER_PATH}/mkl.h") + if (NOT EXISTS "${INTEL_MKL_HEADER_PATH}/mkl.h") message(FATAL_ERROR "SAF: MKL header not found at ${INTEL_MKL_HEADER_PATH}/mkl.h") - endif() + endif () - foreach(lib_file ${INTEL_MKL_LIB}) - if(NOT EXISTS "${lib_file}") + foreach (lib_file ${INTEL_MKL_LIB}) + if (NOT EXISTS "${lib_file}") message(FATAL_ERROR "SAF: MKL library not found: ${lib_file}") - endif() - endforeach() - endif() -else() + endif () + endforeach () + endif () +else () message(SEND_ERROR "SAF: Using OpenBLAS/LAPACKE (default)") -endif() - -# Reduce optimization level for SAF to avoid compiler crash -if(WIN32) - set(CMAKE_C_FLAGS_RELEASE "/O1 /MD /DNDEBUG" CACHE STRING "" FORCE) -endif() +endif () # Build SAF from source on all platforms message(STATUS "SAF: Building from source with ${SAF_PERFORMANCE_LIB}") @@ -125,24 +120,19 @@ add_subdirectory(LUFSMeter) # IAMF decoder set(IAMF_DEC_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/third_party/libiamf/code/include") -if(EXISTS ${IAMF_DEC_INCLUDE_DIR}) +if (EXISTS ${IAMF_DEC_INCLUDE_DIR}) include_directories(${IAMF_DEC_INCLUDE_DIR}) -else() +else () message(FATAL_ERROR "IAMF decoder include directory not found: ${IAMF_DEC_INCLUDE_DIR}") -endif() +endif () # SAF includes (optional) set(SAF_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/third_party/Spatial_Audio_Framework/examples/include") -if(EXISTS ${SAF_INCLUDE_DIR}) +if (EXISTS ${SAF_INCLUDE_DIR}) include_directories(${SAF_INCLUDE_DIR}) -else() +else () message(WARNING "SAF include directory not found: ${SAF_INCLUDE_DIR}") -endif() - -# Windows flags -if(WIN32) - add_compile_definitions(_USE_MATH_DEFINES) -endif() +endif () #Force all projects to use locally fetched Protobuf if (DEFINED protobuf_SOURCE_DIR AND DEFINED protobuf_BINARY_DIR) @@ -151,7 +141,7 @@ if (DEFINED protobuf_SOURCE_DIR AND DEFINED protobuf_BINARY_DIR) set(Protobuf_LIBRARIES "${protobuf_BINARY_DIR}/libprotobuf.lib" CACHE STRING "" FORCE) set(Protobuf_PROTOC_EXECUTABLE "${protobuf_BINARY_DIR}/protoc" CACHE FILEPATH "" FORCE) set(Protobuf_DIR "${protobuf_BINARY_DIR}/cmake" CACHE PATH "" FORCE) -else() +else () message(WARNING "protobuf_SOURCE_DIR not defined yet ΓÇö ensure FetchContent_MakeAvailable(protobuf) ran") -endif() +endif () From 54bb0474e3e99a544fe65c837797d4d70b75af46 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 2 Feb 2026 14:35:27 -0800 Subject: [PATCH 05/43] Plugin-specific Cmake adjustments --- audioelementplugin/CMakeLists.txt | 85 +++++++++++++++--------------- cmake/toolchains/windows.cmake | 41 +++++++++------ common/CMakeLists.txt | 33 ++++++------ rendererplugin/CMakeLists.txt | 87 +++++++++++++++---------------- 4 files changed, 123 insertions(+), 123 deletions(-) diff --git a/audioelementplugin/CMakeLists.txt b/audioelementplugin/CMakeLists.txt index e937b5e9..6b2dccac 100644 --- a/audioelementplugin/CMakeLists.txt +++ b/audioelementplugin/CMakeLists.txt @@ -13,13 +13,13 @@ # limitations under the License. # Set plugin code and name based on build type -if(ECLIPSA_LOGIC_PRO_BUILD) +if (ECLIPSA_LOGIC_PRO_BUILD) set(AUDIO_ELEMENT_PLUGIN_CODE "Eacl") set(AUDIO_ELEMENT_PRODUCT_NAME "Eclipsa Audio Element Plugin for Logic Pro") -else() +else () set(AUDIO_ELEMENT_PLUGIN_CODE "Ecae") set(AUDIO_ELEMENT_PRODUCT_NAME "Eclipsa Audio Element Plugin") -endif() +endif () juce_add_plugin(AudioElementPlugin PLUGIN_MANUFACTURER_CODE ${ECLIPSA_MANUFACTURER_CODE} @@ -54,20 +54,17 @@ target_compile_definitions(AudioElementPlugin JucePlugin_Category="Spatial") # Add DAW-specific build flags when enabled -if(ECLIPSA_LOGIC_PRO_BUILD) +if (ECLIPSA_LOGIC_PRO_BUILD) target_compile_definitions(AudioElementPlugin PRIVATE ECLIPSA_LOGIC_PRO_BUILD=1) -endif() +endif () # Platform-specific settings -if(APPLE) +if (APPLE) target_link_options(AudioElementPlugin PUBLIC "-Wl" "-ld_classic") -elseif(WIN32) - # MSVC flags for math constants - target_compile_definitions(AudioElementPlugin PRIVATE _USE_MATH_DEFINES) -endif() +endif () target_include_directories(AudioElementPlugin PUBLIC "${BOOST_LIBRARY_INCLUDES}/include") @@ -84,78 +81,78 @@ target_link_libraries(AudioElementPlugin juce::juce_recommended_lto_flags juce::juce_recommended_warning_flags) -if(WIN32) +if (WIN32) target_link_libraries(AudioElementPlugin PRIVATE delayimp) -endif() +endif () # Platform-specific Boost linking -if(WIN32) +if (WIN32) # Windows: Boost headers only (lockfree is header-only) target_include_directories(AudioElementPlugin PRIVATE ${Boost_INCLUDE_DIRS}) -else() +else () # macOS: Modern CMake target target_link_libraries(AudioElementPlugin PRIVATE Boost::lockfree) -endif() +endif () # Windows-specific: Link ZLIB -if(WIN32) +if (WIN32) find_package(ZLIB REQUIRED) - if(ZLIB_FOUND) + if (ZLIB_FOUND) message(STATUS "Linking AudioElementPlugin against ZLIB: ${ZLIB_LIBRARIES}") target_link_libraries(AudioElementPlugin PRIVATE ZLIB::ZLIB) - if(TARGET AudioElementPlugin_VST3) + if (TARGET AudioElementPlugin_VST3) target_link_libraries(AudioElementPlugin_VST3 PRIVATE ZLIB::ZLIB) - endif() - else() + endif () + else () message(FATAL_ERROR "ZLIB not found for AudioElementPlugin") - endif() -endif() + endif () +endif () -if(CI_TEST OR INTERNAL_TEST) +if (CI_TEST OR INTERNAL_TEST) add_subdirectory(test) -endif() +endif () # Copy resources for each plugin format -if(BUILD_AAX AND TARGET AudioElementPlugin_AAX) +if (BUILD_AAX AND TARGET AudioElementPlugin_AAX) message(STATUS "AAX build detected. Setting up audio element plugin path and copying resources.") set(AUDIO_ELEMENT_AAX_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/$/AAX/Eclipsa Audio Element Plugin.aaxplugin") copy_resources(AudioElementPlugin_AAX "${AUDIO_ELEMENT_AAX_PATH}") - if(WIN32) - foreach(dll IN LISTS DELAYLOAD_DLLS) + if (WIN32) + foreach (dll IN LISTS DELAYLOAD_DLLS) target_link_options(AudioElementPlugin_AAX PRIVATE /DELAYLOAD:${dll}) - endforeach() - endif() -endif() + endforeach () + endif () +endif () -if(BUILD_VST3 AND TARGET AudioElementPlugin_VST3) +if (BUILD_VST3 AND TARGET AudioElementPlugin_VST3) message(STATUS "VST3 build detected. Setting up Audio Element plugin path and copying resources.") set(AUDIO_ELEMENT_VST3_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/$/VST3/Eclipsa Audio Element Plugin.vst3") copy_resources(AudioElementPlugin_VST3 "${AUDIO_ELEMENT_VST3_PATH}") if (WIN32) - foreach(dll IN LISTS DELAYLOAD_DLLS) + foreach (dll IN LISTS DELAYLOAD_DLLS) target_link_options(AudioElementPlugin_VST3 PRIVATE /DELAYLOAD:${dll}) - endforeach() - endif() -endif() + endforeach () + endif () +endif () -if(CMAKE_BUILD_TYPE STREQUAL "Release" AND APPLE) +if (CMAKE_BUILD_TYPE STREQUAL "Release" AND APPLE) message(STATUS "MacOS release build detected. Copying Audio Element Resources for AU Plugins.") - if(ECLIPSA_LOGIC_PRO_BUILD) + if (ECLIPSA_LOGIC_PRO_BUILD) set(AUDIO_PLUGIN_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/Release/AU/Eclipsa Audio Element Plugin for Logic Pro.component") - else() + else () set(AUDIO_PLUGIN_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/Release/AU/Eclipsa Audio Element Plugin.component") - endif() + endif () copy_resources(AudioElementPlugin ${AUDIO_PLUGIN_PATH}) -endif() +endif () -if(TARGET AudioElementPlugin_Standalone) +if (TARGET AudioElementPlugin_Standalone) message(STATUS "Standalone build detected. Setting up Audio Element plugin path and copying resources.") set(AUDIO_ELEMENT_STANDALONE_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/$/Standalone") copy_resources(AudioElementPlugin_Standalone "${AUDIO_ELEMENT_STANDALONE_PATH}") -endif() +endif () -if(NOT BUILD_AAX AND NOT BUILD_VST3 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") +if (NOT BUILD_AAX AND NOT BUILD_VST3 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") message(STATUS "No supported plugin formats detected. Skipping resource setup and resource copy for Audio Element Plugin.") -endif() \ No newline at end of file +endif () \ No newline at end of file diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index 5c556875..d1e55974 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -1,22 +1,38 @@ -# windows.cmake - +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Include guard if (DEFINED _WINDOWS_TOOLCHAIN_INCLUDED) return() endif () set(_WINDOWS_TOOLCHAIN_INCLUDED TRUE) -set(CMAKE_SYSTEM_NAME Windows) +# Math constants +add_compile_definitions(_USE_MATH_DEFINES) + +# Reduce optimization to avoid MSVC compiler crash on SAF +set(CMAKE_C_FLAGS_RELEASE "/O1 /MD /DNDEBUG" CACHE STRING "" FORCE) -# Find resource compiler +# Resource compiler fallback if (NOT CMAKE_RC_COMPILER) find_program(CMAKE_RC_COMPILER rc.exe HINTS "C:/Program Files (x86)/Windows Kits/10/bin/*/x64") endif () -# Disable vcpkg applocal copy +# Disable automatic DLL copying (we handle this manually) set(X_VCPKG_APPLOCAL_DEPS_INSTALL OFF CACHE BOOL "") -# Try environment variable first (same behavior as before) if (NOT DEFINED VCPKG_ROOT AND DEFINED ENV{VCPKG_ROOT}) set(VCPKG_ROOT "$ENV{VCPKG_ROOT}" CACHE PATH "Path to vcpkg root") endif () @@ -25,7 +41,7 @@ if (DEFINED VCPKG_ROOT) set(_VCPKG_TOOLCHAIN "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake") if (NOT EXISTS "${_VCPKG_TOOLCHAIN}") - message(FATAL_ERROR "vcpkg toolchain file not found at: ${_VCPKG_TOOLCHAIN}") + message(FATAL_ERROR "vcpkg toolchain not found at: ${_VCPKG_TOOLCHAIN}") endif () if (NOT DEFINED VCPKG_TARGET_TRIPLET) @@ -35,14 +51,7 @@ if (DEFINED VCPKG_ROOT) message(STATUS "vcpkg toolchain: ${_VCPKG_TOOLCHAIN}") message(STATUS "vcpkg triplet: ${VCPKG_TARGET_TRIPLET}") - # Chain load (this replaces setting CMAKE_TOOLCHAIN_FILE) include("${_VCPKG_TOOLCHAIN}") else () - message(WARNING "vcpkg not configured. Set VCPKG_ROOT or pass -DVCPKG_ROOT.") -endif () - -#Add math defines -add_compile_definitions(_USE_MATH_DEFINES) - -# Reduce optimization to avoid MSVC compiler crash on SAF -set(CMAKE_C_FLAGS_RELEASE "/O1 /MD /DNDEBUG" CACHE STRING "" FORCE) + message(WARNING "vcpkg not configured. Set VCPKG_ROOT environment variable or pass -DVCPKG_ROOT=") +endif () \ No newline at end of file diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index cb52b2fd..35b0716a 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -15,36 +15,36 @@ # ------------------------------- juce_add_modules( - components - data_repository - data_structures - logger - player - processors - substream_rdr) + components + data_repository + data_structures + logger + player + processors + substream_rdr) # ------------------------------- # Optional test targets # ------------------------------- -if(CI_TEST OR INTERNAL_TEST) +if (CI_TEST OR INTERNAL_TEST) add_subdirectory(processors/tests) add_subdirectory(data_repository/tests) add_subdirectory(logger/tests) add_subdirectory(data_structures/tests) add_subdirectory(substream_rdr/tests) add_subdirectory(player/test) - -endif() + +endif () # ------------------------------- # Platform-specific processor defs # ------------------------------- # DAW-specific build flags -if(ECLIPSA_LOGIC_PRO_BUILD) +if (ECLIPSA_LOGIC_PRO_BUILD) target_compile_definitions(processors INTERFACE ECLIPSA_LOGIC_PRO_BUILD=1) -endif() +endif () # ------------------------------- # Icon resources @@ -125,11 +125,9 @@ target_link_libraries(player INTERFACE processors substream_rdr) target_link_libraries(components INTERFACE binary_data libear substream_rdr processors data_structures data_repository player) -if(WIN32) +if (WIN32) message(STATUS "Linking logger against Boost via CMake targets") -# find_package(Boost 1.70.0 REQUIRED COMPONENTS log log_setup thread filesystem) - target_link_libraries(logger INTERFACE Boost::log Boost::log_setup @@ -139,8 +137,7 @@ if(WIN32) juce::juce_core ) -# target_include_directories(logger INTERFACE ${Boost_INCLUDE_DIRS}) -else() +else () target_link_libraries(logger INTERFACE Boost::log Boost::log_setup @@ -148,7 +145,7 @@ else() Boost::filesystem juce::juce_core ) -endif() +endif () get_target_property(SUBSTREAM_INCLUDES substream_rdr INTERFACE_INCLUDE_DIRECTORIES) message(STATUS "substream_rdr include paths: ${SUBSTREAM_INCLUDES}") diff --git a/rendererplugin/CMakeLists.txt b/rendererplugin/CMakeLists.txt index 241bf4fa..198df951 100644 --- a/rendererplugin/CMakeLists.txt +++ b/rendererplugin/CMakeLists.txt @@ -13,13 +13,13 @@ # limitations under the License. # Set plugin code and name based on build type -if(ECLIPSA_LOGIC_PRO_BUILD) +if (ECLIPSA_LOGIC_PRO_BUILD) set(RENDERER_PLUGIN_CODE "Ercl") set(RENDERER_PRODUCT_NAME "Eclipsa Audio Renderer for Logic Pro") -else() +else () set(RENDERER_PLUGIN_CODE "Ecrd") set(RENDERER_PRODUCT_NAME "Eclipsa Audio Renderer") -endif() +endif () juce_add_plugin(RendererPlugin PLUGIN_MANUFACTURER_CODE ${ECLIPSA_MANUFACTURER_CODE} @@ -62,20 +62,17 @@ target_compile_definitions(RendererPlugin JucePlugin_Category="Synth") # Add DAW-specific build flags when enabled -if(ECLIPSA_LOGIC_PRO_BUILD) +if (ECLIPSA_LOGIC_PRO_BUILD) target_compile_definitions(RendererPlugin PRIVATE ECLIPSA_LOGIC_PRO_BUILD=1) -endif() +endif () # Platform-specific settings -if(APPLE) +if (APPLE) target_link_options(RendererPlugin PUBLIC "-Wl" "-ld_classic") -elseif(WIN32) - # MSVC flags for math constants - target_compile_definitions(RendererPlugin PRIVATE _USE_MATH_DEFINES) -endif() +endif () target_include_directories(RendererPlugin PUBLIC "${BOOST_LIBRARY_INCLUDES}/include") @@ -94,83 +91,83 @@ target_link_libraries(RendererPlugin juce::juce_recommended_warning_flags libzmq) -if(WIN32) +if (WIN32) target_link_libraries(RendererPlugin PRIVATE delayimp) -endif() +endif () # Platform-specific Boost linking -if(WIN32) +if (WIN32) # Windows: Boost headers only (lockfree is header-only) target_include_directories(RendererPlugin PRIVATE ${Boost_INCLUDE_DIRS}) -else() +else () # macOS: Modern CMake target target_link_libraries(RendererPlugin PRIVATE Boost::lockfree) -endif() +endif () # Windows-specific: Link ZLIB -if(WIN32) +if (WIN32) find_package(ZLIB REQUIRED) - if(ZLIB_FOUND) + if (ZLIB_FOUND) message(STATUS "Linking RendererPlugin against ZLIB: ${ZLIB_LIBRARIES}") target_link_libraries(RendererPlugin PRIVATE ZLIB::ZLIB) - if(TARGET RendererPlugin_VST3) + if (TARGET RendererPlugin_VST3) target_link_libraries(RendererPlugin_VST3 PRIVATE ZLIB::ZLIB) - endif() - else() + endif () + else () message(FATAL_ERROR "ZLIB not found for RendererPlugin") - endif() -endif() + endif () +endif () -if(CI_TEST OR INTERNAL_TEST) +if (CI_TEST OR INTERNAL_TEST) target_link_libraries(RendererPlugin PRIVATE juce::juce_cryptography) add_subdirectory(test) -endif() +endif () # Copy resources for each plugin format -if(BUILD_AAX AND TARGET RendererPlugin_AAX) +if (BUILD_AAX AND TARGET RendererPlugin_AAX) message(STATUS "AAX build detected. Setting up renderer plugin path and copying resources.") set(RENDERER_AAX_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/$/AAX/Eclipsa Audio Renderer.aaxplugin") copy_resources(RendererPlugin_AAX "${RENDERER_AAX_PATH}") # For builds on Windows, set up delay loading for DLLs - if(WIN32) - foreach(dll IN LISTS DELAYLOAD_DLLS) + if (WIN32) + foreach (dll IN LISTS DELAYLOAD_DLLS) target_link_options(RendererPlugin_AAX PRIVATE /DELAYLOAD:${dll}) - endforeach() - endif() -endif() + endforeach () + endif () +endif () -if(BUILD_VST3 AND TARGET RendererPlugin_VST3) +if (BUILD_VST3 AND TARGET RendererPlugin_VST3) message(STATUS "VST3 build detected. Setting up renderer plugin path and copying resources.") set(RENDERER_VST3_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/$/VST3/Eclipsa Audio Renderer.vst3") copy_resources(RendererPlugin_VST3 "${RENDERER_VST3_PATH}") # For builds on Windows, set up delay loading for DLLs - if(WIN32) - foreach(dll IN LISTS DELAYLOAD_DLLS) + if (WIN32) + foreach (dll IN LISTS DELAYLOAD_DLLS) target_link_options(RendererPlugin_VST3 PRIVATE /DELAYLOAD:${dll}) - endforeach() - endif() -endif() + endforeach () + endif () +endif () -if(CMAKE_BUILD_TYPE STREQUAL "Release" AND APPLE) +if (CMAKE_BUILD_TYPE STREQUAL "Release" AND APPLE) message(STATUS "MacOS release build detected. Copying Renderer Plugin Resources for AU Plugins.") - if(ECLIPSA_LOGIC_PRO_BUILD) + if (ECLIPSA_LOGIC_PRO_BUILD) set(RDR_PLUGIN_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/Release/AU/Eclipsa Audio Renderer for Logic Pro.component") - else() + else () set(RDR_PLUGIN_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/Release/AU/Eclipsa Audio Renderer.component") - endif() + endif () copy_resources(RendererPlugin ${RDR_PLUGIN_PATH}) -endif() +endif () -if(TARGET RendererPlugin_Standalone) +if (TARGET RendererPlugin_Standalone) message(STATUS "Standalone build detected. Setting up renderer plugin path and copying resources.") set(RENDERER_STANDALONE_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/$/Standalone") copy_resources(RendererPlugin_Standalone "${RENDERER_STANDALONE_PATH}") -endif() +endif () -if(NOT BUILD_AAX AND NOT BUILD_VST3 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") +if (NOT BUILD_AAX AND NOT BUILD_VST3 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") message(STATUS "No supported plugin formats detected. Skipping resource setup and resource copy for Renderer Plugin.") -endif() \ No newline at end of file +endif () \ No newline at end of file From 2c167b19cf516a1f0f43f98d1c63c7d7d73dbc34 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 3 Feb 2026 12:18:57 -0800 Subject: [PATCH 06/43] Added macos toolchain, cleaned up individual plugin cmakes --- .github/workflows/cmake-multi-platform.yml | 10 +- CMakeLists.txt | 47 +--- audioelementplugin/CMakeLists.txt | 47 ---- cmake/copy_resources.cmake | 155 +++++++------- cmake/toolchains/macos.cmake | 40 ++++ cmake/toolchains/windows.cmake | 27 ++- common/components/src/Icons.h | 2 +- rendererplugin/CMakeLists.txt | 49 ----- third_party/CMakeLists.txt | 67 ++++++ third_party/iamftools/scripts/update.sh | 4 +- third_party/libiamf/CMakeLists.txt | 238 ++++++++++----------- 11 files changed, 347 insertions(+), 339 deletions(-) create mode 100644 cmake/toolchains/macos.cmake diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 01f320db..9647399b 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-14, windows-latest] + os: [ macos-14, windows-latest ] steps: - name: Checkout @@ -67,7 +67,7 @@ jobs: uses: actions/cache@v3 with: path: build/third_party/JUCE - key: ${{ runner.os }}-juce-build-${{ hashFiles('third_party/JUCE/CMakeLists.txt') }} + key: ${{ runner.os }}-juce-build-${{ hashFiles('third_party/JUCE/macos.cmake') }} - name: Check JUCE Cache if: env.CLEAN_BUILD != 'true' @@ -85,7 +85,7 @@ jobs: uses: actions/cache@v3 with: path: build/_deps/libiamf-build - key: ${{ runner.os }}-iamf-build-${{ hashFiles('third_party/libiamf/CMakeLists.txt') }} + key: ${{ runner.os }}-iamf-build-${{ hashFiles('third_party/libiamf/macos.cmake') }} - name: Check IAMF Cache if: env.CLEAN_BUILD != 'true' @@ -103,7 +103,7 @@ jobs: uses: actions/cache@v3 with: path: build/third_party/libear - key: ${{ runner.os }}-libear-build-${{ hashFiles('third_party/libear/CMakeLists.txt') }} + key: ${{ runner.os }}-libear-build-${{ hashFiles('third_party/libear/macos.cmake') }} - name: Check Libear Cache if: env.CLEAN_BUILD != 'true' @@ -121,7 +121,7 @@ jobs: uses: actions/cache@v3 with: path: build - key: ${{ runner.os }}-main-build-${{ hashFiles('CMakeLists.txt', 'cmake/**', 'components/**/*.cpp', 'components/**/*.h') }} + key: ${{ runner.os }}-main-build-${{ hashFiles('macos.cmake', 'cmake/**', 'components/**/*.cpp', 'components/**/*.h') }} - name: Check Main Build Cache if: env.CLEAN_BUILD != 'true' diff --git a/CMakeLists.txt b/CMakeLists.txt index 466b2a9c..77a07ea9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,19 +79,6 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -# Set default plugin formats per platform -if (APPLE) - set(CMAKE_BUILD_RPATH "@loader_path/../Resources;${CMAKE_SOURCE_DIR}") - set(PLUGIN_FORMATS "AU") - # Add vendored libraries path (for CI/GitHub Actions) - set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") - link_directories(${VENDOR_LIB_PATH}) -elseif (WIN32) - set(PLUGIN_FORMATS "Standalone") -else () - set(PLUGIN_FORMATS "") -endif () - option(INTERNAL_TEST OFF) option(CI_TEST OFF) option(JUCE_COPY_PLUGIN_AFTER_BUILD "Automatically copy built plugins to standard locations after build" ON) @@ -127,37 +114,21 @@ endif () add_subdirectory(third_party) -# ZLIB configuration for Windows builds -if (WIN32) - find_package(ZLIB REQUIRED) - message(STATUS "ZLIB found at: ${ZLIB_LIBRARIES}") - # Fix link targets that request 'z' - link_libraries(ZLIB::ZLIB) -endif () - include("${CMAKE_SOURCE_DIR}/cmake/copy_resources.cmake") if (BUILD_AAX) - if (WIN32) - set(AAX_SDK_VER "2-8-1" CACHE STRING "AAX SDK Version") - list(APPEND PLUGIN_FORMATS "AAX") - - # Allow team members to specify their own AAX SDK path - if (NOT DEFINED AAX_SDK_ROOT) - set(AAX_SDK_ROOT "C:/Code/Repos/aax-sdk-${AAX_SDK_VER}" CACHE PATH "Path to AAX SDK") - endif () - else () - set(AAX_SDK_VER "2-7-0" CACHE STRING "Default AAX SDK Version") - list(APPEND PLUGIN_FORMATS "AAX") - find_path(AAX_SDK_ROOT NAMES "aax-sdk-${AAX_SDK_VER}" HINTS "/opt" "/usr/local") - set(AAX_SDK_ROOT "${AAX_SDK_ROOT}/aax-sdk-${AAX_SDK_VER}") - endif () + # Use find_path instead of hardcoded 'set' to allow user overrides + find_path(AAX_SDK_ROOT + NAMES "Interfaces/AAX_Exports.cpp" # A file known to be in the SDK + HINTS "${AAX_SDK_SEARCH_HINT}" + DOC "Path to AAX SDK" + ) - if (EXISTS "${AAX_SDK_ROOT}") - message(STATUS "Using AAX SDK at ${AAX_SDK_ROOT}") + if (AAX_SDK_ROOT) + message(STATUS "AAX SDK found: ${AAX_SDK_ROOT}") juce_set_aax_sdk_path("${AAX_SDK_ROOT}") else () - message(FATAL_ERROR "AAX SDK not found at ${AAX_SDK_ROOT}. Set AAX_SDK_ROOT to the correct path.") + message(FATAL_ERROR "AAX SDK not found. Please set AAX_SDK_ROOT.") endif () endif () diff --git a/audioelementplugin/CMakeLists.txt b/audioelementplugin/CMakeLists.txt index 6b2dccac..e0d27925 100644 --- a/audioelementplugin/CMakeLists.txt +++ b/audioelementplugin/CMakeLists.txt @@ -58,14 +58,6 @@ if (ECLIPSA_LOGIC_PRO_BUILD) target_compile_definitions(AudioElementPlugin PRIVATE ECLIPSA_LOGIC_PRO_BUILD=1) endif () -# Platform-specific settings -if (APPLE) - target_link_options(AudioElementPlugin - PUBLIC - "-Wl" - "-ld_classic") -endif () - target_include_directories(AudioElementPlugin PUBLIC "${BOOST_LIBRARY_INCLUDES}/include") target_link_libraries(AudioElementPlugin @@ -81,33 +73,6 @@ target_link_libraries(AudioElementPlugin juce::juce_recommended_lto_flags juce::juce_recommended_warning_flags) -if (WIN32) - target_link_libraries(AudioElementPlugin PRIVATE delayimp) -endif () - -# Platform-specific Boost linking -if (WIN32) - # Windows: Boost headers only (lockfree is header-only) - target_include_directories(AudioElementPlugin PRIVATE ${Boost_INCLUDE_DIRS}) -else () - # macOS: Modern CMake target - target_link_libraries(AudioElementPlugin PRIVATE Boost::lockfree) -endif () - -# Windows-specific: Link ZLIB -if (WIN32) - find_package(ZLIB REQUIRED) - if (ZLIB_FOUND) - message(STATUS "Linking AudioElementPlugin against ZLIB: ${ZLIB_LIBRARIES}") - target_link_libraries(AudioElementPlugin PRIVATE ZLIB::ZLIB) - if (TARGET AudioElementPlugin_VST3) - target_link_libraries(AudioElementPlugin_VST3 PRIVATE ZLIB::ZLIB) - endif () - else () - message(FATAL_ERROR "ZLIB not found for AudioElementPlugin") - endif () -endif () - if (CI_TEST OR INTERNAL_TEST) add_subdirectory(test) endif () @@ -117,24 +82,12 @@ if (BUILD_AAX AND TARGET AudioElementPlugin_AAX) message(STATUS "AAX build detected. Setting up audio element plugin path and copying resources.") set(AUDIO_ELEMENT_AAX_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/$/AAX/Eclipsa Audio Element Plugin.aaxplugin") copy_resources(AudioElementPlugin_AAX "${AUDIO_ELEMENT_AAX_PATH}") - - if (WIN32) - foreach (dll IN LISTS DELAYLOAD_DLLS) - target_link_options(AudioElementPlugin_AAX PRIVATE /DELAYLOAD:${dll}) - endforeach () - endif () endif () if (BUILD_VST3 AND TARGET AudioElementPlugin_VST3) message(STATUS "VST3 build detected. Setting up Audio Element plugin path and copying resources.") set(AUDIO_ELEMENT_VST3_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/$/VST3/Eclipsa Audio Element Plugin.vst3") copy_resources(AudioElementPlugin_VST3 "${AUDIO_ELEMENT_VST3_PATH}") - - if (WIN32) - foreach (dll IN LISTS DELAYLOAD_DLLS) - target_link_options(AudioElementPlugin_VST3 PRIVATE /DELAYLOAD:${dll}) - endforeach () - endif () endif () if (CMAKE_BUILD_TYPE STREQUAL "Release" AND APPLE) diff --git a/cmake/copy_resources.cmake b/cmake/copy_resources.cmake index 6dcf9769..6676a06e 100644 --- a/cmake/copy_resources.cmake +++ b/cmake/copy_resources.cmake @@ -13,96 +13,97 @@ # limitations under the License. function(copy_resources target plugin_path) - if(APPLE) - # macOS: Copy dylibs to Resources - set(LIB_OBR_PATH "${CMAKE_SOURCE_DIR}/third_party/obr/lib/obr.dylib") - set(LIB_IAMF_TOOLS_PATH "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/libiamf_tools.dylib") - set(LIB_ZMQ_5_2_6_PATH "${CMAKE_BINARY_DIR}/_deps/zeromq-build/lib/libzmq.5.2.6.dylib") - set(LIB_GPAC_PATH "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/libgpac.dylib") - # Set Resources directory and external subdirectories - set(RESOURCES_DIR "${plugin_path}/Contents/Resources") - set(EXTERNAL_IAMF_DIR "${RESOURCES_DIR}/third_party/iamftools/lib") - set(EXTERNAL_OBR_DIR "${RESOURCES_DIR}/third_party/obr/lib") - set(EXTERNAL_GPAC_DIR "${RESOURCES_DIR}/third_party/gpac/lib") + # --- 1. Define Destinations --- + if (APPLE) + set(DEST_ROOT "${plugin_path}/Contents/Resources") + set(DEST_IAMF "${DEST_ROOT}/third_party/iamftools/lib") + set(DEST_OBR "${DEST_ROOT}/third_party/obr/lib") + set(DEST_GPAC "${DEST_ROOT}/third_party/gpac/lib") + elseif (WIN32) + if ("${target}" MATCHES ".*_VST3$") + set(DEST_ROOT "${plugin_path}/Contents/x86_64-win") + elseif ("${target}" MATCHES ".*_AAX$") + set(DEST_ROOT "${plugin_path}/Contents/x64") + elseif ("${target}" MATCHES ".*_Standalone$") + set(DEST_ROOT "${plugin_path}") + else () + message(WARNING "Unknown plugin format: ${target}") + return() + endif () - # Copy libraries to the appropriate directories - add_custom_command(TARGET ${target} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory ${EXTERNAL_IAMF_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${EXTERNAL_OBR_DIR} - COMMAND ${CMAKE_COMMAND} -E make_directory ${EXTERNAL_GPAC_DIR} - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_OBR_PATH} ${EXTERNAL_OBR_DIR}/obr.dylib - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_IAMF_TOOLS_PATH} ${EXTERNAL_IAMF_DIR}/libiamf_tools.dylib - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_GPAC_PATH} ${EXTERNAL_GPAC_DIR}/libgpac.dylib - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_ZMQ_5_2_6_PATH} ${RESOURCES_DIR}/libzmq.5.2.6.dylib + set(DEST_IAMF "${DEST_ROOT}") + set(DEST_GPAC "${DEST_ROOT}") + # DEST_OBR is not needed on Windows + endif () - # Create symbolic links for libzmq - COMMAND ${CMAKE_COMMAND} -E create_symlink libzmq.5.2.6.dylib ${RESOURCES_DIR}/libzmq.5.dylib - COMMAND ${CMAKE_COMMAND} -E create_symlink libzmq.5.dylib ${RESOURCES_DIR}/libzmq.dylib + # --- 2. Windows: Apply Delay Load Flags --- + if (WIN32) + target_link_options(${target} PRIVATE + "/DELAYLOAD:$" + "/DELAYLOAD:$" + "/DELAYLOAD:$" + "/DELAYLOAD:$" + "/DELAYLOAD:$" + "/DELAYLOAD:$" ) + set(DELAYLOAD_DLLS "" PARENT_SCOPE) + endif () - elseif(WIN32) - # Set DLL names using generator expressions for multi-config generators - set(GPAC_DLL "libgpac.dll") - set(CRYPTOMD_DLL "libcryptoMD.dll") - set(LIBSSLMD_DLL "libsslMD.dll") - set(IAMF_TOOLS_DLL "iamf_tools.dll") - set(OPENSVC_DECODER "OpenSVCDecoder.dll") - set(ZMQ_DLL "libzmq-v143-mt$<$:-gd>-4_3_6.dll") + # --- 3. Copy Commands (Grouped by Platform to avoid evaluation crashes) --- - # Export DLL list to parent scope for DELAYLOAD configuration - set(DELAYLOAD_DLLS - ${GPAC_DLL} - ${CRYPTOMD_DLL} - ${LIBSSLMD_DLL} - ${IAMF_TOOLS_DLL} - ${OPENSVC_DECODER} - ${ZMQ_DLL} - PARENT_SCOPE - ) + # A. Commands Common to BOTH platforms + set(COPY_COMMANDS + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_IAMF}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_GPAC}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_GPAC}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_IAMF}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" + ) - # Set the paths to the DLLs - set(GPAC_DLL_PATH "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/$/${GPAC_DLL}") - set(CRYPTOMD_DLL_PATH "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/$/${CRYPTOMD_DLL}") - set(LIBSSLMD_DLL_PATH "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/$/${LIBSSLMD_DLL}") - set(IAMF_TOOLS_DLL_PATH "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/$/${IAMF_TOOLS_DLL}") - set(OPENSVC_DECODER_PATH "${CMAKE_SOURCE_DIR}/third_party/OpenSVC/lib/Windows/$/${OPENSVC_DECODER}") - set(ZMQ_DLL_PATH "${CMAKE_BINARY_DIR}/_deps/zeromq-build/bin/$/${ZMQ_DLL}") + # B. Windows-Only Commands + if (WIN32) + list(APPEND COPY_COMMANDS + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" + ) + endif () + # C. Mac-Only Commands + if (APPLE) + list(APPEND COPY_COMMANDS + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_OBR}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_OBR}/" + ) + endif () - if("${target}" MATCHES ".*_VST3$") - set(PLUGIN_BINARY_DIR "${plugin_path}/Contents/x86_64-win") - elseif("${target}" MATCHES ".*_AAX$") - set(PLUGIN_BINARY_DIR "${plugin_path}/Contents/x64") - elseif("${target}" MATCHES ".*_Standalone$") - set(PLUGIN_BINARY_DIR "${plugin_path}") - else() - message(WARNING "Unknown plugin format for target: ${target}. Skipping DLL copy.") - return() - endif() + # Apply the aggregated commands + add_custom_command(TARGET ${target} POST_BUILD + ${COPY_COMMANDS} + COMMENT "Deploying resources to ${DEST_ROOT}" + ) - # Single POST_BUILD command per target - add_custom_command(TARGET ${target} PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory "${PLUGIN_BINARY_DIR}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GPAC_DLL_PATH} "${PLUGIN_BINARY_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CRYPTOMD_DLL_PATH} "${PLUGIN_BINARY_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBSSLMD_DLL_PATH} "${PLUGIN_BINARY_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${IAMF_TOOLS_DLL_PATH} "${PLUGIN_BINARY_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZMQ_DLL_PATH} "${PLUGIN_BINARY_DIR}/" - COMMENT "Copied DLLs to ${PLUGIN_BINARY_DIR}" + # --- 4. macOS ZMQ Symlinks --- + if (APPLE) + add_custom_command(TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E create_symlink "$" "${DEST_ROOT}/libzmq.5.dylib" + COMMAND ${CMAKE_COMMAND} -E create_symlink "libzmq.5.dylib" "${DEST_ROOT}/libzmq.dylib" ) + endif () - # Copy DLLs to Debug folder in build directory for use by the JUCE VST3 tool - # The tool runs from this directory and runs the plugins, so the DLLs need to be here as well + # --- 5. Helper Tool Copy (Windows Only) --- + if (WIN32) set(VST3_SIGNING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${BUILD_LIB_DIR}") - add_custom_command(TARGET ${target} PRE_BUILD + add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${VST3_SIGNING_DIR}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GPAC_DLL_PATH} "${VST3_SIGNING_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CRYPTOMD_DLL_PATH} "${VST3_SIGNING_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBSSLMD_DLL_PATH} "${VST3_SIGNING_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${IAMF_TOOLS_DLL_PATH} "${VST3_SIGNING_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZMQ_DLL_PATH} "${VST3_SIGNING_DIR}/" - COMMENT "Copied DLLs to ${VST3_SIGNING_DIR}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" ) - endif() + endif () endfunction() \ No newline at end of file diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake new file mode 100644 index 00000000..d40e5658 --- /dev/null +++ b/cmake/toolchains/macos.cmake @@ -0,0 +1,40 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Include guard +if (DEFINED _MACOS_TOOLCHAIN_INCLUDED) + return() +endif () +set(_MACOS_TOOLCHAIN_INCLUDED TRUE) + +# RPATH logic moved from root +set(CMAKE_BUILD_RPATH "@loader_path/../Resources;${CMAKE_SOURCE_DIR}" CACHE STRING "") + +# Initialize formats +set(_MAC_DEFAULT_FORMATS "AU") + +if (BUILD_AAX) + set(AAX_SDK_VER "2-7-0" CACHE STRING "AAX SDK Version") + list(APPEND _MAC_DEFAULT_FORMATS "AAX") + # Typical Mac location for vendored SDKs + set(AAX_SDK_SEARCH_HINT "/opt/aax-sdk-${AAX_SDK_VER}" CACHE INTERNAL "") +endif () + +set(PLUGIN_FORMATS "${_MAC_DEFAULT_FORMATS}" CACHE STRING "Target plugin formats") + +# Vendored Lib Path Logic +set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos" CACHE INTERNAL "") + +# Xcode 15+ classic linker (avoids duplicate symbol warnings) +add_link_options("-Wl,-ld_classic") \ No newline at end of file diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index d1e55974..3df4dd41 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -16,6 +16,7 @@ if (DEFINED _WINDOWS_TOOLCHAIN_INCLUDED) return() endif () + set(_WINDOWS_TOOLCHAIN_INCLUDED TRUE) # Math constants @@ -54,4 +55,28 @@ if (DEFINED VCPKG_ROOT) include("${_VCPKG_TOOLCHAIN}") else () message(WARNING "vcpkg not configured. Set VCPKG_ROOT environment variable or pass -DVCPKG_ROOT=") -endif () \ No newline at end of file +endif () + +# Initialize the base formats +set(_DEFAULT_FORMATS "Standalone") + +if (BUILD_AAX) + set(AAX_SDK_VER "2-8-1" CACHE STRING "AAX SDK Version") + list(APPEND _DEFAULT_FORMATS "AAX") + set(AAX_SDK_SEARCH_HINT "C:/Code/Repos/aax-sdk-${AAX_SDK_VER}" CACHE INTERNAL "") +endif () + +# Finalize the list into the CACHE so the project can see it +set(PLUGIN_FORMATS "${_DEFAULT_FORMATS}" CACHE STRING "Target plugin formats") + +# --- ZLIB Configuration --- +find_package(ZLIB REQUIRED) + +# We use a CACHE variable to store the library path/target +# so the rest of the project can access it easily. +set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} CACHE INTERNAL "ZLIB libraries for Windows") + +# If you REALLY want every single target to link ZLIB automatically: +link_libraries(ZLIB::ZLIB) +link_libraries(delayimp) + diff --git a/common/components/src/Icons.h b/common/components/src/Icons.h index 72160ee7..e99b4a7c 100644 --- a/common/components/src/Icons.h +++ b/common/components/src/Icons.h @@ -43,7 +43,7 @@ class IconStore { /* ========================================================================= * To add a new icon: - Place icon in "icons" folder - - Update CMakeLists.txt in the "icons" folder to include the new icon + - Update macos.cmake in the "icons" folder to include the new icon - Run the build, which regnerates the JUCE binary data file - Add a new LOAD_IMAGE macro for the new icon, using the icon's filename - Fetch your new icon with IconStore::getInstance().getNewIcon() diff --git a/rendererplugin/CMakeLists.txt b/rendererplugin/CMakeLists.txt index 198df951..d93eaf97 100644 --- a/rendererplugin/CMakeLists.txt +++ b/rendererplugin/CMakeLists.txt @@ -66,14 +66,6 @@ if (ECLIPSA_LOGIC_PRO_BUILD) target_compile_definitions(RendererPlugin PRIVATE ECLIPSA_LOGIC_PRO_BUILD=1) endif () -# Platform-specific settings -if (APPLE) - target_link_options(RendererPlugin - PUBLIC - "-Wl" - "-ld_classic") -endif () - target_include_directories(RendererPlugin PUBLIC "${BOOST_LIBRARY_INCLUDES}/include") target_link_libraries(RendererPlugin @@ -91,33 +83,6 @@ target_link_libraries(RendererPlugin juce::juce_recommended_warning_flags libzmq) -if (WIN32) - target_link_libraries(RendererPlugin PRIVATE delayimp) -endif () - -# Platform-specific Boost linking -if (WIN32) - # Windows: Boost headers only (lockfree is header-only) - target_include_directories(RendererPlugin PRIVATE ${Boost_INCLUDE_DIRS}) -else () - # macOS: Modern CMake target - target_link_libraries(RendererPlugin PRIVATE Boost::lockfree) -endif () - -# Windows-specific: Link ZLIB -if (WIN32) - find_package(ZLIB REQUIRED) - if (ZLIB_FOUND) - message(STATUS "Linking RendererPlugin against ZLIB: ${ZLIB_LIBRARIES}") - target_link_libraries(RendererPlugin PRIVATE ZLIB::ZLIB) - if (TARGET RendererPlugin_VST3) - target_link_libraries(RendererPlugin_VST3 PRIVATE ZLIB::ZLIB) - endif () - else () - message(FATAL_ERROR "ZLIB not found for RendererPlugin") - endif () -endif () - if (CI_TEST OR INTERNAL_TEST) target_link_libraries(RendererPlugin PRIVATE @@ -130,26 +95,12 @@ if (BUILD_AAX AND TARGET RendererPlugin_AAX) message(STATUS "AAX build detected. Setting up renderer plugin path and copying resources.") set(RENDERER_AAX_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/$/AAX/Eclipsa Audio Renderer.aaxplugin") copy_resources(RendererPlugin_AAX "${RENDERER_AAX_PATH}") - - # For builds on Windows, set up delay loading for DLLs - if (WIN32) - foreach (dll IN LISTS DELAYLOAD_DLLS) - target_link_options(RendererPlugin_AAX PRIVATE /DELAYLOAD:${dll}) - endforeach () - endif () endif () if (BUILD_VST3 AND TARGET RendererPlugin_VST3) message(STATUS "VST3 build detected. Setting up renderer plugin path and copying resources.") set(RENDERER_VST3_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/$/VST3/Eclipsa Audio Renderer.vst3") copy_resources(RendererPlugin_VST3 "${RENDERER_VST3_PATH}") - - # For builds on Windows, set up delay loading for DLLs - if (WIN32) - foreach (dll IN LISTS DELAYLOAD_DLLS) - target_link_options(RendererPlugin_VST3 PRIVATE /DELAYLOAD:${dll}) - endforeach () - endif () endif () if (CMAKE_BUILD_TYPE STREQUAL "Release" AND APPLE) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index d296cd44..068e0ce5 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -145,3 +145,70 @@ else () message(WARNING "protobuf_SOURCE_DIR not defined yet ΓÇö ensure FetchContent_MakeAvailable(protobuf) ran") endif () +# --- Imported Targets for Vendored Binaries --- +# We use the prefix "vendored_" to ensure we don't collide with +# any targets defined by add_subdirectory(). + +# 1. GPAC (renamed to vendored_gpac) +if (NOT TARGET vendored_gpac) + add_library(vendored_gpac SHARED IMPORTED GLOBAL) + if (APPLE) + set_target_properties(vendored_gpac PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/libgpac.dylib") + elseif (WIN32) + set_target_properties(vendored_gpac PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Release/libgpac.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Debug/libgpac.dll" + IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Release/libgpac.lib" + IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Debug/libgpac.lib" + ) + endif () +endif () + +# 2. IAMF Tools (renamed to vendored_iamf_tools) +if (NOT TARGET vendored_iamf_tools) + add_library(vendored_iamf_tools SHARED IMPORTED GLOBAL) + if (APPLE) + set_target_properties(vendored_iamf_tools PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/iamftools/lib/libiamf_tools.dylib") + elseif (WIN32) + set_target_properties(vendored_iamf_tools PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/iamftools/lib/Windows/Release/iamf_tools.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/iamftools/lib/Windows/Debug/iamf_tools.dll" + IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/iamftools/lib/Windows/Release/iamf_tools.lib" + IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/iamftools/lib/Windows/Debug/iamf_tools.lib" + ) + endif () +endif () + +# 3. OBR (Mac Only - renamed to vendored_obr) +if (APPLE AND NOT TARGET vendored_obr) + add_library(vendored_obr SHARED IMPORTED GLOBAL) + set_target_properties(vendored_obr PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/obr/lib/obr.dylib") +endif () + +# 4. Windows-Specific Helpers +if (WIN32) + if (NOT TARGET vendored_opensvc) + add_library(vendored_opensvc SHARED IMPORTED GLOBAL) + set_target_properties(vendored_opensvc PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/OpenSVC/lib/Windows/Release/OpenSVCDecoder.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/OpenSVC/lib/Windows/Debug/OpenSVCDecoder.dll" + ) + endif () + + if (NOT TARGET vendored_gpac_crypto) + add_library(vendored_gpac_crypto SHARED IMPORTED GLOBAL) + set_target_properties(vendored_gpac_crypto PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Release/libcryptoMD.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Debug/libcryptoMD.dll" + ) + endif () + + if (NOT TARGET vendored_gpac_ssl) + add_library(vendored_gpac_ssl SHARED IMPORTED GLOBAL) + set_target_properties(vendored_gpac_ssl PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Release/libsslMD.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Debug/libsslMD.dll" + ) + endif () +endif () + diff --git a/third_party/iamftools/scripts/update.sh b/third_party/iamftools/scripts/update.sh index 715c8b47..94348366 100755 --- a/third_party/iamftools/scripts/update.sh +++ b/third_party/iamftools/scripts/update.sh @@ -68,7 +68,7 @@ cp bazel-bin/iamf/include/iamf_tools/libiamf_tools.dylib "$DEST_LIB_DIR/" echo "Copying and updating proto files..." # Create proto directory if it doesn't exist mkdir -p "$DEST_PROTO_DIR" -# Save CMakeLists.txt if it exists +# Save macos.cmake if it exists if [ -f "$DEST_PROTO_DIR/CMakeLists.txt" ]; then CMAKELISTS_BACKUP=$(mktemp) cp "$DEST_PROTO_DIR/CMakeLists.txt" "$CMAKELISTS_BACKUP" @@ -83,7 +83,7 @@ for file in *.proto; do done # Copy the modified proto files to the final destination cp *.proto "$DEST_PROTO_DIR/" -# Restore CMakeLists.txt if it was backed up +# Restore macos.cmake if it was backed up if [ -f "$CMAKELISTS_BACKUP" ]; then cp "$CMAKELISTS_BACKUP" "$DEST_PROTO_DIR/CMakeLists.txt" rm "$CMAKELISTS_BACKUP" diff --git a/third_party/libiamf/CMakeLists.txt b/third_party/libiamf/CMakeLists.txt index ae2df931..8a4ebe47 100644 --- a/third_party/libiamf/CMakeLists.txt +++ b/third_party/libiamf/CMakeLists.txt @@ -27,104 +27,104 @@ set(HOA_BINAURALIZER OFF CACHE BOOL "Enable HOA binaural rendering" FORCE) # Fetch but don't build yet - we need to patch first FetchContent_GetProperties(libiamf) -if(NOT libiamf_POPULATED) - FetchContent_Populate(libiamf) - - # --- PATCH: Fix libiamf's CMakeLists.txt to remove GCC-only flags and m library on Windows - if(WIN32) - file(READ "${libiamf_SOURCE_DIR}/code/CMakeLists.txt" LIBIAMF_CMAKE_CONTENT) - string(REPLACE "-O3" "" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") - string(REPLACE "-Werror=unused-variable" "" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") - string(REGEX REPLACE "target_link_libraries\\([^)]*[ \t\n]+m[ \t\n)]+[^)]*\\)" "" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") - string(REPLACE " m)" ")" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") - string(REPLACE " m " " " LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") - string(REPLACE "option(BUILD_SHARED_LIBS \"Build shared library\" ON)" "option(BUILD_SHARED_LIBS \"Build shared library\" OFF)" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") - file(WRITE "${libiamf_SOURCE_DIR}/code/CMakeLists.txt" "${LIBIAMF_CMAKE_CONTENT}") - message(STATUS "Patched libiamf CMakeLists.txt to remove GCC-only flags and m library") - endif() - - # --- macOS vendor handling - if(APPLE) - set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") - file(REMOVE - "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libopus.a" - "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libfdk-aac.a" - "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libFLAC.a" - ) - file(COPY - "${VENDOR_LIB_PATH}/libopus.a" - "${VENDOR_LIB_PATH}/libFLAC.a" - "${VENDOR_LIB_PATH}/libfdk-aac.a" - "${VENDOR_LIB_PATH}/libogg.a" - DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" - ) - link_directories("${VENDOR_LIB_PATH}") - endif() - - # --- Windows vendor handling - if(WIN32) - message(STATUS "Using Windows codec libraries for IAMF") - - set(VENDOR_LIB_PATH_DEBUG "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Debug") - set(VENDOR_LIB_PATH_RELEASE "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Release") - - # Copy Debug libraries if they exist - if(EXISTS "${VENDOR_LIB_PATH_DEBUG}/fdk-aac.lib") - file(COPY - "${VENDOR_LIB_PATH_DEBUG}/fdk-aac.lib" - "${VENDOR_LIB_PATH_DEBUG}/FLAC.lib" - "${VENDOR_LIB_PATH_DEBUG}/opus.lib" - "${VENDOR_LIB_PATH_DEBUG}/ogg.lib" - DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" - ) - endif() - - # Copy Release libraries if they exist - if(EXISTS "${VENDOR_LIB_PATH_RELEASE}/fdk-aac.lib") - file(COPY - "${VENDOR_LIB_PATH_RELEASE}/fdk-aac.lib" - "${VENDOR_LIB_PATH_RELEASE}/FLAC.lib" - "${VENDOR_LIB_PATH_RELEASE}/opus.lib" - "${VENDOR_LIB_PATH_RELEASE}/ogg.lib" - DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" - ) - endif() - endif() - - - # --- Protobuf / Abseil injection (for Windows builds) - if(WIN32) - message(STATUS "Using Protobuf and Abseil targets from FetchContent") - endif() - - # --- NOW build libiamf (after patching) - add_subdirectory(${libiamf_SOURCE_DIR}/code ${libiamf_BINARY_DIR}) - - # --- PATCH: Remove Linux-only 'm' linkage (no libm on Windows) - if (WIN32 AND TARGET iamf) - message(STATUS "Patching libiamf: removing Linux-only 'm' linkage") - get_target_property(_iamf_libs iamf INTERFACE_LINK_LIBRARIES) - if (_iamf_libs) - list(REMOVE_ITEM _iamf_libs m) - set_target_properties(iamf PROPERTIES INTERFACE_LINK_LIBRARIES "${_iamf_libs}") - endif() - endif() - - # --- Windows codec linking (after target exists) - if(WIN32 AND TARGET iamf) - target_link_libraries(iamf - "${VENDOR_LIB_PATH}/fdk-aac.lib" - "${VENDOR_LIB_PATH}/FLAC.lib" - "${VENDOR_LIB_PATH}/opus.lib" - "${VENDOR_LIB_PATH}/ogg.lib" - ) - endif() -endif() +if (NOT libiamf_POPULATED) + FetchContent_Populate(libiamf) + + # --- PATCH: Fix libiamf's macos.cmake to remove GCC-only flags and m library on Windows + if (WIN32) + file(READ "${libiamf_SOURCE_DIR}/code/CMakeLists.txt" LIBIAMF_CMAKE_CONTENT) + string(REPLACE "-O3" "" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") + string(REPLACE "-Werror=unused-variable" "" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") + string(REGEX REPLACE "target_link_libraries\\([^)]*[ \t\n]+m[ \t\n)]+[^)]*\\)" "" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") + string(REPLACE " m)" ")" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") + string(REPLACE " m " " " LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") + string(REPLACE "option(BUILD_SHARED_LIBS \"Build shared library\" ON)" "option(BUILD_SHARED_LIBS \"Build shared library\" OFF)" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") + file(WRITE "${libiamf_SOURCE_DIR}/code/CMakeLists.txt" "${LIBIAMF_CMAKE_CONTENT}") + message(STATUS "Patched libiamf CMakeLists.txt to remove GCC-only flags and m library") + endif () + + # --- macOS vendor handling + if (APPLE) + set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") + file(REMOVE + "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libopus.a" + "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libfdk-aac.a" + "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libFLAC.a" + ) + file(COPY + "${VENDOR_LIB_PATH}/libopus.a" + "${VENDOR_LIB_PATH}/libFLAC.a" + "${VENDOR_LIB_PATH}/libfdk-aac.a" + "${VENDOR_LIB_PATH}/libogg.a" + DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" + ) + link_directories("${VENDOR_LIB_PATH}") + endif () + + # --- Windows vendor handling + if (WIN32) + message(STATUS "Using Windows codec libraries for IAMF") + + set(VENDOR_LIB_PATH_DEBUG "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Debug") + set(VENDOR_LIB_PATH_RELEASE "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Release") + + # Copy Debug libraries if they exist + if (EXISTS "${VENDOR_LIB_PATH_DEBUG}/fdk-aac.lib") + file(COPY + "${VENDOR_LIB_PATH_DEBUG}/fdk-aac.lib" + "${VENDOR_LIB_PATH_DEBUG}/FLAC.lib" + "${VENDOR_LIB_PATH_DEBUG}/opus.lib" + "${VENDOR_LIB_PATH_DEBUG}/ogg.lib" + DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" + ) + endif () + + # Copy Release libraries if they exist + if (EXISTS "${VENDOR_LIB_PATH_RELEASE}/fdk-aac.lib") + file(COPY + "${VENDOR_LIB_PATH_RELEASE}/fdk-aac.lib" + "${VENDOR_LIB_PATH_RELEASE}/FLAC.lib" + "${VENDOR_LIB_PATH_RELEASE}/opus.lib" + "${VENDOR_LIB_PATH_RELEASE}/ogg.lib" + DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" + ) + endif () + endif () + + + # --- Protobuf / Abseil injection (for Windows builds) + if (WIN32) + message(STATUS "Using Protobuf and Abseil targets from FetchContent") + endif () + + # --- NOW build libiamf (after patching) + add_subdirectory(${libiamf_SOURCE_DIR}/code ${libiamf_BINARY_DIR}) + + # --- PATCH: Remove Linux-only 'm' linkage (no libm on Windows) + if (WIN32 AND TARGET iamf) + message(STATUS "Patching libiamf: removing Linux-only 'm' linkage") + get_target_property(_iamf_libs iamf INTERFACE_LINK_LIBRARIES) + if (_iamf_libs) + list(REMOVE_ITEM _iamf_libs m) + set_target_properties(iamf PROPERTIES INTERFACE_LINK_LIBRARIES "${_iamf_libs}") + endif () + endif () + + # --- Windows codec linking (after target exists) + if (WIN32 AND TARGET iamf) + target_link_libraries(iamf + "${VENDOR_LIB_PATH}/fdk-aac.lib" + "${VENDOR_LIB_PATH}/FLAC.lib" + "${VENDOR_LIB_PATH}/opus.lib" + "${VENDOR_LIB_PATH}/ogg.lib" + ) + endif () +endif () # --- Extra linking for ogg -if(TARGET iamf) - target_link_libraries(iamf ogg) -endif() +if (TARGET iamf) + target_link_libraries(iamf ogg) +endif () # --- Include dirs (for iamfdec_utils) set(LIBIAMF_INCLUDE_DIRS @@ -144,29 +144,29 @@ set(LIBIAMF_INCLUDE_DIRS ) # --- Build iamfdec_utils (no main) -if(EXISTS "${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src") - set(IAMFDEC_UTIL_SOURCES - ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/dmemory.c - ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/iamf_header.c - ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/mp4demux.c - ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/mp4iamfpar.c - ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/vlogging_iamfmp4_sr.c - ) - - if(IAMFDEC_UTIL_SOURCES) - add_library(iamfdec_utils STATIC ${IAMFDEC_UTIL_SOURCES}) - target_include_directories(iamfdec_utils PUBLIC - ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/include - $ +if (EXISTS "${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src") + set(IAMFDEC_UTIL_SOURCES + ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/dmemory.c + ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/iamf_header.c + ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/mp4demux.c + ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/mp4iamfpar.c + ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/vlogging_iamfmp4_sr.c ) - target_include_directories(iamfdec_utils PRIVATE ${LIBIAMF_INCLUDE_DIRS}) - if(TARGET iamf) - target_link_libraries(iamfdec_utils PUBLIC iamf) - else() - message(WARNING "Core 'iamf' target not found for linking iamfdec_utils.") - endif() - message(STATUS "Created iamfdec_utils library (without main).") - endif() -endif() + + if (IAMFDEC_UTIL_SOURCES) + add_library(iamfdec_utils STATIC ${IAMFDEC_UTIL_SOURCES}) + target_include_directories(iamfdec_utils PUBLIC + ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/include + $ + ) + target_include_directories(iamfdec_utils PRIVATE ${LIBIAMF_INCLUDE_DIRS}) + if (TARGET iamf) + target_link_libraries(iamfdec_utils PUBLIC iamf) + else () + message(WARNING "Core 'iamf' target not found for linking iamfdec_utils.") + endif () + message(STATUS "Created iamfdec_utils library (without main).") + endif () +endif () message(STATUS "LIBIAMF source directory: ${libiamf_SOURCE_DIR}") \ No newline at end of file From 23eada8b0a897ada67a373323ea19925233516f6 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 3 Feb 2026 12:27:21 -0800 Subject: [PATCH 07/43] Added cmake function for setting plugin-specific JUCE values --- CMakeLists.txt | 1 + audioelementplugin/CMakeLists.txt | 10 ++-------- cmake/eclipsa_plugin_defaults.cmake | 25 +++++++++++++++++++++++++ rendererplugin/CMakeLists.txt | 10 ++-------- 4 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 cmake/eclipsa_plugin_defaults.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 77a07ea9..49d1bdfd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,6 +115,7 @@ endif () add_subdirectory(third_party) include("${CMAKE_SOURCE_DIR}/cmake/copy_resources.cmake") +include("${CMAKE_SOURCE_DIR}/cmake/eclipsa_plugin_defaults.cmake") if (BUILD_AAX) # Use find_path instead of hardcoded 'set' to allow user overrides diff --git a/audioelementplugin/CMakeLists.txt b/audioelementplugin/CMakeLists.txt index e0d27925..3ca8a318 100644 --- a/audioelementplugin/CMakeLists.txt +++ b/audioelementplugin/CMakeLists.txt @@ -44,22 +44,16 @@ target_sources(AudioElementPlugin src/screens/PositionSelectionScreen.cpp src/screens/TrackMonitorScreen.cpp) +eclipsa_plugin_defaults(AudioElementPlugin) + target_compile_definitions(AudioElementPlugin PUBLIC - JUCE_WEB_BROWSER=0 - JUCE_USE_CURL=0 - JUCE_VST3_CAN_REPLACE_VST2=0 - JUCE_SILENCE_XCODE_15_LINKER_WARNING - JUCE_ENABLE_LIVE_CONSTANT_EDITOR=1 JucePlugin_Category="Spatial") -# Add DAW-specific build flags when enabled if (ECLIPSA_LOGIC_PRO_BUILD) target_compile_definitions(AudioElementPlugin PRIVATE ECLIPSA_LOGIC_PRO_BUILD=1) endif () -target_include_directories(AudioElementPlugin PUBLIC "${BOOST_LIBRARY_INCLUDES}/include") - target_link_libraries(AudioElementPlugin PRIVATE substream_rdr diff --git a/cmake/eclipsa_plugin_defaults.cmake b/cmake/eclipsa_plugin_defaults.cmake new file mode 100644 index 00000000..1a577b75 --- /dev/null +++ b/cmake/eclipsa_plugin_defaults.cmake @@ -0,0 +1,25 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +function(eclipsa_plugin_defaults target) + target_compile_definitions(${target} + PUBLIC + JUCE_WEB_BROWSER=0 + JUCE_USE_CURL=0 + JUCE_VST3_CAN_REPLACE_VST2=0 + JUCE_SILENCE_XCODE_15_LINKER_WARNING + JUCE_ENABLE_LIVE_CONSTANT_EDITOR=1) + + target_include_directories(${target} PUBLIC "${BOOST_LIBRARY_INCLUDES}/include") +endfunction() \ No newline at end of file diff --git a/rendererplugin/CMakeLists.txt b/rendererplugin/CMakeLists.txt index d93eaf97..34f5b170 100644 --- a/rendererplugin/CMakeLists.txt +++ b/rendererplugin/CMakeLists.txt @@ -51,23 +51,17 @@ target_sources(RendererPlugin src/screens/mix_tabs/PresentationEditorViewPort.cpp src/screens/MixPresentationTagScreen.cpp) +eclipsa_plugin_defaults(RendererPlugin) + target_compile_definitions(RendererPlugin PUBLIC - JUCE_WEB_BROWSER=0 - JUCE_USE_CURL=0 - JUCE_VST3_CAN_REPLACE_VST2=0 - JUCE_SILENCE_XCODE_15_LINKER_WARNING - JUCE_ENABLE_LIVE_CONSTANT_EDITOR=1 JucePlugin_IsSynth=1 JucePlugin_Category="Synth") -# Add DAW-specific build flags when enabled if (ECLIPSA_LOGIC_PRO_BUILD) target_compile_definitions(RendererPlugin PRIVATE ECLIPSA_LOGIC_PRO_BUILD=1) endif () -target_include_directories(RendererPlugin PUBLIC "${BOOST_LIBRARY_INCLUDES}/include") - target_link_libraries(RendererPlugin PRIVATE binary_data From f46e8732ed37bf63e03d6313751c804b3b17285b Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 3 Feb 2026 13:36:09 -0800 Subject: [PATCH 08/43] Organized root-level cmake --- CMakeLists.txt | 73 ++++++++++++++++++++++++---------- cmake/toolchains/macos.cmake | 8 +++- cmake/toolchains/windows.cmake | 5 +++ common/CMakeLists.txt | 28 ++++--------- third_party/CMakeLists.txt | 23 ++++------- 5 files changed, 77 insertions(+), 60 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49d1bdfd..a4539b78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,25 +14,29 @@ cmake_minimum_required(VERSION 3.30.0) +#==================================================================== +#Cmake Policies +#==================================================================== +cmake_policy(SET CMP0167 NEW) +cmake_policy(SET CMP0077 NEW) +cmake_policy(SET CMP0169 OLD) + +#==================================================================== # Disable vcpkg from finding Boost and Protobuf (provided by libiamf) +#==================================================================== set(CMAKE_DISABLE_FIND_PACKAGE_Boost ON CACHE BOOL "" FORCE) set(CMAKE_DISABLE_FIND_PACKAGE_Protobuf ON CACHE BOOL "" FORCE) +#==================================================================== # Clear any cached Protobuf references +#==================================================================== unset(Protobuf_INCLUDE_DIRS CACHE) unset(Protobuf_LIBRARIES CACHE) unset(Protobuf_DIR CACHE) unset(Protobuf_FOUND CACHE) unset(Protobuf_PROTOC_EXECUTABLE CACHE) -cmake_policy(SET CMP0167 NEW) -cmake_policy(SET CMP0077 NEW) -cmake_policy(SET CMP0169 OLD) -set(CMAKE_CXX_EXTENSIONS OFF) - -# Configure release or debug builds -set(BUILD_LIB_DIR "$,Debug,Release>") - +#==================================================================== # Version configuration # The version can be set in multiple ways (in order of precedence): # 1. Pass via command line: cmake -DECLIPSA_VERSION=1.2.3 ... @@ -45,44 +49,58 @@ set(BUILD_LIB_DIR "$,Debug,Release>") # - Or extract from git tag in your build script and pass it to CMake # # The version appears as a watermark in the bottom-left corner of both plugins. +#==================================================================== if (NOT DEFINED ECLIPSA_VERSION) set(ECLIPSA_VERSION "0.0.1" CACHE STRING "Version for Eclipsa project") endif () project(Eclipsa LANGUAGES C CXX VERSION ${ECLIPSA_VERSION}) +#==================================================================== +# Compiler Settings +#==================================================================== +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +#==================================================================== +# Build Configuration +#==================================================================== +set(BUILD_LIB_DIR "$,Debug,Release>") add_compile_definitions(ECLIPSA_VERSION="${ECLIPSA_VERSION}") +#==================================================================== +# Plugin Naming +#==================================================================== # Make company name configurable via command line with a default value if (NOT DEFINED ECLIPSA_COMPANY_NAME) set(ECLIPSA_COMPANY_NAME "Eclipsa Project" CACHE STRING "Company name for Eclipsa project") endif () - # Make manufacturer code configurable via command line with a default value if (NOT DEFINED ECLIPSA_MANUFACTURER_CODE) set(ECLIPSA_MANUFACTURER_CODE "Eclp" CACHE STRING "Manufacturer code for Eclipsa project") endif () - # Make bundle IDs configurable via command line with default values if (NOT DEFINED ECLIPSA_RENDERER_BUNDLE_ID) set(ECLIPSA_RENDERER_BUNDLE_ID "com.eclipsaproject.renderer" CACHE STRING "Bundle ID for the renderer plugin") endif () - if (NOT DEFINED ECLIPSA_PANNER_BUNDLE_ID) set(ECLIPSA_PANNER_BUNDLE_ID "com.eclipsaproject.panner" CACHE STRING "Bundle ID for the panner plugin") endif () +#==================================================================== +# Build Options +#==================================================================== # Build configuration for different DAW targets option(ECLIPSA_LOGIC_PRO_BUILD "Build AU plugin optimized for Logic Pro (7.1.4 layout)" OFF) - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - option(INTERNAL_TEST OFF) option(CI_TEST OFF) option(JUCE_COPY_PLUGIN_AFTER_BUILD "Automatically copy built plugins to standard locations after build" ON) +#==================================================================== +# Testing +#==================================================================== if (CI_TEST OR INTERNAL_TEST) message(STATUS "Unit tests enabled") include(FetchContent) @@ -112,11 +130,20 @@ if (CI_TEST OR INTERNAL_TEST) endif () endif () -add_subdirectory(third_party) - +#==================================================================== +# Cmake Functions +#==================================================================== include("${CMAKE_SOURCE_DIR}/cmake/copy_resources.cmake") include("${CMAKE_SOURCE_DIR}/cmake/eclipsa_plugin_defaults.cmake") +#==================================================================== +# Dependencies +#==================================================================== +add_subdirectory(third_party) + +#==================================================================== +# AAX Setup +#==================================================================== if (BUILD_AAX) # Use find_path instead of hardcoded 'set' to allow user overrides find_path(AAX_SDK_ROOT @@ -133,14 +160,16 @@ if (BUILD_AAX) endif () endif () -if (BUILD_VST3) - list(APPEND PLUGIN_FORMATS "VST3") -endif () - +#==================================================================== +# Add Sub Directories +#==================================================================== add_subdirectory(common) add_subdirectory(rendererplugin) add_subdirectory(audioelementplugin) +#==================================================================== +# Testing #2 +#==================================================================== if (CI_TEST OR INTERNAL_TEST) eclipsa_build_tests() endif () \ No newline at end of file diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index d40e5658..4a1474bc 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -37,4 +37,10 @@ set(PLUGIN_FORMATS "${_MAC_DEFAULT_FORMATS}" CACHE STRING "Target plugin formats set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos" CACHE INTERNAL "") # Xcode 15+ classic linker (avoids duplicate symbol warnings) -add_link_options("-Wl,-ld_classic") \ No newline at end of file +add_link_options("-Wl,-ld_classic") + +set(IAMF_LIB_NAME "libiamf" CACHE STRING "") + +if (BUILD_VST3) + list(APPEND _DEFAULT_FORMATS "VST3") +endif () \ No newline at end of file diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index 3df4dd41..5e98f6c7 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -80,3 +80,8 @@ set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} CACHE INTERNAL "ZLIB libraries for Windows" link_libraries(ZLIB::ZLIB) link_libraries(delayimp) +set(IAMF_LIB_NAME "iamf" CACHE STRING "") + +if (BUILD_VST3) + list(APPEND _DEFAULT_FORMATS "VST3") +endif () diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 35b0716a..7bc1b07c 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -125,27 +125,13 @@ target_link_libraries(player INTERFACE processors substream_rdr) target_link_libraries(components INTERFACE binary_data libear substream_rdr processors data_structures data_repository player) -if (WIN32) - message(STATUS "Linking logger against Boost via CMake targets") - - target_link_libraries(logger INTERFACE - Boost::log - Boost::log_setup - Boost::filesystem - Boost::thread - Boost::system - juce::juce_core - ) - -else () - target_link_libraries(logger INTERFACE - Boost::log - Boost::log_setup - Boost::thread - Boost::filesystem - juce::juce_core - ) -endif () +target_link_libraries(logger INTERFACE + Boost::log + Boost::log_setup + Boost::filesystem + Boost::thread + juce::juce_core +) get_target_property(SUBSTREAM_INCLUDES substream_rdr INTERFACE_INCLUDE_DIRECTORIES) message(STATUS "substream_rdr include paths: ${SUBSTREAM_INCLUDES}") diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 068e0ce5..73dd4d8f 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -11,12 +11,6 @@ include(FetchContent) -# After FetchContent_MakeAvailable(protobuf) -set(Protobuf_INCLUDE_DIRS "${protobuf_SOURCE_DIR}/src" CACHE PATH "" FORCE) -set(Protobuf_LIBRARIES "${protobuf_BINARY_DIR}/libprotobuf.lib" CACHE STRING "" FORCE) -set(Protobuf_PROTOC_EXECUTABLE "${protobuf_BINARY_DIR}/protoc" CACHE FILEPATH "" FORCE) -set(Protobuf_DIR "${protobuf_BINARY_DIR}/cmake" CACHE PATH "" FORCE) - # Force static linking for all third-party dependencies set(BUILD_SHARED_LIBS OFF) #JUCE for plugin development. @@ -35,22 +29,15 @@ include("${CMAKE_SOURCE_DIR}/cmake/zeromq.cmake") #LibIAMF for audio file import. add_subdirectory(libiamf) -#Ensure IAMF library is found and named correctly +# IAMF library directory (platform-specific structure) if (WIN32) - # MSVC builds iamf.lib (no 'lib' prefix) - set(IAMF_LIB_NAME iamf) set(IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build/$") else () - # UNIX builds libiamf.a - set(IAMF_LIB_NAME libiamf) set(IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build") endif () # Make sure all subprojects can find it link_directories(${IAMF_LIB_DIR}) - -# Export variables globally so modules can use ${IAMF_LIB_NAME} -set(IAMF_LIB_NAME ${IAMF_LIB_NAME} CACHE STRING "IAMF library name") set(IAMF_LIB_DIR ${IAMF_LIB_DIR} CACHE STRING "IAMF library directory") #Override some of the SAF variables @@ -138,11 +125,15 @@ endif () if (DEFINED protobuf_SOURCE_DIR AND DEFINED protobuf_BINARY_DIR) message(STATUS "Overriding Protobuf include/lib paths with fetched version") set(Protobuf_INCLUDE_DIRS "${protobuf_SOURCE_DIR}/src" CACHE PATH "" FORCE) - set(Protobuf_LIBRARIES "${protobuf_BINARY_DIR}/libprotobuf.lib" CACHE STRING "" FORCE) + if (WIN32) + set(Protobuf_LIBRARIES "${protobuf_BINARY_DIR}/libprotobuf.lib" CACHE STRING "" FORCE) + else () + set(Protobuf_LIBRARIES "${protobuf_BINARY_DIR}/libprotobuf.a" CACHE STRING "" FORCE) + endif () set(Protobuf_PROTOC_EXECUTABLE "${protobuf_BINARY_DIR}/protoc" CACHE FILEPATH "" FORCE) set(Protobuf_DIR "${protobuf_BINARY_DIR}/cmake" CACHE PATH "" FORCE) else () - message(WARNING "protobuf_SOURCE_DIR not defined yet ΓÇö ensure FetchContent_MakeAvailable(protobuf) ran") + message(WARNING "protobuf_SOURCE_DIR not defined yet — ensure FetchContent_MakeAvailable(protobuf) ran") endif () # --- Imported Targets for Vendored Binaries --- From c17a36aed9099c9aff8d854ec107677b6e29f79d Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 3 Feb 2026 13:55:40 -0800 Subject: [PATCH 09/43] Formatted root-level cmake and windows toolchain --- cmake/toolchains/windows.cmake | 68 ++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index 5e98f6c7..ac802402 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -12,25 +12,54 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Include guard +#==================================================================== +#Include Guard +#==================================================================== if (DEFINED _WINDOWS_TOOLCHAIN_INCLUDED) return() endif () - set(_WINDOWS_TOOLCHAIN_INCLUDED TRUE) -# Math constants -add_compile_definitions(_USE_MATH_DEFINES) +#==================================================================== +#Plugin Formats +#==================================================================== +set(_DEFAULT_FORMATS "Standalone") + +if (BUILD_AAX) + set(AAX_SDK_VER "2-8-1" CACHE STRING "AAX SDK Version") + list(APPEND _DEFAULT_FORMATS "AAX") + set(AAX_SDK_SEARCH_HINT "C:/Code/Repos/aax-sdk-${AAX_SDK_VER}" CACHE INTERNAL "") +endif () +if (BUILD_VST3) + list(APPEND _DEFAULT_FORMATS "VST3") +endif () + +set(PLUGIN_FORMATS "${_DEFAULT_FORMATS}" CACHE STRING "Target plugin formats") + +#==================================================================== +#Compiler Settings +#==================================================================== +add_compile_definitions(_USE_MATH_DEFINES) # Reduce optimization to avoid MSVC compiler crash on SAF set(CMAKE_C_FLAGS_RELEASE "/O1 /MD /DNDEBUG" CACHE STRING "" FORCE) -# Resource compiler fallback +#==================================================================== +# Library Names (platform-specific) +#==================================================================== +set(IAMF_LIB_NAME "iamf" CACHE STRING "") + +#==================================================================== +# Resource Compiler +#==================================================================== if (NOT CMAKE_RC_COMPILER) find_program(CMAKE_RC_COMPILER rc.exe HINTS "C:/Program Files (x86)/Windows Kits/10/bin/*/x64") endif () +#==================================================================== +# VCPKG +#==================================================================== # Disable automatic DLL copying (we handle this manually) set(X_VCPKG_APPLOCAL_DEPS_INSTALL OFF CACHE BOOL "") @@ -57,31 +86,14 @@ else () message(WARNING "vcpkg not configured. Set VCPKG_ROOT environment variable or pass -DVCPKG_ROOT=") endif () -# Initialize the base formats -set(_DEFAULT_FORMATS "Standalone") - -if (BUILD_AAX) - set(AAX_SDK_VER "2-8-1" CACHE STRING "AAX SDK Version") - list(APPEND _DEFAULT_FORMATS "AAX") - set(AAX_SDK_SEARCH_HINT "C:/Code/Repos/aax-sdk-${AAX_SDK_VER}" CACHE INTERNAL "") -endif () - -# Finalize the list into the CACHE so the project can see it -set(PLUGIN_FORMATS "${_DEFAULT_FORMATS}" CACHE STRING "Target plugin formats") - -# --- ZLIB Configuration --- +#==================================================================== +# Dependencies +#==================================================================== find_package(ZLIB REQUIRED) - -# We use a CACHE variable to store the library path/target -# so the rest of the project can access it easily. set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} CACHE INTERNAL "ZLIB libraries for Windows") -# If you REALLY want every single target to link ZLIB automatically: +#==================================================================== +# Link Libraries +#==================================================================== link_libraries(ZLIB::ZLIB) link_libraries(delayimp) - -set(IAMF_LIB_NAME "iamf" CACHE STRING "") - -if (BUILD_VST3) - list(APPEND _DEFAULT_FORMATS "VST3") -endif () From 6b270a729b678a89d3e1d2f005ed1f35e2027633 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Wed, 4 Feb 2026 11:10:36 -0800 Subject: [PATCH 10/43] Ready to clean up copy_resources --- audioelementplugin/CMakeLists.txt | 6 +++ cmake/copy_resources.cmake | 16 ++---- cmake/deploy_runtime_deps.cmake | 84 +++++++++++++++++++++++++++++++ cmake/toolchains/windows.cmake | 1 + rendererplugin/CMakeLists.txt | 6 +++ third_party/CMakeLists.txt | 21 ++++---- 6 files changed, 114 insertions(+), 20 deletions(-) create mode 100644 cmake/deploy_runtime_deps.cmake diff --git a/audioelementplugin/CMakeLists.txt b/audioelementplugin/CMakeLists.txt index 3ca8a318..c34e72ad 100644 --- a/audioelementplugin/CMakeLists.txt +++ b/audioelementplugin/CMakeLists.txt @@ -71,6 +71,12 @@ if (CI_TEST OR INTERNAL_TEST) add_subdirectory(test) endif () +#include("${CMAKE_SOURCE_DIR}/cmake/deploy_runtime_deps.cmake") +# +#if (TARGET AudioElementPlugin_VST3) +# deploy_runtime_deps(AudioElementPlugin_VST3) +#endif () + # Copy resources for each plugin format if (BUILD_AAX AND TARGET AudioElementPlugin_AAX) message(STATUS "AAX build detected. Setting up audio element plugin path and copying resources.") diff --git a/cmake/copy_resources.cmake b/cmake/copy_resources.cmake index 6676a06e..b059150b 100644 --- a/cmake/copy_resources.cmake +++ b/cmake/copy_resources.cmake @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to add writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -42,7 +42,6 @@ function(copy_resources target plugin_path) target_link_options(${target} PRIVATE "/DELAYLOAD:$" "/DELAYLOAD:$" - "/DELAYLOAD:$" "/DELAYLOAD:$" "/DELAYLOAD:$" "/DELAYLOAD:$" @@ -65,7 +64,6 @@ function(copy_resources target plugin_path) # B. Windows-Only Commands if (WIN32) list(APPEND COPY_COMMANDS - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" ) @@ -79,15 +77,12 @@ function(copy_resources target plugin_path) ) endif () - # Apply the aggregated commands - add_custom_command(TARGET ${target} POST_BUILD - ${COPY_COMMANDS} - COMMENT "Deploying resources to ${DEST_ROOT}" - ) + add_custom_command(TARGET ${target} PRE_BUILD ${COPY_COMMANDS}) + # --- 4. macOS ZMQ Symlinks --- if (APPLE) - add_custom_command(TARGET ${target} POST_BUILD + add_custom_command(TARGET ${target} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink "$" "${DEST_ROOT}/libzmq.5.dylib" COMMAND ${CMAKE_COMMAND} -E create_symlink "libzmq.5.dylib" "${DEST_ROOT}/libzmq.dylib" ) @@ -96,12 +91,11 @@ function(copy_resources target plugin_path) # --- 5. Helper Tool Copy (Windows Only) --- if (WIN32) set(VST3_SIGNING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${BUILD_LIB_DIR}") - add_custom_command(TARGET ${target} POST_BUILD + add_custom_command(TARGET ${target} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${VST3_SIGNING_DIR}" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" ) diff --git a/cmake/deploy_runtime_deps.cmake b/cmake/deploy_runtime_deps.cmake new file mode 100644 index 00000000..a9be3f94 --- /dev/null +++ b/cmake/deploy_runtime_deps.cmake @@ -0,0 +1,84 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +function(deploy_runtime_deps target) + + if (APPLE) + set(DEST_ROOT "$/Resources") + set(DEST_IAMF "${DEST_ROOT}/third_party/iamftools/lib") + set(DEST_GPAC "${DEST_ROOT}/third_party/gpac/lib") + set(DEST_OBR "${DEST_ROOT}/third_party/obr/lib") + elseif (WIN32) + # Mirror your existing layout logic, but anchored to the real target output dir + # JUCE often outputs .../Eclipsa Audio Element Plugin.vst3/Contents/x86_64-win + # so we *derive* the correct folder rather than hardcoding the artefacts path. + set(_BASE "$") + + # Your old logic used target name suffixes; keep that just for the destination + if ("${target}" MATCHES ".*_VST3$") + set(DEST_ROOT "${_BASE}/Contents/x86_64-win") + elseif ("${target}" MATCHES ".*_AAX$") + set(DEST_ROOT "${_BASE}/Contents/x64") + elseif ("${target}" MATCHES ".*_Standalone$") + set(DEST_ROOT "${_BASE}") + else () + set(DEST_ROOT "${_BASE}") + endif () + + set(DEST_IAMF "${DEST_ROOT}") + set(DEST_GPAC "${DEST_ROOT}") + endif () + + # Delay-load flags stay (Windows only) + if (WIN32) + target_link_options(${target} PRIVATE + "/DELAYLOAD:$" + "/DELAYLOAD:$" + "/DELAYLOAD:$" + "/DELAYLOAD:$" + "/DELAYLOAD:$" + "/DELAYLOAD:$" + ) + endif () + + # Copy deps + add_custom_command(TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_IAMF}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_GPAC}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_GPAC}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_IAMF}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" + COMMENT "Deploying runtime deps to ${target}" + ) + + if (WIN32) + add_custom_command(TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" + ) + endif () + + if (APPLE) + add_custom_command(TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_OBR}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_OBR}/" + COMMAND ${CMAKE_COMMAND} -E create_symlink "$" "${DEST_ROOT}/libzmq.5.dylib" + COMMAND ${CMAKE_COMMAND} -E create_symlink "libzmq.5.dylib" "${DEST_ROOT}/libzmq.dylib" + ) + endif () + +endfunction() + diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index ac802402..c5941eb7 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -97,3 +97,4 @@ set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} CACHE INTERNAL "ZLIB libraries for Windows" #==================================================================== link_libraries(ZLIB::ZLIB) link_libraries(delayimp) + diff --git a/rendererplugin/CMakeLists.txt b/rendererplugin/CMakeLists.txt index 34f5b170..1b54502f 100644 --- a/rendererplugin/CMakeLists.txt +++ b/rendererplugin/CMakeLists.txt @@ -84,6 +84,12 @@ if (CI_TEST OR INTERNAL_TEST) add_subdirectory(test) endif () +#include("${CMAKE_SOURCE_DIR}/cmake/deploy_runtime_deps.cmake") +# +#if (TARGET RendererPlugin) +# deploy_runtime_deps(RendererPlugin_VST3) +#endif () + # Copy resources for each plugin format if (BUILD_AAX AND TARGET RendererPlugin_AAX) message(STATUS "AAX build detected. Setting up renderer plugin path and copying resources.") diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 73dd4d8f..6abeaea5 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -13,11 +13,13 @@ include(FetchContent) # Force static linking for all third-party dependencies set(BUILD_SHARED_LIBS OFF) +#==================================================================== +# Add Dependencies +#==================================================================== #JUCE for plugin development. add_subdirectory(JUCE) #IAMF for IAMF file export. add_subdirectory(iamftools) - # lib open binaural renderer for panning via ambisonics and binaural rendering. add_subdirectory(obr) # Libear for loudness rendering. @@ -29,24 +31,27 @@ include("${CMAKE_SOURCE_DIR}/cmake/zeromq.cmake") #LibIAMF for audio file import. add_subdirectory(libiamf) +#==================================================================== # IAMF library directory (platform-specific structure) +#==================================================================== if (WIN32) set(IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build/$") else () set(IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build") endif () - # Make sure all subprojects can find it link_directories(${IAMF_LIB_DIR}) set(IAMF_LIB_DIR ${IAMF_LIB_DIR} CACHE STRING "IAMF library directory") +#==================================================================== +#Spatial Audio Framework #Override some of the SAF variables #Unit tests for SAF have been tested and they pass, confirming the SAF library is working as expected. # Manually set the SAF_PERFORMANCE_LIB variables for each platform +#==================================================================== set(SAF_BUILD_TESTS 0 CACHE BOOL "" FORCE) set(SAF_BUILD_EXAMPLES 1 CACHE BOOL "" FORCE) set(saf_example_list ambi_dec CACHE STRING "" FORCE) - # Default performance library (fallback) set(SAF_PERFORMANCE_LIB "SAF_USE_OPEN_BLAS_AND_LAPACKE") @@ -136,10 +141,9 @@ else () message(WARNING "protobuf_SOURCE_DIR not defined yet — ensure FetchContent_MakeAvailable(protobuf) ran") endif () -# --- Imported Targets for Vendored Binaries --- -# We use the prefix "vendored_" to ensure we don't collide with -# any targets defined by add_subdirectory(). - +#==================================================================== +# Imported Targets +#==================================================================== # 1. GPAC (renamed to vendored_gpac) if (NOT TARGET vendored_gpac) add_library(vendored_gpac SHARED IMPORTED GLOBAL) @@ -201,5 +205,4 @@ if (WIN32) IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Debug/libsslMD.dll" ) endif () -endif () - +endif () \ No newline at end of file From 331d8a4aebe086db27fd36e21d56cbfd893aa2e0 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Wed, 4 Feb 2026 12:57:38 -0800 Subject: [PATCH 11/43] Cleaned up copy resources --- cmake/copy_resources.cmake | 83 +++++++++++++++++++----------------- cmake/toolchains/macos.cmake | 3 +- third_party/CMakeLists.txt | 2 - 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/cmake/copy_resources.cmake b/cmake/copy_resources.cmake index b059150b..a82135e0 100644 --- a/cmake/copy_resources.cmake +++ b/cmake/copy_resources.cmake @@ -14,13 +14,28 @@ function(copy_resources target plugin_path) - # --- 1. Define Destinations --- + # ========================================================================= + # Common Dependency List Between Mac and Windows + # ========================================================================= + set(COMMON_DEPS vendored_gpac + vendored_iamf_tools + libzmq + ) + # ========================================================================= + # Platform-Specific Configurations + # ========================================================================= if (APPLE) + set(PLATFORM_DEPS vendored_obr) set(DEST_ROOT "${plugin_path}/Contents/Resources") set(DEST_IAMF "${DEST_ROOT}/third_party/iamftools/lib") set(DEST_OBR "${DEST_ROOT}/third_party/obr/lib") set(DEST_GPAC "${DEST_ROOT}/third_party/gpac/lib") + elseif (WIN32) + set(PLATFORM_DEPS vendored_gpac_crypto + vendored_gpac_ssl + ) + if ("${target}" MATCHES ".*_VST3$") set(DEST_ROOT "${plugin_path}/Contents/x86_64-win") elseif ("${target}" MATCHES ".*_AAX$") @@ -34,24 +49,13 @@ function(copy_resources target plugin_path) set(DEST_IAMF "${DEST_ROOT}") set(DEST_GPAC "${DEST_ROOT}") - # DEST_OBR is not needed on Windows endif () - # --- 2. Windows: Apply Delay Load Flags --- - if (WIN32) - target_link_options(${target} PRIVATE - "/DELAYLOAD:$" - "/DELAYLOAD:$" - "/DELAYLOAD:$" - "/DELAYLOAD:$" - "/DELAYLOAD:$" - ) - set(DELAYLOAD_DLLS "" PARENT_SCOPE) - endif () - - # --- 3. Copy Commands (Grouped by Platform to avoid evaluation crashes) --- + set(ALL_DEPS ${COMMON_DEPS} ${PLATFORM_DEPS}) - # A. Commands Common to BOTH platforms + # ========================================================================= + # Copy Commands for Common Libs + # ========================================================================= set(COPY_COMMANDS COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}" COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_IAMF}" @@ -61,43 +65,46 @@ function(copy_resources target plugin_path) COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" ) - # B. Windows-Only Commands - if (WIN32) - list(APPEND COPY_COMMANDS - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" - ) - endif () - - # C. Mac-Only Commands + # ========================================================================= + # Copy Commands for Platforms + # ========================================================================= if (APPLE) list(APPEND COPY_COMMANDS COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_OBR}" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_OBR}/" ) + elseif (WIN32) + foreach (_dep IN LISTS PLATFORM_DEPS) + list(APPEND COPY_COMMANDS + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/") + endforeach () endif () add_custom_command(TARGET ${target} PRE_BUILD ${COPY_COMMANDS}) - - # --- 4. macOS ZMQ Symlinks --- + # ========================================================================= + # Platform-Specific Post-Processing + # ========================================================================= if (APPLE) + # ZMQ symlinks add_custom_command(TARGET ${target} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink "$" "${DEST_ROOT}/libzmq.5.dylib" COMMAND ${CMAKE_COMMAND} -E create_symlink "libzmq.5.dylib" "${DEST_ROOT}/libzmq.dylib" ) - endif () - # --- 5. Helper Tool Copy (Windows Only) --- - if (WIN32) + elseif (WIN32) + # DELAYLOAD flags + foreach (_dep IN LISTS ALL_DEPS) + target_link_options(${target} PRIVATE "/DELAYLOAD:$") + endforeach () + + # Signing dir copy (for JUCE VST3 validator) set(VST3_SIGNING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${BUILD_LIB_DIR}") - add_custom_command(TARGET ${target} PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory "${VST3_SIGNING_DIR}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/" - ) + set(SIGNING_COMMANDS COMMAND ${CMAKE_COMMAND} -E make_directory "${VST3_SIGNING_DIR}") + foreach (_dep IN LISTS ALL_DEPS) + list(APPEND SIGNING_COMMANDS + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/") + endforeach () + add_custom_command(TARGET ${target} PRE_BUILD ${SIGNING_COMMANDS}) endif () endfunction() \ No newline at end of file diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index 4a1474bc..f7c42ffd 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -43,4 +43,5 @@ set(IAMF_LIB_NAME "libiamf" CACHE STRING "") if (BUILD_VST3) list(APPEND _DEFAULT_FORMATS "VST3") -endif () \ No newline at end of file +endif () + diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 6abeaea5..d8b8081a 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -95,8 +95,6 @@ elseif (WIN32) endif () endforeach () endif () -else () - message(SEND_ERROR "SAF: Using OpenBLAS/LAPACKE (default)") endif () # Build SAF from source on all platforms From e43b69f2bfc047b8edef3028128ed9a6e82706dc Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Wed, 4 Feb 2026 14:42:38 -0800 Subject: [PATCH 12/43] Moving to mac toolchain setup --- CMakeLists.txt | 51 ++++++++++++++++++-- audioelementplugin/CMakeLists.txt | 66 +++++++++++--------------- cmake/copy_resources.cmake | 17 +++---- cmake/toolchains/macos.cmake | 45 +++++++++--------- cmake/toolchains/windows.cmake | 11 +---- common/CMakeLists.txt | 78 ++++++++++++++++--------------- rendererplugin/CMakeLists.txt | 67 +++++++++++--------------- third_party/CMakeLists.txt | 16 ++----- 8 files changed, 177 insertions(+), 174 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4539b78..bfcd2ab2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,21 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_EXTENSIONS OFF) +#==================================================================== +# Plugin Formats +#==================================================================== +set(ECLIPSA_PLUGIN_FORMATS Standalone) + +if (BUILD_VST3) + list(APPEND ECLIPSA_PLUGIN_FORMATS VST3) +endif () +if (APPLE) + list(APPEND ECLIPSA_PLUGIN_FORMATS AU) +endif () +if (BUILD_AAX) + list(APPEND ECLIPSA_PLUGIN_FORMATS AAX) +endif () + #==================================================================== # Build Configuration #==================================================================== @@ -92,7 +107,6 @@ endif () #==================================================================== # Build Options #==================================================================== -# Build configuration for different DAW targets option(ECLIPSA_LOGIC_PRO_BUILD "Build AU plugin optimized for Logic Pro (7.1.4 layout)" OFF) option(INTERNAL_TEST OFF) option(CI_TEST OFF) @@ -145,9 +159,8 @@ add_subdirectory(third_party) # AAX Setup #==================================================================== if (BUILD_AAX) - # Use find_path instead of hardcoded 'set' to allow user overrides find_path(AAX_SDK_ROOT - NAMES "Interfaces/AAX_Exports.cpp" # A file known to be in the SDK + NAMES "Interfaces/AAX_Exports.cpp" HINTS "${AAX_SDK_SEARCH_HINT}" DOC "Path to AAX SDK" ) @@ -167,6 +180,38 @@ add_subdirectory(common) add_subdirectory(rendererplugin) add_subdirectory(audioelementplugin) +#==================================================================== +# Dependency List +#==================================================================== +add_library(eclipsa_dependencies INTERFACE) + +target_link_libraries(eclipsa_dependencies INTERFACE + # Vendored shared libs + vendored_gpac + vendored_iamf_tools + libzmq + + # Static libs from third_party + saf + Libear + LUFSMeter + spatialaudiolib + ${IAMF_LIB_NAME} +) + +if (APPLE) + target_link_libraries(eclipsa_dependencies INTERFACE + vendored_obr + ) +elseif (WIN32) + target_link_libraries(eclipsa_dependencies INTERFACE + vendored_gpac_crypto + vendored_gpac_ssl + ZLIB::ZLIB + delayimp + ) +endif () + #==================================================================== # Testing #2 #==================================================================== diff --git a/audioelementplugin/CMakeLists.txt b/audioelementplugin/CMakeLists.txt index c34e72ad..47c5a580 100644 --- a/audioelementplugin/CMakeLists.txt +++ b/audioelementplugin/CMakeLists.txt @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +#==================================================================== # Set plugin code and name based on build type +#==================================================================== if (ECLIPSA_LOGIC_PRO_BUILD) set(AUDIO_ELEMENT_PLUGIN_CODE "Eacl") set(AUDIO_ELEMENT_PRODUCT_NAME "Eclipsa Audio Element Plugin for Logic Pro") @@ -31,7 +33,7 @@ juce_add_plugin(AudioElementPlugin IS_MIDI_EFFECT FALSE EDITOR_WANTS_KEYBOARD_FOCUS FALSE COPY_PLUGIN_AFTER_BUILD ${JUCE_COPY_PLUGIN_AFTER_BUILD} - FORMATS ${PLUGIN_FORMATS} + FORMATS ${ECLIPSA_PLUGIN_FORMATS} PRODUCT_NAME ${AUDIO_ELEMENT_PRODUCT_NAME} AAX_CATEGORY "AAX_ePlugInCategory_SoundField") @@ -54,58 +56,42 @@ if (ECLIPSA_LOGIC_PRO_BUILD) target_compile_definitions(AudioElementPlugin PRIVATE ECLIPSA_LOGIC_PRO_BUILD=1) endif () +#==================================================================== +#Link libraries +#==================================================================== target_link_libraries(AudioElementPlugin PRIVATE - substream_rdr - processors - components - player - logger - data_repository - data_structures - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) + eclipsa_common) +#==================================================================== +#Testing +#==================================================================== if (CI_TEST OR INTERNAL_TEST) add_subdirectory(test) endif () -#include("${CMAKE_SOURCE_DIR}/cmake/deploy_runtime_deps.cmake") -# -#if (TARGET AudioElementPlugin_VST3) -# deploy_runtime_deps(AudioElementPlugin_VST3) -#endif () - +#==================================================================== # Copy resources for each plugin format -if (BUILD_AAX AND TARGET AudioElementPlugin_AAX) - message(STATUS "AAX build detected. Setting up audio element plugin path and copying resources.") - set(AUDIO_ELEMENT_AAX_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/$/AAX/Eclipsa Audio Element Plugin.aaxplugin") - copy_resources(AudioElementPlugin_AAX "${AUDIO_ELEMENT_AAX_PATH}") -endif () +#==================================================================== +set(_ARTEFACTS_BASE "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts") +set(_PLUGIN_NAME "Eclipsa Audio Element Plugin") -if (BUILD_VST3 AND TARGET AudioElementPlugin_VST3) - message(STATUS "VST3 build detected. Setting up Audio Element plugin path and copying resources.") - set(AUDIO_ELEMENT_VST3_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/$/VST3/Eclipsa Audio Element Plugin.vst3") - copy_resources(AudioElementPlugin_VST3 "${AUDIO_ELEMENT_VST3_PATH}") +if (TARGET AudioElementPlugin_AAX) + copy_resources(AudioElementPlugin_AAX "${_ARTEFACTS_BASE}/$/AAX/${_PLUGIN_NAME}.aaxplugin") endif () -if (CMAKE_BUILD_TYPE STREQUAL "Release" AND APPLE) - message(STATUS "MacOS release build detected. Copying Audio Element Resources for AU Plugins.") - if (ECLIPSA_LOGIC_PRO_BUILD) - set(AUDIO_PLUGIN_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/Release/AU/Eclipsa Audio Element Plugin for Logic Pro.component") - else () - set(AUDIO_PLUGIN_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/Release/AU/Eclipsa Audio Element Plugin.component") - endif () - copy_resources(AudioElementPlugin ${AUDIO_PLUGIN_PATH}) +if (TARGET AudioElementPlugin_VST3) + copy_resources(AudioElementPlugin_VST3 "${_ARTEFACTS_BASE}/$/VST3/${_PLUGIN_NAME}.vst3") endif () if (TARGET AudioElementPlugin_Standalone) - message(STATUS "Standalone build detected. Setting up Audio Element plugin path and copying resources.") - set(AUDIO_ELEMENT_STANDALONE_PATH "${CMAKE_BINARY_DIR}/audioelementplugin/AudioElementPlugin_artefacts/$/Standalone") - copy_resources(AudioElementPlugin_Standalone "${AUDIO_ELEMENT_STANDALONE_PATH}") + copy_resources(AudioElementPlugin_Standalone "${_ARTEFACTS_BASE}/$/Standalone") endif () -if (NOT BUILD_AAX AND NOT BUILD_VST3 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") - message(STATUS "No supported plugin formats detected. Skipping resource setup and resource copy for Audio Element Plugin.") -endif () \ No newline at end of file +if (TARGET AudioElementPlugin_AU) + if (ECLIPSA_LOGIC_PRO_BUILD) + copy_resources(AudioElementPlugin_AU "${_ARTEFACTS_BASE}/$/AU/${_PLUGIN_NAME} for Logic Pro.component") + else () + copy_resources(AudioElementPlugin_AU "${_ARTEFACTS_BASE}/$/AU/${_PLUGIN_NAME}.component") + endif () +endif () diff --git a/cmake/copy_resources.cmake b/cmake/copy_resources.cmake index a82135e0..3823b96a 100644 --- a/cmake/copy_resources.cmake +++ b/cmake/copy_resources.cmake @@ -54,27 +54,24 @@ function(copy_resources target plugin_path) set(ALL_DEPS ${COMMON_DEPS} ${PLATFORM_DEPS}) # ========================================================================= - # Copy Commands for Common Libs + # Copy Commands # ========================================================================= set(COPY_COMMANDS COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}" - COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_IAMF}" - COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_GPAC}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_GPAC}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_IAMF}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" ) - # ========================================================================= - # Copy Commands for Platforms - # ========================================================================= if (APPLE) list(APPEND COPY_COMMANDS + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_IAMF}" COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_OBR}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_GPAC}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_GPAC}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_IAMF}/" COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_OBR}/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" ) elseif (WIN32) - foreach (_dep IN LISTS PLATFORM_DEPS) + foreach (_dep IN LISTS ALL_DEPS) list(APPEND COPY_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/") endforeach () diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index f7c42ffd..de02e940 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -6,42 +6,45 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to add writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# Include guard +#==================================================================== +# Include Guard +#==================================================================== if (DEFINED _MACOS_TOOLCHAIN_INCLUDED) return() endif () set(_MACOS_TOOLCHAIN_INCLUDED TRUE) -# RPATH logic moved from root +#==================================================================== +# Deployment Target +#==================================================================== +set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum macOS version") + +#==================================================================== +# RPATH Configuration +#==================================================================== set(CMAKE_BUILD_RPATH "@loader_path/../Resources;${CMAKE_SOURCE_DIR}" CACHE STRING "") -# Initialize formats -set(_MAC_DEFAULT_FORMATS "AU") +#==================================================================== +# Linker Settings +#==================================================================== +# Xcode 15+ classic linker (avoids duplicate symbol warnings) +add_link_options("-Wl,-ld_classic") +#==================================================================== +# AAX SDK Path +#==================================================================== if (BUILD_AAX) set(AAX_SDK_VER "2-7-0" CACHE STRING "AAX SDK Version") - list(APPEND _MAC_DEFAULT_FORMATS "AAX") - # Typical Mac location for vendored SDKs set(AAX_SDK_SEARCH_HINT "/opt/aax-sdk-${AAX_SDK_VER}" CACHE INTERNAL "") endif () -set(PLUGIN_FORMATS "${_MAC_DEFAULT_FORMATS}" CACHE STRING "Target plugin formats") - -# Vendored Lib Path Logic -set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos" CACHE INTERNAL "") - -# Xcode 15+ classic linker (avoids duplicate symbol warnings) -add_link_options("-Wl,-ld_classic") - -set(IAMF_LIB_NAME "libiamf" CACHE STRING "") - -if (BUILD_VST3) - list(APPEND _DEFAULT_FORMATS "VST3") -endif () - +#==================================================================== +# Library Names (platform-specific) +#==================================================================== +set(IAMF_LIB_NAME "libiamf" CACHE STRING "") \ No newline at end of file diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index c5941eb7..be0f1786 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -21,22 +21,13 @@ endif () set(_WINDOWS_TOOLCHAIN_INCLUDED TRUE) #==================================================================== -#Plugin Formats +# AAX SDK Path (Windows) #==================================================================== -set(_DEFAULT_FORMATS "Standalone") - if (BUILD_AAX) set(AAX_SDK_VER "2-8-1" CACHE STRING "AAX SDK Version") - list(APPEND _DEFAULT_FORMATS "AAX") set(AAX_SDK_SEARCH_HINT "C:/Code/Repos/aax-sdk-${AAX_SDK_VER}" CACHE INTERNAL "") endif () -if (BUILD_VST3) - list(APPEND _DEFAULT_FORMATS "VST3") -endif () - -set(PLUGIN_FORMATS "${_DEFAULT_FORMATS}" CACHE STRING "Target plugin formats") - #==================================================================== #Compiler Settings #==================================================================== diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 7bc1b07c..0aefba3a 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -10,10 +10,9 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# ------------------------------- -# Core module setup -# ------------------------------- - +#==================================================================== +# Core module setup +#==================================================================== juce_add_modules( components data_repository @@ -23,10 +22,9 @@ juce_add_modules( processors substream_rdr) -# ------------------------------- -# Optional test targets -# ------------------------------- - +#==================================================================== +# Optional test targets +#==================================================================== if (CI_TEST OR INTERNAL_TEST) add_subdirectory(processors/tests) add_subdirectory(data_repository/tests) @@ -37,35 +35,29 @@ if (CI_TEST OR INTERNAL_TEST) endif () -# ------------------------------- -# Platform-specific processor defs -# ------------------------------- - +#==================================================================== # DAW-specific build flags +#==================================================================== if (ECLIPSA_LOGIC_PRO_BUILD) target_compile_definitions(processors INTERFACE ECLIPSA_LOGIC_PRO_BUILD=1) endif () -# ------------------------------- -# Icon resources -# ------------------------------- - +#==================================================================== +# Icon resources +#==================================================================== add_subdirectory(components/icons) target_link_libraries(components INTERFACE binary_data) - # Link components against Eigen (for AmbisonicsVisualizer) target_link_libraries(components INTERFACE Eigen) -# ------------------------------- -# Common include directories -# ------------------------------- - +#==================================================================== +# Common include directories +#==================================================================== target_include_directories(data_structures INTERFACE "${BOOST_LIBRARY_INCLUDES}/include" "${zeromq_SOURCE_DIR}/include" "${cppzmq_SOURCE_DIR}" ) - target_include_directories(substream_rdr INTERFACE "${spatialaudio_SOURCE_DIR}/include" "${spatialaudio_SOURCE_DIR}" @@ -78,11 +70,9 @@ target_include_directories(substream_rdr INTERFACE "${CMAKE_SOURCE_DIR}/third_party/libiamf/code/include" ) -# ------------------------------- -# IAMF and Proto Integration -# ------------------------------- - -# Unified cross-platform IAMF linkage (no Bazel paths) +#==================================================================== +# IAMF and Proto Integration +#==================================================================== target_link_libraries(data_structures INTERFACE iamftools substream_rdr) # Make sure our regenerated proto headers come first @@ -90,10 +80,9 @@ target_include_directories(data_structures INTERFACE "${CMAKE_SOURCE_DIR}/third_party/iamftools/iamf/cli/proto" ) -# ------------------------------- -# Substream and Processor Linking -# ------------------------------- - +#==================================================================== +# Substream and Processor Linking +#==================================================================== # Both Windows and macOS now link full audio stack (OBR + SAF) target_link_libraries(substream_rdr INTERFACE libspatialaudio @@ -101,7 +90,6 @@ target_link_libraries(substream_rdr INTERFACE libear data_structures ) - target_link_libraries(processors INTERFACE gpac libear @@ -113,16 +101,13 @@ target_link_libraries(processors INTERFACE saf_example_ambi_dec lufs_meter ) - target_include_directories(substream_rdr INTERFACE ${OBR_INCLUDE_DIRS}) target_include_directories(processors INTERFACE ${OBR_INCLUDE_DIRS}) - target_link_libraries(player INTERFACE processors substream_rdr) -# ------------------------------- -# Components and Logging -# ------------------------------- - +#==================================================================== +# Components and Logging +#==================================================================== target_link_libraries(components INTERFACE binary_data libear substream_rdr processors data_structures data_repository player) target_link_libraries(logger INTERFACE @@ -135,3 +120,20 @@ target_link_libraries(logger INTERFACE get_target_property(SUBSTREAM_INCLUDES substream_rdr INTERFACE_INCLUDE_DIRECTORIES) message(STATUS "substream_rdr include paths: ${SUBSTREAM_INCLUDES}") + +#==================================================================== +# Unified plugin dependency target +#==================================================================== +add_library(eclipsa_common INTERFACE) +target_link_libraries(eclipsa_common INTERFACE + substream_rdr + processors + components + player + logger + data_repository + data_structures + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags +) diff --git a/rendererplugin/CMakeLists.txt b/rendererplugin/CMakeLists.txt index 1b54502f..31734c11 100644 --- a/rendererplugin/CMakeLists.txt +++ b/rendererplugin/CMakeLists.txt @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +#==================================================================== # Set plugin code and name based on build type +#==================================================================== if (ECLIPSA_LOGIC_PRO_BUILD) set(RENDERER_PLUGIN_CODE "Ercl") set(RENDERER_PRODUCT_NAME "Eclipsa Audio Renderer for Logic Pro") @@ -31,7 +33,7 @@ juce_add_plugin(RendererPlugin IS_MIDI_EFFECT FALSE EDITOR_WANTS_KEYBOARD_FOCUS FALSE COPY_PLUGIN_AFTER_BUILD ${JUCE_COPY_PLUGIN_AFTER_BUILD} - FORMATS ${PLUGIN_FORMATS} + FORMATS ${ECLIPSA_PLUGIN_FORMATS} PRODUCT_NAME ${RENDERER_PRODUCT_NAME} AAX_CATEGORY "AAX_ePlugInCategory_SWGenerators") @@ -62,21 +64,18 @@ if (ECLIPSA_LOGIC_PRO_BUILD) target_compile_definitions(RendererPlugin PRIVATE ECLIPSA_LOGIC_PRO_BUILD=1) endif () +#==================================================================== +#Link libraries +#==================================================================== target_link_libraries(RendererPlugin PRIVATE + eclipsa_common binary_data - substream_rdr - processors - components - player - logger - data_repository - data_structures - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags libzmq) +#==================================================================== +#Testing +#==================================================================== if (CI_TEST OR INTERNAL_TEST) target_link_libraries(RendererPlugin PRIVATE @@ -84,41 +83,29 @@ if (CI_TEST OR INTERNAL_TEST) add_subdirectory(test) endif () -#include("${CMAKE_SOURCE_DIR}/cmake/deploy_runtime_deps.cmake") -# -#if (TARGET RendererPlugin) -# deploy_runtime_deps(RendererPlugin_VST3) -#endif () - +#==================================================================== # Copy resources for each plugin format -if (BUILD_AAX AND TARGET RendererPlugin_AAX) - message(STATUS "AAX build detected. Setting up renderer plugin path and copying resources.") - set(RENDERER_AAX_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/$/AAX/Eclipsa Audio Renderer.aaxplugin") - copy_resources(RendererPlugin_AAX "${RENDERER_AAX_PATH}") -endif () +#==================================================================== -if (BUILD_VST3 AND TARGET RendererPlugin_VST3) - message(STATUS "VST3 build detected. Setting up renderer plugin path and copying resources.") - set(RENDERER_VST3_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/$/VST3/Eclipsa Audio Renderer.vst3") - copy_resources(RendererPlugin_VST3 "${RENDERER_VST3_PATH}") +set(_ARTEFACTS_BASE "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts") +set(_PLUGIN_NAME "Eclipsa Audio Renderer") + +if (TARGET RendererPlugin_AAX) + copy_resources(RendererPlugin_AAX "${_ARTEFACTS_BASE}/$/AAX/${_PLUGIN_NAME}.aaxplugin") endif () -if (CMAKE_BUILD_TYPE STREQUAL "Release" AND APPLE) - message(STATUS "MacOS release build detected. Copying Renderer Plugin Resources for AU Plugins.") - if (ECLIPSA_LOGIC_PRO_BUILD) - set(RDR_PLUGIN_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/Release/AU/Eclipsa Audio Renderer for Logic Pro.component") - else () - set(RDR_PLUGIN_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/Release/AU/Eclipsa Audio Renderer.component") - endif () - copy_resources(RendererPlugin ${RDR_PLUGIN_PATH}) +if (TARGET RendererPlugin_VST3) + copy_resources(RendererPlugin_VST3 "${_ARTEFACTS_BASE}/$/VST3/${_PLUGIN_NAME}.vst3") endif () if (TARGET RendererPlugin_Standalone) - message(STATUS "Standalone build detected. Setting up renderer plugin path and copying resources.") - set(RENDERER_STANDALONE_PATH "${CMAKE_BINARY_DIR}/rendererplugin/RendererPlugin_artefacts/$/Standalone") - copy_resources(RendererPlugin_Standalone "${RENDERER_STANDALONE_PATH}") + copy_resources(RendererPlugin_Standalone "${_ARTEFACTS_BASE}/$/Standalone") endif () -if (NOT BUILD_AAX AND NOT BUILD_VST3 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") - message(STATUS "No supported plugin formats detected. Skipping resource setup and resource copy for Renderer Plugin.") -endif () \ No newline at end of file +if (TARGET RendererPlugin_AU) + if (ECLIPSA_LOGIC_PRO_BUILD) + copy_resources(RendererPlugin_AU "${_ARTEFACTS_BASE}/$/AU/${_PLUGIN_NAME} for Logic Pro.component") + else () + copy_resources(RendererPlugin_AU "${_ARTEFACTS_BASE}/$/AU/${_PLUGIN_NAME}.component") + endif () +endif () diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index d8b8081a..ab38e744 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -142,7 +142,7 @@ endif () #==================================================================== # Imported Targets #==================================================================== -# 1. GPAC (renamed to vendored_gpac) +#GPAC (renamed to vendored_gpac) if (NOT TARGET vendored_gpac) add_library(vendored_gpac SHARED IMPORTED GLOBAL) if (APPLE) @@ -157,7 +157,7 @@ if (NOT TARGET vendored_gpac) endif () endif () -# 2. IAMF Tools (renamed to vendored_iamf_tools) +#IAMF Tools (renamed to vendored_iamf_tools) if (NOT TARGET vendored_iamf_tools) add_library(vendored_iamf_tools SHARED IMPORTED GLOBAL) if (APPLE) @@ -172,22 +172,14 @@ if (NOT TARGET vendored_iamf_tools) endif () endif () -# 3. OBR (Mac Only - renamed to vendored_obr) +#OBR (Mac Only) if (APPLE AND NOT TARGET vendored_obr) add_library(vendored_obr SHARED IMPORTED GLOBAL) set_target_properties(vendored_obr PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/obr/lib/obr.dylib") endif () -# 4. Windows-Specific Helpers +#Windows-Specific Helpers if (WIN32) - if (NOT TARGET vendored_opensvc) - add_library(vendored_opensvc SHARED IMPORTED GLOBAL) - set_target_properties(vendored_opensvc PROPERTIES - IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/OpenSVC/lib/Windows/Release/OpenSVCDecoder.dll" - IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/OpenSVC/lib/Windows/Debug/OpenSVCDecoder.dll" - ) - endif () - if (NOT TARGET vendored_gpac_crypto) add_library(vendored_gpac_crypto SHARED IMPORTED GLOBAL) set_target_properties(vendored_gpac_crypto PROPERTIES From 6576d0334e0cb4ec8671f73aa741ecc227b1a8ec Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Wed, 4 Feb 2026 16:00:41 -0800 Subject: [PATCH 13/43] Root Cmake platform-agnostic --- CMakeLists.txt | 26 ++++++++++---------------- cmake/toolchains/macos.cmake | 11 +++++++++-- cmake/toolchains/windows.cmake | 8 ++++++++ common/CMakeLists.txt | 1 - 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bfcd2ab2..87092a78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,13 +72,12 @@ set(ECLIPSA_PLUGIN_FORMATS Standalone) if (BUILD_VST3) list(APPEND ECLIPSA_PLUGIN_FORMATS VST3) endif () -if (APPLE) - list(APPEND ECLIPSA_PLUGIN_FORMATS AU) -endif () if (BUILD_AAX) list(APPEND ECLIPSA_PLUGIN_FORMATS AAX) endif () +list(APPEND ECLIPSA_PLUGIN_FORMATS ${ECLIPSA_PLATFORM_PLUGIN_FORMATS}) + #==================================================================== # Build Configuration #==================================================================== @@ -183,6 +182,11 @@ add_subdirectory(audioelementplugin) #==================================================================== # Dependency List #==================================================================== +if (NOT DEFINED ECLIPSA_PLATFORM_LIBS) + message(WARNING "ECLIPSA_PLATFORM_LIBS not set—are you using a platform toolchain?") + set(ECLIPSA_PLATFORM_LIBS "") +endif () + add_library(eclipsa_dependencies INTERFACE) target_link_libraries(eclipsa_dependencies INTERFACE @@ -197,20 +201,10 @@ target_link_libraries(eclipsa_dependencies INTERFACE LUFSMeter spatialaudiolib ${IAMF_LIB_NAME} -) -if (APPLE) - target_link_libraries(eclipsa_dependencies INTERFACE - vendored_obr - ) -elseif (WIN32) - target_link_libraries(eclipsa_dependencies INTERFACE - vendored_gpac_crypto - vendored_gpac_ssl - ZLIB::ZLIB - delayimp - ) -endif () + # Platform-specific (from toolchain) + ${ECLIPSA_PLATFORM_LIBS} +) #==================================================================== # Testing #2 diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index de02e940..2c57d8d1 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -45,6 +45,13 @@ if (BUILD_AAX) endif () #==================================================================== -# Library Names (platform-specific) +# Library Names #==================================================================== -set(IAMF_LIB_NAME "libiamf" CACHE STRING "") \ No newline at end of file +set(IAMF_LIB_NAME "libiamf" CACHE STRING "") + +set(ECLIPSA_PLATFORM_LIBS + vendored_obr + CACHE STRING "Platform-specific libraries" +) + +set(ECLIPSA_PLATFORM_PLUGIN_FORMATS AU CACHE STRING "Platform-specific plugin formats") diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index be0f1786..2787e207 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -89,3 +89,11 @@ set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} CACHE INTERNAL "ZLIB libraries for Windows" link_libraries(ZLIB::ZLIB) link_libraries(delayimp) +set(ECLIPSA_PLATFORM_LIBS + vendored_gpac_crypto + vendored_gpac_ssl + ZLIB::ZLIB + delayimp + CACHE STRING "Platform-specific libraries" +) + diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 0aefba3a..cac78ba2 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -83,7 +83,6 @@ target_include_directories(data_structures INTERFACE #==================================================================== # Substream and Processor Linking #==================================================================== -# Both Windows and macOS now link full audio stack (OBR + SAF) target_link_libraries(substream_rdr INTERFACE libspatialaudio obr From 2c91be5d44fd1ddc3736294877073372859016db Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Wed, 4 Feb 2026 16:24:42 -0800 Subject: [PATCH 14/43] Completed platform-agnostic third_party Cmake --- cmake/imported_targets_macos.cmake | 38 +++++++++ cmake/imported_targets_windows.cmake | 54 +++++++++++++ cmake/toolchains/macos.cmake | 8 ++ cmake/toolchains/windows.cmake | 42 ++++++++++ third_party/CMakeLists.txt | 115 ++------------------------- 5 files changed, 148 insertions(+), 109 deletions(-) create mode 100644 cmake/imported_targets_macos.cmake create mode 100644 cmake/imported_targets_windows.cmake diff --git a/cmake/imported_targets_macos.cmake b/cmake/imported_targets_macos.cmake new file mode 100644 index 00000000..6b31ad7e --- /dev/null +++ b/cmake/imported_targets_macos.cmake @@ -0,0 +1,38 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +#==================================================================== +# Imported Targets - macOS +#==================================================================== + +# GPAC +if (NOT TARGET vendored_gpac) + add_library(vendored_gpac SHARED IMPORTED GLOBAL) + set_target_properties(vendored_gpac PROPERTIES + IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/libgpac.dylib" + ) +endif () + +# IAMF Tools +if (NOT TARGET vendored_iamf_tools) + add_library(vendored_iamf_tools SHARED IMPORTED GLOBAL) + set_target_properties(vendored_iamf_tools PROPERTIES + IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/libiamf_tools.dylib" + ) +endif () + +# OBR +if (NOT TARGET vendored_obr) + add_library(vendored_obr SHARED IMPORTED GLOBAL) + set_target_properties(vendored_obr PROPERTIES + IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/obr/lib/obr.dylib" + ) +endif () \ No newline at end of file diff --git a/cmake/imported_targets_windows.cmake b/cmake/imported_targets_windows.cmake new file mode 100644 index 00000000..7d48a180 --- /dev/null +++ b/cmake/imported_targets_windows.cmake @@ -0,0 +1,54 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +#==================================================================== +# Imported Targets - Windows +#==================================================================== + +# GPAC +if (NOT TARGET vendored_gpac) + add_library(vendored_gpac SHARED IMPORTED GLOBAL) + set_target_properties(vendored_gpac PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libgpac.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libgpac.dll" + IMPORTED_IMPLIB_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libgpac.lib" + IMPORTED_IMPLIB_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libgpac.lib" + ) +endif () + +# IAMF Tools +if (NOT TARGET vendored_iamf_tools) + add_library(vendored_iamf_tools SHARED IMPORTED GLOBAL) + set_target_properties(vendored_iamf_tools PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.dll" + IMPORTED_IMPLIB_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.lib" + IMPORTED_IMPLIB_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.lib" + ) +endif () + +# GPAC Crypto +if (NOT TARGET vendored_gpac_crypto) + add_library(vendored_gpac_crypto SHARED IMPORTED GLOBAL) + set_target_properties(vendored_gpac_crypto PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libcryptoMD.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libcryptoMD.dll" + ) +endif () + +# GPAC SSL +if (NOT TARGET vendored_gpac_ssl) + add_library(vendored_gpac_ssl SHARED IMPORTED GLOBAL) + set_target_properties(vendored_gpac_ssl PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libsslMD.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libsslMD.dll" + ) +endif () \ No newline at end of file diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index 2c57d8d1..ec1de804 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -55,3 +55,11 @@ set(ECLIPSA_PLATFORM_LIBS ) set(ECLIPSA_PLATFORM_PLUGIN_FORMATS AU CACHE STRING "Platform-specific plugin formats") + +set(ECLIPSA_IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build" CACHE STRING "") + +set(SAF_PERFORMANCE_LIB "SAF_USE_APPLE_ACCELERATE" CACHE STRING "") + +set(ECLIPSA_STATIC_LIB_SUFFIX ".a" CACHE STRING "") + +set(ECLIPSA_PLATFORM "macos" CACHE STRING "") diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index 2787e207..44ce9161 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -97,3 +97,45 @@ set(ECLIPSA_PLATFORM_LIBS CACHE STRING "Platform-specific libraries" ) +set(ECLIPSA_IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build/$" CACHE STRING "") + +set(ECLIPSA_STATIC_LIB_SUFFIX ".lib" CACHE STRING "") + +#==================================================================== +# SAF Performance Library (Intel MKL) +#==================================================================== +if (NOT DEFINED CACHE{SAF_PERFORMANCE_LIB}) + if (NOT DEFINED MKL_ROOT) + set(MKL_ROOT "$ENV{MKLROOT}" CACHE PATH "Path to Intel MKL root directory") + endif () + + if (NOT MKL_ROOT OR NOT EXISTS "${MKL_ROOT}") + message(STATUS "SAF: Intel MKL not found. MKLROOT is not set or invalid: '${MKL_ROOT}'") + message(STATUS " Falling back to OpenBLAS/LAPACKE") + set(SAF_PERFORMANCE_LIB "SAF_USE_OPEN_BLAS_AND_LAPACKE" CACHE STRING "" FORCE) + else () + message(STATUS "SAF: Found Intel MKL at: ${MKL_ROOT}") + set(SAF_PERFORMANCE_LIB "SAF_USE_INTEL_MKL_LP64" CACHE STRING "" FORCE) + set(INTEL_MKL_HEADER_PATH "${MKL_ROOT}/include" CACHE STRING "" FORCE) + set(INTEL_MKL_LIB + "${MKL_ROOT}/lib/mkl_intel_lp64.lib" + "${MKL_ROOT}/lib/mkl_sequential.lib" + "${MKL_ROOT}/lib/mkl_core.lib" + CACHE STRING "" FORCE + ) + + if (NOT EXISTS "${INTEL_MKL_HEADER_PATH}/mkl.h") + message(FATAL_ERROR "SAF: MKL header not found at ${INTEL_MKL_HEADER_PATH}/mkl.h") + endif () + + foreach (lib_file ${INTEL_MKL_LIB}) + if (NOT EXISTS "${lib_file}") + message(FATAL_ERROR "SAF: MKL library not found: ${lib_file}") + endif () + endforeach () + endif () +endif () + +set(ECLIPSA_PLATFORM "windows" CACHE STRING "") + + diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index ab38e744..239ab4c8 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -34,11 +34,8 @@ add_subdirectory(libiamf) #==================================================================== # IAMF library directory (platform-specific structure) #==================================================================== -if (WIN32) - set(IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build/$") -else () - set(IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build") -endif () +set(IAMF_LIB_DIR ${ECLIPSA_IAMF_LIB_DIR}) + # Make sure all subprojects can find it link_directories(${IAMF_LIB_DIR}) set(IAMF_LIB_DIR ${IAMF_LIB_DIR} CACHE STRING "IAMF library directory") @@ -49,55 +46,12 @@ set(IAMF_LIB_DIR ${IAMF_LIB_DIR} CACHE STRING "IAMF library directory") #Unit tests for SAF have been tested and they pass, confirming the SAF library is working as expected. # Manually set the SAF_PERFORMANCE_LIB variables for each platform #==================================================================== +# Spatial Audio Framework +#==================================================================== set(SAF_BUILD_TESTS 0 CACHE BOOL "" FORCE) set(SAF_BUILD_EXAMPLES 1 CACHE BOOL "" FORCE) set(saf_example_list ambi_dec CACHE STRING "" FORCE) -# Default performance library (fallback) -set(SAF_PERFORMANCE_LIB "SAF_USE_OPEN_BLAS_AND_LAPACKE") - -if (APPLE) - message(STATUS "SAF: Using Apple Accelerate") - set(SAF_PERFORMANCE_LIB "SAF_USE_APPLE_ACCELERATE") - -elseif (WIN32) - # Use system Intel MKL directly - message(STATUS "SAF: Attempting to use system Intel MKL") - - # Allow user to specify MKL root, or use environment variable - set(MKL_ROOT "$ENV{MKLROOT}" CACHE PATH "Path to Intel MKL root directory") - - if (NOT MKL_ROOT OR NOT EXISTS "${MKL_ROOT}") - message(WARNING "SAF: Intel MKL not found. MKLROOT is not set or invalid: '${MKL_ROOT}'") - message(WARNING " Set MKL_ROOT variable or source the Intel oneAPI setvars script") - message(WARNING " Falling back to OpenBLAS/LAPACKE") - set(SAF_PERFORMANCE_LIB "SAF_USE_OPENBLAS_AND_LAPACKE") - else () - message(STATUS "SAF: Found Intel MKL at: ${MKL_ROOT}") - set(SAF_PERFORMANCE_LIB "SAF_USE_INTEL_MKL_LP64") - - # Construct paths relative to MKL_ROOT - set(INTEL_MKL_HEADER_PATH "${MKL_ROOT}/include" CACHE STRING "" FORCE) - - set(INTEL_MKL_LIB - "${MKL_ROOT}/lib/mkl_intel_lp64.lib" - "${MKL_ROOT}/lib/mkl_sequential.lib" - "${MKL_ROOT}/lib/mkl_core.lib" - CACHE STRING "" FORCE) - # Validate that critical files exist - if (NOT EXISTS "${INTEL_MKL_HEADER_PATH}/mkl.h") - message(FATAL_ERROR "SAF: MKL header not found at ${INTEL_MKL_HEADER_PATH}/mkl.h") - endif () - - foreach (lib_file ${INTEL_MKL_LIB}) - if (NOT EXISTS "${lib_file}") - message(FATAL_ERROR "SAF: MKL library not found: ${lib_file}") - endif () - endforeach () - endif () -endif () - -# Build SAF from source on all platforms message(STATUS "SAF: Building from source with ${SAF_PERFORMANCE_LIB}") add_subdirectory(${CMAKE_SOURCE_DIR}/third_party/Spatial_Audio_Framework) @@ -128,11 +82,7 @@ endif () if (DEFINED protobuf_SOURCE_DIR AND DEFINED protobuf_BINARY_DIR) message(STATUS "Overriding Protobuf include/lib paths with fetched version") set(Protobuf_INCLUDE_DIRS "${protobuf_SOURCE_DIR}/src" CACHE PATH "" FORCE) - if (WIN32) - set(Protobuf_LIBRARIES "${protobuf_BINARY_DIR}/libprotobuf.lib" CACHE STRING "" FORCE) - else () - set(Protobuf_LIBRARIES "${protobuf_BINARY_DIR}/libprotobuf.a" CACHE STRING "" FORCE) - endif () + set(Protobuf_LIBRARIES "${protobuf_BINARY_DIR}/libprotobuf${ECLIPSA_STATIC_LIB_SUFFIX}" CACHE STRING "" FORCE) set(Protobuf_PROTOC_EXECUTABLE "${protobuf_BINARY_DIR}/protoc" CACHE FILEPATH "" FORCE) set(Protobuf_DIR "${protobuf_BINARY_DIR}/cmake" CACHE PATH "" FORCE) else () @@ -142,57 +92,4 @@ endif () #==================================================================== # Imported Targets #==================================================================== -#GPAC (renamed to vendored_gpac) -if (NOT TARGET vendored_gpac) - add_library(vendored_gpac SHARED IMPORTED GLOBAL) - if (APPLE) - set_target_properties(vendored_gpac PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/libgpac.dylib") - elseif (WIN32) - set_target_properties(vendored_gpac PROPERTIES - IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Release/libgpac.dll" - IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Debug/libgpac.dll" - IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Release/libgpac.lib" - IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Debug/libgpac.lib" - ) - endif () -endif () - -#IAMF Tools (renamed to vendored_iamf_tools) -if (NOT TARGET vendored_iamf_tools) - add_library(vendored_iamf_tools SHARED IMPORTED GLOBAL) - if (APPLE) - set_target_properties(vendored_iamf_tools PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/iamftools/lib/libiamf_tools.dylib") - elseif (WIN32) - set_target_properties(vendored_iamf_tools PROPERTIES - IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/iamftools/lib/Windows/Release/iamf_tools.dll" - IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/iamftools/lib/Windows/Debug/iamf_tools.dll" - IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/iamftools/lib/Windows/Release/iamf_tools.lib" - IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/iamftools/lib/Windows/Debug/iamf_tools.lib" - ) - endif () -endif () - -#OBR (Mac Only) -if (APPLE AND NOT TARGET vendored_obr) - add_library(vendored_obr SHARED IMPORTED GLOBAL) - set_target_properties(vendored_obr PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/obr/lib/obr.dylib") -endif () - -#Windows-Specific Helpers -if (WIN32) - if (NOT TARGET vendored_gpac_crypto) - add_library(vendored_gpac_crypto SHARED IMPORTED GLOBAL) - set_target_properties(vendored_gpac_crypto PROPERTIES - IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Release/libcryptoMD.dll" - IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Debug/libcryptoMD.dll" - ) - endif () - - if (NOT TARGET vendored_gpac_ssl) - add_library(vendored_gpac_ssl SHARED IMPORTED GLOBAL) - set_target_properties(vendored_gpac_ssl PROPERTIES - IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Release/libsslMD.dll" - IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/gpac/lib/Windows/Debug/libsslMD.dll" - ) - endif () -endif () \ No newline at end of file +include("${CMAKE_SOURCE_DIR}/cmake/imported_targets_${ECLIPSA_PLATFORM}.cmake") From ec035bafe23f8800808020d2059795b8ace5be52 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Thu, 5 Feb 2026 12:53:36 -0800 Subject: [PATCH 15/43] Updated individual third-party cmakes --- cmake/imported_targets_macos.cmake | 3 - cmake/toolchains/macos.cmake | 32 ++++++++++ cmake/toolchains/windows.cmake | 41 +++++++++++++ third_party/gpac/CMakeLists.txt | 64 +++++++------------- third_party/iamftools/CMakeLists.txt | 52 ++++++---------- third_party/libear/CMakeLists.txt | 28 ++++----- third_party/libiamf/CMakeLists.txt | 88 ++++++++++++---------------- third_party/obr/CMakeLists.txt | 52 ++++++++-------- 8 files changed, 188 insertions(+), 172 deletions(-) diff --git a/cmake/imported_targets_macos.cmake b/cmake/imported_targets_macos.cmake index 6b31ad7e..5918d797 100644 --- a/cmake/imported_targets_macos.cmake +++ b/cmake/imported_targets_macos.cmake @@ -12,7 +12,6 @@ #==================================================================== # Imported Targets - macOS #==================================================================== - # GPAC if (NOT TARGET vendored_gpac) add_library(vendored_gpac SHARED IMPORTED GLOBAL) @@ -20,7 +19,6 @@ if (NOT TARGET vendored_gpac) IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/libgpac.dylib" ) endif () - # IAMF Tools if (NOT TARGET vendored_iamf_tools) add_library(vendored_iamf_tools SHARED IMPORTED GLOBAL) @@ -28,7 +26,6 @@ if (NOT TARGET vendored_iamf_tools) IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/libiamf_tools.dylib" ) endif () - # OBR if (NOT TARGET vendored_obr) add_library(vendored_obr SHARED IMPORTED GLOBAL) diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index ec1de804..8a95bba4 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -63,3 +63,35 @@ set(SAF_PERFORMANCE_LIB "SAF_USE_APPLE_ACCELERATE" CACHE STRING "") set(ECLIPSA_STATIC_LIB_SUFFIX ".a" CACHE STRING "") set(ECLIPSA_PLATFORM "macos" CACHE STRING "") + +#==================================================================== +# GPAC Paths +#==================================================================== +set(GPAC_DYLIB "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/libgpac.dylib" CACHE FILEPATH "") +set(GPAC_EXTRA_LIBS "" CACHE STRING "") +set(GPAC_COPY_DLL OFF CACHE BOOL "") + +#==================================================================== +# IAMF Tools Paths +#==================================================================== +set(IAMF_TOOLS_DYLIB "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/libiamf_tools.dylib" CACHE FILEPATH "") +set(IAMF_TOOLS_COPY_DLL OFF CACHE BOOL "") + +#==================================================================== +# Libear Paths +#==================================================================== +set(LIBEAR_DEBUG_PATH "${CMAKE_SOURCE_DIR}/third_party/libear/lib/libear.a" CACHE FILEPATH "") +set(LIBEAR_RELEASE_PATH "${CMAKE_SOURCE_DIR}/third_party/libear/lib/libear.a" CACHE FILEPATH "") + +#==================================================================== +# LibIAMF Paths +#==================================================================== +set(LIBIAMF_VENDOR_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos" CACHE PATH "") +set(LIBIAMF_NEEDS_PATCHING OFF CACHE BOOL "") +set(LIBIAMF_REMOVE_M_LINKAGE OFF CACHE BOOL "") + +#==================================================================== +# OBR Paths +#==================================================================== +set(OBR_DYLIB "${CMAKE_SOURCE_DIR}/third_party/obr/lib/obr.dylib" CACHE FILEPATH "") +set(OBR_USE_STATIC OFF CACHE BOOL "") diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index 44ce9161..6d9ac0f2 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -138,4 +138,45 @@ endif () set(ECLIPSA_PLATFORM "windows" CACHE STRING "") +#==================================================================== +# GPAC Paths +#==================================================================== +set(GPAC_DEBUG_DLL "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libgpac.dll" CACHE FILEPATH "") +set(GPAC_DEBUG_LIB "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libgpac.lib" CACHE FILEPATH "") +set(GPAC_RELEASE_DLL "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libgpac.dll" CACHE FILEPATH "") +set(GPAC_RELEASE_LIB "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libgpac.lib" CACHE FILEPATH "") +set(GPAC_EXTRA_LIBS "ws2_32;shlwapi;winmm" CACHE STRING "") +set(GPAC_COPY_DLL ON CACHE BOOL "") + +#==================================================================== +# IAMF Tools Paths +#==================================================================== +set(IAMF_TOOLS_DEBUG_DLL "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.dll" CACHE FILEPATH "") +set(IAMF_TOOLS_DEBUG_LIB "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.if.lib" CACHE FILEPATH "") +set(IAMF_TOOLS_RELEASE_DLL "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.dll" CACHE FILEPATH "") +set(IAMF_TOOLS_RELEASE_LIB "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.if.lib" CACHE FILEPATH "") +set(IAMF_TOOLS_COPY_DLL ON CACHE BOOL "") + +#==================================================================== +# Libear Paths +#==================================================================== +set(LIBEAR_DEBUG_PATH "${CMAKE_SOURCE_DIR}/third_party/libear/lib/Windows/Debug/libear.lib" CACHE FILEPATH "") +set(LIBEAR_RELEASE_PATH "${CMAKE_SOURCE_DIR}/third_party/libear/lib/Windows/Release/libear.lib" CACHE FILEPATH "") + +#==================================================================== +# LibIAMF Paths +#==================================================================== +set(LIBIAMF_VENDOR_DEBUG_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Debug" CACHE PATH "") +set(LIBIAMF_VENDOR_RELEASE_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Release" CACHE PATH "") +set(LIBIAMF_NEEDS_PATCHING ON CACHE BOOL "") +set(LIBIAMF_REMOVE_M_LINKAGE ON CACHE BOOL "") + +#==================================================================== +# OBR Paths +#==================================================================== +set(OBR_DEBUG_LIB "${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Debug/obr.lib" CACHE FILEPATH "") +set(OBR_RELEASE_LIB "${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Release/obr.lib" CACHE FILEPATH "") +set(PFFFT_DEBUG_LIB "${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Debug/pffft.lib" CACHE FILEPATH "") +set(PFFFT_RELEASE_LIB "${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Release/pffft.lib" CACHE FILEPATH "") +set(OBR_USE_STATIC ON CACHE BOOL "") diff --git a/third_party/gpac/CMakeLists.txt b/third_party/gpac/CMakeLists.txt index 963a7142..5e795cee 100644 --- a/third_party/gpac/CMakeLists.txt +++ b/third_party/gpac/CMakeLists.txt @@ -1,37 +1,26 @@ add_library(gpac INTERFACE) -target_include_directories(gpac INTERFACE "include/") +target_include_directories(gpac INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include/") -if(WIN32) - # Platform-specific setup for Windows - set(GPAC_PLATFORM "Windows") - - # Set paths for each configuration - set(GPAC_DEBUG_DLL "${CMAKE_CURRENT_LIST_DIR}/lib/${GPAC_PLATFORM}/Debug/libgpac.dll") - set(GPAC_DEBUG_LIB "${CMAKE_CURRENT_LIST_DIR}/lib/${GPAC_PLATFORM}/Debug/libgpac.lib") - set(GPAC_RELEASE_DLL "${CMAKE_CURRENT_LIST_DIR}/lib/${GPAC_PLATFORM}/Release/libgpac.dll") - set(GPAC_RELEASE_LIB "${CMAKE_CURRENT_LIST_DIR}/lib/${GPAC_PLATFORM}/Release/libgpac.lib") - - # Validate that the libraries exist - if(NOT EXISTS "${GPAC_DEBUG_DLL}") - message(FATAL_ERROR "GPAC Debug DLL not found at: ${GPAC_DEBUG_DLL}") - endif() - if(NOT EXISTS "${GPAC_DEBUG_LIB}") - message(FATAL_ERROR "GPAC Debug LIB not found at: ${GPAC_DEBUG_LIB}") - endif() - if(NOT EXISTS "${GPAC_RELEASE_DLL}") - message(FATAL_ERROR "GPAC Release DLL not found at: ${GPAC_RELEASE_DLL}") - endif() - if(NOT EXISTS "${GPAC_RELEASE_LIB}") - message(FATAL_ERROR "GPAC Release LIB not found at: ${GPAC_RELEASE_LIB}") - endif() +if (DEFINED GPAC_DYLIB) + # macOS: single dylib + add_library(gpac_impl SHARED IMPORTED GLOBAL) + set_target_properties(gpac_impl PROPERTIES + IMPORTED_LOCATION "${GPAC_DYLIB}" + LINKER_LANGUAGE CXX + ) +else () + # Windows: dll + lib with debug/release + foreach (_file ${GPAC_DEBUG_DLL} ${GPAC_DEBUG_LIB} ${GPAC_RELEASE_DLL} ${GPAC_RELEASE_LIB}) + if (NOT EXISTS "${_file}") + message(FATAL_ERROR "GPAC file not found: ${_file}") + endif () + endforeach () message(STATUS "GPAC Debug DLL: ${GPAC_DEBUG_DLL}") message(STATUS "GPAC Release DLL: ${GPAC_RELEASE_DLL}") - # Windows: dynamic library (.dll + .lib) - add_library(gpac_archive SHARED IMPORTED GLOBAL) - - set_target_properties(gpac_archive PROPERTIES + add_library(gpac_impl SHARED IMPORTED GLOBAL) + set_target_properties(gpac_impl PROPERTIES IMPORTED_LOCATION "${GPAC_RELEASE_DLL}" IMPORTED_LOCATION_DEBUG "${GPAC_DEBUG_DLL}" IMPORTED_LOCATION_RELEASE "${GPAC_RELEASE_DLL}" @@ -40,24 +29,15 @@ if(WIN32) IMPORTED_IMPLIB_RELEASE "${GPAC_RELEASE_LIB}" LINKER_LANGUAGE CXX ) +endif () + +target_link_libraries(gpac INTERFACE gpac_impl ${GPAC_EXTRA_LIBS}) - # Copy DLL to build directory (configuration-aware) +if (GPAC_COPY_DLL) add_custom_target(copy_gpac_dll ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different "$,${GPAC_DEBUG_DLL},${GPAC_RELEASE_DLL}>" "${CMAKE_BINARY_DIR}/$/libgpac.dll" COMMENT "Copying GPAC runtime DLL to build directory" ) - - target_link_libraries(gpac INTERFACE gpac_archive ws2_32 shlwapi winmm) - -else() - add_library(gpac_shared SHARED IMPORTED) - set_target_properties(gpac_shared PROPERTIES - IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/lib/libgpac.dylib" - IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_LIST_DIR}/lib/libgpac.dylib" - IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libgpac.dylib" - IMPORTED_LOCATION_RELWITHDEBINFO "${CMAKE_CURRENT_LIST_DIR}/lib/libgpac.dylib" - LINKER_LANGUAGE CXX) - target_link_libraries(gpac INTERFACE gpac_shared) -endif() +endif () \ No newline at end of file diff --git a/third_party/iamftools/CMakeLists.txt b/third_party/iamftools/CMakeLists.txt index 51923b65..76446a0f 100644 --- a/third_party/iamftools/CMakeLists.txt +++ b/third_party/iamftools/CMakeLists.txt @@ -26,29 +26,20 @@ target_include_directories(iamftools INTERFACE # Cross-platform dynamic library setup add_library(iamftools_dylib SHARED IMPORTED) -if(WIN32) - # Platform-specific setup for Windows - set(IAMF_PLATFORM "Windows") - - # Set paths for each configuration - set(IAMF_TOOLS_DEBUG_DLL "${CMAKE_CURRENT_LIST_DIR}/lib/${IAMF_PLATFORM}/Debug/iamf_tools.dll") - set(IAMF_TOOLS_DEBUG_LIB "${CMAKE_CURRENT_LIST_DIR}/lib/${IAMF_PLATFORM}/Debug/iamf_tools.if.lib") - set(IAMF_TOOLS_RELEASE_DLL "${CMAKE_CURRENT_LIST_DIR}/lib/${IAMF_PLATFORM}/Release/iamf_tools.dll") - set(IAMF_TOOLS_RELEASE_LIB "${CMAKE_CURRENT_LIST_DIR}/lib/${IAMF_PLATFORM}/Release/iamf_tools.if.lib") - - # Validate that the libraries exist - if(NOT EXISTS "${IAMF_TOOLS_DEBUG_DLL}") - message(FATAL_ERROR "IAMF Tools Debug DLL not found at: ${IAMF_TOOLS_DEBUG_DLL}") - endif() - if(NOT EXISTS "${IAMF_TOOLS_DEBUG_LIB}") - message(FATAL_ERROR "IAMF Tools Debug LIB not found at: ${IAMF_TOOLS_DEBUG_LIB}") - endif() - if(NOT EXISTS "${IAMF_TOOLS_RELEASE_DLL}") - message(FATAL_ERROR "IAMF Tools Release DLL not found at: ${IAMF_TOOLS_RELEASE_DLL}") - endif() - if(NOT EXISTS "${IAMF_TOOLS_RELEASE_LIB}") - message(FATAL_ERROR "IAMF Tools Release LIB not found at: ${IAMF_TOOLS_RELEASE_LIB}") - endif() +if (DEFINED IAMF_TOOLS_DYLIB) + # macOS: single dylib + set_target_properties(iamftools_dylib PROPERTIES + IMPORTED_LOCATION "${IAMF_TOOLS_DYLIB}" + IMPORTED_SONAME "libiamf_tools.dylib" + LINKER_LANGUAGE CXX + ) +else () + # Windows: dll + lib with debug/release + foreach (_file ${IAMF_TOOLS_DEBUG_DLL} ${IAMF_TOOLS_DEBUG_LIB} ${IAMF_TOOLS_RELEASE_DLL} ${IAMF_TOOLS_RELEASE_LIB}) + if (NOT EXISTS "${_file}") + message(FATAL_ERROR "IAMF Tools file not found: ${_file}") + endif () + endforeach () message(STATUS "IAMF Tools Debug DLL: ${IAMF_TOOLS_DEBUG_DLL}") message(STATUS "IAMF Tools Release DLL: ${IAMF_TOOLS_RELEASE_DLL}") @@ -62,25 +53,18 @@ if(WIN32) IMPORTED_IMPLIB_RELEASE "${IAMF_TOOLS_RELEASE_LIB}" LINKER_LANGUAGE CXX ) +endif () - # Copy DLL to build directory (configuration-aware using generator expressions) +if (IAMF_TOOLS_COPY_DLL) add_custom_target(copy_iamftools_dll ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different "$,${IAMF_TOOLS_DEBUG_DLL},${IAMF_TOOLS_RELEASE_DLL}>" "${CMAKE_BINARY_DIR}/$/iamf_tools.dll" COMMENT "Copying IAMF Tools DLL to build directory" ) - -else() - # macOS: dylib - set_target_properties(iamftools_dylib PROPERTIES - IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/lib/libiamf_tools.dylib" - IMPORTED_SONAME "libiamf_tools.dylib" - LINKER_LANGUAGE CXX - ) -endif() +endif () target_link_libraries(iamftools INTERFACE iamftools_dylib proto-objects -) +) \ No newline at end of file diff --git a/third_party/libear/CMakeLists.txt b/third_party/libear/CMakeLists.txt index 1a0e2081..165c9a72 100644 --- a/third_party/libear/CMakeLists.txt +++ b/third_party/libear/CMakeLists.txt @@ -1,17 +1,8 @@ add_library(libear INTERFACE) target_include_directories(libear INTERFACE "include/") -target_compile_options(libear INTERFACE "-w") # Silence is golden +target_compile_options(libear INTERFACE "-w") -#Cross-platform setup -if(WIN32) - set(LIBEAR_DEBUG_PATH "${CMAKE_CURRENT_LIST_DIR}/lib/Windows/Debug/libear.lib") - set(LIBEAR_RELEASE_PATH "${CMAKE_CURRENT_LIST_DIR}/lib/Windows/Release/libear.lib") -else() - set(LIBEAR_DEBUG_PATH "${CMAKE_CURRENT_LIST_DIR}/lib/libear.a") - set(LIBEAR_RELEASE_PATH "${CMAKE_CURRENT_LIST_DIR}/lib/libear.a") -endif() - -# Check that the file actually exists +# Validate paths from toolchain if(NOT EXISTS "${LIBEAR_DEBUG_PATH}") message(FATAL_ERROR "libear Debug library not found at: ${LIBEAR_DEBUG_PATH}") endif() @@ -30,10 +21,11 @@ set_target_properties(libear_archive PROPERTIES IMPORTED_LOCATION_MINSIZEREL "${LIBEAR_RELEASE_PATH}" ) -target_link_libraries(libear - INTERFACE - libear_archive - Boost::optional - Boost::variant - Boost::math - Boost::algorithm) \ No newline at end of file +target_link_libraries(libear + INTERFACE + libear_archive + Boost::optional + Boost::variant + Boost::math + Boost::algorithm +) \ No newline at end of file diff --git a/third_party/libiamf/CMakeLists.txt b/third_party/libiamf/CMakeLists.txt index 8a4ebe47..e6f31dee 100644 --- a/third_party/libiamf/CMakeLists.txt +++ b/third_party/libiamf/CMakeLists.txt @@ -1,11 +1,11 @@ -# Copyright 2024 Google LLC -# +# Copyright 2025 Google LLC +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,13 +25,12 @@ set(CODEC_CAP ON CACHE BOOL "Codec capability check" FORCE) set(MULTICHANNEL_BINAURALIZER OFF CACHE BOOL "Enable multichannel binaural rendering" FORCE) set(HOA_BINAURALIZER OFF CACHE BOOL "Enable HOA binaural rendering" FORCE) -# Fetch but don't build yet - we need to patch first FetchContent_GetProperties(libiamf) if (NOT libiamf_POPULATED) FetchContent_Populate(libiamf) - # --- PATCH: Fix libiamf's macos.cmake to remove GCC-only flags and m library on Windows - if (WIN32) + # Patch CMakeLists.txt if needed (Windows) + if (LIBIAMF_NEEDS_PATCHING) file(READ "${libiamf_SOURCE_DIR}/code/CMakeLists.txt" LIBIAMF_CMAKE_CONTENT) string(REPLACE "-O3" "" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") string(REPLACE "-Werror=unused-variable" "" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") @@ -43,65 +42,54 @@ if (NOT libiamf_POPULATED) message(STATUS "Patched libiamf CMakeLists.txt to remove GCC-only flags and m library") endif () - # --- macOS vendor handling - if (APPLE) - set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") + # Vendor library handling + if (DEFINED LIBIAMF_VENDOR_PATH) + # macOS: single vendor path file(REMOVE "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libopus.a" "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libfdk-aac.a" "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libFLAC.a" ) file(COPY - "${VENDOR_LIB_PATH}/libopus.a" - "${VENDOR_LIB_PATH}/libFLAC.a" - "${VENDOR_LIB_PATH}/libfdk-aac.a" - "${VENDOR_LIB_PATH}/libogg.a" + "${LIBIAMF_VENDOR_PATH}/libopus.a" + "${LIBIAMF_VENDOR_PATH}/libFLAC.a" + "${LIBIAMF_VENDOR_PATH}/libfdk-aac.a" + "${LIBIAMF_VENDOR_PATH}/libogg.a" DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" ) - link_directories("${VENDOR_LIB_PATH}") - endif () - - # --- Windows vendor handling - if (WIN32) + link_directories("${LIBIAMF_VENDOR_PATH}") + elseif (DEFINED LIBIAMF_VENDOR_DEBUG_PATH) + # Windows: debug/release vendor paths message(STATUS "Using Windows codec libraries for IAMF") - set(VENDOR_LIB_PATH_DEBUG "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Debug") - set(VENDOR_LIB_PATH_RELEASE "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Release") - - # Copy Debug libraries if they exist - if (EXISTS "${VENDOR_LIB_PATH_DEBUG}/fdk-aac.lib") + if (EXISTS "${LIBIAMF_VENDOR_DEBUG_PATH}/fdk-aac.lib") file(COPY - "${VENDOR_LIB_PATH_DEBUG}/fdk-aac.lib" - "${VENDOR_LIB_PATH_DEBUG}/FLAC.lib" - "${VENDOR_LIB_PATH_DEBUG}/opus.lib" - "${VENDOR_LIB_PATH_DEBUG}/ogg.lib" + "${LIBIAMF_VENDOR_DEBUG_PATH}/fdk-aac.lib" + "${LIBIAMF_VENDOR_DEBUG_PATH}/FLAC.lib" + "${LIBIAMF_VENDOR_DEBUG_PATH}/opus.lib" + "${LIBIAMF_VENDOR_DEBUG_PATH}/ogg.lib" DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" ) endif () - # Copy Release libraries if they exist - if (EXISTS "${VENDOR_LIB_PATH_RELEASE}/fdk-aac.lib") + if (EXISTS "${LIBIAMF_VENDOR_RELEASE_PATH}/fdk-aac.lib") file(COPY - "${VENDOR_LIB_PATH_RELEASE}/fdk-aac.lib" - "${VENDOR_LIB_PATH_RELEASE}/FLAC.lib" - "${VENDOR_LIB_PATH_RELEASE}/opus.lib" - "${VENDOR_LIB_PATH_RELEASE}/ogg.lib" + "${LIBIAMF_VENDOR_RELEASE_PATH}/fdk-aac.lib" + "${LIBIAMF_VENDOR_RELEASE_PATH}/FLAC.lib" + "${LIBIAMF_VENDOR_RELEASE_PATH}/opus.lib" + "${LIBIAMF_VENDOR_RELEASE_PATH}/ogg.lib" DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" ) endif () - endif () - - # --- Protobuf / Abseil injection (for Windows builds) - if (WIN32) message(STATUS "Using Protobuf and Abseil targets from FetchContent") endif () - # --- NOW build libiamf (after patching) + # Build libiamf (after patching) add_subdirectory(${libiamf_SOURCE_DIR}/code ${libiamf_BINARY_DIR}) - # --- PATCH: Remove Linux-only 'm' linkage (no libm on Windows) - if (WIN32 AND TARGET iamf) + # Remove 'm' linkage if needed (Windows) + if (LIBIAMF_REMOVE_M_LINKAGE AND TARGET iamf) message(STATUS "Patching libiamf: removing Linux-only 'm' linkage") get_target_property(_iamf_libs iamf INTERFACE_LINK_LIBRARIES) if (_iamf_libs) @@ -110,23 +98,23 @@ if (NOT libiamf_POPULATED) endif () endif () - # --- Windows codec linking (after target exists) - if (WIN32 AND TARGET iamf) + # Windows codec linking (after target exists) + if (DEFINED LIBIAMF_VENDOR_RELEASE_PATH AND TARGET iamf) target_link_libraries(iamf - "${VENDOR_LIB_PATH}/fdk-aac.lib" - "${VENDOR_LIB_PATH}/FLAC.lib" - "${VENDOR_LIB_PATH}/opus.lib" - "${VENDOR_LIB_PATH}/ogg.lib" + "${LIBIAMF_VENDOR_RELEASE_PATH}/fdk-aac.lib" + "${LIBIAMF_VENDOR_RELEASE_PATH}/FLAC.lib" + "${LIBIAMF_VENDOR_RELEASE_PATH}/opus.lib" + "${LIBIAMF_VENDOR_RELEASE_PATH}/ogg.lib" ) endif () endif () -# --- Extra linking for ogg +# Extra linking for ogg if (TARGET iamf) target_link_libraries(iamf ogg) endif () -# --- Include dirs (for iamfdec_utils) +# Include dirs (for iamfdec_utils) set(LIBIAMF_INCLUDE_DIRS ${libiamf_SOURCE_DIR}/code/include ${libiamf_SOURCE_DIR}/code/src/common @@ -143,7 +131,7 @@ set(LIBIAMF_INCLUDE_DIRS CACHE INTERNAL "LIBIAMF include directories" ) -# --- Build iamfdec_utils (no main) +# Build iamfdec_utils (no main) if (EXISTS "${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src") set(IAMFDEC_UTIL_SOURCES ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/dmemory.c diff --git a/third_party/obr/CMakeLists.txt b/third_party/obr/CMakeLists.txt index 08dc5c0e..648ab720 100644 --- a/third_party/obr/CMakeLists.txt +++ b/third_party/obr/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(obr INTERFACE) -target_compile_options(obr INTERFACE "-w") # Silence is golden +target_compile_options(obr INTERFACE "-w") # Disable unneeded build options for dependencies set(BUILD_TESTING OFF CACHE BOOL "" FORCE) @@ -19,34 +19,37 @@ target_include_directories(obr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/obr/renderer ${CMAKE_CURRENT_SOURCE_DIR}/obr/ambisonic_encoder ${CMAKE_BINARY_DIR}/_deps/pffft-src - ) -# Platform-specific static linking -if (WIN32) +# Platform-specific linking +if (OBR_USE_STATIC) + # Windows: static libs with debug/release target_link_libraries(obr INTERFACE - $<$:${CMAKE_CURRENT_SOURCE_DIR}/lib/Windows/Debug/obr.lib> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/lib/Windows/Release/obr.lib> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/lib/Windows/Debug/pffft.lib> - $<$:${CMAKE_CURRENT_SOURCE_DIR}/lib/Windows/Release/pffft.lib> + $<$:${OBR_DEBUG_LIB}> + $<$:${OBR_RELEASE_LIB}> + $<$:${PFFFT_DEBUG_LIB}> + $<$:${PFFFT_RELEASE_LIB}> Eigen ) -else() - add_library(obr_dylib SHARED IMPORTED) - set_target_properties(obr_dylib PROPERTIES - IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/lib/obr.dylib" - IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_LIST_DIR}/lib/obr.dylib" - IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/obr.dylib" - IMPORTED_LOCATION_RELWITHDEBINFO "${CMAKE_CURRENT_LIST_DIR}/lib/obr.dylib" - IMPORTED_SONAME "obr.dylib" - LINKER_LANGUAGE CXX) +else () + # macOS: dynamic library + add_library(obr_dylib SHARED IMPORTED) + set_target_properties(obr_dylib PROPERTIES + IMPORTED_LOCATION "${OBR_DYLIB}" + IMPORTED_LOCATION_DEBUG "${OBR_DYLIB}" + IMPORTED_LOCATION_RELEASE "${OBR_DYLIB}" + IMPORTED_LOCATION_RELWITHDEBINFO "${OBR_DYLIB}" + IMPORTED_SONAME "obr.dylib" + LINKER_LANGUAGE CXX + ) - target_link_libraries(obr - INTERFACE - obr_dylib - Eigen - pffft) -endif() + target_link_libraries(obr + INTERFACE + obr_dylib + Eigen + pffft + ) +endif () # Make include dirs available to parent set(OBR_INCLUDE_DIRS @@ -54,6 +57,5 @@ set(OBR_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/obr ${CMAKE_CURRENT_SOURCE_DIR}/obr/renderer ${CMAKE_CURRENT_SOURCE_DIR}/obr/ambisonic_encoder - ) -set(OBR_INCLUDE_DIRS "${OBR_INCLUDE_DIRS}" PARENT_SCOPE) +set(OBR_INCLUDE_DIRS "${OBR_INCLUDE_DIRS}" PARENT_SCOPE) \ No newline at end of file From ea6db705ac3f46ecd32bb24fe9c4293c616d4f52 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Thu, 5 Feb 2026 14:58:04 -0800 Subject: [PATCH 16/43] Refactored macos cmake files --- cmake/copy_resources.cmake | 79 ++++--------------- cmake/imported_targets_macos.cmake | 35 -------- cmake/imported_targets_windows.cmake | 54 ------------- cmake/prebuiltLibs/macos.cmake | 52 ++++++++++++ cmake/prebuiltLibs/windows.cmake | 76 ++++++++++++++++++ cmake/toolchains/macos.cmake | 58 +++----------- cmake/toolchains/windows.cmake | 86 +++++--------------- third_party/CMakeLists.txt | 8 +- third_party/gpac/CMakeLists.txt | 42 +--------- third_party/iamftools/CMakeLists.txt | 46 +---------- third_party/libear/CMakeLists.txt | 24 +----- third_party/libiamf/CMakeLists.txt | 114 +++++++++++---------------- third_party/obr/CMakeLists.txt | 35 +------- 13 files changed, 230 insertions(+), 479 deletions(-) delete mode 100644 cmake/imported_targets_macos.cmake delete mode 100644 cmake/imported_targets_windows.cmake create mode 100644 cmake/prebuiltLibs/macos.cmake create mode 100644 cmake/prebuiltLibs/windows.cmake diff --git a/cmake/copy_resources.cmake b/cmake/copy_resources.cmake index 3823b96a..6266d191 100644 --- a/cmake/copy_resources.cmake +++ b/cmake/copy_resources.cmake @@ -14,28 +14,23 @@ function(copy_resources target plugin_path) - # ========================================================================= - # Common Dependency List Between Mac and Windows - # ========================================================================= - set(COMMON_DEPS vendored_gpac - vendored_iamf_tools - libzmq - ) - # ========================================================================= - # Platform-Specific Configurations - # ========================================================================= if (APPLE) - set(PLATFORM_DEPS vendored_obr) set(DEST_ROOT "${plugin_path}/Contents/Resources") - set(DEST_IAMF "${DEST_ROOT}/third_party/iamftools/lib") - set(DEST_OBR "${DEST_ROOT}/third_party/obr/lib") - set(DEST_GPAC "${DEST_ROOT}/third_party/gpac/lib") - elseif (WIN32) - set(PLATFORM_DEPS vendored_gpac_crypto - vendored_gpac_ssl + add_custom_command(TARGET ${target} PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}/third_party/gpac/lib" + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}/third_party/iamftools/lib" + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}/third_party/obr/lib" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/third_party/gpac/lib/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/third_party/iamftools/lib/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/third_party/obr/lib/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" + COMMAND ${CMAKE_COMMAND} -E create_symlink "$" "${DEST_ROOT}/libzmq.5.dylib" + COMMAND ${CMAKE_COMMAND} -E create_symlink "libzmq.5.dylib" "${DEST_ROOT}/libzmq.dylib" ) + elseif (WIN32) if ("${target}" MATCHES ".*_VST3$") set(DEST_ROOT "${plugin_path}/Contents/x86_64-win") elseif ("${target}" MATCHES ".*_AAX$") @@ -47,61 +42,21 @@ function(copy_resources target plugin_path) return() endif () - set(DEST_IAMF "${DEST_ROOT}") - set(DEST_GPAC "${DEST_ROOT}") - endif () - - set(ALL_DEPS ${COMMON_DEPS} ${PLATFORM_DEPS}) - - # ========================================================================= - # Copy Commands - # ========================================================================= - set(COPY_COMMANDS - COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}" - ) - - if (APPLE) - list(APPEND COPY_COMMANDS - COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_IAMF}" - COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_OBR}" - COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_GPAC}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_GPAC}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_IAMF}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_OBR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" - ) - elseif (WIN32) - foreach (_dep IN LISTS ALL_DEPS) + set(COPY_COMMANDS COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}") + foreach (_dep IN LISTS ECLIPSA_VENDORED_LIBS) list(APPEND COPY_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/") - endforeach () - endif () - - add_custom_command(TARGET ${target} PRE_BUILD ${COPY_COMMANDS}) - - # ========================================================================= - # Platform-Specific Post-Processing - # ========================================================================= - if (APPLE) - # ZMQ symlinks - add_custom_command(TARGET ${target} PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E create_symlink "$" "${DEST_ROOT}/libzmq.5.dylib" - COMMAND ${CMAKE_COMMAND} -E create_symlink "libzmq.5.dylib" "${DEST_ROOT}/libzmq.dylib" - ) - - elseif (WIN32) - # DELAYLOAD flags - foreach (_dep IN LISTS ALL_DEPS) target_link_options(${target} PRIVATE "/DELAYLOAD:$") endforeach () + add_custom_command(TARGET ${target} PRE_BUILD ${COPY_COMMANDS}) - # Signing dir copy (for JUCE VST3 validator) set(VST3_SIGNING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${BUILD_LIB_DIR}") set(SIGNING_COMMANDS COMMAND ${CMAKE_COMMAND} -E make_directory "${VST3_SIGNING_DIR}") - foreach (_dep IN LISTS ALL_DEPS) + foreach (_dep IN LISTS ECLIPSA_VENDORED_LIBS) list(APPEND SIGNING_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${VST3_SIGNING_DIR}/") endforeach () add_custom_command(TARGET ${target} PRE_BUILD ${SIGNING_COMMANDS}) endif () + endfunction() \ No newline at end of file diff --git a/cmake/imported_targets_macos.cmake b/cmake/imported_targets_macos.cmake deleted file mode 100644 index 5918d797..00000000 --- a/cmake/imported_targets_macos.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -#==================================================================== -# Imported Targets - macOS -#==================================================================== -# GPAC -if (NOT TARGET vendored_gpac) - add_library(vendored_gpac SHARED IMPORTED GLOBAL) - set_target_properties(vendored_gpac PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/libgpac.dylib" - ) -endif () -# IAMF Tools -if (NOT TARGET vendored_iamf_tools) - add_library(vendored_iamf_tools SHARED IMPORTED GLOBAL) - set_target_properties(vendored_iamf_tools PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/libiamf_tools.dylib" - ) -endif () -# OBR -if (NOT TARGET vendored_obr) - add_library(vendored_obr SHARED IMPORTED GLOBAL) - set_target_properties(vendored_obr PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/obr/lib/obr.dylib" - ) -endif () \ No newline at end of file diff --git a/cmake/imported_targets_windows.cmake b/cmake/imported_targets_windows.cmake deleted file mode 100644 index 7d48a180..00000000 --- a/cmake/imported_targets_windows.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -#==================================================================== -# Imported Targets - Windows -#==================================================================== - -# GPAC -if (NOT TARGET vendored_gpac) - add_library(vendored_gpac SHARED IMPORTED GLOBAL) - set_target_properties(vendored_gpac PROPERTIES - IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libgpac.dll" - IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libgpac.dll" - IMPORTED_IMPLIB_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libgpac.lib" - IMPORTED_IMPLIB_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libgpac.lib" - ) -endif () - -# IAMF Tools -if (NOT TARGET vendored_iamf_tools) - add_library(vendored_iamf_tools SHARED IMPORTED GLOBAL) - set_target_properties(vendored_iamf_tools PROPERTIES - IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.dll" - IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.dll" - IMPORTED_IMPLIB_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.lib" - IMPORTED_IMPLIB_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.lib" - ) -endif () - -# GPAC Crypto -if (NOT TARGET vendored_gpac_crypto) - add_library(vendored_gpac_crypto SHARED IMPORTED GLOBAL) - set_target_properties(vendored_gpac_crypto PROPERTIES - IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libcryptoMD.dll" - IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libcryptoMD.dll" - ) -endif () - -# GPAC SSL -if (NOT TARGET vendored_gpac_ssl) - add_library(vendored_gpac_ssl SHARED IMPORTED GLOBAL) - set_target_properties(vendored_gpac_ssl PROPERTIES - IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libsslMD.dll" - IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libsslMD.dll" - ) -endif () \ No newline at end of file diff --git a/cmake/prebuiltLibs/macos.cmake b/cmake/prebuiltLibs/macos.cmake new file mode 100644 index 00000000..32c3499c --- /dev/null +++ b/cmake/prebuiltLibs/macos.cmake @@ -0,0 +1,52 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +#==================================================================== +# Prebuilt Libraries - macOS +#==================================================================== + +# GPAC +add_library(gpac_impl SHARED IMPORTED GLOBAL) +set_target_properties(gpac_impl PROPERTIES + IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/libgpac.dylib" +) +add_library(vendored_gpac ALIAS gpac_impl) + +# IAMF Tools +add_library(iamftools_impl SHARED IMPORTED GLOBAL) +set_target_properties(iamftools_impl PROPERTIES + IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/libiamf_tools.dylib" +) +add_library(vendored_iamf_tools ALIAS iamftools_impl) + +# OBR +add_library(obr_impl SHARED IMPORTED GLOBAL) +set_target_properties(obr_impl PROPERTIES + IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/obr/lib/obr.dylib" +) +add_library(vendored_obr ALIAS obr_impl) + +# Libear +add_library(libear_impl STATIC IMPORTED GLOBAL) +set_target_properties(libear_impl PROPERTIES + IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/libear/lib/libear.a" +) + +#==================================================================== +# Vendored Libraries (for bundle packaging) +#==================================================================== +set(ECLIPSA_VENDORED_LIBS + vendored_gpac + vendored_iamf_tools + vendored_obr + libzmq + CACHE STRING "" +) \ No newline at end of file diff --git a/cmake/prebuiltLibs/windows.cmake b/cmake/prebuiltLibs/windows.cmake new file mode 100644 index 00000000..87655e67 --- /dev/null +++ b/cmake/prebuiltLibs/windows.cmake @@ -0,0 +1,76 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +#==================================================================== +# Prebuilt Libraries - Windows +#==================================================================== + +# GPAC +add_library(gpac_impl SHARED IMPORTED GLOBAL) +set_target_properties(gpac_impl PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libgpac.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libgpac.dll" + IMPORTED_IMPLIB_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libgpac.lib" + IMPORTED_IMPLIB_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libgpac.lib" +) +add_library(vendored_gpac ALIAS gpac_impl) + +# IAMF Tools +add_library(iamftools_impl SHARED IMPORTED GLOBAL) +set_target_properties(iamftools_impl PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.dll" + IMPORTED_IMPLIB_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.lib" + IMPORTED_IMPLIB_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.lib" +) +add_library(vendored_iamf_tools ALIAS iamftools_impl) + +# GPAC Crypto +add_library(vendored_gpac_crypto SHARED IMPORTED GLOBAL) +set_target_properties(vendored_gpac_crypto PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libcryptoMD.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libcryptoMD.dll" +) + +# GPAC SSL +add_library(vendored_gpac_ssl SHARED IMPORTED GLOBAL) +set_target_properties(vendored_gpac_ssl PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libsslMD.dll" + IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libsslMD.dll" +) + +# OBR (static) +add_library(obr_impl INTERFACE) +target_link_libraries(obr_impl INTERFACE + $<$:${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Debug/obr.lib> + $<$:${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Release/obr.lib> + $<$:${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Debug/pffft.lib> + $<$:${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Release/pffft.lib> +) + +# Libear +add_library(libear_impl STATIC IMPORTED GLOBAL) +set_target_properties(libear_impl PROPERTIES + IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/libear/lib/Windows/Release/libear.lib" + IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/libear/lib/Windows/Debug/libear.lib" +) + +#==================================================================== +# Vendored Libraries (for bundle packaging) +#==================================================================== +set(ECLIPSA_VENDORED_LIBS + vendored_gpac + vendored_iamf_tools + vendored_gpac_crypto + vendored_gpac_ssl + libzmq + CACHE STRING "" +) \ No newline at end of file diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index 8a95bba4..9ee9f370 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -20,6 +20,11 @@ if (DEFINED _MACOS_TOOLCHAIN_INCLUDED) endif () set(_MACOS_TOOLCHAIN_INCLUDED TRUE) +#==================================================================== +# Platform Identifier +#==================================================================== +set(ECLIPSA_PLATFORM "macos" CACHE STRING "") + #==================================================================== # Deployment Target #==================================================================== @@ -28,12 +33,11 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum macOS version") #==================================================================== # RPATH Configuration #==================================================================== -set(CMAKE_BUILD_RPATH "@loader_path/../Resources;${CMAKE_SOURCE_DIR}" CACHE STRING "") +set(CMAKE_BUILD_RPATH "@loader_path/../Resources" CACHE STRING "") #==================================================================== # Linker Settings #==================================================================== -# Xcode 15+ classic linker (avoids duplicate symbol warnings) add_link_options("-Wl,-ld_classic") #==================================================================== @@ -45,53 +49,11 @@ if (BUILD_AAX) endif () #==================================================================== -# Library Names +# Build Settings #==================================================================== set(IAMF_LIB_NAME "libiamf" CACHE STRING "") - -set(ECLIPSA_PLATFORM_LIBS - vendored_obr - CACHE STRING "Platform-specific libraries" -) - -set(ECLIPSA_PLATFORM_PLUGIN_FORMATS AU CACHE STRING "Platform-specific plugin formats") - set(ECLIPSA_IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build" CACHE STRING "") - -set(SAF_PERFORMANCE_LIB "SAF_USE_APPLE_ACCELERATE" CACHE STRING "") - set(ECLIPSA_STATIC_LIB_SUFFIX ".a" CACHE STRING "") - -set(ECLIPSA_PLATFORM "macos" CACHE STRING "") - -#==================================================================== -# GPAC Paths -#==================================================================== -set(GPAC_DYLIB "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/libgpac.dylib" CACHE FILEPATH "") -set(GPAC_EXTRA_LIBS "" CACHE STRING "") -set(GPAC_COPY_DLL OFF CACHE BOOL "") - -#==================================================================== -# IAMF Tools Paths -#==================================================================== -set(IAMF_TOOLS_DYLIB "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/libiamf_tools.dylib" CACHE FILEPATH "") -set(IAMF_TOOLS_COPY_DLL OFF CACHE BOOL "") - -#==================================================================== -# Libear Paths -#==================================================================== -set(LIBEAR_DEBUG_PATH "${CMAKE_SOURCE_DIR}/third_party/libear/lib/libear.a" CACHE FILEPATH "") -set(LIBEAR_RELEASE_PATH "${CMAKE_SOURCE_DIR}/third_party/libear/lib/libear.a" CACHE FILEPATH "") - -#==================================================================== -# LibIAMF Paths -#==================================================================== -set(LIBIAMF_VENDOR_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos" CACHE PATH "") -set(LIBIAMF_NEEDS_PATCHING OFF CACHE BOOL "") -set(LIBIAMF_REMOVE_M_LINKAGE OFF CACHE BOOL "") - -#==================================================================== -# OBR Paths -#==================================================================== -set(OBR_DYLIB "${CMAKE_SOURCE_DIR}/third_party/obr/lib/obr.dylib" CACHE FILEPATH "") -set(OBR_USE_STATIC OFF CACHE BOOL "") +set(ECLIPSA_PLATFORM_PLUGIN_FORMATS AU CACHE STRING "") +set(ECLIPSA_PLATFORM_LIBS vendored_obr CACHE STRING "") +set(SAF_PERFORMANCE_LIB "SAF_USE_APPLE_ACCELERATE" CACHE STRING "") \ No newline at end of file diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index 6d9ac0f2..efd4faab 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -13,7 +13,7 @@ # limitations under the License. #==================================================================== -#Include Guard +# Include Guard #==================================================================== if (DEFINED _WINDOWS_TOOLCHAIN_INCLUDED) return() @@ -21,7 +21,12 @@ endif () set(_WINDOWS_TOOLCHAIN_INCLUDED TRUE) #==================================================================== -# AAX SDK Path (Windows) +# Platform Identifier +#==================================================================== +set(ECLIPSA_PLATFORM "windows" CACHE STRING "") + +#==================================================================== +# AAX SDK Path #==================================================================== if (BUILD_AAX) set(AAX_SDK_VER "2-8-1" CACHE STRING "AAX SDK Version") @@ -29,19 +34,13 @@ if (BUILD_AAX) endif () #==================================================================== -#Compiler Settings +# Compiler Settings #==================================================================== add_compile_definitions(_USE_MATH_DEFINES) -# Reduce optimization to avoid MSVC compiler crash on SAF set(CMAKE_C_FLAGS_RELEASE "/O1 /MD /DNDEBUG" CACHE STRING "" FORCE) #==================================================================== -# Library Names (platform-specific) -#==================================================================== -set(IAMF_LIB_NAME "iamf" CACHE STRING "") - -#==================================================================== -# Resource Compiler +# Resource Compiler #==================================================================== if (NOT CMAKE_RC_COMPILER) find_program(CMAKE_RC_COMPILER rc.exe @@ -51,7 +50,6 @@ endif () #==================================================================== # VCPKG #==================================================================== -# Disable automatic DLL copying (we handle this manually) set(X_VCPKG_APPLOCAL_DEPS_INSTALL OFF CACHE BOOL "") if (NOT DEFINED VCPKG_ROOT AND DEFINED ENV{VCPKG_ROOT}) @@ -82,25 +80,23 @@ endif () #==================================================================== find_package(ZLIB REQUIRED) set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} CACHE INTERNAL "ZLIB libraries for Windows") - -#==================================================================== -# Link Libraries -#==================================================================== link_libraries(ZLIB::ZLIB) link_libraries(delayimp) +#==================================================================== +# Build Settings +#==================================================================== +set(IAMF_LIB_NAME "iamf" CACHE STRING "") +set(ECLIPSA_IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build/$" CACHE STRING "") +set(ECLIPSA_STATIC_LIB_SUFFIX ".lib" CACHE STRING "") set(ECLIPSA_PLATFORM_LIBS vendored_gpac_crypto vendored_gpac_ssl ZLIB::ZLIB delayimp - CACHE STRING "Platform-specific libraries" + CACHE STRING "" ) -set(ECLIPSA_IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build/$" CACHE STRING "") - -set(ECLIPSA_STATIC_LIB_SUFFIX ".lib" CACHE STRING "") - #==================================================================== # SAF Performance Library (Intel MKL) #==================================================================== @@ -110,8 +106,7 @@ if (NOT DEFINED CACHE{SAF_PERFORMANCE_LIB}) endif () if (NOT MKL_ROOT OR NOT EXISTS "${MKL_ROOT}") - message(STATUS "SAF: Intel MKL not found. MKLROOT is not set or invalid: '${MKL_ROOT}'") - message(STATUS " Falling back to OpenBLAS/LAPACKE") + message(STATUS "SAF: Intel MKL not found, falling back to OpenBLAS/LAPACKE") set(SAF_PERFORMANCE_LIB "SAF_USE_OPEN_BLAS_AND_LAPACKE" CACHE STRING "" FORCE) else () message(STATUS "SAF: Found Intel MKL at: ${MKL_ROOT}") @@ -134,49 +129,4 @@ if (NOT DEFINED CACHE{SAF_PERFORMANCE_LIB}) endif () endforeach () endif () -endif () - -set(ECLIPSA_PLATFORM "windows" CACHE STRING "") - -#==================================================================== -# GPAC Paths -#==================================================================== -set(GPAC_DEBUG_DLL "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libgpac.dll" CACHE FILEPATH "") -set(GPAC_DEBUG_LIB "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Debug/libgpac.lib" CACHE FILEPATH "") -set(GPAC_RELEASE_DLL "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libgpac.dll" CACHE FILEPATH "") -set(GPAC_RELEASE_LIB "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/Release/libgpac.lib" CACHE FILEPATH "") -set(GPAC_EXTRA_LIBS "ws2_32;shlwapi;winmm" CACHE STRING "") -set(GPAC_COPY_DLL ON CACHE BOOL "") - -#==================================================================== -# IAMF Tools Paths -#==================================================================== -set(IAMF_TOOLS_DEBUG_DLL "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.dll" CACHE FILEPATH "") -set(IAMF_TOOLS_DEBUG_LIB "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.if.lib" CACHE FILEPATH "") -set(IAMF_TOOLS_RELEASE_DLL "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.dll" CACHE FILEPATH "") -set(IAMF_TOOLS_RELEASE_LIB "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.if.lib" CACHE FILEPATH "") -set(IAMF_TOOLS_COPY_DLL ON CACHE BOOL "") - -#==================================================================== -# Libear Paths -#==================================================================== -set(LIBEAR_DEBUG_PATH "${CMAKE_SOURCE_DIR}/third_party/libear/lib/Windows/Debug/libear.lib" CACHE FILEPATH "") -set(LIBEAR_RELEASE_PATH "${CMAKE_SOURCE_DIR}/third_party/libear/lib/Windows/Release/libear.lib" CACHE FILEPATH "") - -#==================================================================== -# LibIAMF Paths -#==================================================================== -set(LIBIAMF_VENDOR_DEBUG_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Debug" CACHE PATH "") -set(LIBIAMF_VENDOR_RELEASE_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Release" CACHE PATH "") -set(LIBIAMF_NEEDS_PATCHING ON CACHE BOOL "") -set(LIBIAMF_REMOVE_M_LINKAGE ON CACHE BOOL "") - -#==================================================================== -# OBR Paths -#==================================================================== -set(OBR_DEBUG_LIB "${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Debug/obr.lib" CACHE FILEPATH "") -set(OBR_RELEASE_LIB "${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Release/obr.lib" CACHE FILEPATH "") -set(PFFFT_DEBUG_LIB "${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Debug/pffft.lib" CACHE FILEPATH "") -set(PFFFT_RELEASE_LIB "${CMAKE_SOURCE_DIR}/third_party/obr/lib/Windows/Release/pffft.lib" CACHE FILEPATH "") -set(OBR_USE_STATIC ON CACHE BOOL "") - +endif () \ No newline at end of file diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 239ab4c8..07c9197b 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -13,6 +13,12 @@ include(FetchContent) # Force static linking for all third-party dependencies set(BUILD_SHARED_LIBS OFF) + +#==================================================================== +# Prebuilt Libraries (must come first) +#==================================================================== +include("${CMAKE_SOURCE_DIR}/cmake/prebuiltLibs/${ECLIPSA_PLATFORM}.cmake") + #==================================================================== # Add Dependencies #==================================================================== @@ -92,4 +98,4 @@ endif () #==================================================================== # Imported Targets #==================================================================== -include("${CMAKE_SOURCE_DIR}/cmake/imported_targets_${ECLIPSA_PLATFORM}.cmake") +#include("${CMAKE_SOURCE_DIR}/cmake/prebuiltLibs/imported_targets_${ECLIPSA_PLATFORM}.cmake") diff --git a/third_party/gpac/CMakeLists.txt b/third_party/gpac/CMakeLists.txt index 5e795cee..319f91b4 100644 --- a/third_party/gpac/CMakeLists.txt +++ b/third_party/gpac/CMakeLists.txt @@ -1,43 +1,3 @@ add_library(gpac INTERFACE) target_include_directories(gpac INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include/") - -if (DEFINED GPAC_DYLIB) - # macOS: single dylib - add_library(gpac_impl SHARED IMPORTED GLOBAL) - set_target_properties(gpac_impl PROPERTIES - IMPORTED_LOCATION "${GPAC_DYLIB}" - LINKER_LANGUAGE CXX - ) -else () - # Windows: dll + lib with debug/release - foreach (_file ${GPAC_DEBUG_DLL} ${GPAC_DEBUG_LIB} ${GPAC_RELEASE_DLL} ${GPAC_RELEASE_LIB}) - if (NOT EXISTS "${_file}") - message(FATAL_ERROR "GPAC file not found: ${_file}") - endif () - endforeach () - - message(STATUS "GPAC Debug DLL: ${GPAC_DEBUG_DLL}") - message(STATUS "GPAC Release DLL: ${GPAC_RELEASE_DLL}") - - add_library(gpac_impl SHARED IMPORTED GLOBAL) - set_target_properties(gpac_impl PROPERTIES - IMPORTED_LOCATION "${GPAC_RELEASE_DLL}" - IMPORTED_LOCATION_DEBUG "${GPAC_DEBUG_DLL}" - IMPORTED_LOCATION_RELEASE "${GPAC_RELEASE_DLL}" - IMPORTED_IMPLIB "${GPAC_RELEASE_LIB}" - IMPORTED_IMPLIB_DEBUG "${GPAC_DEBUG_LIB}" - IMPORTED_IMPLIB_RELEASE "${GPAC_RELEASE_LIB}" - LINKER_LANGUAGE CXX - ) -endif () - -target_link_libraries(gpac INTERFACE gpac_impl ${GPAC_EXTRA_LIBS}) - -if (GPAC_COPY_DLL) - add_custom_target(copy_gpac_dll ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "$,${GPAC_DEBUG_DLL},${GPAC_RELEASE_DLL}>" - "${CMAKE_BINARY_DIR}/$/libgpac.dll" - COMMENT "Copying GPAC runtime DLL to build directory" - ) -endif () \ No newline at end of file +target_link_libraries(gpac INTERFACE gpac_impl) \ No newline at end of file diff --git a/third_party/iamftools/CMakeLists.txt b/third_party/iamftools/CMakeLists.txt index 76446a0f..186d917b 100644 --- a/third_party/iamftools/CMakeLists.txt +++ b/third_party/iamftools/CMakeLists.txt @@ -23,48 +23,4 @@ target_include_directories(iamftools INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/iamf/include/iamf_tools" ) -# Cross-platform dynamic library setup -add_library(iamftools_dylib SHARED IMPORTED) - -if (DEFINED IAMF_TOOLS_DYLIB) - # macOS: single dylib - set_target_properties(iamftools_dylib PROPERTIES - IMPORTED_LOCATION "${IAMF_TOOLS_DYLIB}" - IMPORTED_SONAME "libiamf_tools.dylib" - LINKER_LANGUAGE CXX - ) -else () - # Windows: dll + lib with debug/release - foreach (_file ${IAMF_TOOLS_DEBUG_DLL} ${IAMF_TOOLS_DEBUG_LIB} ${IAMF_TOOLS_RELEASE_DLL} ${IAMF_TOOLS_RELEASE_LIB}) - if (NOT EXISTS "${_file}") - message(FATAL_ERROR "IAMF Tools file not found: ${_file}") - endif () - endforeach () - - message(STATUS "IAMF Tools Debug DLL: ${IAMF_TOOLS_DEBUG_DLL}") - message(STATUS "IAMF Tools Release DLL: ${IAMF_TOOLS_RELEASE_DLL}") - - set_target_properties(iamftools_dylib PROPERTIES - IMPORTED_LOCATION "${IAMF_TOOLS_RELEASE_DLL}" - IMPORTED_LOCATION_DEBUG "${IAMF_TOOLS_DEBUG_DLL}" - IMPORTED_LOCATION_RELEASE "${IAMF_TOOLS_RELEASE_DLL}" - IMPORTED_IMPLIB "${IAMF_TOOLS_RELEASE_LIB}" - IMPORTED_IMPLIB_DEBUG "${IAMF_TOOLS_DEBUG_LIB}" - IMPORTED_IMPLIB_RELEASE "${IAMF_TOOLS_RELEASE_LIB}" - LINKER_LANGUAGE CXX - ) -endif () - -if (IAMF_TOOLS_COPY_DLL) - add_custom_target(copy_iamftools_dll ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "$,${IAMF_TOOLS_DEBUG_DLL},${IAMF_TOOLS_RELEASE_DLL}>" - "${CMAKE_BINARY_DIR}/$/iamf_tools.dll" - COMMENT "Copying IAMF Tools DLL to build directory" - ) -endif () - -target_link_libraries(iamftools INTERFACE - iamftools_dylib - proto-objects -) \ No newline at end of file +target_link_libraries(iamftools INTERFACE iamftools_impl proto-objects) \ No newline at end of file diff --git a/third_party/libear/CMakeLists.txt b/third_party/libear/CMakeLists.txt index 165c9a72..bddb81af 100644 --- a/third_party/libear/CMakeLists.txt +++ b/third_party/libear/CMakeLists.txt @@ -2,28 +2,8 @@ add_library(libear INTERFACE) target_include_directories(libear INTERFACE "include/") target_compile_options(libear INTERFACE "-w") -# Validate paths from toolchain -if(NOT EXISTS "${LIBEAR_DEBUG_PATH}") - message(FATAL_ERROR "libear Debug library not found at: ${LIBEAR_DEBUG_PATH}") -endif() - -if(NOT EXISTS "${LIBEAR_RELEASE_PATH}") - message(FATAL_ERROR "libear Release library not found at: ${LIBEAR_RELEASE_PATH}") -endif() - -# Import prebuilt static library -add_library(libear_archive STATIC IMPORTED) -set_target_properties(libear_archive PROPERTIES - IMPORTED_LOCATION "${LIBEAR_RELEASE_PATH}" - IMPORTED_LOCATION_DEBUG "${LIBEAR_DEBUG_PATH}" - IMPORTED_LOCATION_RELEASE "${LIBEAR_RELEASE_PATH}" - IMPORTED_LOCATION_RELWITHDEBINFO "${LIBEAR_RELEASE_PATH}" - IMPORTED_LOCATION_MINSIZEREL "${LIBEAR_RELEASE_PATH}" -) - -target_link_libraries(libear - INTERFACE - libear_archive +target_link_libraries(libear INTERFACE + libear_impl Boost::optional Boost::variant Boost::math diff --git a/third_party/libiamf/CMakeLists.txt b/third_party/libiamf/CMakeLists.txt index e6f31dee..c0b21dcb 100644 --- a/third_party/libiamf/CMakeLists.txt +++ b/third_party/libiamf/CMakeLists.txt @@ -29,8 +29,27 @@ FetchContent_GetProperties(libiamf) if (NOT libiamf_POPULATED) FetchContent_Populate(libiamf) - # Patch CMakeLists.txt if needed (Windows) - if (LIBIAMF_NEEDS_PATCHING) + #==================================================================== + # Platform-specific configuration + #==================================================================== + if (APPLE) + set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") + file(REMOVE + "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libopus.a" + "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libfdk-aac.a" + "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libFLAC.a" + ) + file(COPY + "${LIBIAMF_CODEC_PATH}/libopus.a" + "${LIBIAMF_CODEC_PATH}/libFLAC.a" + "${LIBIAMF_CODEC_PATH}/libfdk-aac.a" + "${LIBIAMF_CODEC_PATH}/libogg.a" + DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" + ) + link_directories("${LIBIAMF_CODEC_PATH}") + + elseif (WIN32) + # Patch CMakeLists.txt to remove GCC-only flags file(READ "${libiamf_SOURCE_DIR}/code/CMakeLists.txt" LIBIAMF_CMAKE_CONTENT) string(REPLACE "-O3" "" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") string(REPLACE "-Werror=unused-variable" "" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") @@ -39,72 +58,33 @@ if (NOT libiamf_POPULATED) string(REPLACE " m " " " LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") string(REPLACE "option(BUILD_SHARED_LIBS \"Build shared library\" ON)" "option(BUILD_SHARED_LIBS \"Build shared library\" OFF)" LIBIAMF_CMAKE_CONTENT "${LIBIAMF_CMAKE_CONTENT}") file(WRITE "${libiamf_SOURCE_DIR}/code/CMakeLists.txt" "${LIBIAMF_CMAKE_CONTENT}") - message(STATUS "Patched libiamf CMakeLists.txt to remove GCC-only flags and m library") - endif () + message(STATUS "Patched libiamf CMakeLists.txt for Windows") - # Vendor library handling - if (DEFINED LIBIAMF_VENDOR_PATH) - # macOS: single vendor path - file(REMOVE - "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libopus.a" - "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libfdk-aac.a" - "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/libFLAC.a" - ) + set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/windows") file(COPY - "${LIBIAMF_VENDOR_PATH}/libopus.a" - "${LIBIAMF_VENDOR_PATH}/libFLAC.a" - "${LIBIAMF_VENDOR_PATH}/libfdk-aac.a" - "${LIBIAMF_VENDOR_PATH}/libogg.a" + "${LIBIAMF_CODEC_PATH}/fdk-aac.lib" + "${LIBIAMF_CODEC_PATH}/FLAC.lib" + "${LIBIAMF_CODEC_PATH}/opus.lib" + "${LIBIAMF_CODEC_PATH}/ogg.lib" DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" ) - link_directories("${LIBIAMF_VENDOR_PATH}") - elseif (DEFINED LIBIAMF_VENDOR_DEBUG_PATH) - # Windows: debug/release vendor paths - message(STATUS "Using Windows codec libraries for IAMF") - - if (EXISTS "${LIBIAMF_VENDOR_DEBUG_PATH}/fdk-aac.lib") - file(COPY - "${LIBIAMF_VENDOR_DEBUG_PATH}/fdk-aac.lib" - "${LIBIAMF_VENDOR_DEBUG_PATH}/FLAC.lib" - "${LIBIAMF_VENDOR_DEBUG_PATH}/opus.lib" - "${LIBIAMF_VENDOR_DEBUG_PATH}/ogg.lib" - DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" - ) - endif () - - if (EXISTS "${LIBIAMF_VENDOR_RELEASE_PATH}/fdk-aac.lib") - file(COPY - "${LIBIAMF_VENDOR_RELEASE_PATH}/fdk-aac.lib" - "${LIBIAMF_VENDOR_RELEASE_PATH}/FLAC.lib" - "${LIBIAMF_VENDOR_RELEASE_PATH}/opus.lib" - "${LIBIAMF_VENDOR_RELEASE_PATH}/ogg.lib" - DESTINATION "${libiamf_SOURCE_DIR}/code/dep_codecs/lib/" - ) - endif () - - message(STATUS "Using Protobuf and Abseil targets from FetchContent") endif () - # Build libiamf (after patching) + # Build libiamf add_subdirectory(${libiamf_SOURCE_DIR}/code ${libiamf_BINARY_DIR}) - # Remove 'm' linkage if needed (Windows) - if (LIBIAMF_REMOVE_M_LINKAGE AND TARGET iamf) - message(STATUS "Patching libiamf: removing Linux-only 'm' linkage") + # Windows: remove 'm' linkage and add codec libs + if (WIN32 AND TARGET iamf) get_target_property(_iamf_libs iamf INTERFACE_LINK_LIBRARIES) if (_iamf_libs) list(REMOVE_ITEM _iamf_libs m) set_target_properties(iamf PROPERTIES INTERFACE_LINK_LIBRARIES "${_iamf_libs}") endif () - endif () - - # Windows codec linking (after target exists) - if (DEFINED LIBIAMF_VENDOR_RELEASE_PATH AND TARGET iamf) target_link_libraries(iamf - "${LIBIAMF_VENDOR_RELEASE_PATH}/fdk-aac.lib" - "${LIBIAMF_VENDOR_RELEASE_PATH}/FLAC.lib" - "${LIBIAMF_VENDOR_RELEASE_PATH}/opus.lib" - "${LIBIAMF_VENDOR_RELEASE_PATH}/ogg.lib" + "${LIBIAMF_CODEC_PATH}/fdk-aac.lib" + "${LIBIAMF_CODEC_PATH}/FLAC.lib" + "${LIBIAMF_CODEC_PATH}/opus.lib" + "${LIBIAMF_CODEC_PATH}/ogg.lib" ) endif () endif () @@ -114,7 +94,7 @@ if (TARGET iamf) target_link_libraries(iamf ogg) endif () -# Include dirs (for iamfdec_utils) +# Include dirs set(LIBIAMF_INCLUDE_DIRS ${libiamf_SOURCE_DIR}/code/include ${libiamf_SOURCE_DIR}/code/src/common @@ -131,7 +111,7 @@ set(LIBIAMF_INCLUDE_DIRS CACHE INTERNAL "LIBIAMF include directories" ) -# Build iamfdec_utils (no main) +# Build iamfdec_utils if (EXISTS "${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src") set(IAMFDEC_UTIL_SOURCES ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/dmemory.c @@ -141,20 +121,14 @@ if (EXISTS "${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src") ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/src/vlogging_iamfmp4_sr.c ) - if (IAMFDEC_UTIL_SOURCES) - add_library(iamfdec_utils STATIC ${IAMFDEC_UTIL_SOURCES}) - target_include_directories(iamfdec_utils PUBLIC - ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/include - $ - ) - target_include_directories(iamfdec_utils PRIVATE ${LIBIAMF_INCLUDE_DIRS}) - if (TARGET iamf) - target_link_libraries(iamfdec_utils PUBLIC iamf) - else () - message(WARNING "Core 'iamf' target not found for linking iamfdec_utils.") - endif () - message(STATUS "Created iamfdec_utils library (without main).") - endif () + add_library(iamfdec_utils STATIC ${IAMFDEC_UTIL_SOURCES}) + target_include_directories(iamfdec_utils PUBLIC + ${libiamf_SOURCE_DIR}/code/test/tools/iamfdec/include + $ + ) + target_include_directories(iamfdec_utils PRIVATE ${LIBIAMF_INCLUDE_DIRS}) + target_link_libraries(iamfdec_utils PUBLIC iamf) + message(STATUS "Created iamfdec_utils library (without main).") endif () message(STATUS "LIBIAMF source directory: ${libiamf_SOURCE_DIR}") \ No newline at end of file diff --git a/third_party/obr/CMakeLists.txt b/third_party/obr/CMakeLists.txt index 648ab720..aa058ba6 100644 --- a/third_party/obr/CMakeLists.txt +++ b/third_party/obr/CMakeLists.txt @@ -1,18 +1,15 @@ add_library(obr INTERFACE) target_compile_options(obr INTERFACE "-w") -# Disable unneeded build options for dependencies set(BUILD_TESTING OFF CACHE BOOL "" FORCE) set(EIGEN_BUILD_TESTING OFF CACHE BOOL "" FORCE) set(EIGEN_MPL2_ONLY ON CACHE BOOL "" FORCE) set(EIGEN_BUILD_PKGCONFIG OFF CACHE BOOL "" FORCE) set(EIGEN_BUILD_DOC OFF CACHE BOOL "" FORCE) -# Fetch Eigen and pffft include("${CMAKE_SOURCE_DIR}/cmake/eigen.cmake") include("${CMAKE_SOURCE_DIR}/cmake/pffft.cmake") -# Expose header locations target_include_directories(obr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/obr @@ -21,37 +18,9 @@ target_include_directories(obr INTERFACE ${CMAKE_BINARY_DIR}/_deps/pffft-src ) -# Platform-specific linking -if (OBR_USE_STATIC) - # Windows: static libs with debug/release - target_link_libraries(obr INTERFACE - $<$:${OBR_DEBUG_LIB}> - $<$:${OBR_RELEASE_LIB}> - $<$:${PFFFT_DEBUG_LIB}> - $<$:${PFFFT_RELEASE_LIB}> - Eigen - ) -else () - # macOS: dynamic library - add_library(obr_dylib SHARED IMPORTED) - set_target_properties(obr_dylib PROPERTIES - IMPORTED_LOCATION "${OBR_DYLIB}" - IMPORTED_LOCATION_DEBUG "${OBR_DYLIB}" - IMPORTED_LOCATION_RELEASE "${OBR_DYLIB}" - IMPORTED_LOCATION_RELWITHDEBINFO "${OBR_DYLIB}" - IMPORTED_SONAME "obr.dylib" - LINKER_LANGUAGE CXX - ) +# Platform-specific impl defined in cmake/prebuiltLibs/*.cmake +target_link_libraries(obr INTERFACE obr_impl Eigen pffft) - target_link_libraries(obr - INTERFACE - obr_dylib - Eigen - pffft - ) -endif () - -# Make include dirs available to parent set(OBR_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/obr From 84d4ab4d27e0edd962674bc45e83016492758ff4 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Fri, 6 Feb 2026 10:08:54 -0800 Subject: [PATCH 17/43] Cross-platform root level Cmake refactor complete --- cmake/pffft.cmake | 58 +++++++++++++--------------- cmake/prebuiltLibs/windows.cmake | 2 +- cmake/toolchains/windows.cmake | 3 +- third_party/CMakeLists.txt | 4 -- third_party/iamftools/CMakeLists.txt | 11 ++++-- third_party/libiamf/CMakeLists.txt | 2 +- 6 files changed, 38 insertions(+), 42 deletions(-) diff --git a/cmake/pffft.cmake b/cmake/pffft.cmake index 5eb61825..7b0c2ec5 100644 --- a/cmake/pffft.cmake +++ b/cmake/pffft.cmake @@ -12,38 +12,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -message(STATUS "Using prebuilt pffft from obr build") +include(FetchContent) -if (WIN32) - # Fetch pffft from source on Windows too - include(FetchContent) - FetchContent_Declare( - pffft - GIT_REPOSITORY "https://github.com/marton78/pffft.git" - SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/pffft-src - ) - FetchContent_GetProperties(pffft) - if(NOT pffft_POPULATED) - FetchContent_Populate(pffft) - add_library(pffft STATIC IMPORTED) - set_target_properties(pffft PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/third_party/Windows/pffft.lib" - ) - target_include_directories(pffft INTERFACE ${pffft_SOURCE_DIR}) - endif() -else() +FetchContent_Declare( + pffft + GIT_REPOSITORY "https://github.com/marton78/pffft.git" + SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/pffft-src +) - # macOS/Linux - fetch and build from source - include(FetchContent) - FetchContent_Declare( - pffft - GIT_REPOSITORY "https://github.com/marton78/pffft.git" - SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/pffft-src - ) - FetchContent_GetProperties(pffft) - if(NOT pffft_POPULATED) +FetchContent_GetProperties(pffft) +if (NOT pffft_POPULATED) FetchContent_Populate(pffft) - add_library(pffft STATIC ${pffft_SOURCE_DIR}/pffft.c) - target_include_directories(pffft PUBLIC ${pffft_SOURCE_DIR}) - endif() -endif() \ No newline at end of file + + if (DEFINED PFFFT_RELEASE_LIB) + # Use prebuilt library (set in toolchain) + message(STATUS "Using prebuilt pffft from: ${PFFFT_RELEASE_LIB}") + add_library(pffft STATIC IMPORTED) + set_target_properties(pffft PROPERTIES + IMPORTED_LOCATION "${PFFFT_RELEASE_LIB}" + IMPORTED_LOCATION_DEBUG "${PFFFT_DEBUG_LIB}" + IMPORTED_LOCATION_RELEASE "${PFFFT_RELEASE_LIB}" + ) + target_include_directories(pffft INTERFACE ${pffft_SOURCE_DIR}) + else () + # Build from source + message(STATUS "Building pffft from source") + add_library(pffft STATIC ${pffft_SOURCE_DIR}/pffft.c) + target_include_directories(pffft PUBLIC ${pffft_SOURCE_DIR}) + endif () +endif () \ No newline at end of file diff --git a/cmake/prebuiltLibs/windows.cmake b/cmake/prebuiltLibs/windows.cmake index 87655e67..1620cae7 100644 --- a/cmake/prebuiltLibs/windows.cmake +++ b/cmake/prebuiltLibs/windows.cmake @@ -28,7 +28,7 @@ add_library(iamftools_impl SHARED IMPORTED GLOBAL) set_target_properties(iamftools_impl PROPERTIES IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.dll" IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.dll" - IMPORTED_IMPLIB_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.lib" + IMPORTED_IMPLIB_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.if.lib" IMPORTED_IMPLIB_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.lib" ) add_library(vendored_iamf_tools ALIAS iamftools_impl) diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index efd4faab..0cf6a546 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -129,4 +129,5 @@ if (NOT DEFINED CACHE{SAF_PERFORMANCE_LIB}) endif () endforeach () endif () -endif () \ No newline at end of file +endif () + diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 07c9197b..25450b90 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -95,7 +95,3 @@ else () message(WARNING "protobuf_SOURCE_DIR not defined yet — ensure FetchContent_MakeAvailable(protobuf) ran") endif () -#==================================================================== -# Imported Targets -#==================================================================== -#include("${CMAKE_SOURCE_DIR}/cmake/prebuiltLibs/imported_targets_${ECLIPSA_PLATFORM}.cmake") diff --git a/third_party/iamftools/CMakeLists.txt b/third_party/iamftools/CMakeLists.txt index 186d917b..1f3cadd1 100644 --- a/third_party/iamftools/CMakeLists.txt +++ b/third_party/iamftools/CMakeLists.txt @@ -1,8 +1,14 @@ # Copyright 2025 Google LLC +# # Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy at: +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# # http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. add_subdirectory(iamf/cli/proto) @@ -15,7 +21,6 @@ set(HEADER_FILE "${CMAKE_CURRENT_LIST_DIR}/iamf/include/iamf_tools/commit_hash.h set(TEMPLATE_FILE "${CMAKE_CURRENT_LIST_DIR}/iamf/include/iamf_tools/commit_hash.h.in") configure_file(${TEMPLATE_FILE} ${HEADER_FILE} @ONLY) -# -------------------- IAMF TOOLS -------------------- add_library(iamftools INTERFACE) target_compile_options(iamftools INTERFACE "-w") target_include_directories(iamftools INTERFACE diff --git a/third_party/libiamf/CMakeLists.txt b/third_party/libiamf/CMakeLists.txt index c0b21dcb..69e11554 100644 --- a/third_party/libiamf/CMakeLists.txt +++ b/third_party/libiamf/CMakeLists.txt @@ -60,7 +60,7 @@ if (NOT libiamf_POPULATED) file(WRITE "${libiamf_SOURCE_DIR}/code/CMakeLists.txt" "${LIBIAMF_CMAKE_CONTENT}") message(STATUS "Patched libiamf CMakeLists.txt for Windows") - set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/windows") + set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/Release") file(COPY "${LIBIAMF_CODEC_PATH}/fdk-aac.lib" "${LIBIAMF_CODEC_PATH}/FLAC.lib" From 514fa61ae89b2fe0dc8773fc9848bfb835f364fd Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Fri, 6 Feb 2026 10:13:41 -0800 Subject: [PATCH 18/43] Cross-platform third-party Cmake refactor complete --- third_party/CMakeLists.txt | 44 +++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 25450b90..974ebb3e 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -15,7 +15,7 @@ include(FetchContent) set(BUILD_SHARED_LIBS OFF) #==================================================================== -# Prebuilt Libraries (must come first) +# Prebuilt Libraries #==================================================================== include("${CMAKE_SOURCE_DIR}/cmake/prebuiltLibs/${ECLIPSA_PLATFORM}.cmake") @@ -36,7 +36,12 @@ add_subdirectory(libear) include("${CMAKE_SOURCE_DIR}/cmake/zeromq.cmake") #LibIAMF for audio file import. add_subdirectory(libiamf) - +# gpac for AV muxing +add_subdirectory(gpac) +# lib spatialaudio for panning +include("${CMAKE_SOURCE_DIR}/cmake/libspatialaudio.cmake") +# LUFSMeter +add_subdirectory(LUFSMeter) #==================================================================== # IAMF library directory (platform-specific structure) #==================================================================== @@ -46,37 +51,26 @@ set(IAMF_LIB_DIR ${ECLIPSA_IAMF_LIB_DIR}) link_directories(${IAMF_LIB_DIR}) set(IAMF_LIB_DIR ${IAMF_LIB_DIR} CACHE STRING "IAMF library directory") +# IAMF decoder +set(IAMF_DEC_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/third_party/libiamf/code/include") +if (EXISTS ${IAMF_DEC_INCLUDE_DIR}) + include_directories(${IAMF_DEC_INCLUDE_DIR}) +else () + message(FATAL_ERROR "IAMF decoder include directory not found: ${IAMF_DEC_INCLUDE_DIR}") +endif () + #==================================================================== #Spatial Audio Framework -#Override some of the SAF variables -#Unit tests for SAF have been tested and they pass, confirming the SAF library is working as expected. -# Manually set the SAF_PERFORMANCE_LIB variables for each platform -#==================================================================== -# Spatial Audio Framework #==================================================================== set(SAF_BUILD_TESTS 0 CACHE BOOL "" FORCE) set(SAF_BUILD_EXAMPLES 1 CACHE BOOL "" FORCE) set(saf_example_list ambi_dec CACHE STRING "" FORCE) +# Manually set the SAF_PERFORMANCE_LIB variables for each platform message(STATUS "SAF: Building from source with ${SAF_PERFORMANCE_LIB}") add_subdirectory(${CMAKE_SOURCE_DIR}/third_party/Spatial_Audio_Framework) -# gpac for AV muxing -add_subdirectory(gpac) -# lib spatialaudio for panning -include("${CMAKE_SOURCE_DIR}/cmake/libspatialaudio.cmake") -# LUFSMeter -add_subdirectory(LUFSMeter) - -# IAMF decoder -set(IAMF_DEC_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/third_party/libiamf/code/include") -if (EXISTS ${IAMF_DEC_INCLUDE_DIR}) - include_directories(${IAMF_DEC_INCLUDE_DIR}) -else () - message(FATAL_ERROR "IAMF decoder include directory not found: ${IAMF_DEC_INCLUDE_DIR}") -endif () - -# SAF includes (optional) +# SAF includes set(SAF_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/third_party/Spatial_Audio_Framework/examples/include") if (EXISTS ${SAF_INCLUDE_DIR}) include_directories(${SAF_INCLUDE_DIR}) @@ -84,7 +78,9 @@ else () message(WARNING "SAF include directory not found: ${SAF_INCLUDE_DIR}") endif () -#Force all projects to use locally fetched Protobuf +#==================================================================== +# Protobuf +#==================================================================== if (DEFINED protobuf_SOURCE_DIR AND DEFINED protobuf_BINARY_DIR) message(STATUS "Overriding Protobuf include/lib paths with fetched version") set(Protobuf_INCLUDE_DIRS "${protobuf_SOURCE_DIR}/src" CACHE PATH "" FORCE) From b7d1a462c99ba2305b58e4522bbdd5237963daad Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Fri, 6 Feb 2026 10:15:45 -0800 Subject: [PATCH 19/43] Cross-platform library Cmake refactors complete --- third_party/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 974ebb3e..70b8fdf3 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -43,7 +43,7 @@ include("${CMAKE_SOURCE_DIR}/cmake/libspatialaudio.cmake") # LUFSMeter add_subdirectory(LUFSMeter) #==================================================================== -# IAMF library directory (platform-specific structure) +# IAMF library directory #==================================================================== set(IAMF_LIB_DIR ${ECLIPSA_IAMF_LIB_DIR}) From 6fcc9d7c77970feba35c8502e2f60997f966dfd3 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Fri, 6 Feb 2026 11:00:50 -0800 Subject: [PATCH 20/43] Cross-platform Windows Cmake refactor ready --- cmake/boost.cmake | 25 ++++------- cmake/deploy_runtime_deps.cmake | 76 ++++++++++++++++----------------- cmake/eclipsa_build_tests.cmake | 57 +++++++++++-------------- cmake/toolchains/macos.cmake | 7 ++- cmake/toolchains/windows.cmake | 29 +++++++++++++ 5 files changed, 107 insertions(+), 87 deletions(-) diff --git a/cmake/boost.cmake b/cmake/boost.cmake index e63d0bab..4a190e47 100644 --- a/cmake/boost.cmake +++ b/cmake/boost.cmake @@ -9,33 +9,24 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # Suppress CMake 3.31+ warning about FindBoost being deprecated -if(POLICY CMP0167) +if (POLICY CMP0167) cmake_policy(SET CMP0167 OLD) -endif() - -set(BOOST_COMPONENTS log log_setup thread filesystem math) +endif () message(STATUS "Fetching Boost") -include(FetchContent) -set(BOOST_ENABLE_CMAKE ON) - -if(WIN32) - set(Boost_USE_STATIC_RUNTIME OFF) - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") - add_definitions(-DBOOST_ALL_NO_LIB) - -endif() +set(BOOST_COMPONENTS log log_setup thread filesystem math) +set(BOOST_ENABLE_CMAKE ON) set(BOOST_LOCALE_ENABLE_ICU OFF) +include(FetchContent) FetchContent_Declare( Boost USES_TERMINAL_DOWNLOAD TRUE DOWNLOAD_NO_EXTRACT FALSE OVERRIDE_FIND_PACKAGE URL "https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.gz" - CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF) + CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF +) FetchContent_MakeAvailable(Boost) -find_package(Boost 1.86.0 COMPONENTS ${BOOST_COMPONENTS}) - - +find_package(Boost 1.86.0 COMPONENTS ${BOOST_COMPONENTS}) \ No newline at end of file diff --git a/cmake/deploy_runtime_deps.cmake b/cmake/deploy_runtime_deps.cmake index a9be3f94..ce930b4a 100644 --- a/cmake/deploy_runtime_deps.cmake +++ b/cmake/deploy_runtime_deps.cmake @@ -14,71 +14,71 @@ function(deploy_runtime_deps target) - if (APPLE) + set(_BASE "$") + + # Determine destination based on platform + if (TARGET vendored_obr) + # macOS: bundle structure set(DEST_ROOT "$/Resources") set(DEST_IAMF "${DEST_ROOT}/third_party/iamftools/lib") set(DEST_GPAC "${DEST_ROOT}/third_party/gpac/lib") set(DEST_OBR "${DEST_ROOT}/third_party/obr/lib") - elseif (WIN32) - # Mirror your existing layout logic, but anchored to the real target output dir - # JUCE often outputs .../Eclipsa Audio Element Plugin.vst3/Contents/x86_64-win - # so we *derive* the correct folder rather than hardcoding the artefacts path. - set(_BASE "$") - - # Your old logic used target name suffixes; keep that just for the destination + else () + # Windows: flat structure based on target type if ("${target}" MATCHES ".*_VST3$") set(DEST_ROOT "${_BASE}/Contents/x86_64-win") elseif ("${target}" MATCHES ".*_AAX$") set(DEST_ROOT "${_BASE}/Contents/x64") - elseif ("${target}" MATCHES ".*_Standalone$") - set(DEST_ROOT "${_BASE}") else () set(DEST_ROOT "${_BASE}") endif () - set(DEST_IAMF "${DEST_ROOT}") set(DEST_GPAC "${DEST_ROOT}") endif () - # Delay-load flags stay (Windows only) - if (WIN32) - target_link_options(${target} PRIVATE - "/DELAYLOAD:$" - "/DELAYLOAD:$" - "/DELAYLOAD:$" - "/DELAYLOAD:$" - "/DELAYLOAD:$" - "/DELAYLOAD:$" - ) + # Delay-load (Windows only) + if (DEFINED ECLIPSA_DELAYLOAD_LIBS) + foreach (_lib ${ECLIPSA_DELAYLOAD_LIBS}) + target_link_options(${target} PRIVATE "/DELAYLOAD:$") + endforeach () endif () - # Copy deps + # Create directories add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_ROOT}" COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_IAMF}" COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_GPAC}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_GPAC}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_IAMF}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" COMMENT "Deploying runtime deps to ${target}" ) - if (WIN32) - add_custom_command(TARGET ${target} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_ROOT}/" - ) - endif () + # Copy vendored libs (uses ECLIPSA_VENDORED_LIBS from prebuiltLibs) + foreach (_lib ${ECLIPSA_VENDORED_LIBS}) + if (TARGET ${_lib}) + if ("${_lib}" STREQUAL "vendored_gpac") + set(_dest "${DEST_GPAC}") + elseif ("${_lib}" STREQUAL "vendored_iamf_tools") + set(_dest "${DEST_IAMF}") + elseif ("${_lib}" STREQUAL "vendored_obr") + set(_dest "${DEST_OBR}") + add_custom_command(TARGET ${target} POST_BUILD APPEND + COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_OBR}" + ) + else () + set(_dest "${DEST_ROOT}") + endif () - if (APPLE) - add_custom_command(TARGET ${target} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_OBR}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${DEST_OBR}/" + add_custom_command(TARGET ${target} POST_BUILD APPEND + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${_dest}/" + ) + endif () + endforeach () + + # macOS symlinks for zmq + if (TARGET vendored_obr) + add_custom_command(TARGET ${target} POST_BUILD APPEND COMMAND ${CMAKE_COMMAND} -E create_symlink "$" "${DEST_ROOT}/libzmq.5.dylib" COMMAND ${CMAKE_COMMAND} -E create_symlink "libzmq.5.dylib" "${DEST_ROOT}/libzmq.dylib" ) endif () -endfunction() - +endfunction() \ No newline at end of file diff --git a/cmake/eclipsa_build_tests.cmake b/cmake/eclipsa_build_tests.cmake index 42095fb0..96361bdb 100644 --- a/cmake/eclipsa_build_tests.cmake +++ b/cmake/eclipsa_build_tests.cmake @@ -12,57 +12,52 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Function to build a single test executable from all the collected test sources function(eclipsa_build_tests) get_property(test_sources GLOBAL PROPERTY ECLIPSA_TEST_SOURCES) get_property(test_link_libs GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS) - # Remove duplicates from the list of libraries list(REMOVE_DUPLICATES test_link_libs) add_executable(eclipsa_tests ${test_sources}) target_compile_definitions(eclipsa_tests - PUBLIC + PUBLIC JUCE_WEB_BROWSER=0 JUCE_USE_CURL=0 JUCE_VST3_CAN_REPLACE_VST2=0 - JUCE_SILENCE_XCODE_15_LINKER_WARNING) + JUCE_SILENCE_XCODE_15_LINKER_WARNING + ) - if(APPLE) - set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") - target_link_directories(eclipsa_tests PRIVATE ${VENDOR_LIB_PATH}) - elseif(WIN32) - set(VENDOR_LIB_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows/${CMAKE_BUILD_TYPE}") - target_link_directories(eclipsa_tests PRIVATE ${VENDOR_LIB_PATH}) + # Vendor library path (set in toolchain) + if (DEFINED LIBIAMF_VENDOR_PATH) + target_link_directories(eclipsa_tests PRIVATE "${LIBIAMF_VENDOR_PATH}") + elseif (DEFINED LIBIAMF_VENDOR_RELEASE_PATH) + target_link_directories(eclipsa_tests PRIVATE + "$,${LIBIAMF_VENDOR_DEBUG_PATH},${LIBIAMF_VENDOR_RELEASE_PATH}>" + ) + endif () - # Move the dlls required for the unit tests as well - # This can be done in the post build, since we'll run the tests after the build is complete - set(ZMQ_DLL "${CMAKE_BINARY_DIR}/_deps/zeromq-build/bin/${BUILD_LIB_DIR}/libzmq-v143-mt$<$:-gd>-4_3_6.dll") - set(CRYPTOMD_DLL "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/${CMAKE_BUILD_TYPE}/libcryptoMD.dll") - set(LIBSSLMD_DLL "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/${CMAKE_BUILD_TYPE}/libsslMD.dll") - - set(TEST_DIR "${CMAKE_BINARY_DIR}/${BUILD_LIB_DIR}") + # Copy test DLLs (Windows only, set in toolchain) + if (DEFINED ECLIPSA_TEST_DLLS) + set(TEST_DIR "${CMAKE_BINARY_DIR}/$") add_custom_command(TARGET eclipsa_tests POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory "${TEST_DIR}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZMQ_DLL} "${TEST_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CRYPTOMD_DLL} "${TEST_DIR}/" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBSSLMD_DLL} "${TEST_DIR}/" - COMMENT "Copied Test DLLs to ${TEST_DIR}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${TEST_DIR}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ECLIPSA_TEST_DLLS} "${TEST_DIR}/" + COMMENT "Copying test DLLs to ${TEST_DIR}" ) - endif() + endif () - if(DEFINED LIBIAMF_INCLUDE_DIRS) + if (DEFINED LIBIAMF_INCLUDE_DIRS) target_include_directories(eclipsa_tests PRIVATE ${LIBIAMF_INCLUDE_DIRS}) - endif() - + endif () + target_link_libraries(eclipsa_tests - PRIVATE + PRIVATE ${test_link_libs} - PUBLIC + PUBLIC juce::juce_recommended_config_flags juce::juce_recommended_warning_flags - GTest::gtest_main) + GTest::gtest_main + ) - gtest_discover_tests(eclipsa_tests - DISCOVERY_MODE PRE_TEST) + gtest_discover_tests(eclipsa_tests DISCOVERY_MODE PRE_TEST) endfunction() \ No newline at end of file diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index 9ee9f370..fe967395 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -56,4 +56,9 @@ set(ECLIPSA_IAMF_LIB_DIR "${CMAKE_BINARY_DIR}/_deps/libiamf-build" CACHE STRING set(ECLIPSA_STATIC_LIB_SUFFIX ".a" CACHE STRING "") set(ECLIPSA_PLATFORM_PLUGIN_FORMATS AU CACHE STRING "") set(ECLIPSA_PLATFORM_LIBS vendored_obr CACHE STRING "") -set(SAF_PERFORMANCE_LIB "SAF_USE_APPLE_ACCELERATE" CACHE STRING "") \ No newline at end of file +set(SAF_PERFORMANCE_LIB "SAF_USE_APPLE_ACCELERATE" CACHE STRING "") + +#==================================================================== +# Bundle Structure +#==================================================================== +set(ECLIPSA_BUNDLE_RESOURCES_SUBDIR "Resources" CACHE STRING "") \ No newline at end of file diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index 0cf6a546..15bbe70a 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -131,3 +131,32 @@ if (NOT DEFINED CACHE{SAF_PERFORMANCE_LIB}) endif () endif () +#==================================================================== +# Boost Settings +#==================================================================== +set(Boost_USE_STATIC_RUNTIME OFF CACHE BOOL "") +add_definitions(-DBOOST_ALL_NO_LIB) + +#==================================================================== +# Test DLLs +#==================================================================== +set(ECLIPSA_TEST_DLLS + "${CMAKE_BINARY_DIR}/_deps/zeromq-build/bin/$/libzmq-v143-mt$<$:-gd>-4_3_6.dll" + "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/$/libcryptoMD.dll" + "${CMAKE_SOURCE_DIR}/third_party/gpac/lib/Windows/$/libsslMD.dll" + CACHE STRING "" +) + +#==================================================================== +# Delay-load Libraries +#==================================================================== +set(ECLIPSA_DELAYLOAD_LIBS + vendored_gpac + vendored_iamf_tools + vendored_opensvc + libzmq + vendored_gpac_crypto + vendored_gpac_ssl + CACHE STRING "" +) + From 8fe52a4b41d20c0ca6dccf0508b982b60daf96af Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Fri, 6 Feb 2026 11:17:02 -0800 Subject: [PATCH 21/43] Comment edits on prebuiltLibs --- cmake/prebuiltLibs/macos.cmake | 4 ++-- cmake/prebuiltLibs/windows.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/prebuiltLibs/macos.cmake b/cmake/prebuiltLibs/macos.cmake index 32c3499c..6876f966 100644 --- a/cmake/prebuiltLibs/macos.cmake +++ b/cmake/prebuiltLibs/macos.cmake @@ -10,7 +10,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #==================================================================== -# Prebuilt Libraries - macOS +# Prebuilt Libraries #==================================================================== # GPAC @@ -41,7 +41,7 @@ set_target_properties(libear_impl PROPERTIES ) #==================================================================== -# Vendored Libraries (for bundle packaging) +# Vendored Libraries #==================================================================== set(ECLIPSA_VENDORED_LIBS vendored_gpac diff --git a/cmake/prebuiltLibs/windows.cmake b/cmake/prebuiltLibs/windows.cmake index 1620cae7..8daddb50 100644 --- a/cmake/prebuiltLibs/windows.cmake +++ b/cmake/prebuiltLibs/windows.cmake @@ -10,7 +10,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #==================================================================== -# Prebuilt Libraries - Windows +# Prebuilt Libraries #==================================================================== # GPAC @@ -64,7 +64,7 @@ set_target_properties(libear_impl PROPERTIES ) #==================================================================== -# Vendored Libraries (for bundle packaging) +# Vendored Libraries #==================================================================== set(ECLIPSA_VENDORED_LIBS vendored_gpac From 776799709f5077ae2602d854af46c3233dd39c9f Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Fri, 6 Feb 2026 12:40:57 -0800 Subject: [PATCH 22/43] Updated readme with toolchain instructions --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0dd4f40d..07f58382 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ Building on windows requires the following additional setup steps: -DVCPKG_ROOT=C:/vcpkg/vcpkg -DVCPKG_TARGET_TRIPLET=x64-windows ``` +3. Set Windows Toolchain: + -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/windows.cmake ### Building Plugins Locally with CMake @@ -67,7 +69,8 @@ The CMake build supports the following flags: On MacOS, run the following command to configure the CMake build, adding any desired flags as needed ``` -cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -S ./ -B ./build -G "Unix Makefiles" +cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -S ./ -B ./build -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/macos.cmake + ``` Or using Ninja From 9787fa08f063591927abdca49f31c7fa6df76112 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Fri, 6 Feb 2026 12:42:12 -0800 Subject: [PATCH 23/43] Updated Windows readme section with toolchain --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 07f58382..88debf80 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,6 @@ Building on windows requires the following additional setup steps: -DVCPKG_ROOT=C:/vcpkg/vcpkg -DVCPKG_TARGET_TRIPLET=x64-windows ``` -3. Set Windows Toolchain: - -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/windows.cmake ### Building Plugins Locally with CMake @@ -97,7 +95,8 @@ Then execute the Configure and Build commands via the CMake extension. On Windows, run the following command to configure the CMake build: ``` -cmake.exe -DVCPKG_ROOT:STRING=C:\Code\Repos\vcpkg "-DMKL_ROOT:STRING=C:\Program Files (x86)\Intel\oneAPI\mkl\2025.3" -DVCPKG_TARGET_TRIPLET:STRING=x64-windows -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -S ./ -B ./build -G "Visual Studio 17 2022" -T host=x64 -A x64 +cmake.exe -DVCPKG_ROOT:STRING=C:\Code\Repos\vcpkg "-DMKL_ROOT:STRING=C:\Program Files (x86)\Intel\oneAPI\mkl\2025.3" -DVCPKG_TARGET_TRIPLET:STRING=x64-windows -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE --no-warn-unused-cli -S ./ -B ./build -G "Visual Studio 17 2022" -T host=x64 -A x64 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/windows.cmake + ``` The plugin can then be built with the following command: From c46edd1b50b6aec2465b7be579ea055a3882e36e Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Fri, 6 Feb 2026 13:55:11 -0800 Subject: [PATCH 24/43] Updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 88debf80..de23002c 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ The plugin can then be built with the following command: cmake --build ./build --config=Release ``` -Alternativel, use the CMake extension for Visual Studio Code adding the following to settings.json: +Alternatively, use the CMake extension for Visual Studio Code adding the following to settings.json: ``` "cmake.configureSettings": { "VCPKG_ROOT": "C:\\Code\\Repos\\vcpkg", From b8c27ad84dc9b1710fcbef3ca547eb9ce361c836 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 9 Feb 2026 09:31:11 -0800 Subject: [PATCH 25/43] Updated workflows in .github --- .github/workflows/cmake-multi-platform.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 9647399b..4462405e 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -284,7 +284,7 @@ jobs: -DZMQ_BUILD_TESTS=OFF ` -DMKL_ROOT="$env:MKLROOT" ` -DVCPKG_TARGET_TRIPLET=x64-windows ` - -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" + -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/windows.cmake # --- Configure (macOS) --- - name: Configure CMake (macOS) @@ -296,6 +296,7 @@ jobs: -DCMAKE_C_COMPILER=clang \ -DBUILD_TESTING=ON \ -DZMQ_BUILD_TESTS=OFF + -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/macos.cmake # --- Build --- - name: Build From 7b33db80da72e0cd706449ccfd59f679ab518ff4 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 9 Feb 2026 09:34:38 -0800 Subject: [PATCH 26/43] Resolved license typo in copy resources --- cmake/copy_resources.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/copy_resources.cmake b/cmake/copy_resources.cmake index 6266d191..db6042b3 100644 --- a/cmake/copy_resources.cmake +++ b/cmake/copy_resources.cmake @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to add writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and From 683f2b149fe82a7cc648479547b0ba2cee9348bd Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 9 Feb 2026 09:44:03 -0800 Subject: [PATCH 27/43] Added previous comments back to OBR Cmake --- third_party/obr/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/third_party/obr/CMakeLists.txt b/third_party/obr/CMakeLists.txt index aa058ba6..7053d719 100644 --- a/third_party/obr/CMakeLists.txt +++ b/third_party/obr/CMakeLists.txt @@ -1,15 +1,18 @@ add_library(obr INTERFACE) -target_compile_options(obr INTERFACE "-w") +target_compile_options(obr INTERFACE "-w") # Silence is golden +# Disable unneeded build options for dependencies set(BUILD_TESTING OFF CACHE BOOL "" FORCE) set(EIGEN_BUILD_TESTING OFF CACHE BOOL "" FORCE) set(EIGEN_MPL2_ONLY ON CACHE BOOL "" FORCE) set(EIGEN_BUILD_PKGCONFIG OFF CACHE BOOL "" FORCE) set(EIGEN_BUILD_DOC OFF CACHE BOOL "" FORCE) +# Fetch Eigen and pffft include("${CMAKE_SOURCE_DIR}/cmake/eigen.cmake") include("${CMAKE_SOURCE_DIR}/cmake/pffft.cmake") +# Expose header locations target_include_directories(obr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/obr @@ -21,6 +24,7 @@ target_include_directories(obr INTERFACE # Platform-specific impl defined in cmake/prebuiltLibs/*.cmake target_link_libraries(obr INTERFACE obr_impl Eigen pffft) +# Make include dirs available to parent set(OBR_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/obr From ca9e93ee527daf4be946946ccec4dc602d0c4d94 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 9 Feb 2026 09:49:40 -0800 Subject: [PATCH 28/43] Returned add icon comments to previous state --- common/components/src/Icons.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/components/src/Icons.h b/common/components/src/Icons.h index e99b4a7c..72160ee7 100644 --- a/common/components/src/Icons.h +++ b/common/components/src/Icons.h @@ -43,7 +43,7 @@ class IconStore { /* ========================================================================= * To add a new icon: - Place icon in "icons" folder - - Update macos.cmake in the "icons" folder to include the new icon + - Update CMakeLists.txt in the "icons" folder to include the new icon - Run the build, which regnerates the JUCE binary data file - Add a new LOAD_IMAGE macro for the new icon, using the icon's filename - Fetch your new icon with IconStore::getInstance().getNewIcon() From 0b047852fc48f0c0c0611d6716bfc1131e272804 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 9 Feb 2026 09:53:15 -0800 Subject: [PATCH 29/43] Replaced macos.cmake with Cmakelists.txt in github workflows per pr comments --- .github/workflows/cmake-multi-platform.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 4462405e..98a994ef 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -67,7 +67,7 @@ jobs: uses: actions/cache@v3 with: path: build/third_party/JUCE - key: ${{ runner.os }}-juce-build-${{ hashFiles('third_party/JUCE/macos.cmake') }} + key: ${{ runner.os }}-juce-build-${{ hashFiles('third_party/JUCE/CMakeLists.txt') }} - name: Check JUCE Cache if: env.CLEAN_BUILD != 'true' @@ -85,7 +85,7 @@ jobs: uses: actions/cache@v3 with: path: build/_deps/libiamf-build - key: ${{ runner.os }}-iamf-build-${{ hashFiles('third_party/libiamf/macos.cmake') }} + key: ${{ runner.os }}-iamf-build-${{ hashFiles('third_party/libiamf/CMakeLists.txt') }} - name: Check IAMF Cache if: env.CLEAN_BUILD != 'true' @@ -103,7 +103,7 @@ jobs: uses: actions/cache@v3 with: path: build/third_party/libear - key: ${{ runner.os }}-libear-build-${{ hashFiles('third_party/libear/macos.cmake') }} + key: ${{ runner.os }}-libear-build-${{ hashFiles('third_party/libear/CMakeLists.txt') }} - name: Check Libear Cache if: env.CLEAN_BUILD != 'true' @@ -121,7 +121,7 @@ jobs: uses: actions/cache@v3 with: path: build - key: ${{ runner.os }}-main-build-${{ hashFiles('macos.cmake', 'cmake/**', 'components/**/*.cpp', 'components/**/*.h') }} + key: ${{ runner.os }}-main-build-${{ hashFiles('CMakeLists.txt', 'cmake/**', 'components/**/*.cpp', 'components/**/*.h') }} - name: Check Main Build Cache if: env.CLEAN_BUILD != 'true' From d029c8c5b692267c4cae0ffa74a0d3cf84e3711e Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Mon, 9 Feb 2026 13:04:09 -0800 Subject: [PATCH 30/43] Removed 2.6gb test folder from libiamf download --- third_party/libiamf/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/third_party/libiamf/CMakeLists.txt b/third_party/libiamf/CMakeLists.txt index 69e11554..f050a05d 100644 --- a/third_party/libiamf/CMakeLists.txt +++ b/third_party/libiamf/CMakeLists.txt @@ -28,6 +28,7 @@ set(HOA_BINAURALIZER OFF CACHE BOOL "Enable HOA binaural rendering" FORCE) FetchContent_GetProperties(libiamf) if (NOT libiamf_POPULATED) FetchContent_Populate(libiamf) + file(REMOVE_RECURSE "${libiamf_SOURCE_DIR}/tests") #==================================================================== # Platform-specific configuration From e0d3dfc16f9e05edb77f50b2e54d5221edd1b3c2 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 10 Feb 2026 09:56:47 -0800 Subject: [PATCH 31/43] Updated workflows for toolchains --- .github/workflows/cmake-multi-platform.yml | 6 +++--- CMakeLists.txt | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 98a994ef..3eee43f8 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -284,7 +284,7 @@ jobs: -DZMQ_BUILD_TESTS=OFF ` -DMKL_ROOT="$env:MKLROOT" ` -DVCPKG_TARGET_TRIPLET=x64-windows ` - -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/windows.cmake + -DCMAKE_TOOLCHAIN_FILE="cmake/toolchains/windows.cmake" # --- Configure (macOS) --- - name: Configure CMake (macOS) @@ -295,8 +295,8 @@ jobs: -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_C_COMPILER=clang \ -DBUILD_TESTING=ON \ - -DZMQ_BUILD_TESTS=OFF - -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/macos.cmake + -DZMQ_BUILD_TESTS=OFF \ + -DCMAKE_TOOLCHAIN_FILE="cmake/toolchains/macos.cmake" # --- Build --- - name: Build diff --git a/CMakeLists.txt b/CMakeLists.txt index 87092a78..9c329666 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,6 +176,7 @@ endif () # Add Sub Directories #==================================================================== add_subdirectory(common) +message(STATUS "ECLIPSA_PLUGIN_FORMATS = ${ECLIPSA_PLUGIN_FORMATS}") add_subdirectory(rendererplugin) add_subdirectory(audioelementplugin) From 45bf4579d5968a2597508161c13feea12f079d9a Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 10 Feb 2026 11:48:24 -0800 Subject: [PATCH 32/43] Fixed test linking --- cmake/eclipsa_test.cmake | 20 +++++++++----------- cmake/toolchains/macos.cmake | 2 ++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmake/eclipsa_test.cmake b/cmake/eclipsa_test.cmake index 2fb99d8d..6991a60e 100644 --- a/cmake/eclipsa_test.cmake +++ b/cmake/eclipsa_test.cmake @@ -24,38 +24,36 @@ function(eclipsa_add_test test_name test_source test_libs) get_property(test_sources GLOBAL PROPERTY ECLIPSA_TEST_SOURCES) set_property(GLOBAL PROPERTY ECLIPSA_TEST_SOURCES "${test_sources};${absolute_test_source}") - # Append the test libraries to a global list of libraries - get_property(test_link_libs GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS) - set_property(GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS "${test_link_libs};${test_libs}") - # Add codec libraries for all test targets if on macOS if(APPLE) - # Append only if not already present in test_libs + set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") list(FIND test_libs "opus" opus_found) if(opus_found EQUAL -1) - list(APPEND test_libs opus) + list(APPEND test_libs "${LIBIAMF_CODEC_PATH}/libopus.a") endif() list(FIND test_libs "ogg" ogg_found) if(ogg_found EQUAL -1) - list(APPEND test_libs ogg) + list(APPEND test_libs "${LIBIAMF_CODEC_PATH}/libogg.a") endif() endif() # Add IAMF include directories if 'iamf' or 'iamfdec_utils' is requested if("${test_libs}" MATCHES "iamf" OR "${test_libs}" MATCHES "iamfdec_utils") if(NOT DEFINED LIBIAMF_INCLUDE_DIRS) - message(WARNING "LIBIAMF_INCLUDE_DIRS not defined, but required by ${test_name}") + message(WARNING "LIBIAMF_INCLUDE_DIRS not defined, but required by ${test_name}") endif() endif() - + # If iamfdec_utils was requested, make sure iamf is also linked (dependency) if(TARGET iamf AND "${test_libs}" MATCHES "iamfdec_utils") - # Check if iamf is already in the list to avoid duplicates list(FIND test_libs "iamf" iamf_already_linked) if(iamf_already_linked EQUAL -1) - # Link iamf privately as it's a dependency of a private lib list(APPEND test_libs iamf) message(STATUS "Also linking core 'iamf' library as dependency for ${test_name}") endif() endif() + + # Append the test libraries to global list AFTER all modifications + get_property(test_link_libs GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS) + set_property(GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS "${test_link_libs};${test_libs}") endfunction() \ No newline at end of file diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index fe967395..44c218b8 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -57,6 +57,8 @@ set(ECLIPSA_STATIC_LIB_SUFFIX ".a" CACHE STRING "") set(ECLIPSA_PLATFORM_PLUGIN_FORMATS AU CACHE STRING "") set(ECLIPSA_PLATFORM_LIBS vendored_obr CACHE STRING "") set(SAF_PERFORMANCE_LIB "SAF_USE_APPLE_ACCELERATE" CACHE STRING "") +set(LIBIAMF_VENDOR_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos" CACHE PATH "") + #==================================================================== # Bundle Structure From 866f54dcd029dec62b834a4630bb8eab55d12dd1 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 10 Feb 2026 12:27:58 -0800 Subject: [PATCH 33/43] Adjusted vcpkg commands for remote workflows --- cmake/toolchains/windows.cmake | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index 15bbe70a..d4533fb9 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -52,8 +52,12 @@ endif () #==================================================================== set(X_VCPKG_APPLOCAL_DEPS_INSTALL OFF CACHE BOOL "") -if (NOT DEFINED VCPKG_ROOT AND DEFINED ENV{VCPKG_ROOT}) - set(VCPKG_ROOT "$ENV{VCPKG_ROOT}" CACHE PATH "Path to vcpkg root") +if (NOT DEFINED VCPKG_ROOT) + if (DEFINED ENV{VCPKG_ROOT}) + set(VCPKG_ROOT "$ENV{VCPKG_ROOT}" CACHE PATH "Path to vcpkg root") + elseif (DEFINED ENV{VCPKG_INSTALLATION_ROOT}) + set(VCPKG_ROOT "$ENV{VCPKG_INSTALLATION_ROOT}" CACHE PATH "Path to vcpkg root") + endif () endif () if (DEFINED VCPKG_ROOT) @@ -64,19 +68,28 @@ if (DEFINED VCPKG_ROOT) endif () if (NOT DEFINED VCPKG_TARGET_TRIPLET) - set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet") + set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "") endif () - message(STATUS "vcpkg toolchain: ${_VCPKG_TOOLCHAIN}") - message(STATUS "vcpkg triplet: ${VCPKG_TARGET_TRIPLET}") + # --- NEW: FORCE INSTALL ZLIB FOR REMOTE RUNNERS --- + # This ensures ZLIB exists before find_package is called. + message(STATUS "VCPKG: Pre-installing ZLIB to satisfy toolchain requirements...") + execute_process( + COMMAND "${VCPKG_ROOT}/vcpkg" install zlib:${VCPKG_TARGET_TRIPLET} + RESULT_VARIABLE VCPKG_ZLIB_RESULT + ) + if (NOT VCPKG_ZLIB_RESULT EQUAL 0) + message(FATAL_ERROR "VCPKG: Failed to pre-install ZLIB.") + endif() + # -------------------------------------------------- include("${_VCPKG_TOOLCHAIN}") else () - message(WARNING "vcpkg not configured. Set VCPKG_ROOT environment variable or pass -DVCPKG_ROOT=") + message(WARNING "vcpkg not configured. Set VCPKG_ROOT environment variable.") endif () #==================================================================== -# Dependencies +# Dependencies (Now ZLIB will be found) #==================================================================== find_package(ZLIB REQUIRED) set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} CACHE INTERNAL "ZLIB libraries for Windows") From 444f000df8a1e8d4f55981a6772835edb1093afe Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 10 Feb 2026 12:31:58 -0800 Subject: [PATCH 34/43] Returned to prior vcpkg setup --- cmake/toolchains/windows.cmake | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index d4533fb9..15bbe70a 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -52,12 +52,8 @@ endif () #==================================================================== set(X_VCPKG_APPLOCAL_DEPS_INSTALL OFF CACHE BOOL "") -if (NOT DEFINED VCPKG_ROOT) - if (DEFINED ENV{VCPKG_ROOT}) - set(VCPKG_ROOT "$ENV{VCPKG_ROOT}" CACHE PATH "Path to vcpkg root") - elseif (DEFINED ENV{VCPKG_INSTALLATION_ROOT}) - set(VCPKG_ROOT "$ENV{VCPKG_INSTALLATION_ROOT}" CACHE PATH "Path to vcpkg root") - endif () +if (NOT DEFINED VCPKG_ROOT AND DEFINED ENV{VCPKG_ROOT}) + set(VCPKG_ROOT "$ENV{VCPKG_ROOT}" CACHE PATH "Path to vcpkg root") endif () if (DEFINED VCPKG_ROOT) @@ -68,28 +64,19 @@ if (DEFINED VCPKG_ROOT) endif () if (NOT DEFINED VCPKG_TARGET_TRIPLET) - set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "") + set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet") endif () - # --- NEW: FORCE INSTALL ZLIB FOR REMOTE RUNNERS --- - # This ensures ZLIB exists before find_package is called. - message(STATUS "VCPKG: Pre-installing ZLIB to satisfy toolchain requirements...") - execute_process( - COMMAND "${VCPKG_ROOT}/vcpkg" install zlib:${VCPKG_TARGET_TRIPLET} - RESULT_VARIABLE VCPKG_ZLIB_RESULT - ) - if (NOT VCPKG_ZLIB_RESULT EQUAL 0) - message(FATAL_ERROR "VCPKG: Failed to pre-install ZLIB.") - endif() - # -------------------------------------------------- + message(STATUS "vcpkg toolchain: ${_VCPKG_TOOLCHAIN}") + message(STATUS "vcpkg triplet: ${VCPKG_TARGET_TRIPLET}") include("${_VCPKG_TOOLCHAIN}") else () - message(WARNING "vcpkg not configured. Set VCPKG_ROOT environment variable.") + message(WARNING "vcpkg not configured. Set VCPKG_ROOT environment variable or pass -DVCPKG_ROOT=") endif () #==================================================================== -# Dependencies (Now ZLIB will be found) +# Dependencies #==================================================================== find_package(ZLIB REQUIRED) set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} CACHE INTERNAL "ZLIB libraries for Windows") From c16c18c1b024356a7d79c1ed3090de657c80302a Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 10 Feb 2026 12:38:28 -0800 Subject: [PATCH 35/43] Updated Windows workflow --- .github/workflows/cmake-multi-platform.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 3eee43f8..eceafbed 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -272,6 +272,13 @@ jobs: Write-Warning "Could not find lib or lib/intel64 under MKLROOT" Get-ChildItem "$env:MKLROOT" -Recurse -Depth 2 } + + # --- Install vcpkg dependencies (Windows) --- + - name: Install vcpkg dependencies + if: runner.os == 'Windows' + shell: powershell + run: | + vcpkg install --triplet x64-windows # --- Configure (Windows) --- - name: Configure CMake (Windows) From 66862a570d604e31db1dce10b40a8eab2faf1f34 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 10 Feb 2026 13:57:39 -0800 Subject: [PATCH 36/43] Updated github workflow document and zlib config on windows --- .github/workflows/cmake-multi-platform.yml | 18 ++++++++++++++++++ CMakeLists.txt | 5 ++++- cmake/toolchains/macos.cmake | 10 ++++++++-- cmake/toolchains/windows.cmake | 3 --- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index eceafbed..f7cc05ff 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -272,6 +272,23 @@ jobs: Write-Warning "Could not find lib or lib/intel64 under MKLROOT" Get-ChildItem "$env:MKLROOT" -Recurse -Depth 2 } + # --- vcpkg Setup (Windows) --- + - name: Export GitHub Actions cache environment variables + if: runner.os == 'Windows' + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Setup vcpkg + if: runner.os == 'Windows' + shell: powershell + run: | + echo "VCPKG_ROOT=C:\vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Append + cd C:\vcpkg + git pull + .\bootstrap-vcpkg.bat # --- Install vcpkg dependencies (Windows) --- - name: Install vcpkg dependencies @@ -290,6 +307,7 @@ jobs: -DBUILD_TESTING=ON ` -DZMQ_BUILD_TESTS=OFF ` -DMKL_ROOT="$env:MKLROOT" ` + -DVCPKG_ROOT="$env:VCPKG_ROOT" ` -DVCPKG_TARGET_TRIPLET=x64-windows ` -DCMAKE_TOOLCHAIN_FILE="cmake/toolchains/windows.cmake" diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c329666..446f7e26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,7 +153,10 @@ include("${CMAKE_SOURCE_DIR}/cmake/eclipsa_plugin_defaults.cmake") # Dependencies #==================================================================== add_subdirectory(third_party) - +if(WIN32) + find_package(ZLIB REQUIRED) + link_libraries(ZLIB::ZLIB) +endif() #==================================================================== # AAX Setup #==================================================================== diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index 44c218b8..ea3035de 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -33,7 +33,14 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum macOS version") #==================================================================== # RPATH Configuration #==================================================================== -set(CMAKE_BUILD_RPATH "@loader_path/../Resources" CACHE STRING "") +get_filename_component(_ECLIPSA_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) +set(CMAKE_BUILD_RPATH + "@loader_path/../Resources" + "${_ECLIPSA_ROOT}/third_party/gpac/lib" + "${_ECLIPSA_ROOT}/third_party/iamftools/lib" + "${_ECLIPSA_ROOT}/third_party/obr/lib" + CACHE STRING "" +) #==================================================================== # Linker Settings @@ -59,7 +66,6 @@ set(ECLIPSA_PLATFORM_LIBS vendored_obr CACHE STRING "") set(SAF_PERFORMANCE_LIB "SAF_USE_APPLE_ACCELERATE" CACHE STRING "") set(LIBIAMF_VENDOR_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos" CACHE PATH "") - #==================================================================== # Bundle Structure #==================================================================== diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index 15bbe70a..fb70ad80 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -78,9 +78,6 @@ endif () #==================================================================== # Dependencies #==================================================================== -find_package(ZLIB REQUIRED) -set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} CACHE INTERNAL "ZLIB libraries for Windows") -link_libraries(ZLIB::ZLIB) link_libraries(delayimp) #==================================================================== From 1b9449ae03c4b11ce6b4ba1bf110977a913218dc Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Tue, 10 Feb 2026 15:21:00 -0800 Subject: [PATCH 37/43] Updated Rpath on macos --- cmake/toolchains/macos.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/toolchains/macos.cmake b/cmake/toolchains/macos.cmake index ea3035de..84c4305c 100644 --- a/cmake/toolchains/macos.cmake +++ b/cmake/toolchains/macos.cmake @@ -35,13 +35,13 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum macOS version") #==================================================================== get_filename_component(_ECLIPSA_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) set(CMAKE_BUILD_RPATH + "${_ECLIPSA_ROOT}" "@loader_path/../Resources" "${_ECLIPSA_ROOT}/third_party/gpac/lib" "${_ECLIPSA_ROOT}/third_party/iamftools/lib" "${_ECLIPSA_ROOT}/third_party/obr/lib" CACHE STRING "" ) - #==================================================================== # Linker Settings #==================================================================== From 69446c5eda67fe7c31e32af3bb4a851b61fbbc68 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Wed, 11 Feb 2026 11:31:22 -0800 Subject: [PATCH 38/43] Updated eclipsa-tests Cmake for cross-platform build --- .github/workflows/cmake-multi-platform.yml | 5 +-- cmake/eclipsa_test.cmake | 40 ++++++++++++++-------- cmake/toolchains/windows.cmake | 2 +- third_party/libiamf/CMakeLists.txt | 5 +-- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index f7cc05ff..347d134f 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -289,7 +289,7 @@ jobs: cd C:\vcpkg git pull .\bootstrap-vcpkg.bat - + # --- Install vcpkg dependencies (Windows) --- - name: Install vcpkg dependencies if: runner.os == 'Windows' @@ -309,7 +309,8 @@ jobs: -DMKL_ROOT="$env:MKLROOT" ` -DVCPKG_ROOT="$env:VCPKG_ROOT" ` -DVCPKG_TARGET_TRIPLET=x64-windows ` - -DCMAKE_TOOLCHAIN_FILE="cmake/toolchains/windows.cmake" + -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" ` + -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE="cmake/toolchains/windows.cmake" # --- Configure (macOS) --- - name: Configure CMake (macOS) diff --git a/cmake/eclipsa_test.cmake b/cmake/eclipsa_test.cmake index 6991a60e..4d260ad9 100644 --- a/cmake/eclipsa_test.cmake +++ b/cmake/eclipsa_test.cmake @@ -24,34 +24,44 @@ function(eclipsa_add_test test_name test_source test_libs) get_property(test_sources GLOBAL PROPERTY ECLIPSA_TEST_SOURCES) set_property(GLOBAL PROPERTY ECLIPSA_TEST_SOURCES "${test_sources};${absolute_test_source}") - # Add codec libraries for all test targets if on macOS - if(APPLE) + # Add codec libraries for all test targets + if (APPLE) set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") list(FIND test_libs "opus" opus_found) - if(opus_found EQUAL -1) + if (opus_found EQUAL -1) list(APPEND test_libs "${LIBIAMF_CODEC_PATH}/libopus.a") - endif() + endif () list(FIND test_libs "ogg" ogg_found) - if(ogg_found EQUAL -1) + if (ogg_found EQUAL -1) list(APPEND test_libs "${LIBIAMF_CODEC_PATH}/libogg.a") - endif() - endif() + endif () + elseif (WIN32) + set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows") + list(FIND test_libs "opus" opus_found) + if (opus_found EQUAL -1) + list(APPEND test_libs "$,${LIBIAMF_CODEC_PATH}/Debug/opus.lib,${LIBIAMF_CODEC_PATH}/Release/opus.lib>") + endif () + list(FIND test_libs "ogg" ogg_found) + if (ogg_found EQUAL -1) + list(APPEND test_libs "$,${LIBIAMF_CODEC_PATH}/Debug/ogg.lib,${LIBIAMF_CODEC_PATH}/Release/ogg.lib>") + endif () + endif () # Add IAMF include directories if 'iamf' or 'iamfdec_utils' is requested - if("${test_libs}" MATCHES "iamf" OR "${test_libs}" MATCHES "iamfdec_utils") - if(NOT DEFINED LIBIAMF_INCLUDE_DIRS) + if ("${test_libs}" MATCHES "iamf" OR "${test_libs}" MATCHES "iamfdec_utils") + if (NOT DEFINED LIBIAMF_INCLUDE_DIRS) message(WARNING "LIBIAMF_INCLUDE_DIRS not defined, but required by ${test_name}") - endif() - endif() + endif () + endif () # If iamfdec_utils was requested, make sure iamf is also linked (dependency) - if(TARGET iamf AND "${test_libs}" MATCHES "iamfdec_utils") + if (TARGET iamf AND "${test_libs}" MATCHES "iamfdec_utils") list(FIND test_libs "iamf" iamf_already_linked) - if(iamf_already_linked EQUAL -1) + if (iamf_already_linked EQUAL -1) list(APPEND test_libs iamf) message(STATUS "Also linking core 'iamf' library as dependency for ${test_name}") - endif() - endif() + endif () + endif () # Append the test libraries to global list AFTER all modifications get_property(test_link_libs GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS) diff --git a/cmake/toolchains/windows.cmake b/cmake/toolchains/windows.cmake index fb70ad80..1ace91cf 100644 --- a/cmake/toolchains/windows.cmake +++ b/cmake/toolchains/windows.cmake @@ -23,7 +23,7 @@ set(_WINDOWS_TOOLCHAIN_INCLUDED TRUE) #==================================================================== # Platform Identifier #==================================================================== -set(ECLIPSA_PLATFORM "windows" CACHE STRING "") +set(ECLIPSA_PLATFORM "windows" CACHE STRING "" FORCE) #==================================================================== # AAX SDK Path diff --git a/third_party/libiamf/CMakeLists.txt b/third_party/libiamf/CMakeLists.txt index f050a05d..2abe8a60 100644 --- a/third_party/libiamf/CMakeLists.txt +++ b/third_party/libiamf/CMakeLists.txt @@ -90,8 +90,9 @@ if (NOT libiamf_POPULATED) endif () endif () -# Extra linking for ogg -if (TARGET iamf) +# Extra linking for ogg (Mac/Linux only) +# Windows is already handled explicitly above with full paths +if (TARGET iamf AND NOT WIN32) target_link_libraries(iamf ogg) endif () From cd674a079f551f193fac6a0f0ab70e81dc03f4f0 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Wed, 11 Feb 2026 12:32:03 -0800 Subject: [PATCH 39/43] Fix VCPKG_CHAINLOAD_TOOLCHAIN_FILE to use absolute path --- .github/workflows/cmake-multi-platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 347d134f..7bc25dd5 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -310,7 +310,7 @@ jobs: -DVCPKG_ROOT="$env:VCPKG_ROOT" ` -DVCPKG_TARGET_TRIPLET=x64-windows ` -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" ` - -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE="cmake/toolchains/windows.cmake" + -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE="${{ github.workspace }}/cmake/toolchains/windows.cmake" # --- Configure (macOS) --- - name: Configure CMake (macOS) From 773b994ad33e4c92d3c0531753ac5815e2f079b1 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Thu, 12 Feb 2026 12:48:38 -0800 Subject: [PATCH 40/43] updated eclipsa_test.cmake to fix windows crash on tests in workflows --- cmake/eclipsa_test.cmake | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/cmake/eclipsa_test.cmake b/cmake/eclipsa_test.cmake index 4d260ad9..5b5ca9a8 100644 --- a/cmake/eclipsa_test.cmake +++ b/cmake/eclipsa_test.cmake @@ -17,53 +17,35 @@ # test_source: Test source file name. # test_libs: Test link libraries as ';' separated list. function(eclipsa_add_test test_name test_source test_libs) - # Construct the absolute path to the test source file set(absolute_test_source "${CMAKE_CURRENT_SOURCE_DIR}/${test_source}") - # Append the absolute test source path to a global list of sources get_property(test_sources GLOBAL PROPERTY ECLIPSA_TEST_SOURCES) set_property(GLOBAL PROPERTY ECLIPSA_TEST_SOURCES "${test_sources};${absolute_test_source}") - # Add codec libraries for all test targets - if (APPLE) - set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") - list(FIND test_libs "opus" opus_found) - if (opus_found EQUAL -1) - list(APPEND test_libs "${LIBIAMF_CODEC_PATH}/libopus.a") - endif () - list(FIND test_libs "ogg" ogg_found) - if (ogg_found EQUAL -1) - list(APPEND test_libs "${LIBIAMF_CODEC_PATH}/libogg.a") - endif () - elseif (WIN32) - set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows") - list(FIND test_libs "opus" opus_found) - if (opus_found EQUAL -1) - list(APPEND test_libs "$,${LIBIAMF_CODEC_PATH}/Debug/opus.lib,${LIBIAMF_CODEC_PATH}/Release/opus.lib>") - endif () - list(FIND test_libs "ogg" ogg_found) - if (ogg_found EQUAL -1) - list(APPEND test_libs "$,${LIBIAMF_CODEC_PATH}/Debug/ogg.lib,${LIBIAMF_CODEC_PATH}/Release/ogg.lib>") - endif () + list(FIND test_libs "opus" opus_found) + if (opus_found EQUAL -1) + list(APPEND test_libs opus) + endif () + + list(FIND test_libs "ogg" ogg_found) + if (ogg_found EQUAL -1) + list(APPEND test_libs ogg) endif () - # Add IAMF include directories if 'iamf' or 'iamfdec_utils' is requested + # Dependency logic for iamf/iamfdec_utils if ("${test_libs}" MATCHES "iamf" OR "${test_libs}" MATCHES "iamfdec_utils") if (NOT DEFINED LIBIAMF_INCLUDE_DIRS) message(WARNING "LIBIAMF_INCLUDE_DIRS not defined, but required by ${test_name}") endif () endif () - # If iamfdec_utils was requested, make sure iamf is also linked (dependency) if (TARGET iamf AND "${test_libs}" MATCHES "iamfdec_utils") list(FIND test_libs "iamf" iamf_already_linked) if (iamf_already_linked EQUAL -1) list(APPEND test_libs iamf) - message(STATUS "Also linking core 'iamf' library as dependency for ${test_name}") endif () endif () - # Append the test libraries to global list AFTER all modifications get_property(test_link_libs GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS) set_property(GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS "${test_link_libs};${test_libs}") endfunction() \ No newline at end of file From 89aa68427a2991f08c1a80a0cd94cce148a3e168 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Thu, 12 Feb 2026 14:42:23 -0800 Subject: [PATCH 41/43] Updated eclipsa_test cmake --- cmake/eclipsa_test.cmake | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/cmake/eclipsa_test.cmake b/cmake/eclipsa_test.cmake index 5b5ca9a8..445af857 100644 --- a/cmake/eclipsa_test.cmake +++ b/cmake/eclipsa_test.cmake @@ -22,24 +22,35 @@ function(eclipsa_add_test test_name test_source test_libs) get_property(test_sources GLOBAL PROPERTY ECLIPSA_TEST_SOURCES) set_property(GLOBAL PROPERTY ECLIPSA_TEST_SOURCES "${test_sources};${absolute_test_source}") - list(FIND test_libs "opus" opus_found) - if (opus_found EQUAL -1) - list(APPEND test_libs opus) + # Only add codec libs when a test needs IAMF decode/encode stack + set(_needs_iamf_codecs FALSE) + if ("${test_libs}" MATCHES "(^|;)iamf(;|$)" OR "${test_libs}" MATCHES "(^|;)iamfdec_utils(;|$)") + set(_needs_iamf_codecs TRUE) endif () - list(FIND test_libs "ogg" ogg_found) - if (ogg_found EQUAL -1) - list(APPEND test_libs ogg) + if (_needs_iamf_codecs) + if (APPLE) + set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/macos") + list(APPEND test_libs + "${LIBIAMF_CODEC_PATH}/libopus.a" + "${LIBIAMF_CODEC_PATH}/libogg.a" + ) + elseif (WIN32) + set(LIBIAMF_CODEC_PATH "${CMAKE_SOURCE_DIR}/third_party/libiamf/lib/Windows") + list(APPEND test_libs + $,${LIBIAMF_CODEC_PATH}/Debug/opus.lib,${LIBIAMF_CODEC_PATH}/Release/opus.lib> + $,${LIBIAMF_CODEC_PATH}/Debug/ogg.lib,${LIBIAMF_CODEC_PATH}/Release/ogg.lib> + ) + endif () endif () - # Dependency logic for iamf/iamfdec_utils - if ("${test_libs}" MATCHES "iamf" OR "${test_libs}" MATCHES "iamfdec_utils") - if (NOT DEFINED LIBIAMF_INCLUDE_DIRS) - message(WARNING "LIBIAMF_INCLUDE_DIRS not defined, but required by ${test_name}") - endif () + # IAMF include dirs warning + if (_needs_iamf_codecs AND NOT DEFINED LIBIAMF_INCLUDE_DIRS) + message(WARNING "LIBIAMF_INCLUDE_DIRS not defined, but required by ${test_name}") endif () - if (TARGET iamf AND "${test_libs}" MATCHES "iamfdec_utils") + # If iamfdec_utils requested, ensure iamf is also linked + if (TARGET iamf AND "${test_libs}" MATCHES "(^|;)iamfdec_utils(;|$)") list(FIND test_libs "iamf" iamf_already_linked) if (iamf_already_linked EQUAL -1) list(APPEND test_libs iamf) @@ -48,4 +59,4 @@ function(eclipsa_add_test test_name test_source test_libs) get_property(test_link_libs GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS) set_property(GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS "${test_link_libs};${test_libs}") -endfunction() \ No newline at end of file +endfunction() From dbb79c88b1958aceae7f1f741ed13204a6151f91 Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Fri, 13 Feb 2026 13:13:25 -0800 Subject: [PATCH 42/43] Updated eclipsa_build_tests --- cmake/eclipsa_build_tests.cmake | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/cmake/eclipsa_build_tests.cmake b/cmake/eclipsa_build_tests.cmake index 96361bdb..0d06914c 100644 --- a/cmake/eclipsa_build_tests.cmake +++ b/cmake/eclipsa_build_tests.cmake @@ -36,13 +36,14 @@ function(eclipsa_build_tests) ) endif () - # Copy test DLLs (Windows only, set in toolchain) - if (DEFINED ECLIPSA_TEST_DLLS) - set(TEST_DIR "${CMAKE_BINARY_DIR}/$") + if (WIN32 AND DEFINED ECLIPSA_TEST_DLLS) add_custom_command(TARGET eclipsa_tests POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory "${TEST_DIR}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ECLIPSA_TEST_DLLS} "${TEST_DIR}/" - COMMENT "Copying test DLLs to ${TEST_DIR}" + COMMAND ${CMAKE_COMMAND} -E make_directory "$" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ECLIPSA_TEST_DLLS} + "$/" + COMMAND_EXPAND_LISTS + COMMENT "Copying test DLLs to $" ) endif () @@ -59,5 +60,15 @@ function(eclipsa_build_tests) GTest::gtest_main ) + if (WIN32) + add_custom_command(TARGET eclipsa_tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $ + $ + COMMAND_EXPAND_LISTS + COMMENT "Copying runtime DLLs for eclipsa_tests" + ) + endif () + gtest_discover_tests(eclipsa_tests DISCOVERY_MODE PRE_TEST) endfunction() \ No newline at end of file From 5178604518484021028d3b6a1b59da94696b6b0d Mon Sep 17 00:00:00 2001 From: Erik Jourgensen Date: Wed, 18 Feb 2026 14:25:59 -0800 Subject: [PATCH 43/43] All tests are passing locally --- cmake/eclipsa_test.cmake | 5 +++++ cmake/prebuiltLibs/windows.cmake | 2 +- third_party/libiamf/CMakeLists.txt | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/eclipsa_test.cmake b/cmake/eclipsa_test.cmake index 445af857..baea97e0 100644 --- a/cmake/eclipsa_test.cmake +++ b/cmake/eclipsa_test.cmake @@ -58,5 +58,10 @@ function(eclipsa_add_test test_name test_source test_libs) endif () get_property(test_link_libs GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS) + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test_resources") + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/test_resources" + DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + endif () + set_property(GLOBAL PROPERTY ECLIPSA_TEST_LINK_LIBS "${test_link_libs};${test_libs}") endfunction() diff --git a/cmake/prebuiltLibs/windows.cmake b/cmake/prebuiltLibs/windows.cmake index 8daddb50..5bbb2e41 100644 --- a/cmake/prebuiltLibs/windows.cmake +++ b/cmake/prebuiltLibs/windows.cmake @@ -29,7 +29,7 @@ set_target_properties(iamftools_impl PROPERTIES IMPORTED_LOCATION_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.dll" IMPORTED_LOCATION_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.dll" IMPORTED_IMPLIB_RELEASE "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Release/iamf_tools.if.lib" - IMPORTED_IMPLIB_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.lib" + IMPORTED_IMPLIB_DEBUG "${CMAKE_SOURCE_DIR}/third_party/iamftools/lib/Windows/Debug/iamf_tools.if.lib" ) add_library(vendored_iamf_tools ALIAS iamftools_impl) diff --git a/third_party/libiamf/CMakeLists.txt b/third_party/libiamf/CMakeLists.txt index 2abe8a60..48e93a6a 100644 --- a/third_party/libiamf/CMakeLists.txt +++ b/third_party/libiamf/CMakeLists.txt @@ -28,8 +28,6 @@ set(HOA_BINAURALIZER OFF CACHE BOOL "Enable HOA binaural rendering" FORCE) FetchContent_GetProperties(libiamf) if (NOT libiamf_POPULATED) FetchContent_Populate(libiamf) - file(REMOVE_RECURSE "${libiamf_SOURCE_DIR}/tests") - #==================================================================== # Platform-specific configuration #====================================================================