Skip to content

Commit

Permalink
Use variables for sound headers
Browse files Browse the repository at this point in the history
Fixes: #2573

Also adds some comments and small changes

Co-authored-by: pgScorpio <pgScorpio@users.noreply.github.com>
  • Loading branch information
ann0see and pgScorpio committed Apr 19, 2023
1 parent babf6dc commit 3fd0f3a
Showing 1 changed file with 48 additions and 23 deletions.
71 changes: 48 additions & 23 deletions Jamulus.pro
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,35 @@ INCLUDEPATH_OPUS = libs/opus/include \
libs/opus/silk/fixed \
libs/opus

# Add include paths and headers for new audio APIs here

# ASIO
INCLUDEPATH_ASIO = libs/ASIOSDK2/common \
libs/ASIOSDK2/host \
libs/ASIOSDK2/host/pc
HEADERS_ASIO = src/sound/asio/sound.h
SOURCES_ASIO = src/sound/asio/sound.cpp \
libs/ASIOSDK2/common/asio.cpp \
libs/ASIOSDK2/host/asiodrivers.cpp \
libs/ASIOSDK2/host/pc/asiolist.cpp

# JACK
HEADERS_JACK = src/sound/jack/sound.h
SOURCES_JACK = src/sound/jack/sound.cpp

# CoreAudio macOS
HEADERS_COREAUDIO_MAC = src/sound/coreaudio-mac/sound.h
SOURCES_COREAUDIO_MAC = src/sound/coreaudio-mac/sound.cpp

# CoreAudio iOS
HEADERS_COREAUDIO_IOS = src/sound/coreaudio-ios/sound.h
SOURCES_COREAUDIO_IOS = src/sound/coreaudio-ios/sound.mm

# Oboe
HEADERS_OBOE = src/sound/oboe/sound.h
SOURCES_OBOE = src/sound/oboe/sound.cpp \
src/android/androiddebug.cpp # TODO: Remove debugging code if no longer needed

DEFINES += APP_VERSION=\\\"$$VERSION\\\" \
CUSTOM_MODES \
_REENTRANT
Expand Down Expand Up @@ -125,11 +154,11 @@ win32 {
libjackname = "libjack64.lib"
}
!exists("$${programfilesdir}/JACK2/include/jack/jack.h") {
error("Error: jack.h was not found in the expected location ($${programfilesdir}). Ensure that the right JACK2 variant is installed (32bit vs. 64bit).")
error("Error: jack.h was not found in the expected location ($${programfilesdir}). Ensure that the right JACK2 variant is installed (32 Bit vs. 64 Bit).")
}

HEADERS += src/sound/jack/sound.h
SOURCES += src/sound/jack/sound.cpp
HEADERS += $$HEADERS_JACK
SOURCES += $$SOURCES_JACK
DEFINES += WITH_JACK
DEFINES += JACK_ON_WINDOWS
DEFINES += _STDINT_H # supposed to solve compilation error in systemdeps.h
Expand All @@ -144,14 +173,9 @@ win32 {
}
# Important: Keep those ASIO includes local to this build target in
# order to avoid poisoning other builds license-wise.
HEADERS += src/sound/asio/sound.h
SOURCES += src/sound/asio/sound.cpp \
libs/ASIOSDK2/common/asio.cpp \
libs/ASIOSDK2/host/asiodrivers.cpp \
libs/ASIOSDK2/host/pc/asiolist.cpp
INCLUDEPATH += libs/ASIOSDK2/common \
libs/ASIOSDK2/host \
libs/ASIOSDK2/host/pc
HEADERS += $$HEADERS_ASIO
SOURCES += $$SOURCES_ASIO
INCLUDEPATH += $$INCLUDEPATH_ASIO
}
}

Expand All @@ -178,6 +202,7 @@ win32 {
QMAKE_BUNDLE_DATA += OSX_ENTITLEMENTS

macx-xcode {
# As of 2023-04-15 the macOS build with Xcode only fails. This is tracked in #1841
QMAKE_INFO_PLIST = mac/Info-xcode.plist
XCODE_ENTITLEMENTS.name = CODE_SIGN_ENTITLEMENTS
XCODE_ENTITLEMENTS.value = mac/Jamulus.entitlements
Expand Down Expand Up @@ -208,24 +233,26 @@ win32 {
error("Error: jack.h was not found at the usual place, maybe JACK is not installed")
}
}
HEADERS += src/sound/jack/sound.h
SOURCES += src/sound/jack/sound.cpp
HEADERS += $$HEADERS_JACK
SOURCES += $$SOURCES_JACK
DEFINES += WITH_JACK
DEFINES += JACK_REPLACES_COREAUDIO
INCLUDEPATH += /usr/local/include
LIBS += /usr/local/lib/libjack.dylib
} else {
message(Using CoreAudio.)
HEADERS += src/sound/coreaudio-mac/sound.h
SOURCES += src/sound/coreaudio-mac/sound.cpp
HEADERS += $$HEADERS_COREAUDIO_MAC
SOURCES += $$SOURCES_COREAUDIO_MAC
}

} else:ios {
QMAKE_INFO_PLIST = ios/Info.plist
OBJECTIVE_SOURCES += src/ios/ios_app_delegate.mm
HEADERS += src/ios/ios_app_delegate.h
HEADERS += src/sound/coreaudio-ios/sound.h
OBJECTIVE_SOURCES += src/sound/coreaudio-ios/sound.mm

HEADERS += $$HEADERS_COREAUDIO_IOS
OBJECTIVE_SOURCES += $$SOURCES_COREAUDIO_IOS

QMAKE_TARGET_BUNDLE_PREFIX = io.jamulus
LIBS += -framework AVFoundation \
-framework AudioToolbox
Expand All @@ -246,10 +273,8 @@ win32 {
target.path = /tmp/your_executable # path on device
INSTALLS += target

HEADERS += src/sound/oboe/sound.h

SOURCES += src/sound/oboe/sound.cpp \
src/android/androiddebug.cpp
HEADERS += $$HEADERS_OBOE
SOURCES += $$SOURCES_OBOE

LIBS += -lOpenSLES
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
Expand Down Expand Up @@ -296,8 +321,8 @@ win32 {
} else {
message(JACK Audio Interface Enabled.)

HEADERS += src/sound/jack/sound.h
SOURCES += src/sound/jack/sound.cpp
HEADERS += $$HEADERS_JACK
SOURCES += $$SOURCES_JACK

contains(CONFIG, "raspijamulus") {
message(Using JACK Audio in raspijamulus.sh mode.)
Expand Down

0 comments on commit 3fd0f3a

Please sign in to comment.