aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 5b607167886aeda9d26b05fe4fb89f53b926e4bf (plain)
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
########################################################################
# Project setup
########################################################################

cmake_minimum_required(VERSION 2.8)
project(edilib CXX C)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Debug")
    message(STATUS "Build type not specified: defaulting to debug.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)

# Set the version information here
set(VERSION_INFO_MAJOR_VERSION 0)
set(VERSION_INFO_API_COMPAT    0)
set(VERSION_INFO_MINOR_VERSION 0)
set(VERSION_INFO_MAINT_VERSION git)


########################################################################
# Compiler specific setup
########################################################################

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -W -Wall -std=c++11")


########################################################################
# Find build dependencies
########################################################################

########################################################################
# Setup apps
########################################################################

include_directories("./decoder")
include_directories(".")

list(APPEND edilib_cpp_sources
    ReedSolomon.cpp
    Log.cpp
    decoder/ETIDecoder.cpp
    decoder/ETIWriter.cpp
    decoder/PFT.cpp
    decoder/eti.cpp
    decoder/common.cpp
    test/main.cpp
    test/TimestampDecoder.cpp
    test/InetAddress.cpp
    test/UdpSocket.cpp
)

list(APPEND edilib_c_sources
    crc.c
    fec/decode_rs_char.c
    fec/encode_rs_char.c
    fec/init_rs_char.c
)

set_source_files_properties(${edilib_cpp_sources} PROPERTIES LANGUAGE "CXX")
set_source_files_properties(${edilib_c_sources} PROPERTIES LANGUAGE "C")
add_executable(edilib ${edilib_cpp_sources} ${edilib_c_sources})
target_link_libraries(edilib ${FAAD_LIBRARIES} Threads::Threads)

install(TARGETS edilib DESTINATION bin)


########################################################################
# Create uninstall target
########################################################################

configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
    IMMEDIATE @ONLY)

add_custom_target(uninstall
    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)