-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
165 lines (147 loc) · 5.44 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
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
############################################################################
# CMakeLists.txt
# Copyright (C) 2015 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
cmake_minimum_required(VERSION 3.0)
project(ILBCRFC3951 C)
option(ENABLE_STATIC "Build static library (default is shared library)." OFF)
find_program(AWK_PROGRAM awk)
if(NOT AWK_PROGRAM)
message(FATAL_ERROR "You need the awk program to build libilbcrfc3951.")
endif()
set(EXTRACTED_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/FrameClassify.c
${CMAKE_CURRENT_BINARY_DIR}/FrameClassify.h
${CMAKE_CURRENT_BINARY_DIR}/LPCdecode.c
${CMAKE_CURRENT_BINARY_DIR}/LPCdecode.h
${CMAKE_CURRENT_BINARY_DIR}/LPCencode.c
${CMAKE_CURRENT_BINARY_DIR}/LPCencode.h
${CMAKE_CURRENT_BINARY_DIR}/StateConstructW.c
${CMAKE_CURRENT_BINARY_DIR}/StateConstructW.h
${CMAKE_CURRENT_BINARY_DIR}/StateSearchW.c
${CMAKE_CURRENT_BINARY_DIR}/StateSearchW.h
${CMAKE_CURRENT_BINARY_DIR}/anaFilter.c
${CMAKE_CURRENT_BINARY_DIR}/anaFilter.h
${CMAKE_CURRENT_BINARY_DIR}/constants.c
${CMAKE_CURRENT_BINARY_DIR}/constants.h
${CMAKE_CURRENT_BINARY_DIR}/createCB.c
${CMAKE_CURRENT_BINARY_DIR}/createCB.h
${CMAKE_CURRENT_BINARY_DIR}/doCPLC.c
${CMAKE_CURRENT_BINARY_DIR}/doCPLC.h
${CMAKE_CURRENT_BINARY_DIR}/enhancer.c
${CMAKE_CURRENT_BINARY_DIR}/enhancer.h
${CMAKE_CURRENT_BINARY_DIR}/filter.c
${CMAKE_CURRENT_BINARY_DIR}/filter.h
${CMAKE_CURRENT_BINARY_DIR}/gainquant.c
${CMAKE_CURRENT_BINARY_DIR}/gainquant.h
${CMAKE_CURRENT_BINARY_DIR}/getCBvec.c
${CMAKE_CURRENT_BINARY_DIR}/getCBvec.h
${CMAKE_CURRENT_BINARY_DIR}/helpfun.c
${CMAKE_CURRENT_BINARY_DIR}/helpfun.h
${CMAKE_CURRENT_BINARY_DIR}/hpInput.c
${CMAKE_CURRENT_BINARY_DIR}/hpInput.h
${CMAKE_CURRENT_BINARY_DIR}/hpOutput.c
${CMAKE_CURRENT_BINARY_DIR}/hpOutput.h
${CMAKE_CURRENT_BINARY_DIR}/iCBConstruct.c
${CMAKE_CURRENT_BINARY_DIR}/iCBConstruct.h
${CMAKE_CURRENT_BINARY_DIR}/iCBSearch.c
${CMAKE_CURRENT_BINARY_DIR}/iCBSearch.h
${CMAKE_CURRENT_BINARY_DIR}/iLBC_decode.c
${CMAKE_CURRENT_BINARY_DIR}/iLBC_decode.h
${CMAKE_CURRENT_BINARY_DIR}/iLBC_define.h
${CMAKE_CURRENT_BINARY_DIR}/iLBC_encode.c
${CMAKE_CURRENT_BINARY_DIR}/iLBC_encode.h
${CMAKE_CURRENT_BINARY_DIR}/iLBC_test.c
${CMAKE_CURRENT_BINARY_DIR}/lsf.c
${CMAKE_CURRENT_BINARY_DIR}/lsf.h
${CMAKE_CURRENT_BINARY_DIR}/packing.c
${CMAKE_CURRENT_BINARY_DIR}/packing.h
${CMAKE_CURRENT_BINARY_DIR}/syntFilter.c
${CMAKE_CURRENT_BINARY_DIR}/syntFilter.h
)
set_source_files_properties(${EXTRACTED_SOURCES} PROPERTIES GENERATED TRUE)
set(SOURCE_FILES ${EXTRACTED_SOURCES})
if(MSVC)
list(APPEND SOURCE_FILES src/ilbcrfc3951.def)
endif()
add_custom_command(OUTPUT ${EXTRACTED_SOURCES}
COMMAND ${AWK_PROGRAM} -f ${CMAKE_CURRENT_SOURCE_DIR}/downloads/extract-cfile.awk ${CMAKE_CURRENT_SOURCE_DIR}/downloads/rfc3951.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
if(ENABLE_STATIC)
add_library(ilbcrfc3951 STATIC ${SOURCE_FILES})
if(UNIX AND NOT APPLE)
target_compile_options(ilbcrfc3951 PRIVATE "-fPIC")
endif()
else()
add_library(ilbcrfc3951 SHARED ${SOURCE_FILES})
set_target_properties(ilbcrfc3951 PROPERTIES VERSION 0)
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/ilbcrfc3951.pdb
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
endif()
endif()
install(TARGETS ilbcrfc3951 EXPORT IlbcRfc3951Targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
set(HEADER_FILES
${CMAKE_CURRENT_BINARY_DIR}/iLBC_decode.h
${CMAKE_CURRENT_BINARY_DIR}/iLBC_define.h
${CMAKE_CURRENT_BINARY_DIR}/iLBC_encode.h
)
install(FILES ${HEADER_FILES}
DESTINATION include/ilbc
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/IlbcRfc3951ConfigVersion.cmake"
VERSION 0.7
COMPATIBILITY AnyNewerVersion
)
export(EXPORT IlbcRfc3951Targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/IlbcRfc3951Targets.cmake"
NAMESPACE BelledonneCommunications::
)
configure_file(IlbcRfc3951Config.cmake
"${CMAKE_CURRENT_BINARY_DIR}/IlbcRfc3951Config.cmake"
COPYONLY
)
set(ConfigPackageLocation lib/cmake/IlbcRfc3951)
install(EXPORT IlbcRfc3951Targets
FILE IlbcRfc3951Targets.cmake
NAMESPACE BelledonneCommunications::
DESTINATION ${ConfigPackageLocation}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/IlbcRfc3951Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/IlbcRfc3951ConfigVersion.cmake"
DESTINATION ${ConfigPackageLocation}
)