Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch: [macos] for missing <array> and homebrew build support #67

Open
shakfu opened this issue Jul 9, 2023 · 0 comments
Open

patch: [macos] for missing <array> and homebrew build support #67

shakfu opened this issue Jul 9, 2023 · 0 comments

Comments

@shakfu
Copy link

shakfu commented Jul 9, 2023

I tried to compile on a macOS (x86_64) and had to make the following changes to enable compilation without errors.

  • A fix to clients/softcut_jack_osc/src/BufDiskWorker.cpp to include <array>

  • Some additions to clients/softcut_jack_osc/CMakeLists.txt to make it work nicely with homebrew installed dependencies if available.

The patch is as follows and attached at the end of this post:

diff --git a/clients/softcut_jack_osc/CMakeLists.txt b/clients/softcut_jack_osc/CMakeLists.txt
index 08798c0..6381cc6 100644
--- a/clients/softcut_jack_osc/CMakeLists.txt
+++ b/clients/softcut_jack_osc/CMakeLists.txt
@@ -13,9 +13,38 @@ set(SRC src/main.cpp
 
 add_executable(softcut_jack_osc ${SRC})
 
-include_directories(../../softcut-lib/include)
 
-target_link_libraries(softcut_jack_osc softcut jack lo pthread sndfile)
+if(CMAKE_HOST_APPLE)
+    execute_process(
+        COMMAND brew --prefix
+        OUTPUT_VARIABLE HOMEBREW_PREFIX
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+    )
+    if(DEFINED HOMEBREW_PREFIX)
+        set(HAS_HOMEBREW 1)
+        message(STATUS "HAS_HOMEBREW: ${HAS_HOMEBREW}")
+        message(STATUS "HOMEBREW_PREFIX: ${HOMEBREW_PREFIX}")
+    endif()
+endif()
+
+
+include_directories(
+    ../../softcut-lib/include
+    $<${HAS_HOMEBREW}:${HOMEBREW_PREFIX}>/include
+)
+
+target_link_directories(softcut_jack_osc
+    PRIVATE
+    $<${HAS_HOMEBREW}:${HOMEBREW_PREFIX}>/lib
+)
+
+target_link_libraries(softcut_jack_osc
+    softcut
+    jack
+    lo
+    pthread
+    sndfile
+)
 
 target_compile_options(softcut_jack_osc PRIVATE -Wall -Wextra -pedantic)
 
diff --git a/clients/softcut_jack_osc/src/BufDiskWorker.cpp b/clients/softcut_jack_osc/src/BufDiskWorker.cpp
index e5c8dc4..8b65230 100644
--- a/clients/softcut_jack_osc/src/BufDiskWorker.cpp
+++ b/clients/softcut_jack_osc/src/BufDiskWorker.cpp
@@ -12,6 +12,7 @@
 
 #include <sndfile.hh>
 #include <utility>
+#include <array>
 
 #include "BufDiskWorker.h"

macos_fix.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant