BatchDrake / sigutils

Small signal processing utility library
https://batchdrake.github.io/sigutils
GNU General Public License v3.0
71 stars 29 forks source link

Refactor codebase to group the lib in one folder #52

Closed antoniovazquezblanco closed 1 year ago

antoniovazquezblanco commented 1 year ago

This one seems to bring no advantages along with the work but I promise it is for a good reason...

Isolation of the library code is the first step towards a nice and clean structure for packaging. We are a couple of commits away from awesome results!

BatchDrake commented 1 year ago

I am afraid these changes (or maybe the previous ones) are breaking suscan now:

(metalloid) % make
[  3%] Building C object CMakeFiles/suscan.dir/util/cfg.c.o 
[  3%] Building C object CMakeFiles/suscan.dir/util/com.c.o 
[  3%] Building C object CMakeFiles/suscan.dir/util/cbor.c.o 
[  3%] Building C object CMakeFiles/suscan.dir/util/compat.c.o 
/home/waldo/Documents/Desarrollo/suscan/util/com.c:22:10: fatal error: sigutils/log.h: No existe el fichero o el directorio
   22 | #include <sigutils/log.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
/home/waldo/Documents/Desarrollo/suscan/util/cbor.c:24:10: fatal error: sigutils/types.h: No existe el fichero o el directorio
   24 | #include <sigutils/types.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/suscan.dir/build.make:76: CMakeFiles/suscan.dir/util/cbor.c.o] Error 1
make[2]: *** Se espera a que terminen otras tareas....
make[2]: *** [CMakeFiles/suscan.dir/build.make:104: CMakeFiles/suscan.dir/util/com.c.o] Error 1
/home/waldo/Documents/Desarrollo/suscan/util/compat.c:24:10: fatal error: sigutils/log.h: No existe el fichero o el directorio
   24 | #include <sigutils/log.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
In file included from /home/waldo/Documents/Desarrollo/suscan/util/cfg.c:26:
...

This is the full build command:

% VERBOSE=1 command make
/usr/bin/cmake -S/home/waldo/Documents/Desarrollo/suscan -B/home/waldo/Documents/Desarrollo/suscan/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/waldo/Documents/Desarrollo/suscan/build/CMakeFiles /home/waldo/Documents/Desarrollo/suscan/build//CMakeFiles/progress.marks
make  -f CMakeFiles/Makefile2 all
make[1]: se entra en el directorio '/home/waldo/Documents/Desarrollo/suscan/build'
make  -f CMakeFiles/suscan.dir/build.make CMakeFiles/suscan.dir/depend
make[2]: se entra en el directorio '/home/waldo/Documents/Desarrollo/suscan/build'
cd /home/waldo/Documents/Desarrollo/suscan/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/waldo/Documents/Desarrollo/suscan /home/waldo/Documents/Desarrollo/suscan /home/waldo/Documents/Desarrollo/suscan/build /home/waldo/Documents/Desarrollo/suscan/build /home/waldo/Documents/Desarrollo/suscan/build/CMakeFiles/suscan.dir/DependInfo.cmake --color=
make[2]: se sale del directorio '/home/waldo/Documents/Desarrollo/suscan/build'
make  -f CMakeFiles/suscan.dir/build.make CMakeFiles/suscan.dir/build
make[2]: se entra en el directorio '/home/waldo/Documents/Desarrollo/suscan/build'
[  0%] Building C object CMakeFiles/suscan.dir/util/cbor.c.o
/usr/bin/cc -Dsuscan_EXPORTS -I/home/waldo/Documents/Desarrollo/suscan/. -I/home/waldo/Documents/Desarrollo/suscan/util -I/home/waldo/Documents/Desarrollo/suscan/analyzer -I/home/waldo/Documents/Desarrollo/suscan/analyzer/inspector -isystem /usr/include/opus -isystem /usr/include/libxml2 -Wall  -DPKGDATADIR='"/usr/local/share/suscan"' -D__FILENAME__='"build/CMakeFiles/suscan.dir/compiler_depend.ts"' -DHAVE_VOLK=1 -DHAVE_ALSA=1 -g -O0 -ggdb -fPIC -D_SU_SINGLE_PRECISION -DHAVE_VOLK -I/usr/local/include -MD -MT CMakeFiles/suscan.dir/util/cbor.c.o -MF CMakeFiles/suscan.dir/util/cbor.c.o.d -o CMakeFiles/suscan.dir/util/cbor.c.o -c /home/waldo/Documents/Desarrollo/suscan/util/cbor.c
/home/waldo/Documents/Desarrollo/suscan/util/cbor.c:24:10: fatal error: sigutils/types.h: No existe el fichero o el directorio
   24 | #include <sigutils/types.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/suscan.dir/build.make:76: CMakeFiles/suscan.dir/util/cbor.c.o] Error 1
make[2]: se sale del directorio '/home/waldo/Documents/Desarrollo/suscan/build'
make[1]: *** [CMakeFiles/Makefile2:141: CMakeFiles/suscan.dir/all] Error 2
make[1]: se sale del directorio '/home/waldo/Documents/Desarrollo/suscan/build'
make: *** [Makefile:136: all] Error 2
BatchDrake commented 1 year ago

Just looked into the pkg-config flags. It is definitely the .pc file. The output of pkg-config with --cflags is:

(metalloid) % pkg-config sigutils --cflags       
-D_SU_SINGLE_PRECISION -DHAVE_VOLK -I/usr/local/include

Sigutils' include dir should be /usr/local/include/sigutils and not just /usr/local/include.

antoniovazquezblanco commented 1 year ago

Rebased with the latest develop branch. It now includes the PC fix. Untested (will do in a moment).

antoniovazquezblanco commented 1 year ago

It now works!


% cat build/test/usr/lib/pkgconfig/sigutils.pc
# sigutils library pkg-config file
# Automatically generated by CMAKE

prefix=/usr
exec_prefix="${prefix}"
libdir="${prefix}/lib"
includedir="${prefix}/include"

Name: sigutils
Description: Digital signal processing utility library
URL: http://github.org/BatchDrake/sigutils
Version: 0.3.0
Cflags: -I${includedir} -I${includedir}/sigutils -D_SU_SINGLE_PRECISION
Libs: -L${libdir} -lsigutils -lsndfile -lfftw3f -lm```