forked from celtera/libremidi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibremidi.deps.cmake
More file actions
74 lines (60 loc) · 2.43 KB
/
libremidi.deps.cmake
File metadata and controls
74 lines (60 loc) · 2.43 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
### C++ features ###
check_cxx_source_compiles("#include <thread>\nint main() { std::jthread t; }" LIBREMIDI_HAS_STD_JTHREAD)
check_cxx_source_compiles("#include <flat_set>\nint main() { std::flat_set<int> t; }" LIBREMIDI_HAS_STD_FLAT_SET)
check_cxx_source_compiles("#include <print>\nint main() { std::println(\"foo: {}\", 123); }" LIBREMIDI_HAS_STD_PRINTLN)
check_cxx_source_compiles("#include <semaphore>\nint main() { std::binary_semaphore t{0}; }" LIBREMIDI_HAS_STD_SEMAPHORE)
check_cxx_source_compiles("#include <stop_token>\n#include <thread>\nint main() { std::jthread t; }" LIBREMIDI_HAS_STD_STOP_TOKEN)
if(NOT WIN32)
check_include_file_cxx("sys/eventfd.h" LIBREMIDI_HAS_EVENTFD)
check_include_file_cxx("sys/timerfd.h" LIBREMIDI_HAS_TIMERFD)
endif()
check_cxx_compiler_flag(-Werror=return-type LIBREMIDI_CXX_HAS_WERROR_RETURN_TYPE)
check_cxx_compiler_flag(-Wno-gnu-statement-expression-from-macro-expansion LIBREMIDI_CXX_HAS_WNO_GNU_STATEMENT)
check_cxx_compiler_flag(-Wno-c99-extensions LIBREMIDI_CXX_HAS_WNO_C99_EXTENSIONS)
### Dependencies ###
find_package(Threads)
# ni-midi2
if(LIBREMIDI_NI_MIDI2 AND NOT TARGET ni::midi2)
FetchContent_Declare(
ni-midi2
GIT_REPOSITORY https://github.com/midi2-dev/ni-midi2
GIT_TAG main
)
FetchContent_MakeAvailable(ni-midi2)
endif()
# boost
if(LIBREMIDI_NO_BOOST AND LIBREMIDI_FIND_BOOST)
message(FATAL_ERROR "LIBREMIDI_NO_BOOST and LIBREMIDI_FIND_BOOST are incompatible")
endif()
if(LIBREMIDI_FIND_BOOST)
find_package(Boost OPTIONAL_COMPONENTS cobalt)
if(NOT Boost_FOUND)
set(BOOST_ENABLE_CMAKE ON)
set(BOOST_INCLUDE_LIBRARIES container asio variant2 cobalt)
FetchContent_Declare(
Boost
GIT_REPOSITORY https://github.com/boostorg/boost.git
GIT_TAG boost-1.89.0
GIT_PROGRESS ON
GIT_SHALLOW TRUE
OVERRIDE_FIND_PACKAGE TRUE
)
FetchContent_MakeAvailable(Boost)
find_package(Boost REQUIRED OPTIONAL_COMPONENTS cobalt)
endif()
endif()
# readerwriterqueue
if(UNIX AND NOT APPLE AND NOT LIBREMIDI_NO_PIPEWIRE)
set(LIBREMIDI_NEEDS_READERWRITERQUEUE 1)
endif()
if(LIBREMIDI_NEEDS_READERWRITERQUEUE AND NOT TARGET readerwriterqueue)
find_package(readerwriterqueue)
if(NOT readerwriterqueue_FOUND)
FetchContent_Declare(
rwq
GIT_REPOSITORY https://github.com/cameron314/readerwriterqueue
GIT_TAG master
)
FetchContent_MakeAvailable(rwq)
endif()
endif()