Skip to content

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

@shakfu

Description

@shakfu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions