Cmake command line build broken in 369

Hello

I just upgraded to 369 and the cmake command line build no longer works. I am on Mac 10.13.3. Xcode 9.2. cmake 3.9.4

Here is how to reproduce:

With vst368 => works

> mkdir vst368
> cd vst368
> cmake -DCMAKE_BUILD_TYPE=Debug /Volumes/Vault/Applications/VST_SDK.368/VST3_SDK
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
... removed ...
-- Build files have been written to: /Volumes/Vault/tmp/vst-cmake/vst368
> cmake --build . --target again
Scanning dependencies of target vstgui
... removed ...
Scanning dependencies of target again
[ 96%] Building CXX object public.sdk/samples/vst/again/CMakeFiles/again.dir/source/again.cpp.o
[ 96%] Building CXX object public.sdk/samples/vst/again/CMakeFiles/again.dir/source/againcontroller.cpp.o
[ 98%] Building CXX object public.sdk/samples/vst/again/CMakeFiles/again.dir/source/againentry.cpp.o
[ 98%] Building CXX object public.sdk/samples/vst/again/CMakeFiles/again.dir/source/againsidechain.cpp.o
[ 98%] Building CXX object public.sdk/samples/vst/again/CMakeFiles/again.dir/__/__/__/source/main/macmain.cpp.o
[100%] Linking CXX CFBundle shared module ../../../../VST3/again.vst3/Contents/MacOS/again
* Loading module...

	/Volumes/Vault/tmp/vst-cmake/vst368/VST3/again.vst3
... removed ...
-------------------------------------------------------------
Result: 78 tests passed, 0 tests failed
-------------------------------------------------------------

Now with vst369

> mkdir vst369
> cd vst369
> cmake  -DCMAKE_BUILD_TYPE=Debug /Volumes/Vault/Applications/VST_SDK.369/VST3_SDK
-- Building with Xcode version: 9.2
-- macOS Deployment Target: 10.10
... removed ...
-- Build files have been written to: /Volumes/Vault/tmp/vst-cmake/vst369
> cmake --build . --target again
Scanning dependencies of target base
... removed ...
Scanning dependencies of target again
[ 98%] Building CXX object public.sdk/samples/vst/again/CMakeFiles/again.dir/source/again.cpp.o
[ 98%] Building CXX object public.sdk/samples/vst/again/CMakeFiles/again.dir/source/againcontroller.cpp.o
[ 98%] Building CXX object public.sdk/samples/vst/again/CMakeFiles/again.dir/source/againentry.cpp.o
[100%] Building CXX object public.sdk/samples/vst/again/CMakeFiles/again.dir/source/againsidechain.cpp.o
[100%] Building CXX object public.sdk/samples/vst/again/CMakeFiles/again.dir/__/__/__/source/main/macmain.cpp.o
[100%] Linking CXX CFBundle shared module ../../../../VST3/again.vst3/Contents/MacOS/again
* Loading module...

	/Volumes/Vault/tmp/vst-cmake/vst369/VST3/Debug/again.vst3

Invalid Module!
Could not create Bundle for path: /Volumes/Vault/tmp/vst-cmake/vst369/VST3/Debug/again.vst3

It fails. What is weird is that the linking happens under VST3/again.vst3 but the module is being loaded under VST3/Debug/again.vst3

This is working with 368.

I apologize if this is not the right place to report this kind of issue. Should I open a ticket on github?

Thanks
Yan

Hey,

can you try adding

-GXcode

to your cmake call?

It is a mistake in one of the CMakeLists.txt which will be fixed in the next update.

René

Unfortunately that will not help me. I am not a fan of generating an Xcode project and work of it because I want my source of truth to be the cmake files so that I can do cross platform.

I actually use CLion which work directly off the CMakeLists.txt and so the build is broken (works with 368).

Is the next release soon? Could you point me to what is broken so that I can fix it locally?

Thanks
Yan

Open “cmake/modules/AddVST3Library.cmake” and add

set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${VST3_OUTPUT_DIR}/${CMAKE_BUILD_TYPE}")

after line 95.

if(XCODE)
    ...
else()
    set_target_properties(${target} PROPERTIES BUNDLE_EXTENSION ${VST3_EXTENSION})
    set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${VST3_OUTPUT_DIR}/${CMAKE_BUILD_TYPE}")
endif()

This creates the missing “CMAKE_BUILD_TYPE” folders like “Debug” and “Release” when you do not generate with -GXcode.

René

Thank you for your quick response. While looking at the cmake/modules/AddVST3Library.cmake file that you were pointing out I realized what is in fact broken…

This is what 3.6.8 was doing:

# Run the validator after building
function(smtg_run_vst_validator target)
    add_dependencies(${target} validator)
    if(WIN)
        set(TARGET_PATH $<TARGET_FILE:${target}>)
    elseif(XCODE)
        set(TARGET_PATH "${VST3_OUTPUT_DIR}/${CMAKE_BUILD_TYPE}/${target}.vst3")
    else()
        set(TARGET_PATH "${VST3_OUTPUT_DIR}/${target}.vst3")
    endif()
    add_custom_command(TARGET ${target} POST_BUILD COMMAND $<TARGET_FILE:validator> "${TARGET_PATH}" WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
endfunction()

This is what 3.6.9 is doing:

# Run the validator after building
function(smtg_run_vst_validator target)
   add_dependencies(${target} validator)
   if(WIN)
       set(TARGET_PATH $<TARGET_FILE:${target}>)
   else()
       set(TARGET_PATH "${VST3_OUTPUT_DIR}/${CMAKE_BUILD_TYPE}/${target}.${VST3_EXTENSION}")
   endif()
   add_custom_command(TARGET ${target} POST_BUILD COMMAND $<TARGET_FILE:validator> "${TARGET_PATH}" WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
endfunction()

=> in 3.6.8 XCODE was handled one way and command line a different way. This got changed in 3.6.9 and broke the command line approach.

If I revert the function to be like 3.6.8, then it just works from the command line. This seems to me the right approach vs the one you were suggesting which seems a lot more involved.

Yan