aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 7c8998996179884d07a647da5bbaea4475a52161 (plain) (blame)
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
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=address -fno-omit-frame-pointer")

project(gha)

set(SOURCE_FFT_LIB
    src/3rd/kissfft/kiss_fft.c
    src/3rd/kissfft/tools/kiss_fftr.c
)

set_source_files_properties(
    src/3rd/kissfft/kiss_fft.c
    src/3rd/kissfft/tools/kiss_fftr.c
    PROPERTIES COMPILE_FLAGS -Dkiss_fft_scalar=float
)

add_library(fft_impl STATIC ${SOURCE_FFT_LIB})
target_include_directories(
    fft_impl
    PRIVATE
    src/3rd/kissfft
)

add_library(gha src/gha.c)
target_include_directories(
    gha
    PRIVATE
    src/3rd
    src/3rd/kissfft
    .
)
target_link_libraries(gha fft_impl)

add_definitions("-Wall -O2 -g")

add_executable(main test/main.c)
target_include_directories(
    main
    PRIVATE
    .
)
target_link_libraries(main gha m)

enable_testing()
add_test(gha_test_simple_1000_0_a main ../test/data/1000hz_0.85.pcm 0 1024 0.14247585 0.0000 0.850000)
add_test(gha_test_simple_1000_0_b main ../test/data/1000hz_0.85.pcm 0 1000 0.14247585 0.0000 0.850000)
add_test(gha_test_simple_1000_0_c main ../test/data/1000hz_0.85.pcm 0 800 0.14247585 0.0000 0.850000)
add_test(gha_test_simple_1000_90_a main ../test/data/1000hz_0.85.pcm 11 1024 0.14247585 1.5658 0.850000)
add_test(gha_test_simple_1000_90_b main ../test/data/1000hz_0.85.pcm 11 1000 0.14247585 1.5658 0.850000)
add_test(gha_test_simple_1000_90_c main ../test/data/1000hz_0.85.pcm 11 800 0.14247585 1.5658 0.850000)



add_test(gha_test_simple_20000_0_a main ../test/data/20000hz_0.85.pcm 0 1024 2.8495171 0.0000 0.850000)
add_test(gha_test_simple_20000_0_b main ../test/data/20000hz_0.85.pcm 0 500 2.8495171 0.0000 0.850000)
add_test(gha_test_simple_20000_0_c main ../test/data/20000hz_0.85.pcm 0 128 2.8495171 0.0000 0.850000)
add_test(gha_test_simple_20000_0_d main ../test/data/20000hz_0.85.pcm 0 64 2.8495171 0.0000 0.850000)