Draft: Refactor CMakeLists.txt
Refactors CMakeLists.txt
to make it more readable, and to bring us closer to allow
mkdir build && cd build && cmake .. -GNinja && ninja
(i.e., compiling all targets).
Specifically, this MR
- Removes some unused CMake options
- Removes packages that are checked for but that are not used (openpgm, xpm, libcrypto)
-
TODO check that those packages are not installed by default: I think they are not, but not sure; reviewer, please check - Correctly check for dependencies (i.e., USRP has a UHD dependency, but until now, we did not check this, so add it)
- Corollary: these targets need to be enabled now via cmake; build_oai does this automatically. If e.g., OAi has been build without UHD, doing
./build_oai -w USRP
will build USRP (this did not work before)
- Corollary: these targets need to be enabled now via cmake; build_oai does this automatically. If e.g., OAi has been build without UHD, doing
- Reduce the amount of
include_directories()
: it is discouraged by cmake to use it, as it includes directories for all targets. For some libraries (openssl, libconfig, ...), we now usetarget_include_directories()
- Fix
minimal_lib
andrftest
- shlib loader is built as a separate OBJECT library to prevent multiple compilations
- Move all radio libs build instructions into separate
CMakeLists.txt
underradio/
to simplify the rootCMakeLists.txt
-
it seems the AW2S library has a dependency on the ethernet library, but it is currently possible to build one without the other. should be fixed (edit: fixed) - Simplify
build_oai
andtools/build_helper
More detailed information is in the commit messages.
The output of cmake
is now cleaner, and it lists found libraries, like so:
-- Checking for module 'libcrypt'
-- Found libcrypt, version 4.4.10
-- Checking for module 'libconfig'
-- Found libconfig, version 1.5
-- Checking for module 'openssl'
-- Found openssl, version 1.1.1f
-- Checking for module 'blas'
-- Found blas, version 3.10.3
-- Checking for module 'lapacke'
-- Found lapacke, version 3.9.0
-- Checking for module 'cblas'
-- No package 'cblas' found
Bonus: for one machine, the compilation time drops from 5min to 4min 50sec (around 3% faster)
Edited by Francois TABURET