-
Notifications
You must be signed in to change notification settings - Fork 73
/
CMakeLists.txt
163 lines (140 loc) · 6.03 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
cmake_minimum_required(VERSION 3.5)
project(libmysofa C CXX)
include(CheckCCompilerFlag)
include(GenerateExportHeader)
include(GNUInstallDirs)
option(BUILD_TESTS "Build test programs" ON)
option(BUILD_SHARED_LIBS "Build shared library" ON)
option(BUILD_STATIC_LIBS "Build static library" ON)
option(CODE_COVERAGE "Enable coverage reporting" OFF)
option(ADDRESS_SANITIZE "Enable address sanitizer" OFF)
set(CPACK_PACKAGE_DESCRIPTION "SOFA file reader for better HRTFs")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"This library reads AES SOFA files and normalizes them")
set(CPACK_PACKAGE_VENDOR "Symonics GmbH")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "IOhannes m zmölnig")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "3")
set(CPACK_PACKAGE_VERSION_PATCH "3")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g")
set(PKG_CONFIG_PRIVATELIBS "")
set(PROJECT_VERSION
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
check_c_compiler_flag(-Wall C_HAS_WALL)
if(C_HAS_WALL)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
endif(C_HAS_WALL)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -DVDEBUG")
if(${ADDRESS_SANITIZE} STREQUAL "ON")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -O1 -fno-omit-frame-pointer -g")
endif()
install(FILES share/default.sofa DESTINATION ${CMAKE_INSTALL_DATADIR}/libmysofa)
install(FILES share/MIT_KEMAR_normal_pinna.sofa
DESTINATION ${CMAKE_INSTALL_DATADIR}/libmysofa)
if(BUILD_TESTS)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(FindCUnit)
include_directories(${CUNIT_INCLUDE_DIRS})
find_package(CUnit REQUIRED cunit)
enable_testing()
add_test(Mesh2HRTF src/mysofa2json -c -o tmp.json
${PROJECT_SOURCE_DIR}/tests/Mesh2HRTF.sofa)
add_test(latTestAziBeRTA_Resamp1_Fran src/mysofa2json -c -o tmp.json
${PROJECT_SOURCE_DIR}/tests/latTestAziBeRTA_Resamp1_Fran.sofa)
add_test(D1_48K_24bit_0.3s_FIR_SOFA src/mysofa2json -o tmp.json
${PROJECT_SOURCE_DIR}/tests/D1_48K_24bit_0.3s_FIR_SOFA.sofa)
add_test(H20_44K_16bit_256tap_FIR_SOFA ${PROJECT_SOURCE_DIR}/tests/compareIgnoreNew.sh
${PROJECT_SOURCE_DIR}/tests/H20_44K_16bit_256tap_FIR_SOFA)
add_test(MIT_KEMAR_large_pinna ${PROJECT_SOURCE_DIR}/tests/compare.sh
${PROJECT_SOURCE_DIR}/tests/MIT_KEMAR_large_pinna)
add_test(MIT_KEMAR_normal_pinna ${PROJECT_SOURCE_DIR}/tests/compareIgnoreNew.sh
${PROJECT_SOURCE_DIR}/tests/MIT_KEMAR_normal_pinna)
add_test(MIT_KEMAR_normal_pinna.old ${PROJECT_SOURCE_DIR}/tests/compare.sh
${PROJECT_SOURCE_DIR}/tests/MIT_KEMAR_normal_pinna.old)
add_test(dtf_nh2 ${PROJECT_SOURCE_DIR}/tests/compareIgnoreNew.sh
${PROJECT_SOURCE_DIR}/tests/dtf_nh2)
add_test(hrtf_c_nh898 ${PROJECT_SOURCE_DIR}/tests/compareIgnoreNew.sh
${PROJECT_SOURCE_DIR}/tests/hrtf_c_nh898)
foreach(
ISSUE
72
75
76
77
79
82
83
84
130
132
135
136
137
138
156
163
167a
167b
168
171
173
)
# issues with osx 96)
add_test(fail-issue-${ISSUE} ${PROJECT_SOURCE_DIR}/tests/notcrashed.sh
${PROJECT_SOURCE_DIR}/tests/fail-issue-${ISSUE})
endforeach(ISSUE)
add_test(CIPIC_subject_003_hrir_final ${PROJECT_SOURCE_DIR}/tests/compare.sh
${PROJECT_SOURCE_DIR}/tests/CIPIC_subject_003_hrir_final)
add_test(FHK_HRIR_L2354 ${PROJECT_SOURCE_DIR}/tests/compare.sh ${PROJECT_SOURCE_DIR}/tests/FHK_HRIR_L2354)
add_test(LISTEN_1002_IRC_1002_C_HRIR ${PROJECT_SOURCE_DIR}/tests/compare.sh
${PROJECT_SOURCE_DIR}/tests/LISTEN_1002_IRC_1002_C_HRIR)
add_test(Pulse ${PROJECT_SOURCE_DIR}/tests/compare.sh ${PROJECT_SOURCE_DIR}/tests/Pulse)
add_test(Tester ${PROJECT_SOURCE_DIR}/tests/compare.sh ${PROJECT_SOURCE_DIR}/tests/tester)
add_test(TU-Berlin_QU_KEMAR_anechoic_radius_0.5_1_2_3_m ${PROJECT_SOURCE_DIR}/tests/compare.sh
${PROJECT_SOURCE_DIR}/tests/TU-Berlin_QU_KEMAR_anechoic_radius_0.5_1_2_3_m)
add_test(TU-Berlin_QU_KEMAR_anechoic_radius_0.5m ${PROJECT_SOURCE_DIR}/tests/compare.sh
${PROJECT_SOURCE_DIR}/tests/TU-Berlin_QU_KEMAR_anechoic_radius_0.5m)
add_test(example_dummy_sofa48 ${PROJECT_SOURCE_DIR}/tests/compare.sh
${PROJECT_SOURCE_DIR}/tests/example_dummy_sofa48)
add_test(TestSOFA48_netcdf472 ${PROJECT_SOURCE_DIR}/tests/compare.sh
${PROJECT_SOURCE_DIR}/tests/TestSOFA48_netcdf472)
add_test(example_dummy_sofa48_with_user_defined_variable ${PROJECT_SOURCE_DIR}/tests/compare.sh
${PROJECT_SOURCE_DIR}/tests/example_dummy_sofa48_with_user_defined_variable)
endif(BUILD_TESTS)
add_subdirectory(src)
include(CPack)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libmysofa.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
# Install exported targets as config files for use from install tree
install(EXPORT mysofa_exports
NAMESPACE mysofa::
FILE mysofaTargets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mysofa
)
# Create a target export file for use from the build tree.
export(EXPORT mysofa_exports
NAMESPACE mysofa::
FILE ${CMAKE_CURRENT_BINARY_DIR}/mysofaTargets.cmake
)
include(CMakePackageConfigHelpers)
# Configure package config file
configure_package_config_file(mysofaConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/mysofaConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mysofa
)
# Create package version file
# Assuming major version bump = breaking API changes
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/mysofaConfigVersion.cmake
VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
COMPATIBILITY SameMajorVersion)
# Install package config file for use from install tree
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/mysofaConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/mysofaConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mysofa
)