forked from everdrone/libsnd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
executable file
·180 lines (153 loc) · 3.71 KB
/
Copy pathCMakeLists.txt
File metadata and controls
executable file
·180 lines (153 loc) · 3.71 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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
cmake_minimum_required( VERSION 3.2.2 )
project( libsnd VERSION 0.1.0 )
### Standard
set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF )
### Verbosity
set( CMAKE_COLOR_MAKEFILE ON )
set( CMAKE_VERBOSE_MAKEFILE OFF )
option( BUILD_TESTS "Build unit tests" ON )
### Targets
add_library(
libsnd
STATIC
source/approx.cpp
source/bilinear.cpp
source/conversion.cpp
source/denormal.cpp
source/envelope.cpp
source/interpolation.cpp
source/lfo.cpp
source/saturator.cpp
source/sawtooth.cpp
source/sine.cpp
source/utils.cpp
source/waveshaper.cpp
)
target_include_directories(
libsnd
PRIVATE
include
)
set_target_properties(
libsnd PROPERTIES
VERSION ${libsnd_VERSION}
PREFIX ""
DEBUG_POSTFIX "d"
)
### dist
set( ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${libsnd_VERSION} )
add_custom_target(dist
COMMAND tar -czf "${CMAKE_PROJECT_NAME}-${libsnd_VERSION}.tar.gz"
source/
include/
docs/
examples/
test/
.gitignore
CPPLINT.cfg
CMakeLists.txt
Doxyfile
libsnd-config.cmake.in
LICENSE
README.md
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
### Optimizations
if ( MSVC )
target_compile_options(
libsnd
PUBLIC
/W4
)
elseif( CMAKE_COMPILER_IS_GNUCXX )
target_compile_options(
libsnd
PUBLIC
-O2
-Wall
-Wextra
)
endif()
### Tests
if ( BUILD_TESTS )
configure_file(test/CMakeLists.txt googletest-download/CMakeLists.txt)
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download" )
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download" )
# Prevent GoogleTest from overriding our compiler/linker options
# when building with Visual Studio
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Add googletest directly to our build. This adds
# the following targets: gtest, gtest_main, gmock
# and gmock_main
add_subdirectory(
"${CMAKE_BINARY_DIR}/googletest-src"
"${CMAKE_BINARY_DIR}/googletest-build"
EXCLUDE_FROM_ALL
)
# The gtest/gmock targets carry header search path
# dependencies automatically when using CMake 2.8.11 or
# later. Otherwise we have to add them here ourselves.
if(CMAKE_VERSION VERSION_LESS 2.8.11)
include_directories(
"${gtest_SOURCE_DIR}/include"
"${gmock_SOURCE_DIR}/include"
include
EXCLUDE_FROM_ALL
)
endif()
add_executable(
test
test/main.cpp
test/approx.cpp
test/bilinear.cpp
test/conversion.cpp
test/denormal.cpp
test/interpolation.cpp
test/lfo.cpp
test/saturator.cpp
test/sine.cpp
test/utils.cpp
)
target_link_libraries(test
gtest
libsnd
)
# add_test(
# NAME test
# COMMAND test
# )
endif()
include( CMakePackageConfigHelpers )
include( GNUInstallDirs )
install(
TARGETS libsnd
EXPORT libsnd-targets
ARCHIVE DESTINATION lib
)
install(
FILES ${CMAKE_SOURCE_DIR}/include/snd.h
DESTINATION include
)
set(CONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/cmake/${CMAKE_PROJECT_NAME}")
write_basic_package_version_file(
"${CMAKE_BINARY_DIR}/libsnd-config-version.cmake"
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
"${CMAKE_SOURCE_DIR}/libsnd-config.cmake.in"
"${CMAKE_BINARY_DIR}/libsnd-config.cmake"
INSTALL_DESTINATION ${CONF_INSTALL_DIR}
PATH_VARS CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR
)
install(
EXPORT libsnd-targets
FILE libsnd-targets.cmake
DESTINATION ${CONF_INSTALL_DIR}
)
install(
FILES ${CMAKE_BINARY_DIR}/libsnd-config.cmake ${CMAKE_BINARY_DIR}/libsnd-config-version.cmake
DESTINATION ${CONF_INSTALL_DIR}
)