Skip to content

Commit

Permalink
Merge branch 'develop' of ssh://github.com/BatchDrake/sigutils into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
BatchDrake committed Apr 13, 2023
2 parents 4d5494b + be5dd39 commit 3d162cf
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 3,855 deletions.
124 changes: 31 additions & 93 deletions CMakeLists.txt
Expand Up @@ -22,7 +22,6 @@ cmake_minimum_required(VERSION 3.12.0)

# CMake modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
include(GNUInstallDirs)
include(FindPkgConfig)
include(CodeAnalysis)
include(GitVersionDetect)
Expand All @@ -42,51 +41,57 @@ project(
VERSION ${SIGUTILS_VERSION}
LANGUAGES C)

# Late module imports that depend on project definitions
include(GNUInstallDirs)

# Find requirements
find_package(Threads)

pkg_check_modules(SNDFILE REQUIRED sndfile>=1.0.2)
include_directories(${SNDFILE_INCLUDE_DIRS})
link_directories(${SNDFILE_LIBRARY_DIRS})

pkg_check_modules(FFTW3 REQUIRED fftw3f>=3.0)
include_directories(${FFTW3_INCLUDE_DIRS})
link_directories(${FFTW3_LIBRARY_DIRS})

pkg_check_modules(VOLK volk>=1.0)
if(VOLK_FOUND)
add_compile_definitions(HAVE_VOLK)
include_directories(${VOLK_INCLUDE_DIRS})
link_directories(${VOLK_LIBRARY_DIRS})
endif()

# Project build options
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffast-math -s")
endif()

option(SIGUTILS_SINGLE_PRECISSION "Use single precission data types" ON)
if(SIGUTILS_SINGLE_PRECISSION)
add_compile_definitions(_SU_SINGLE_PRECISION)
endif()

# Source location
set(SRCDIR sigutils)
set(UTILDIR util)
set(SPECDIR ${SRCDIR}/specific)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE )
if (DEFINED PKGVERSION)
# If you are building sigutils for your own software distribution, you may want
# to set PKGVERSION to some descriptive string.
add_compile_definitions(SIGUTILS_PKGVERSION="${PKGVERSION}")
endif()

# General CMake hacks
# The following hack exposes __FILENAME__ to source files as the relative
# path of each source file.
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")

#
# If you are building sigutils for your own software distribution, you may want
# to set PKGVERSION to some descriptive string.
#
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")

if (DEFINED PKGVERSION)
set(
CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DSIGUTILS_PKGVERSION='\"${PKGVERSION}\"'")
endif()

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -ggdb")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -s -DNDEBUG")
# Source location
set(SRCDIR sigutils)
set(UTILDIR util)
set(SPECDIR ${SRCDIR}/specific)

########################## pkg-config description #############################
set(SIGUTILS_PC_FILE_PATH "${PROJECT_BINARY_DIR}/sigutils.pc")
Expand Down Expand Up @@ -218,7 +223,7 @@ set(SIGUTILS_LIB_SOURCES
${SRCDIR}/tvproc.c
${SRCDIR}/version.c)

link_directories(${PROJECT_BINARY_DIR} ${SNDFILE_LIBRARY_DIRS} ${FFTW3_LIBRARY_DIRS})
link_directories(${PROJECT_BINARY_DIR})

