131 lines
3.7 KiB
CMake
131 lines
3.7 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
|
|
project(warppipe VERSION 0.1.0 LANGUAGES CXX)
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
set(WARPPIPE_HOMEBREW_PREFIX "/home/linuxbrew/.linuxbrew")
|
|
if(EXISTS "${WARPPIPE_HOMEBREW_PREFIX}/bin/brew")
|
|
list(PREPEND CMAKE_PREFIX_PATH "${WARPPIPE_HOMEBREW_PREFIX}")
|
|
set(ENV{PKG_CONFIG_PATH}
|
|
"${WARPPIPE_HOMEBREW_PREFIX}/lib/pkgconfig:${WARPPIPE_HOMEBREW_PREFIX}/share/pkgconfig:$ENV{PKG_CONFIG_PATH}")
|
|
endif()
|
|
|
|
option(WARPPIPE_BUILD_EXAMPLES "Build warppipe examples" ON)
|
|
option(WARPPIPE_BUILD_TESTS "Build warppipe tests" ON)
|
|
option(WARPPIPE_BUILD_PERF "Build warppipe perf tools" ON)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(PIPEWIRE REQUIRED IMPORTED_TARGET libpipewire-0.3)
|
|
|
|
include(FetchContent)
|
|
find_package(nlohmann_json 3.11.0 QUIET)
|
|
if(NOT nlohmann_json_FOUND)
|
|
FetchContent_Declare(json
|
|
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)
|
|
FetchContent_MakeAvailable(json)
|
|
endif()
|
|
|
|
add_library(warppipe STATIC
|
|
src/warppipe.cpp
|
|
)
|
|
|
|
target_include_directories(warppipe
|
|
PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>
|
|
)
|
|
|
|
target_compile_features(warppipe PUBLIC cxx_std_20)
|
|
target_link_libraries(warppipe PUBLIC PkgConfig::PIPEWIRE PRIVATE nlohmann_json::nlohmann_json)
|
|
|
|
if(WARPPIPE_BUILD_EXAMPLES)
|
|
add_executable(warppipe_example examples/minimal.cpp)
|
|
target_link_libraries(warppipe_example PRIVATE warppipe)
|
|
|
|
add_executable(warppipe_cli examples/warppipe_cli.cpp)
|
|
target_link_libraries(warppipe_cli PRIVATE warppipe)
|
|
endif()
|
|
|
|
if(WARPPIPE_BUILD_PERF)
|
|
add_executable(warppipe_perf perf/warppipe_perf.cpp)
|
|
target_link_libraries(warppipe_perf PRIVATE warppipe)
|
|
endif()
|
|
|
|
if(WARPPIPE_BUILD_TESTS)
|
|
enable_testing()
|
|
find_package(Catch2 3 REQUIRED)
|
|
add_executable(warppipe_tests tests/warppipe_tests.cpp)
|
|
target_link_libraries(warppipe_tests PRIVATE warppipe Catch2::Catch2WithMain)
|
|
target_compile_definitions(warppipe PRIVATE WARPPIPE_TESTING)
|
|
target_compile_definitions(warppipe_tests PRIVATE WARPPIPE_TESTING)
|
|
add_test(NAME warppipe_tests COMMAND warppipe_tests)
|
|
endif()
|
|
|
|
option(WARPPIPE_BUILD_GUI "Build warppipe Qt6 GUI application" ON)
|
|
|
|
if(WARPPIPE_BUILD_GUI)
|
|
set(CMAKE_AUTOMOC ON)
|
|
set(CMAKE_AUTORCC ON)
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
find_package(Qt6 6.2 REQUIRED COMPONENTS Core Widgets)
|
|
|
|
FetchContent_Declare(
|
|
QtNodes
|
|
GIT_REPOSITORY https://github.com/paceholder/nodeeditor
|
|
GIT_TAG master
|
|
)
|
|
FetchContent_MakeAvailable(QtNodes)
|
|
|
|
add_executable(warppipe-gui
|
|
gui/main.cpp
|
|
gui/WarpGraphModel.cpp
|
|
gui/GraphEditorWidget.cpp
|
|
gui/PresetManager.cpp
|
|
gui/VolumeWidgets.cpp
|
|
gui/AudioLevelMeter.cpp
|
|
)
|
|
|
|
target_link_libraries(warppipe-gui PRIVATE
|
|
warppipe
|
|
Qt6::Core
|
|
Qt6::Widgets
|
|
QtNodes
|
|
)
|
|
|
|
if(WARPPIPE_BUILD_TESTS)
|
|
add_executable(warppipe-gui-tests
|
|
tests/gui/warppipe_gui_tests.cpp
|
|
gui/WarpGraphModel.cpp
|
|
gui/GraphEditorWidget.cpp
|
|
gui/PresetManager.cpp
|
|
gui/VolumeWidgets.cpp
|
|
gui/AudioLevelMeter.cpp
|
|
)
|
|
|
|
target_compile_definitions(warppipe-gui-tests PRIVATE WARPPIPE_TESTING)
|
|
|
|
target_link_libraries(warppipe-gui-tests PRIVATE
|
|
warppipe
|
|
Qt6::Core
|
|
Qt6::Widgets
|
|
QtNodes
|
|
Catch2::Catch2WithMain
|
|
)
|
|
|
|
add_test(NAME warppipe_gui_tests COMMAND warppipe-gui-tests)
|
|
|
|
option(WARPPIPE_GUI_VISUAL_TESTS "Enable screenshot-based visual tests" OFF)
|
|
if(WARPPIPE_GUI_VISUAL_TESTS)
|
|
add_test(NAME gui_screenshot_smoke
|
|
COMMAND ${CMAKE_COMMAND} -E env QT_QPA_PLATFORM=offscreen
|
|
$<TARGET_FILE:warppipe-gui> --screenshot ${CMAKE_BINARY_DIR}/test_screenshot.png
|
|
)
|
|
set_tests_properties(gui_screenshot_smoke PROPERTIES
|
|
LABELS "visual"
|
|
TIMEOUT 10
|
|
)
|
|
endif()
|
|
endif()
|
|
endif()
|