-
Notifications
You must be signed in to change notification settings - Fork 38
/
CMakeLists.txt
35 lines (29 loc) · 1.2 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.14)
project(QMidi)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
# Common QMidi source files & library
aux_source_directory("${PROJECT_SOURCE_DIR}/src" SOURCES)
set(LIBRARIES Qt${QT_VERSION_MAJOR}::Core)
# Platform specific QMidi source files & libraries
if(WIN32)
set(LIBRARIES ${LIBRARIES} winmm)
set(SOURCES ${SOURCES} "${PROJECT_SOURCE_DIR}/src/OS/QMidi_Win32.cpp")
elseif(APPLE)
set(LIBRARIES ${LIBRARIES} "-framework CoreMIDI" "-framework CoreFoundation" "-framework CoreAudio")
set(SOURCES ${SOURCES} "${PROJECT_SOURCE_DIR}/src/OS/QMidi_CoreMidi.cpp")
elseif(UNIX)
set(LIBRARIES ${LIBRARIES} asound)
set(SOURCES ${SOURCES} "${PROJECT_SOURCE_DIR}/src/OS/QMidi_ALSA.cpp")
elseif(HAIKU)
set(LIBRARIES ${LIBRARIES} midi2)
set(SOURCES ${SOURCES} "${PROJECT_SOURCE_DIR}/src/OS/QMidi_Haiku.cpp")
endif()
# Add library
add_library(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/src")
target_link_libraries(${PROJECT_NAME} ${LIBRARIES})