Skip to content

Commit

Permalink
Migrated dependency management to CPM where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
tornupnegatives committed Mar 19, 2024
1 parent 7eb3abe commit f6853a7
Show file tree
Hide file tree
Showing 10 changed files with 1,212 additions and 34,294 deletions.
52 changes: 45 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ endif()
# Project Dependencies ########################################################
###############################################################################

# TMS Express uses QT for its graphical interface. Unfortunately, QT does not
# play nicely with CMake's find_package tool, nor does it integrate well with
# pkg-config. The host must ensure that QT is installed and present in the path

if(TMSEXPRESS_BUILD_GUI)
find_package(
Qt6
Expand All @@ -86,6 +90,10 @@ if(TMSEXPRESS_BUILD_GUI)
Qt::Multimedia)
endif()

# TMS Express uses libsndfile for audio I/O. The host must ensure that
# libsndfile is installed, but CMake can detect it via pkg-config. Note
# that pkg-config must also be installed

find_package(PkgConfig REQUIRED)

pkg_check_modules(
Expand All @@ -94,15 +102,45 @@ pkg_check_modules(
IMPORTED_TARGET
sndfile)

pkg_check_modules(
SampleRate
REQUIRED
IMPORTED_TARGET
target_link_libraries(${PROJECT_NAME} PkgConfig::SndFile)

# The bulk of TMS Express' dependencies may be downloaded and configured using
# the CMake Package Manager (CPM). An active internet connection is required

include(cmake/CPM.cmake)

cpmaddpackage(
CLI11
GITHUB_REPOSITORY
CLIUtils/CLI11
VERSION
2.4.1)

cpmaddpackage(
nlohmann_json
GITHUB_REPOSITORY
nlohmann/json
VERSION
3.11.3
OPTIONS
"JSON_MultipleHeaders OFF"
"JSON_SystemInclude ON")

cpmaddpackage(
samplerate
GITHUB_REPOSITORY
libsndfile/libsamplerate
GIT_TAG
0.2.2
OPTIONS
"BUILD_TESTING OFF")

target_link_libraries(
${PROJECT_NAME}
CLI11
nlohmann_json::nlohmann_json
samplerate)

target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::SndFile
PkgConfig::SampleRate)

###############################################################################
# Artifacts & Sub-Targets #####################################################
###############################################################################
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ has fewer dependencies and will compile on a wider range of systems.
```shell
# macOS #######################################################################

# CLI-only build
$ brew install cmake libsamplerate libsndfile pkg-config

# GUI build
Expand Down
Loading

0 comments on commit f6853a7

Please sign in to comment.