aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 3e64f6b2394c5eccc7365895850c3d4801b805d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
cmake_minimum_required(VERSION 3.10.0)

project(QMidiPlayer VERSION 0.8.7 LANGUAGES C CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(OPTIONAL_QT_DEPS "")

option(BUILD_VISUALIZATION "Build visualization plugin" ON)
if(WIN32)
    set(OPTIONAL_QT_DEPS "WinExtras")
    option(BUILD_WINEXTRA "Build Windows extra library" ON)
    option(BUILD_BACKTRACE "Build backtrace library" OFF)
endif()
if(UNIX)
    option(BUILD_PORTABLE "Instruct the built binary not to search system directories" OFF)
endif()

option(USE_QT6 "Build with Qt 6" OFF)

include(FindPkgConfig)
if (USE_QT6)
    find_package(QT NAMES Qt6 REQUIRED)
    find_package(Qt6 REQUIRED COMPONENTS Widgets LinguistTools OPTIONAL_COMPONENTS DBus ${OPTIONAL_QT_DEPS})
else()
    find_package(QT NAMES Qt5 REQUIRED)
    find_package(Qt5 5.15 REQUIRED COMPONENTS Widgets LinguistTools OPTIONAL_COMPONENTS DBus ${OPTIONAL_QT_DEPS})
endif()
find_package(Threads REQUIRED)
find_package(ICU COMPONENTS uc i18n REQUIRED)
pkg_search_module(fluidsynth REQUIRED fluidsynth>=2.0.0)
pkg_search_module(rtmidi REQUIRED rtmidi)

add_definitions(-DAPP_VERSION=\"${PROJECT_VERSION}\")
add_definitions(-DPLUGIN_VERSION=\"${PROJECT_VERSION}\")
add_definitions(-DRC_VER_MAJOR=${PROJECT_VERSION_MAJOR})
add_definitions(-DRC_VER_MINOR=${PROJECT_VERSION_MINOR})
add_definitions(-DRC_VER_PATCH=${PROJECT_VERSION_PATCH})

add_subdirectory(core)
add_subdirectory(qmidiplayer-desktop)
add_subdirectory(sample-plugin)
if (Qt${QT_VERSION_MAJOR}DBus_FOUND)
    add_subdirectory(mpris-plugin)
endif()
add_subdirectory(midifmt-plugin)
add_subdirectory(simple-visualization)
if(BUILD_VISUALIZATION)
    add_subdirectory(visualization)
endif()
if(WIN32)
    if(BUILD_WINEXTRA AND Qt${QT_VERSION_MAJOR}WinExtras_FOUND)
        add_subdirectory(windows-extra)
    endif()
    if(BUILD_BACKTRACE)
        add_subdirectory(third_party/backtrace-mingw)
    endif()
endif()