-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
108 lines (89 loc) · 3.55 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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
cmake_minimum_required(VERSION 3.3)
project(midimessage)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include_directories(
include
PRIVATE deps/c-utils/lib)
set(HEADER_FILES
include/midimessage/midimessage.h
include/midimessage/packers.h
include/midimessage/manufacturerids.h
include/midimessage/dlsproprietarychunkids.h
include/midimessage/commonccs.h
include/midimessage/notes.h
include/midimessage/stringifier.h
include/midimessage/parser.h
include/midimessage/simpleparser.h)
set(SOURCE_FILES
src/midimessage.cpp
src/stringifier.cpp
src/parser.cpp
src/simpleparser.cpp
deps/c-utils/lib/util-hex.c)
add_library(midimsg STATIC ${HEADER_FILES} ${SOURCE_FILES})
add_executable(midimessage src/cli.cpp )
target_link_libraries(midimessage midimsg)
#target_include_directories(midimessage-cli PRIVATE deps/c-utils/lib)
message("Install path: ${CMAKE_INSTALL_PREFIX}")
install(TARGETS midimsg midimessage
LIBRARY
DESTINATION lib
COMPONENT Libraries
NAMELINK_COMPONENT Development
ARCHIVE
DESTINATION lib
# PUBLIC_HEADER
# DESTINATION include
# COMPONENT Development
RUNTIME
DESTINATION bin
COMPONENT Runtime
)
install(FILES
include/midimessage.h
# PUBLIC_HEADER
DESTINATION include
COMPONENT Development
)
install(FILES
include/midimessage/packers.h
include/midimessage/manufacturerids.h
include/midimessage/dlsproprietarychunkids.h
include/midimessage/commonccs.h
include/midimessage/notes.h
include/midimessage/stringifier.h
include/midimessage/parser.h
# PUBLIC_HEADER
DESTINATION include/midimessage
COMPONENT Development
)
message("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n")
message("NOTE to create an up-to-date 'include/manufacturerids.h' you can 'make manufacturerids' (requires wget and php)")
message("\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n")
add_custom_target(manufacturerids
COMMAND wget https://www.midi.org/specifications-old/item/manufacturer-id-numbers
COMMAND php ${CMAKE_CURRENT_SOURCE_DIR}/tools/createManufacturerIdsHeader.php manufacturer-id-numbers ${CMAKE_CURRENT_SOURCE_DIR}/include/midimessage/manufacturerids.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/midimessage/manufacturerids.h
COMMAND rm manufacturer-id-numbers)
add_custom_target(docs
COMMAND doxygen)
# EXAMPLES
add_executable(simple EXCLUDE_FROM_ALL examples/simple.cpp)
target_link_libraries(simple midimsg)
set_target_properties(simple
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples/bin"
)
add_executable(nrpn-simpleparser EXCLUDE_FROM_ALL examples/nrpn-simpleparser.cpp)
target_link_libraries(nrpn-simpleparser midimsg)
set_target_properties(nrpn-simpleparser
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples/bin"
)
# Group examples into target <examples>
if(NOT TARGET examples)
add_custom_target(examples)
add_dependencies(examples simple nrpn-simpleparser)
endif()