Commit f33f46ed authored by Manolis Surligas's avatar Manolis Surligas

Add libfec as external project

The CMake build system will first try to locate libfec in the system. if
it is not available, it will start building the libfec that is part of
the gr-satnogs source code. During the installation libfec is installed
in the system, thus future builds will make use of it and will not
rebuild from source.
parent 02801c9a
......@@ -131,7 +131,6 @@ find_package(Volk REQUIRED)
find_package(OggVorbis REQUIRED)
find_package(PNG REQUIRED)
find_package(png++ REQUIRED)
find_package(Fec REQUIRED)
########################################################################
# Include or not into the module blocks for debugging
......@@ -150,6 +149,45 @@ if(${INCLUDE_DEBUG_BLOCKS})
endif()
endif()
########################################################################
# Search for the libfec if it is already installed in the system
# If not, install the internal one.
########################################################################
find_package(Fec)
if(NOT FEC_FOUND)
message(WARNING "libfec is not installed. The internal libfec will be automatically build and install.")
include(ExternalProject)
ExternalProject_Add(FEC_EXTERNAL
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libfec
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libfec
CMAKE_ARGS "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}"
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(FEC_EXTERNAL binary_dir)
add_library(fec SHARED IMPORTED)
set_property(TARGET fec PROPERTY IMPORTED_LOCATION ${install_dir}/libfec.so)
add_dependencies(fec FEC_EXTERNAL)
set(FEC_LIBRARIES "${binary_dir}/libfec.so")
set(FEC_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/libfec")
# Install the header and the library in the standard places
install(FILES
"${FEC_INCLUDE_DIRS}/fec.h"
DESTINATION "include"
)
install(FILES
${FEC_LIBRARIES}
DESTINATION lib${LIB_SUFFIX}
)
else()
add_library(fec INTERFACE)
endif()
# Search for GNU Radio and its components and versions. Add any
# components required to the list of GR_REQUIRED_COMPONENTS (in all
# caps such as FILTER or FFT) and change the version to the minimum
......
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Debug Afsk Transceiver Osmocom
# Generated: Mon Jun 13 20:30:12 2016
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print "Warning: failed to XInitThreads()"
from PyQt4 import Qt
from gnuradio import analog
from gnuradio import audio
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import filter
from gnuradio import gr
from gnuradio import qtgui
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from gnuradio.qtgui import Range, RangeWidget
from optparse import OptionParser
import math
import numpy
import satnogs
import sip
import sys
class debug_afsk_transceiver_osmocom(gr.top_block, Qt.QWidget):
def __init__(self):
gr.top_block.__init__(self, "Debug Afsk Transceiver Osmocom")
Qt.QWidget.__init__(self)
self.setWindowTitle("Debug Afsk Transceiver Osmocom")
try:
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
except:
pass
self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)
self.settings = Qt.QSettings("GNU Radio", "debug_afsk_transceiver_osmocom")
self.restoreGeometry(self.settings.value("geometry").toByteArray())
##################################################
# Variables
##################################################
self.samples_per_symbol_tx = samples_per_symbol_tx = 4
self.sq_wave = sq_wave = (1.0, ) * samples_per_symbol_tx
self.gaussian_taps = gaussian_taps = filter.firdes.gaussian(1.0, samples_per_symbol_tx, 1.0, 4*samples_per_symbol_tx)
self.deviation = deviation = 800
self.baud_rate = baud_rate = 1200
self.tx_frequency = tx_frequency = 145.835e6
self.samp_rate_tx = samp_rate_tx = 48e3
self.modulation_index = modulation_index = deviation / (baud_rate / 2.0)
self.interp_taps = interp_taps = numpy.convolve(numpy.array(gaussian_taps), numpy.array(sq_wave))
self.atten = atten = 0.1
##################################################
# Blocks
##################################################
self._atten_range = Range(0, 0.9, 0.01, 0.1, 200)
self._atten_win = RangeWidget(self._atten_range, self.set_atten, "Attenuation", "counter_slider", float)
self.top_layout.addWidget(self._atten_win)
self.satnogs_upsat_fsk_frame_encoder_0 = satnogs.upsat_fsk_frame_encoder([0x33]*8, [0x7A, 0x0E], False, False, False, True, True, "ABCD", 0, "UPSAT", 0, 1024)
self.satnogs_udp_msg_source_0 = satnogs.udp_msg_source("127.0.0.1", 16886, 1500)
self.satnogs_debug_msg_source_0 = satnogs.debug_msg_source("HELLO"*4, 1, True)
self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
interpolation=10,
decimation=1,
taps=None,
fractional_bw=None,
)
self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_c(
1024, #size
samp_rate_tx, #samp_rate
"", #name
1 #number of inputs
)
self.qtgui_time_sink_x_0_0_0.set_update_time(0.10)
self.qtgui_time_sink_x_0_0_0.set_y_axis(-1, 1)
self.qtgui_time_sink_x_0_0_0.set_y_label("Amplitude", "")
self.qtgui_time_sink_x_0_0_0.enable_tags(-1, True)
self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
self.qtgui_time_sink_x_0_0_0.enable_autoscale(False)
self.qtgui_time_sink_x_0_0_0.enable_grid(False)
self.qtgui_time_sink_x_0_0_0.enable_control_panel(True)
if not True:
self.qtgui_time_sink_x_0_0_0.disable_legend()
labels = ["", "", "", "", "",
"", "", "", "", ""]
widths = [1, 1, 1, 1, 1,
1, 1, 1, 1, 1]
colors = ["blue", "red", "green", "black", "cyan",
"magenta", "yellow", "dark red", "dark green", "blue"]
styles = [1, 1, 1, 1, 1,
1, 1, 1, 1, 1]
markers = [2, -1, -1, -1, -1,
-1, -1, -1, -1, -1]
alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0]
for i in xrange(2*1):
if len(labels[i]) == 0:
if(i % 2 == 0):
self.qtgui_time_sink_x_0_0_0.set_line_label(i, "Re{{Data {0}}}".format(i/2))
else:
self.qtgui_time_sink_x_0_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2))
else:
self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i])
self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i])
self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i])
self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i])
self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i])
self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i])
self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win)
self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
1024, #size
samp_rate_tx, #samp_rate
"", #name
1 #number of inputs
)
self.qtgui_time_sink_x_0_0.set_update_time(0.10)
self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)
self.qtgui_time_sink_x_0_0.set_y_label("Amplitude", "")
self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
self.qtgui_time_sink_x_0_0.enable_autoscale(False)
self.qtgui_time_sink_x_0_0.enable_grid(False)
self.qtgui_time_sink_x_0_0.enable_control_panel(True)
if not True:
self.qtgui_time_sink_x_0_0.disable_legend()
labels = ["", "", "", "", "",
"", "", "", "", ""]
widths = [1, 1, 1, 1, 1,
1, 1, 1, 1, 1]
colors = ["blue", "red", "green", "black", "cyan",
"magenta", "yellow", "dark red", "dark green", "blue"]
styles = [1, 1, 1, 1, 1,
1, 1, 1, 1, 1]
markers = [2, -1, -1, -1, -1,
-1, -1, -1, -1, -1]
alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0]
for i in xrange(1):
if len(labels[i]) == 0:
self.qtgui_time_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
else:
self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])
self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(samples_per_symbol_tx, (interp_taps))
self.interp_fir_filter_xxx_0.declare_sample_delay(0)
self.blocks_vco_f_0 = blocks.vco_f(48e3, -48e3, 1.0)
self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((atten, ))
self.audio_sink_0_0 = audio.sink(48000, "", True)
self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(48e3/(2*math.pi*deviation/8.0))
self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc((math.pi*modulation_index) / samples_per_symbol_tx)
##################################################
# Connections
##################################################
self.msg_connect((self.satnogs_debug_msg_source_0, 'msg'), (self.satnogs_upsat_fsk_frame_encoder_0, 'pdu'))
self.msg_connect((self.satnogs_udp_msg_source_0, 'msg'), (self.satnogs_upsat_fsk_frame_encoder_0, 'pdu'))
self.connect((self.analog_frequency_modulator_fc_0, 0), (self.qtgui_time_sink_x_0_0_0, 0))
self.connect((self.analog_frequency_modulator_fc_0, 0), (self.rational_resampler_xxx_0, 0))
self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_multiply_const_vxx_0, 0))
self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0_0, 0))
self.connect((self.blocks_vco_f_0, 0), (self.qtgui_time_sink_x_0_0, 0))
self.connect((self.interp_fir_filter_xxx_0, 0), (self.analog_frequency_modulator_fc_0, 0))
self.connect((self.interp_fir_filter_xxx_0, 0), (self.blocks_vco_f_0, 0))
self.connect((self.rational_resampler_xxx_0, 0), (self.analog_quadrature_demod_cf_0, 0))
self.connect((self.satnogs_upsat_fsk_frame_encoder_0, 0), (self.interp_fir_filter_xxx_0, 0))
def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "debug_afsk_transceiver_osmocom")
self.settings.setValue("geometry", self.saveGeometry())
event.accept()
def get_samples_per_symbol_tx(self):
return self.samples_per_symbol_tx
def set_samples_per_symbol_tx(self, samples_per_symbol_tx):
self.samples_per_symbol_tx = samples_per_symbol_tx
self.set_gaussian_taps(filter.firdes.gaussian(1.0, self.samples_per_symbol_tx, 1.0, 4*self.samples_per_symbol_tx))
self.set_sq_wave((1.0, ) * self.samples_per_symbol_tx)
self.analog_frequency_modulator_fc_0.set_sensitivity((math.pi*self.modulation_index) / self.samples_per_symbol_tx)
def get_sq_wave(self):
return self.sq_wave
def set_sq_wave(self, sq_wave):
self.sq_wave = sq_wave
self.set_interp_taps(numpy.convolve(numpy.array(self.gaussian_taps), numpy.array(self.sq_wave)))
def get_gaussian_taps(self):
return self.gaussian_taps
def set_gaussian_taps(self, gaussian_taps):
self.gaussian_taps = gaussian_taps
self.set_interp_taps(numpy.convolve(numpy.array(self.gaussian_taps), numpy.array(self.sq_wave)))
def get_deviation(self):
return self.deviation
def set_deviation(self, deviation):
self.deviation = deviation
self.set_modulation_index(self.deviation / (self.baud_rate / 2.0))
self.analog_quadrature_demod_cf_0.set_gain(48e3/(2*math.pi*self.deviation/8.0))
def get_baud_rate(self):
return self.baud_rate
def set_baud_rate(self, baud_rate):
self.baud_rate = baud_rate
self.set_modulation_index(self.deviation / (self.baud_rate / 2.0))
def get_tx_frequency(self):
return self.tx_frequency
def set_tx_frequency(self, tx_frequency):
self.tx_frequency = tx_frequency
def get_samp_rate_tx(self):
return self.samp_rate_tx
def set_samp_rate_tx(self, samp_rate_tx):
self.samp_rate_tx = samp_rate_tx
self.qtgui_time_sink_x_0_0_0.set_samp_rate(self.samp_rate_tx)
self.qtgui_time_sink_x_0_0.set_samp_rate(self.samp_rate_tx)
def get_modulation_index(self):
return self.modulation_index
def set_modulation_index(self, modulation_index):
self.modulation_index = modulation_index
self.analog_frequency_modulator_fc_0.set_sensitivity((math.pi*self.modulation_index) / self.samples_per_symbol_tx)
def get_interp_taps(self):
return self.interp_taps
def set_interp_taps(self, interp_taps):
self.interp_taps = interp_taps
self.interp_fir_filter_xxx_0.set_taps((self.interp_taps))
def get_atten(self):
return self.atten
def set_atten(self, atten):
self.atten = atten
self.blocks_multiply_const_vxx_0.set_k((self.atten, ))
def main(top_block_cls=debug_afsk_transceiver_osmocom, options=None):
from distutils.version import StrictVersion
if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
style = gr.prefs().get_string('qtgui', 'style', 'raster')
Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)
tb = top_block_cls()
tb.start()
tb.show()
def quitting():
tb.stop()
tb.wait()
qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
qapp.exec_()
if __name__ == '__main__':
main()
# this module will be imported in the into your flowgraph
def append_dev_args(device, dev_args):
if(len(dev_args) == 0):
return 0
......@@ -22,4 +22,4 @@ FIND_LIBRARY(
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FEC DEFAULT_MSG FEC_LIBRARIES FEC_INCLUDE_DIRS)
\ No newline at end of file
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FEC DEFAULT_MSG FEC_LIBRARIES FEC_INCLUDE_DIRS)
......@@ -81,6 +81,9 @@ if(NOT satnogs_sources)
endif(NOT satnogs_sources)
add_library(gnuradio-satnogs SHARED ${satnogs_sources})
add_dependencies(gnuradio-satnogs fec)
target_link_libraries(gnuradio-satnogs
${Boost_LIBRARIES}
${GNURADIO_ALL_LIBRARIES}
......
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 2.8)
project(libfec ASM C)
option(BUILD_32BIT_ON_64BIT "Build a 32-bit library on a 64-bit system" OFF)
# Select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
if(NOT LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR lib)
endif()
########################################################################
# Version information
########################################################################
set(VERSION_INFO_MAJOR 3)
set(VERSION_INFO_MINOR 0)
set(VERSION_INFO_PATCH 0)
if(NOT DEFINED VERSION_INFO_EXTRA)
set(VERSION_INFO_EXTRA "git")
endif()
include(Version)
if(NOT DEFINED VERSION)
#set(VERSION "\"${VERSION_INFO_MAJOR}.${VERSION_INFO_MINOR}.${VERSION_INFO_PATCH}\"")
set(VERSION "\"${VERSION_INFO}\"")
endif()
########################################################################
# Compiler specific setup
########################################################################
if(BUILD_32BIT_ON_64BIT)
set(CMAKE_SYSTEM_PROCESSOR "i386")
set(CMAKE_SIZEOF_VOID_P 4)
set(CMAKE_C_FLAGS -m32)
set(CMAKE_CXX_FLAGS -m32)
add_definitions(-m32)
endif()
if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 4))
set(TARGET_ARCH "x86")
elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
set(TARGET_ARCH "x64")
elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "i386") AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (APPLE))
# Mac is weird like that.
set(TARGET_ARCH "x64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm*")
set(TARGET_ARCH "ARM")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
set(TARGET_ARCH "ppc64" "ppc64le")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
set(TARGET_ARCH "ppc64" "ppc")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
set(TARGET_ARCH "ppc")
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANGCC)
add_definitions(-Wall)
add_definitions(-Wno-unused)
if(TARGET_ARCH MATCHES "x64")
add_definitions(-fPIC)
add_definitions(-msse2)
elseif(TARGET_ARCH MATCHES "x86")
add_definitions(-mmmx)
add_definitions(-msse)
add_definitions(-msse2)
elseif(TARGET_ARCH MATCHES "ppc|ppc64")
add_definitions(-fno-common)
add_definitions(-faltivec)
endif()
endif()
########################################################################
# Find build dependencies
########################################################################
# libm
find_library(M_LIB m REQUIRED)
########################################################################
# config.h
########################################################################
#add_definitions(-DHAVE_CONFIG_H)
# Checks for includes
include(CheckIncludeFile)
check_include_file("getopt.h" HAVE_GETOPT_H)
check_include_file("stdio.h" HAVE_STDIO_H)
check_include_file("stdlib.h" HAVE_STDLIB_H)
check_include_file("memory.h" HAVE_MEMORY_H)
check_include_file("string.h" HAVE_STRING_H)
# Checks for functions
include(CheckFunctionExists)
check_function_exists("getopt_long" HAVE_GETOPT_LONG)
check_function_exists("memset" HAVE_MEMSET)
check_function_exists("memmove" HAVE_MEMMOVE)
########################################################################
# Setup apps
########################################################################
if(TARGET_ARCH MATCHES "x64")
list(APPEND libfec_sources
dotprod_port.c
peakval_port.c
sumsq.c
sumsq_port.c
cpu_mode_x86_64.c
##asm
#sse2bfly27-64.s
#sse2bfly29-64.s
)
elseif(TARGET_ARCH MATCHES "x86")
list(APPEND libfec_sources
viterbi27_mmx.c
viterbi27_sse.c
viterbi27_sse2.c
viterbi29_mmx.c
viterbi29_sse.c
viterbi29_sse2.c
viterbi39_sse2.c
viterbi39_sse.c
viterbi39_mmx.c
viterbi615_mmx.c
viterbi615_sse.c
viterbi615_sse2.c
dotprod_mmx.c
dotprod_sse2.c
#peakval_mmx.c
#peakval_sse.c
#peakval_sse2.c
sumsq.c
sumsq_port.c
sumsq_sse2.c
sumsq_mmx.c
cpu_mode_x86.c
#asm
cpu_features.s
dotprod_mmx_assist.s
dotprod_sse2_assist.s
mmxbfly27.s
mmxbfly29.s
peak_mmx_assist.s
peak_sse2_assist.s
peak_sse_assist.s
peakval_mmx_assist.s
peakval_sse2_assist.s
peakval_sse_assist.s
sse2bfly27.s
sse2bfly29.s
ssebfly27.s
ssebfly29.s
sumsq_mmx_assist.s
sumsq_sse2_assist.s
)
elseif(TARGET_ARCH MATCHES "ppc|ppc64")
list(APPEND libfec_sources
viterbi27_av.c
viterbi29_av.c
viterbi39_av.c
viterbi615_av.c
encode_rs_av.c
dotprod_av.c
sumsq_av.c
peakval_av.c
cpu_mode_ppc.c
)
else()
list(APPEND libfec_sources
cpu_mode_generic.c
)
endif()
list(APPEND libfec_sources
fec.c
sim.c
viterbi27.c
viterbi27_port.c
viterbi29.c
viterbi29_port.c
viterbi39.c
viterbi39_port.c
viterbi615.c
viterbi615_port.c
encode_rs_char.c
encode_rs_int.c
encode_rs_8.c
decode_rs_char.c
decode_rs_int.c
decode_rs_8.c
init_rs_char.c
init_rs_int.c
encode_rs_ccsds.c
decode_rs_ccsds.c
dotprod.c
dotprod_port.c
peakval.c
peakval_port.c
sumsq.c
sumsq_port.c
ccsds_tab.c
ccsds_tal.c
)
################################################################################
# Generate pkg-config file
################################################################################
foreach(inc ${LIBFEC_INCLUDE_DIR})
list(APPEND LIBFEC_PC_CFLAGS "-I${inc}")
endforeach()
foreach(lib ${LIBFEC_LIBRARY_DIRS})
list(APPEND LIBFEC_PC_PRIV_LIBS "-L${lib}")
endforeach()
set(LIBFEC_PC_PREFIX ${CMAKE_INSTALL_PREFIX})
set(LIBFEC_PC_EXEC_PREFIX \${prefix})
set(LIBFEC_PC_LIBDIR \${exec_prefix}/${LIB_INSTALL_DIR})
set(LIBFEC_PC_INCLUDEDIR \${prefix}/include)
set(LIBFEC_PC_VERSION ${VERSION})
set(LIBFEC_PC_LIBS "-lfec")
# Use space-delimiter in the .pc file, rather than CMake's semicolon separator
string(REPLACE ";" " " LIBFEC_PC_CFLAGS "${LIBFEC_PC_CFLAGS}")
string(REPLACE ";" " " LIBFEC_PC_LIBS "${LIBFEC_PC_LIBS}")
# Unset these to avoid hard-coded paths in a cross-environment
if(CMAKE_CROSSCOMPILING)
unset(LIBFEC_PC_CFLAGS)
unset(LIBFEC_PC_LIBS)
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/libfec.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libfec.pc
@ONLY
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/libfec.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig/
)
########################################################################