-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
88 lines (63 loc) · 1.96 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
cmake_minimum_required (VERSION 2.8)
project (qrtone)
include (CheckIncludeFile)
include (CheckFunctionExists)
include (CheckLibraryExists)
if(MSVC)
set(LIBM "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
else(MSVC)
set(LIBM "m")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c99 -pedantic -Wall")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3 -O0 -march=native -fsanitize=address")
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie,")
else()
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Profiling")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -g3")
endif()
endif()
endif(MSVC)
include_directories (src)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_USE_MATH_DEFINES")
add_library(qrtone src/reed_solomon.c "src/qrtone.c")
target_link_libraries (qrtone ${LIBM})
#------------#
# TEST 1
#------------#
set(TEST_DATA_DIR "${PROJECT_BINARY_DIR}/TestAudio")
file(MAKE_DIRECTORY ${TEST_DATA_DIR})
# Test executable and folder
set(ECC_TESTS
test/c/Test_reed_solomon.c)
add_executable(Test_REED_SOLOMON ${ECC_TESTS})
target_link_libraries (Test_REED_SOLOMON
qrtone )
set_property(TARGET Test_REED_SOLOMON PROPERTY FOLDER "tests")
# Add to test suite
enable_testing()
add_test( NAME ecc_test1
WORKING_DIRECTORY ${TEST_DATA_DIR}
COMMAND Test_REED_SOLOMON )
#------------#
# TEST 2
#------------#
file(COPY jqrtone/src/test/resources/org/noise_planet/qrtone/ipfs_16khz_16bits_mono.raw
DESTINATION ${TEST_DATA_DIR})
# Test executable and folder
set(QRTONE_TESTS
test/c/test_qrtone.c)
add_executable(Test_QRTONE ${QRTONE_TESTS})
target_link_libraries (Test_QRTONE
qrtone )
set_property(TARGET Test_QRTONE PROPERTY FOLDER "tests")
# Add to test suite
add_test( NAME qrtone_test1
WORKING_DIRECTORY ${TEST_DATA_DIR}
COMMAND Test_QRTONE )
enable_testing()