-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake Build Support for liquid 1.5.0 #314
base: master
Are you sure you want to change the base?
Conversation
Current minimum version set to CMake 3.15 to take advantage of newer language features. Alternative to using autotools. One-to-one port of configure.ac and makefile.in to CMakeLists.txt + supporting CMake module files. Certain options such as the default CFLAGS are left up to the CMake generator to determine (e.g. If you want '-g -O2' then you do a RelWithDebInfo build). Handles the required platform checks for generating config.h. Depends on the cpu_features library (https://github.com/google/cpu_features) for detection of supported CPU instruction sets. All main targets defined by makefile.in are supported. The help target has been rebranded as list due to help being reserved by the CMake Unix Makefile generator. The .gitignore has been updated to handle CMake generated build files. Note that not all generated executables currently write to the build folder, but continue to be created in their expected locations within the source. This is to ensure the correct results are output when running targets that depend the autoscript generated xautotest/benchmark programs. Additionally, the doc-check, examples, and sandbox executables are also still written to their expected locations within the source.
- Add liquid_config target to replace global options - Remove non-standard header checks for malloc.h and memory.h - Add autotest byproducts lists to facilitate automatic cleanup - Additionally, manually link libc to conform with original makefile.in - Enable test target - Add string replacement to doc-test source to correct header include - Removed doc-test runtime output from source directory - Fix sandbox and coverage targets for when their dependencies aren't met - Fix liquid_linker_test to properly use installed library/header - Add distclean target
You can use |
I used variables as I was closely following the layout of the |
I would use cmake best practices rather than make it mirror autotools. Not saying you don't but may as well use the functions cmake provides out the box. |
I would use https://cmake.org/cmake/help/latest/module/CMakeDependentOption.html for options that depend on libraries like FFTW. |
Should we not revive cmake support? It's way better than autotools, cross platform and you can integrate into other projects quite easily using FetchContent. @jgaeddert |
Using liquid-dsp with projects that use CMake has been extremely challenging. I've been trying to integrate it with Zephyr RTOS for many hours without success. I've attempted using While some people might not like CMake, it has become the standard for C/C++ build systems, even for major projects like Zephyr RTOS. Adding proper CMake support would greatly improve usability and adoption, especially for cross-platform and embedded applications. |
Current minimum version set to CMake 3.15 to take advantage of newer language features. Alternative to using autotools for building liquid. The contribution is purely additive and does not modify the autotools configuration or impact the current behavior/performance of liquid when built the conventional way. This is a 1-to-1 port of
configure.ac
andmakefile.in
toCMakeLists.txt
+ supporting CMake module files. Certain options such as the default CFLAGS are left up to the CMake generator to determine (e.g. If you want-g -O2
then you do aRelWithDebInfo
build). Handles the required platform checks for generatingconfig.h
. Depends on the cpu_features library for detection of supported CPU instruction sets. All main targets defined bymakefile.in
are supported. The help target has been rebranded as list due to help being reserved by the CMake Unix Makefile generator. The.gitignore
has been updated to handle CMake generated build files.Note that not all generated executables currently write to the build folder, but continue to be created in their expected locations within the source. This is to ensure the correct results are output when running targets that depend on the autoscript generated xautotest/benchmark programs. Additionally the examples and sandbox executables are also still written to their expected locations within the source. The clean targets still work as expected.
Building with CMake is a prerequisite for introducing MSVC support. However, the Microsoft Visual Studio C Compiler is not fully compatible with the C99 standard. It does not support the
complex
/_Complex
keywords or variable-length arrays, both of which are optional C11 features. These are currently required for compilation. I plan to address these in upcoming PRs with the goal of removing the need for MSYS2/MinGW and addressing other issues summarized in #209 (comment).Credit where it's due: I built upon the prior work of @brian-armstrong in https://github.com/quiet/quiet-dsp/tree/win as a guide for the general layout of my
CMakeLists.txt
. This PR can be considered a resurrection of his work for the latest version of liquid, albeit without MSVC support. See #102 and #209 (comment).This PR supersedes #40 which has staled.