Skip to content

Commit

Permalink
add dynamic link option
Browse files Browse the repository at this point in the history
  • Loading branch information
shakfu committed May 25, 2024
1 parent 66734b9 commit edebb8c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.19)

project(pd_chuck)

# general options
option(DYNAMIC_LINKING "enable dynamic linking with dependencies")

# linux options
option(LINUX_ALSA "enable linux alsa build")
option(LINUX_PULSE "enable linux pulseaudio build")
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ linux-adv-alsa: faust
@mkdir -p build && \
cd build && \
cmake .. \
-DDYNAMIC_LINKING=ON \
-DLINUX_ALSA=ON \
-DENABLE_EXTRA_FORMATS=ON \
-DENABLE_MP3=ON \
Expand All @@ -144,6 +145,7 @@ linux-adv-pulse: faust
@mkdir -p build && \
cd build && \
cmake .. \
-DDYNAMIC_LINKING=ON \
-DLINUX_PULSE=ON \
-DENABLE_EXTRA_FORMATS=ON \
-DENABLE_MP3=ON \
Expand All @@ -155,6 +157,7 @@ linux-adv-jack: faust
@mkdir -p build && \
cd build && \
cmake .. \
-DDYNAMIC_LINKING=ON \
-DLINUX_JACK=ON \
-DENABLE_EXTRA_FORMATS=ON \
-DENABLE_MP3=ON \
Expand All @@ -166,6 +169,7 @@ linux-adv-all: faust
@mkdir -p build && \
cd build && \
cmake .. \
-DDYNAMIC_LINKING=ON \
-DLINUX_ALL=ON \
-DENABLE_EXTRA_FORMATS=ON \
-DENABLE_MP3=ON \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ brew install cmake bison flex autoconf autogen automake flac libogg libtool libv
On Debian Linux the requirements can be installed via:

```bash
sudo apt install build-essential cmake bison flex libsndfile1-dev libasound2-dev libpulse-dev libjack-jackd2-dev libmp3lame-dev libresample1-dev librubberband-dev
sudo apt install build-essential cmake bison flex libsndfile1-dev libasound2-dev libpulse-dev libjack-jackd2-dev libmpg123-dev libmp3lame-dev libresample1-dev librubberband-dev
```

Each build option has a Makefile target as follows:
Expand Down
24 changes: 21 additions & 3 deletions thirdparty/chugins/Fauck/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,25 @@ target_link_directories(${CHUGIN_NAME}
${THIRDPARTY}/install/lib
)


if (DYNAMIC_LINKING)
target_link_libraries(${CHUGIN_NAME}
PUBLIC
${LIBFAUST_DIR}/lib/libfaustwithllvm.a
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lFLAC>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-logg>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lvorbis>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lvorbisenc>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lvorbisfile>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lopus>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lmpg123>
$<$<BOOL:${ENABLE_MP3}>:-lmp3lame>
-lsndfile
"$<$<BOOL:${APPLE}>:-framework CoreFoundation>"
"$<$<BOOL:${APPLE}>:-framework CoreMIDI>"
"$<$<BOOL:${APPLE}>:-framework CoreAudio>"
"$<$<BOOL:${APPLE}>:-framework Accelerate>"
)
else()
target_link_libraries(${CHUGIN_NAME}
PUBLIC
${LIBFAUST_DIR}/lib/libfaustwithllvm.a
Expand All @@ -108,14 +126,14 @@ target_link_libraries(${CHUGIN_NAME}
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:${LOCAL_LIB}/libvorbisfile.a>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:${LOCAL_LIB}/libopus.a>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:${LOCAL_LIB}/libmpg123.a>
$<$<BOOL:${ENABLE_MP3}>:${LOCAL_LIB}/libmp3lame.a>
$<$<BOOL:${ENABLE_MP3}>:${LOCAL_LIB}/libmp3lame.a>
${LOCAL_LIB}/libsndfile.a
"$<$<BOOL:${APPLE}>:-framework CoreFoundation>"
"$<$<BOOL:${APPLE}>:-framework CoreMIDI>"
"$<$<BOOL:${APPLE}>:-framework CoreAudio>"
"$<$<BOOL:${APPLE}>:-framework Accelerate>"
)

endif()

install(
TARGETS ${CHUGIN_NAME}
Expand Down
22 changes: 22 additions & 0 deletions thirdparty/chugins/WarpBuf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,26 @@ target_link_directories(${CHUGIN_NAME}
)


if (DYNAMIC_LINKING)
target_link_libraries(${CHUGIN_NAME}
PUBLIC
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lFLAC>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-logg>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lvorbis>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lvorbisenc>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lvorbisfile>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lopus>
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:-lmpg123>
$<$<BOOL:${ENABLE_MP3}>:-lmp3lame>
-lsndfile
-lrubberband
-lsamplerate
"$<$<BOOL:${APPLE}>:-framework CoreFoundation>"
"$<$<BOOL:${APPLE}>:-framework CoreMIDI>"
"$<$<BOOL:${APPLE}>:-framework CoreAudio>"
"$<$<BOOL:${APPLE}>:-framework Accelerate>"
)
else()
target_link_libraries(${CHUGIN_NAME}
PUBLIC
$<$<BOOL:${ENABLE_EXTRA_FORMATS}>:${LOCAL_LIB}/libFLAC.a>
Expand All @@ -97,6 +117,8 @@ target_link_libraries(${CHUGIN_NAME}
"$<$<BOOL:${APPLE}>:-framework CoreAudio>"
"$<$<BOOL:${APPLE}>:-framework Accelerate>"
)
endif()


# set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/examples")
install(
Expand Down

0 comments on commit edebb8c

Please sign in to comment.