Skip to content

Commit

Permalink
linux: fix tests linking to swell
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjnixon committed Nov 14, 2022
1 parent 6c0d264 commit 1e64007
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cmake_modules/wdl_linux_stub.cpp
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
#include <WDL/swell/swell-types.h>

// there are three ways to get at the SWELL symbols:
//
// - 1, SWELL_PROVIDED_BY_APP, SWELL_LOAD_SWELL_DYLIB, defined in swell-modstub-generic
//
// swell symbols are looked up by dlopening libswell.so, assuming that the
// parent application has loaded such a library itself
//
// - 2, SWELL_PROVIDED_BY_APP, no SWELL_LOAD_SWELL_DYLIB, defined in swell-modstub-generic
//
// the application will call SWELL_dllMain with a function that can be used
// to look up the symbols
//
// - 3, no SWELL_PROVIDED_BY_APP, defined in swell-appstub-generic
//
// we compile the SWELL functions and provide them ourselves
//
// normally on linux we use method 1 (2 doesn't seem to work), but when testing
// libswell doesn't exist, although the rest of the code is linked against it,
// so the symbols will still exist. we could compile it ourselves, but we don't
// actually need to use any of the functions for testing the non-gui parts, so
// it's ok to enable method 2 -- swell symbols will still exist as function
// pointers, but will be left as NULL at run-time
#ifdef SWELL_TESTING
#undef SWELL_LOAD_SWELL_DYLIB
#endif

#include <WDL/swell/swell-modstub-generic.cpp>
2 changes: 2 additions & 0 deletions reaper-adm-extension/test/reaper_adm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_executable(testreaper_adm "")

add_dependencies(testreaper_adm reaper_adm reaper_adm_dependencies)
target_compile_definitions(testreaper_adm PUBLIC SWELL_TESTING)

target_sources(testreaper_adm
PRIVATE
Expand Down Expand Up @@ -56,6 +57,7 @@ add_test(
add_executable(testacceptreaper_adm "")

add_dependencies(testacceptreaper_adm reaper_adm reaper_adm_dependencies)
target_compile_definitions(testacceptreaper_adm PUBLIC SWELL_TESTING)

target_sources(testacceptreaper_adm
PRIVATE
Expand Down

0 comments on commit 1e64007

Please sign in to comment.