free-audio / clap-wrapper

Wrappers for using CLAP in other plugin environments
MIT License
107 stars 17 forks source link

auv2 cmake build fail: wrapasauv2.cpp:769:12: error: use of undeclared identifier 'kAudioUnitProperty_MIDIOutputEventListCallback' #246

Closed mightgoyardstill closed 3 months ago

mightgoyardstill commented 4 months ago

currently running into this error when i build my wrapper project:

Users/jt/Desktop/clap-dev/projects/clap-saw-build-test/build/_deps/clap-wrapper-src/src/wrapasauv2.cpp:769:12: error: use of undeclared identifier 'kAudioUnitProperty_MIDIOutputEventListCallback'; did you mean 'kAudioUnitProperty_MIDIOutputCallback'? [build] case kAudioUnitProperty_MIDIOutputEventListCallback: [build] ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [build] kAudioUnitProperty_MIDIOutputCallback [build] /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioUnitProperties.h:836:2: note: 'kAudioUnitProperty_MIDIOutputCallback' declared here [build] kAudioUnitProperty_MIDIOutputCallback = 48, [build] ^ [build] /Users/jt/Desktop/clap-dev/projects/clap-saw-build-test/build/_deps/clap-wrapper-src/src/wrapasauv2.cpp:771:12: error: duplicate case value 'kAudioUnitProperty_MIDIOutputCallback' [build] case kAudioUnitProperty_MIDIOutputCallback: [build] ^ [build] /Users/jt/Desktop/clap-dev/projects/clap-saw-build-test/build/_deps/clap-wrapper-src/src/wrapasauv2.cpp:769:12: note: previous case defined here [build] case kAudioUnitProperty_MIDIOutputEventListCallback: [build] ^ [build] 2 errors generated.

pulling in all the clap, helpers and wrapper libs using cpm from the main branches.. can't tell if its an issue with my cmake set up or not but looks like it might either be a clash with my audio unit sdk against the wrapasauv2 code or the fact im setting CLAP_WRAPPER_BUILD_AUV2 to true

baconpaul commented 4 months ago

Which au sdk are you using?

we have one we recommend (and which we grab and test with cpm) but if you are using an older one we may need to guard

mightgoyardstill commented 4 months ago

well from the output path Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/AudioToolbox.framework/ it seems like its linking against my older sdk even though in my cmake i've set the following:

set (CLAP_WRAPPER_DOWNLOAD_DEPENDENCIES TRUE CACHE BOOL "Get em")
set (CLAP_WRAPPER_DONT_ADD_TARGETS TRUE CACHE BOOL "I'll targetize")
set (CLAP_WRAPPER_BUILD_AUV2 TRUE CACHE BOOL "It's only logical")

I haven't specifically set a path to the the au sdk or anything, i thought it would do that automatically?

mightgoyardstill commented 4 months ago

just had a look here and it looks like you aren't pulling in the most recent audio unit sdk? https://github.com/free-audio/clap-wrapper/blob/cef9bb58a5cce45a56b8d453f60d1c4c70a683bb/cmake/base_sdks.cmake#L203

    if (NOT "${AUDIOUNIT_SDK_ROOT}" STREQUAL "")
        # Use the provided root
    elseif (${CLAP_WRAPPER_DOWNLOAD_DEPENDENCIES})
        guarantee_cpm()
        CPMAddPackage(
                NAME "AudioUnitSDK"
                GITHUB_REPOSITORY "apple/AudioUnitSDK"
                GIT_TAG "AudioUnitSDK-1.1.0"
                EXCLUDE_FROM_ALL TRUE
                DOWNLOAD_ONLY TRUE
                SOURCE_DIR cpm/AudioUnitSDK
        )
        set(AUDIOUNIT_SDK_ROOT "${CMAKE_CURRENT_BINARY_DIR}/cpm/AudioUnitSDK")
    else()
        search_for_sdk_source(SDKDIR AudioUnitSDK RESULT AUDIOUNIT_SDK_ROOT)
    endif()

where here it looks like they are on 1.2.0 https://github.com/apple/AudioUnitSDK

mightgoyardstill commented 4 months ago

i've uploaded the project onto github with some notes about how i'm building, i was talking to defiantnerd and they seem to think its probably an issue building using ninja?

https://github.com/mightgoyardstill/clap-build-test/tree/main

defiantnerd commented 4 months ago

I've checked out the 1.2.0 version of the SDK and it requires(!) c++20 - I am not sure if we already want this, the runtime library is strictly tied to the macOS versions and this could introduce new minimum requirements we don't want to raise yet.

defiantnerd commented 4 months ago

your project does not properly compile because it does not adding the VSTGUI path correctly. Use this diff:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b97881d..d5e2b51 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,7 +41,7 @@ target_link_libraries (${PROJECT_NAME} clap-core clap-helpers vstgui readerwrite

 # VSTGUI doesn't include the include paths and compile definitions in the library
 # targets like other CMake libraries do, so explicitly include them here...
-target_include_directories (${PROJECT_NAME} PUBLIC libs/vstgui)
+target_include_directories (${PROJECT_NAME} PUBLIC ${VSTGUI_SOURCE_DIR})
 target_compile_definitions (${PROJECT_NAME} PRIVATE IS_MAC=1 HAS_GUI=1 ${VSTGUI_COMPILE_DEFINITIONS})
 # there must be more nicer way to set if the plugin has gui or not and what platform it is running on

Then it compiles properly with cmake -Bbuild -G Xcode

I also suggest you delete your CMake build folder once, sometimes CMake chokes whilst you hack your cmakelists..

defiantnerd commented 4 months ago

Oh, and I always recommend Xcode over Ninja, it is just less alien to the Mac platform.