Skip to content
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

Conan 2 #373

Merged
merged 6 commits into from
Feb 18, 2024
Merged

Conan 2 #373

merged 6 commits into from
Feb 18, 2024

Conversation

garethsb
Copy link
Contributor

@garethsb garethsb commented Feb 16, 2024

  • Conan 1.X is no longer supported
  • NMOS_CPP_USE_CONAN cache variable is no more, but there are two new NMOS_CPP_USE_SUPPLIED_xxx options to use the supplied json-schema-validator and jwt-cpp if you're not using Conan
  • To use Conan as the dependency provider, CMAKE_PROJECT_TOP_LEVEL_INCLUDES must be used explicitly, which is documented in the Getting Started guide (see Dependency Providers for the rationale)
  • A conan lockfile is created and output in the log in CI, which will help us track which precise versions have been used for each build
  • Bump CMake to 3.28.3, apart from on ubuntu-14.04 (where it didn't work)

@garethsb
Copy link
Contributor Author

Noticed while I was updating CI and documentation that at the moment, the Dependencies doc says:

Install a DNS Service Discovery implementation, since this isn't currently handled by Conan

That isn't true - hasn't been true for a long time now. However, we haven't changed this because the required library is different on Windows (mDNSResponder) than on Linux (Avahi or mDNSResponder), and that can't be expressed in a simple conanfile.txt. It would be good to improve this, as it would simplify the build even further. We could adopt the CCI conanfile.py which expresses the necessary logic.

README.md Show resolved Hide resolved
Copy link
Contributor

@lo-simon lo-simon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lo-simon lo-simon merged commit ba267fa into sony:master Feb 18, 2024
11 checks passed
@garethsb garethsb deleted the conan-2 branch February 18, 2024 09:24
@garethsb
Copy link
Contributor Author

Not sure whether we want to note anywhere what a user will experience if they are not ready for the migration, which requires:

  • Conan 2.0.5 or higher (not Conan 1.X)
  • CMake 3.24 or higher
  • new cmake command

If they try to use previous cmake command without -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES, or if they do not have CMake 3.24 or higher (e.g. CMake 3.20 supplied with Visual Studio 2019) so the CMAKE_PROJECT_TOP_LEVEL_INCLUDES will just be ignored, they'll get this error from find_package(Boost).

cmake .. -DCMAKE_CONFIGURATION_TYPES="Debug;Release"
-- Building for: Visual Studio 16 2019
...
CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: Boost_INCLUDE_DIR system date_time regex
  thread) (Required is at least version "1.54.0")
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.28/Modules/FindBoost.cmake:2393 (find_package_handle_standard_args)
  cmake/NmosCppDependencies.cmake:19 (find_package)
  CMakeLists.txt:21 (include)


-- Configuring incomplete, errors occurred!

If they have conan 1.X but do use the new cmake command, they'll get an error message telling them they need Conan 2.0.5 or higher.

cmake .. -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="third_party/cmake/conan_provider.cmake"
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
WARN: Migration: Updating settings.yml
CMake Error at third_party/cmake/conan_provider.cmake:487 (message):
  CMake-Conan: Conan version must be 2.0.5 or later
Call Stack (most recent call first):
  third_party/cmake/conan_provider.cmake:516 (conan_version_check)
  cmake/NmosCppDependencies.cmake:19 (find_package)
  CMakeLists.txt:21 (include)


-- Configuring incomplete, errors occurred!

@lo-simon
Copy link
Contributor

How about under the Recent Activity, we extend and bold the wording Update to Conan 2; Conan 1.X is no longer supported with a MUST and otherwise you will get error.

@garethsb
Copy link
Contributor Author

garethsb commented Feb 21, 2024

I've started investigating how to use Conan 2 with earlier versions of CMake, by manually running conan install and passing a generated preset/toolchain to CMake.

Approximately...

mkdir build
cd build
conan install .. -g CMakeToolchain --settings:all build_type=Release --build=missing --output-folder=conan
conan install .. -g CMakeToolchain --settings:all build_type=Debug --build=missing --output-folder=conan

then either... (hmm, this doesn't work because the generated CMakePresets.json is in the build/conan directory not the source directory)

cmake .. --preset conan-default -DCMAKE_CONFIGURATION_TYPES="Debug;Release"

or... (this does seem to work...)

cmake .. -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE=conan/conan_toolchain.cmake -DCMAKE_CONFIGURATION_TYPES="Debug;Release"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants