122 lines
2.8 KiB
CMake
122 lines
2.8 KiB
CMake
|
|
cmake_minimum_required(VERSION 4.0)
|
|
project(sonobulus LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# get dependencies
|
|
include(FetchContent)
|
|
set(RTAUDIO_BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
|
set(RTMIDI_BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
|
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
|
set(RTAUDIO_TARGETNAME_UNINSTALL rtaudio-uninstall CACHE STRING "" FORCE)
|
|
set(RTMIDI_TARGETNAME_UNINSTALL rtmidi-uninstall CACHE STRING "" FORCE)
|
|
FetchContent_Declare(
|
|
rtaudio
|
|
GIT_REPOSITORY https://github.com/thestk/rtaudio.git
|
|
GIT_TAG 6.0.1
|
|
)
|
|
FetchContent_Declare(
|
|
rtmidi
|
|
GIT_REPOSITORY https://github.com/thestk/rtmidi.git
|
|
GIT_TAG 6.0.0
|
|
)
|
|
FetchContent_Declare(
|
|
libconfig
|
|
GIT_REPOSITORY https://github.com/hyperrealm/libconfig.git
|
|
GIT_TAG v1.8.2
|
|
)
|
|
FetchContent_Declare(
|
|
eigen
|
|
GIT_REPOSITORY git@gitlab.com:libeigen/eigen.git
|
|
GIT_TAG 5.0
|
|
)
|
|
FetchContent_MakeAvailable(rtaudio)
|
|
FetchContent_MakeAvailable(rtmidi)
|
|
FetchContent_MakeAvailable(libconfig)
|
|
|
|
# needs to be preinstalled
|
|
find_package(Qt6 REQUIRED COMPONENTS
|
|
Core
|
|
Quick
|
|
)
|
|
|
|
qt_standard_project_setup()
|
|
|
|
add_library(sonobulus_core STATIC
|
|
src/ConfigService.cpp
|
|
src/LoggerService.cpp
|
|
src/TimerComponent.cpp
|
|
src/synth/AudioEngine.cpp
|
|
src/synth/KeyboardController.cpp
|
|
src/synth/MidiController.cpp
|
|
src/synth/NoteQueue.cpp
|
|
src/synth/Scope.cpp
|
|
src/synth/Synth.cpp
|
|
src/synth/Voice.cpp
|
|
src/synth/Instrument.cpp
|
|
)
|
|
target_link_libraries(sonobulus_core PRIVATE
|
|
Qt6::Core
|
|
Qt6::Quick
|
|
rtaudio
|
|
rtmidi
|
|
libconfig++
|
|
)
|
|
|
|
target_include_directories(sonobulus_core PRIVATE
|
|
${CMAKE_SOURCE_DIR}/src/
|
|
${rtaudio_SOURCE_DIR}
|
|
${rtmidi_SOURCE_DIR}
|
|
${libconfig_SOURCE_DIR}/lib
|
|
)
|
|
|
|
target_compile_definitions(sonobulus_core PRIVATE
|
|
BINARY_DIR="${CMAKE_BINARY_DIR}"
|
|
)
|
|
|
|
qt_add_executable(sonobulus
|
|
src/main.cpp
|
|
)
|
|
|
|
qt_add_qml_module(sonobulus
|
|
URI sonobulus
|
|
VERSION 1.0
|
|
QML_FILES ui/Main.qml
|
|
)
|
|
|
|
target_include_directories(sonobulus PRIVATE
|
|
${rtaudio_SOURCE_DIR}
|
|
${rtmidi_SOURCE_DIR}
|
|
${libconfig_SOURCE_DIR}/lib
|
|
)
|
|
|
|
target_link_libraries(sonobulus PRIVATE
|
|
sonobulus_core
|
|
Qt6::Core
|
|
Qt6::Quick
|
|
)
|
|
|
|
install(TARGETS sonobulus)
|
|
|
|
if (WIN32)
|
|
add_custom_command(
|
|
TARGET sonobulus POST_BUILD
|
|
COMMAND powershell -c "${Qt6_DIR}/../../../bin/windeployqt6.exe --qmldir . $<TARGET_FILE:sonobulus>"
|
|
COMMENT "windeployqt..."
|
|
VERBATIM
|
|
)
|
|
add_custom_command(
|
|
TARGET sonobulus POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
$<TARGET_FILE:rtaudio>
|
|
$<TARGET_FILE:rtmidi>
|
|
$<TARGET_FILE:libconfig++>
|
|
$<TARGET_FILE_DIR:sonobulus>
|
|
)
|
|
endif()
|
|
|
|
# add_subdirectory(src)
|
|
# add_subdirectory(ui)
|