add_library(
sigutils SHARED
Expand All @@ -237,12 +242,8 @@ set_property(TARGET sigutils PROPERTY SOVERSION ${SIGUTILS_ABI_VERSION})
target_include_directories(sigutils PRIVATE . util ${SRCDIR})

# Required dependencies
target_include_directories(sigutils SYSTEM PUBLIC ${SNDFILE_INCLUDE_DIRS})
target_link_libraries(sigutils ${SNDFILE_LIBRARIES})

target_include_directories(sigutils SYSTEM PUBLIC ${FFTW3_INCLUDE_DIRS})
target_link_libraries(sigutils ${FFTW3_LIBRARIES})

target_link_libraries(sigutils ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(sigutils m)

Expand All @@ -253,8 +254,6 @@ endif()

# Optional dependencies
if(VOLK_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_VOLK=1")
target_include_directories(sigutils SYSTEM PUBLIC ${VOLK_INCLUDE_DIRS})
target_link_libraries(sigutils ${VOLK_LIBRARIES})
endif()

Expand All @@ -271,64 +270,3 @@ install(
DESTINATION include/sigutils/util)

install(TARGETS sigutils DESTINATION ${CMAKE_INSTALL_LIBDIR})


############################## Unit tests ######################################
set(MAINDIR src)
set(TESTDIR ${MAINDIR}/tests)
set(TESTUTILDIR testutil)

set(SIGUTILS_TESTUTIL_SOURCES
${TESTUTILDIR}/common.c
${TESTUTILDIR}/poolhelper.c
${TESTUTILDIR}/sigbufpool.c)

set(SIGUTILS_TESTUTIL_HEADERS
${TESTUTILDIR}/test.h)

set(SIGUTILS_TEST_SOURCES
${TESTDIR}/agc.c
${TESTDIR}/block.c
${TESTDIR}/clock.c
${TESTDIR}/costas.c
${TESTDIR}/detect.c
${TESTDIR}/filt.c
${MAINDIR}/main.c
${TESTDIR}/mat.c
${TESTDIR}/ncqo.c
${TESTDIR}/pll.c
${TESTDIR}/specttuner.c)

set(SIGUTILS_TEST_HEADERS
${TESTDIR}/test_list.h
${TESTDIR}/test_param.h)

add_executable(
sutest
${SIGUTILS_TEST_SOURCES}
${SIGUTILS_TEST_HEADERS}
${SIGUTILS_TESTUTIL_SOURCES}
${SIGUTILS_TESTUTIL_HEADERS})

# Private header directories
target_include_directories(
sutest
PRIVATE . util ${SRCDIR} ${TESTDIR} ${TESTUTILDIR})

# Required dependencies
target_link_libraries(sutest sigutils)

target_include_directories(sutest SYSTEM PUBLIC ${SNDFILE_INCLUDE_DIRS})
target_link_libraries(sutest ${SNDFILE_LIBRARIES})

target_include_directories(sutest SYSTEM PUBLIC ${FFTW3_INCLUDE_DIRS})
target_link_libraries(sutest ${FFTW3_LIBRARIES})

target_link_libraries(sutest ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(sutest m)

# Optional dependencies
if(VOLK_FOUND)
target_include_directories(sutest SYSTEM PUBLIC ${VOLK_INCLUDE_DIRS})
target_link_libraries(sutest ${VOLK_LIBRARIES})
endif()
11 changes: 0 additions & 11 deletions README.md
Expand Up @@ -39,17 +39,6 @@ And proceed to install the library in your system by running as root:
# ldconfig
```

## Running all unit tests
~~If the compilation was successful, an executable file named `sigutils` must exist in the `src/` directory, containing a set of unit tests for various library features. It's a good idea to run all unit tests before going on. However, these tests rely on a real signal recording from [sigidwiki](http://www.sigidwiki.com).~~

~~In order to run all unit tests, you must download [this ZIP file](http://www.sigidwiki.com/images/3/36/Strange_4psk.zip) first, extract the file `strange 8475 khz_2015-12-04T15-33-32Z_8474.1kHz.wav`, rename it to `test.wav` and place it in the project's root directory. After this step, you can run all unit tests by executing:~~

_Please note: many of these unit tests are failing until the API harmonization work is completed. Don't worry to much about them for now. However, if both your build and installation were successful, you should see a list of unit tests taking place after running:_

```
% src/sutest
```

---
# sigutils API overview
There are three API levels in sigutils, with every high-level API relying on lower-level APIs:
Expand Down
30 changes: 0 additions & 30 deletions cmake.yml

This file was deleted.

0 comments on commit 3d162cf

Please sign in to comment.