-
Notifications
You must be signed in to change notification settings - Fork 23
/
CMakeLists.txt
125 lines (113 loc) · 3.36 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
cmake_minimum_required(VERSION 3.5)
project(KeyFinder VERSION 2.2.8)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
option(BUILD_SHARED_LIBS "Build dynamic library" ON)
add_library(keyfinder
src/audiodata.cpp
src/chromagram.cpp
src/chromatransform.cpp
src/chromatransformfactory.cpp
src/fftadapter.cpp
src/keyclassifier.cpp
src/keyfinder.cpp
src/lowpassfilter.cpp
src/lowpassfilterfactory.cpp
src/spectrumanalyser.cpp
src/temporalwindowfactory.cpp
src/toneprofiles.cpp
src/windowfunctions.cpp
src/workspace.cpp
src/constants.cpp
)
set_target_properties(keyfinder PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(FFTW3 REQUIRED)
target_link_libraries(keyfinder PUBLIC FFTW3::fftw3)
target_include_directories(keyfinder PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
set_target_properties(keyfinder PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
)
#
# Installation
#
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
# Library
install(TARGETS keyfinder
EXPORT KeyFinderTargets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
# Headers
install(FILES
src/audiodata.h
src/chromagram.h
src/chromatransform.h
src/chromatransformfactory.h
src/fftadapter.h
src/keyclassifier.h
src/keyfinder.h
src/lowpassfilter.h
src/lowpassfilterfactory.h
src/spectrumanalyser.h
src/temporalwindowfactory.h
src/toneprofiles.h
src/windowfunctions.h
src/workspace.h
src/constants.h
src/exception.h
src/binode.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/keyfinder")
# pkgconfig
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(PKGCONFIG_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
else()
set(PKGCONFIG_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()
if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(PKGCONFIG_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(PKGCONFIG_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packaging/libkeyfinder.pc.in
${CMAKE_CURRENT_BINARY_DIR}/packaging/libkeyfinder.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/packaging/libkeyfinder.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
# CMake config
set(KEYFINDER_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/KeyFinder")
install(
EXPORT KeyFinderTargets
FILE KeyFinderTargets.cmake
NAMESPACE KeyFinder::
DESTINATION "${KEYFINDER_INSTALL_CMAKEDIR}"
)
configure_package_config_file(packaging/KeyFinderConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/packaging/KeyFinderConfig.cmake"
INSTALL_DESTINATION "${KEYFINDER_INSTALL_CMAKEDIR}"
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/packaging/KeyFinderConfigVersion.cmake"
VERSION "${CMAKE_PROJECT_VERSION}"
COMPATIBILITY SameMajorVersion
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/packaging/KeyFinderConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/packaging/KeyFinderConfigVersion.cmake"
DESTINATION "${KEYFINDER_INSTALL_CMAKEDIR}"
)
install(FILES cmake/FindFFTW3.cmake DESTINATION "${KEYFINDER_INSTALL_CMAKEDIR}/modules")
#
# Tests
#
include(CTest)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()