Skip to content

Commit

Permalink
[ossia] Improve standalone & oscquery bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Mar 15, 2024
1 parent 69aeaeb commit 06b5c32
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 137 deletions.
2 changes: 1 addition & 1 deletion cmake/avendish.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(AVND_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "")
find_package(Boost QUIET REQUIRED)
find_package(Threads QUIET)
find_package(fmt QUIET)

find_package(ossia QUIET)

set(AVENDISH_SOURCES
"${AVND_SOURCE_DIR}/include/avnd/concepts/all.hpp"
Expand Down
17 changes: 17 additions & 0 deletions cmake/avendish.dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,20 @@ if(NOT TARGET pantor::inja)
)
FetchContent_MakeAvailable(pantor_inja)
endif()

if(APPLE)
if(NOT TARGET jthread)
FetchContent_Declare(
jthread
GIT_REPOSITORY "https://github.com/StirlingLabs/jthread"
GIT_TAG main
GIT_PROGRESS true
)
FetchContent_MakeAvailable(jthread)
endif()
endif()


if(NOT TARGET jthread)
add_library(jthread INTERFACE)
endif()
15 changes: 14 additions & 1 deletion cmake/avendish.ossia.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,22 @@ function(avnd_make_ossia)
PUBLIC
Avendish::Avendish
ossia::ossia
SDL2
)

if(TARGET SDL2::SDL2)
target_link_libraries(
${AVND_FX_TARGET}
PUBLIC
SDL2::SDL2
)
elseif(TARGET SDL2::SDL2-static)
target_link_libraries(
${AVND_FX_TARGET}
PUBLIC
SDL2::SDL2-static
)
endif()

avnd_common_setup("${AVND_TARGET}" "${AVND_FX_TARGET}")

target_sources(Avendish PRIVATE
Expand Down
4 changes: 2 additions & 2 deletions cmake/avendish.sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function(avnd_target_setup AVND_FX_TARGET)
target_compile_options(
${AVND_FX_TARGET}
PUBLIC
-stdlib=libc++
# -stdlib=libc++
# -flto
-fno-stack-protector
-fno-ident
Expand Down Expand Up @@ -133,7 +133,7 @@ function(avnd_target_setup AVND_FX_TARGET)
)
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
target_link_libraries(${AVND_FX_TARGET} PRIVATE
-lc++
# -lc++
-Bsymbolic
# -flto
)
Expand Down
17 changes: 15 additions & 2 deletions cmake/avendish.standalone.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "WAS.*")
endfunction()
return()
endif()
find_package(ossia)
find_package(GLEW QUIET)
find_package(glfw3 QUIET)
find_package(OpenGL QUIET)
Expand Down Expand Up @@ -86,7 +85,20 @@ function(avnd_make_standalone)
${AVND_FX_TARGET}
PUBLIC
ossia::ossia
SDL2
)
endif()

if(TARGET SDL2::SDL2)
target_link_libraries(
${AVND_FX_TARGET}
PUBLIC
SDL2::SDL2
)
elseif(TARGET SDL2::SDL2-static)
target_link_libraries(
${AVND_FX_TARGET}
PUBLIC
SDL2::SDL2-static
)
endif()

Expand Down Expand Up @@ -148,6 +160,7 @@ function(avnd_make_standalone)
${AVND_FX_TARGET}
PUBLIC
Avendish::Avendish
jthread
)

if(TARGET ossia::ossia)
Expand Down
44 changes: 43 additions & 1 deletion cmake/avendish.vst3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-non-virtual-dtor")
endif()

if(APPLE)
set(VST3_DYNAMIC_LIST "_BundleEntry\n_BundleExit\n_bundleEntry\n_bundleExit\n_GetPluginFactory")
elseif(WIN32)
set(VST3_DYNAMIC_LIST "AVND {\nlocal:*;\nglobal:InitDll;\nExitDll;\nGetPluginFactory;\n};\n")
else()
set(VST3_DYNAMIC_LIST "AVND {\n global:\n ModuleEntry;\n ModuleExit;\n GetPluginFactory;\n local:\n *;\n};\n")
endif()

file(WRITE "${CMAKE_BINARY_DIR}/vst3_symbols" "${VST3_DYNAMIC_LIST}")
add_subdirectory("${VST3_SDK_ROOT}" "${CMAKE_BINARY_DIR}/vst3_sdk")

function(avnd_make_vst3)
Expand Down Expand Up @@ -62,9 +71,42 @@ function(avnd_make_vst3)
${AVND_FX_TARGET}
PUBLIC
Avendish::Avendish_vst3
sdk_common pluginterfaces
$<IF:$<BOOL:${APPLE}>,base sdk_common pluginterfaces,$<LINK_GROUP:RESCAN,base,sdk_common,pluginterfaces>>
DisableExceptions
)

if(UNIX AND NOT APPLE)
target_link_libraries(
${AVND_FX_TARGET}
PUBLIC
-Wl,-z,defs
)
endif()

if(APPLE)
target_link_libraries(${AVND_FX_TARGET} PRIVATE jthread "-Wl,-exported_symbols_list,${CMAKE_BINARY_DIR}/vst3_symbols")
elseif(WIN32)
if(NOT MSVC)
target_link_libraries(${AVND_FX_TARGET} PRIVATE "-Wl,--version-script=${CMAKE_BINARY_DIR}/vst3_symbols")
endif()
else()
target_link_libraries(${AVND_FX_TARGET} PRIVATE "-Wl,--version-script=${CMAKE_BINARY_DIR}/vst3_symbols")
endif()


if(TARGET ossia::ossia)
target_compile_definitions(
${AVND_FX_TARGET}
PUBLIC
AVND_ADD_OSCQUERY_BINDINGS=1
)
target_link_libraries(
${AVND_FX_TARGET}
PUBLIC
ossia::ossia
)
endif()

if(APPLE)
find_library(COREFOUNDATION_FK CoreFoundation)
target_link_libraries(
Expand Down
2 changes: 1 addition & 1 deletion examples/Helpers/Controls.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct Controls

struct range
{
halp::combo_pair<float> values[3]{{"Foo", 0.1f}, {"Bar", 0.5f}, {"Baz", 0.8f}};
halp::combo_pair<float> values[3]{{"A", 0.1f}, {"B", 0.5f}, {"C", 0.8f}};
int init{1}; // Bar
};

Expand Down
Loading

0 comments on commit 06b5c32

Please sign in to comment.