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 v2 #14

Merged
merged 17 commits into from
Mar 5, 2024
Merged

Conan v2 #14

merged 17 commits into from
Mar 5, 2024

Conversation

eidekrist
Copy link
Member

Converts recipe to Conan v2 syntax.

Copy link

@joakimono joakimono left a comment

Choose a reason for hiding this comment

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

Mostly this looks good. I have added some suggested changes.

I could be useful to add a test_v1_package like they do on conan-center-index, with CI builds for conan v1 to secure legacy support.

build_type: [Debug, Release]
compiler_version: [7, 8, 9]
compiler_version: [9]
compiler_libcxx: [libstdc++11]
option_shared: ['True', 'False']

Choose a reason for hiding this comment

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

I suggest using containers when building. This configuration (gcc 9 and ubuntu 22) is unfortunate, since distributions using gcc 9 have an older glibc version than ubuntu 22 and pesky glibc issues are likely.
conanio have (almost) ready-made containers for various compiler versions.

container:
      image: conanio/gcc${{ matrix.compiler_version }}-ubuntu18.04
      options: -u 0

You would need to upgrade conan and either use conan config install or conan profile detect to setup.

Choose a reason for hiding this comment

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

Also note that many conan environment variables, e.g. CONAN_NON_INTERACTIVE are ignored with conan 2 and should be configured with core:non_interactive = False in global.conf . I think in this case it does not make a difference.

Copy link
Member

Choose a reason for hiding this comment

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

I agree, and we actually do use containers in our main repo, libcosim. But since this is going to be just a stop-gap solution until you get fmilibrary into conan-center, let's just leave it as-is for now.

build_type: [Debug, Release]
compiler_version: [7, 8, 9]
compiler_version: [9]
compiler_libcxx: [libstdc++11]
option_shared: ['True', 'False']
steps:
- uses: actions/checkout@v2

Choose a reason for hiding this comment

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

Should be actions/checkout@v3

@@ -1,8 +1,7 @@
project(PackageTest CXX)
cmake_minimum_required(VERSION 2.8.12)

Choose a reason for hiding this comment

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

Minimum required version when using CMakeDeps is 3.15

tc.cache_variables["FMILIB_BUILD_SHARED_LIB"] = True if self.options.shared else False
tc.cache_variables["FMILIB_BUILD_TESTS"] = False
tc.cache_variables["FMILIB_INSTALL_PREFIX"] = pathlib.Path(os.path.join(self.build_folder, "install")).as_posix()
tc.generate()

Choose a reason for hiding this comment

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

Suggest adding tc.variables["FMILIB_GENERATE_DOXYGEN_DOC"] = False to always avoid building and installing documentation.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed.

conanfile.py Outdated

def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["FMILIB_BUILD_STATIC_LIB"] = False if self.options.shared else True

Choose a reason for hiding this comment

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

I believe these should be variables instead of cache_variables

Copy link
Member

Choose a reason for hiding this comment

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

Are you sure? According to the variables documentation,

This attribute allows defining CMake variables, for multiple configurations (Debug, Release, etc). These variables should be used to define things related to the toolchain and for the majority of cases cache_variables is what you probably want to use.

@kyllingstad kyllingstad removed their request for review October 9, 2023 13:46
@kyllingstad kyllingstad self-assigned this Oct 9, 2023
@kyllingstad kyllingstad added the enhancement New feature or request label Oct 9, 2023
@kyllingstad
Copy link
Member

I did a bit of extra work here today to build the Conan packages using the official Conan Docker images rather than building it directly on the GitHub runner. This was necessary to avoid a glibc version conflict with the libcosim package, which is also built on those images.

@kyllingstad
Copy link
Member

Given that we have now merged several downstream pull requests that depend on this PR, I take it as implicit approval and will just merge this now. Feel free to revert and/or reprimand if you disagree with this decision.

@kyllingstad kyllingstad merged commit 10ef51e into master Mar 5, 2024
12 checks passed
@kyllingstad kyllingstad deleted the feature/conan-2 branch March 5, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants