-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (72 loc) · 2.25 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
cmake_minimum_required(VERSION 3.10)
project(flacplayer CXX)
enable_testing()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS Off)
set(DEFAULT_COPTS "-fno-omit-frame-pointer" "-g")# "-Wall" "-Wextra")
set(DEFAULT_LINKOPTS "")
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
list(APPEND DEFAULT_COPTS
$<$<CONFIG:Debug>:-fsanitize=address,undefined,leak>
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<CONFIG:Debug>>:-fprofile-instr-generate>
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<CONFIG:Debug>>:-fcoverage-mapping>
$<$<CXX_COMPILER_ID:GNU>:-ftree-vectorize>
$<$<CXX_COMPILER_ID:GNU>:-fopt-info-vec-optimized>
-march=nehalem
)
list(APPEND DEFAULT_LINKOPTS
$<$<CONFIG:Debug>:-fsanitize=address,undefined,leak>
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<CONFIG:Debug>>:-fprofile-instr-generate>
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<CONFIG:Debug>>:-fcoverage-mapping>
)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm.*|aarch64")
else()
message(WARNING "Value of CMAKE_SYSTEM_PROCESSOR (${CMAKE_SYSTEM_PROCESSOR}) is unknown")
endif()
add_compile_options(
${DEFAULT_COPTS}
)
link_libraries(
${DEFAULT_LINKOPTS}
)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "")
add_subdirectory(../benchmark _build/benchmark)
add_subdirectory(../googletest _build/googletest)
add_subdirectory(../fmt _build/fmt)
add_library(plac
as_const.h
audio_buffer.h
audio_format.h
bit_cast.h
conditions.h
file_desc.h
flow_control.h
stream.cpp
stream.h
)
target_link_libraries(plac PUBLIC FLAC Threads::Threads fmt)
add_executable(flacplayer
alsa_audio_device.cpp
alsa_audio_device.h
linux_player.cpp
)
target_link_libraries(flacplayer PRIVATE asound plac)
add_executable(unit_tests
audio_buffer_unit_test.cpp
audio_format_unit_test.cpp
file_desc_unit_test.cpp
stream_unit_test.cpp
)
target_link_libraries(unit_tests PRIVATE plac gtest_main)
add_test(unit_tests unit_tests)
add_executable(flac_decode
flac_decode_unit_test.cpp
)
target_link_libraries(flac_decode PRIVATE plac gtest_main)
add_executable(benchmarks
audio_buffer_benchmark.cpp
)
target_link_libraries(benchmarks PRIVATE plac benchmark::benchmark)