-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor CMake files to better support nmos-cpp as a library #2
Conversation
…dd_subdirectory(.../nmos-cpp/Development)
…s; get rid of link_directories and most of the include_directories
…s depend on it (e.g. there are some question marks in the code as to whether lldp and mdns libs should or not)
…AGS for specific definitions and add_compile_options or add_definitions for almost all other cases that are more general
…dependencies' interface definitions, etc. don't need to be transitively applied
… module and recently also by Conan for most generators (cmake_find_package for example) so Linux and Visual Studio "Open folder" work fine, but with cmake_find_package_multi (which we've traditionally used to generate multi-configuration Visual Studio solutions) it isn't, so map the required components to targets instead Same seems to be true for OPENSSL_INCLUDE_DIR and WEBSOCKETPP_INCLUDE_DIR
…eeds to do it (seems no worse than force disabling compiler warnings)
… dependency to mdns and lldp
…op-level project (see PROJECT_IS_TOP_LEVEL in CMake 3.21)
(it'd still be better to auto-detect in the long run)
… same directory, and rely on searching the directory where the current file is found, in order to avoid the need for the project root directory to be in the include path
…es for the whole directory/project
…the Boost recipe uses features from at least 1.33.0
…/system libs, Boost components, Bonjour and PCAP, so that (next) each target's dependencies can be brought together
…checks Boost_VERSION_COMPONENTS
…e and compiler config; the CACHE variables are still spread through the files, but BUILD_LLDP, the only one that affects _what_ is built rather than _how_, is now in the top-level CMakeLists.txt
…found where expected, add --debug-find to the install test
… additional logging we got from --debug-find
…kflows were successful on Windows and Ubuntu 18.04 and 20.04, it failed on macOS (couldn't find CoreFoundation) and on Ubuntu 14.04 (couldn't find system-installed Boost), and the logs weren't much shorter anyway... so I'll keep --debug-find for occasional debugging!
OK... I've now tweaked that project's CMakeLists.txt to never use Conan, but in the CI "install test" I add the location of the nmos-cpp install package to the |
…d dump into the console a log file of where the most important dependencies have been found
One more thought... I noticed how when you using the Preparing project for CPM.cmake (the CMake Package Manager) offers the guidance to "Scope any options your root Those three therefore might benefit from being renamed with an What about some of the others? They basically all have a prefix, we could just argue about whether they need an extra In any case, it seems like in most use cases, only the two or three The
|
…argets are not available because the find-module or config-file packages use add_library() without GLOBAL for the IMPORTED targets, so the target names only have scope in the subdirectory. Rather than set the IMPORTED_GLOBAL target property explicitly somewhere in nmos-cpp itself, just generate the list of include directories directly from the my-nmos-node executable instead.
…ache variables, e.g. BUILD_EXAMPLES, BUILD_TESTS, USE_CONAN
Add NMOS_CPP_ prefix to the CMake cache variables, e.g. BUILD_EXAMPLES, BUILD_TESTS, USE_CONAN
I've noticed that the build instructions for cpprestsdk mention setting |
…Conan instructions behind HTML <details>
I tried this out by setting that option in Sandbox/my-nmos-node, and it worked OK apart from a slew of link warnings. I've opened conan-io/conan-center-index#6847 to resolve those. |
17ae16b
to
0b7689b
Compare
…building from third_party source Reorder dependencies consistently in conanfiles, NmosCppDependencies.cmake and Dependencies docs
…d comment to more clearly explain the rationale for building the patched dnssd.lib and that the Bonjour service and client DLL (dnssd.dll) are still required
…vs. nlohmann_json_schema_validator) Fixes bug in 0b7689b
c842a8b
to
190cea9
Compare
…end slightly) since the existing include in NmosCppConan.cmake didn't work for out-of-source builds, and it seems slightly more elegant to keep the as much of the Conan recipe-specific stuff alongside the conanfile.py and just "turn off" NmosCppConan.cmake in the case of CONAN_EXPORT but take no other action.
Ready to make PR to sony/nmos-cpp |
See the commits for explanation of each change, but in summary, I'm trying to refactor the CMake files towards more modern CMake, with the goal of nmos-cpp being usable as a library from another CMake project.
That means initially aiming to allow use via
add_subdirectory
like so:Next will be to support use via the
INSTALL
ed location and some generated -config.cmake files so thatfind_package
works:As you can see the only difference will be using the
find_package
command rather thanadd_subdirectory
.At that point nmos-cpp really needs versioning, which is another discussion.
And following on from that would be to publish a Conan package.