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

Add bimg #15317

Merged
merged 5 commits into from
Feb 13, 2023
Merged

Add bimg #15317

merged 5 commits into from
Feb 13, 2023

Conversation

RazielXYZ
Copy link
Contributor

@RazielXYZ RazielXYZ commented Jan 17, 2023

Specify library name and version: bimg/cci.20230114

This is the bimg library, part of the direct dependencies of bgfx, and required for that to be added.

This requires bx source to build, and newer versions of bimg may not work with a significantly older version of bx nor the other way around - as such, I've decided to map bimg versions to the newest working bx version in the conanfile. It's likely bx, bimg and bgfx will get updated together on cci, but the update cadence of these is not synced - bx tends to be updated the least frequently, while bimg is updated more frequently, and bgfx the most frequently. As such, it's possibly multiple versions of bimg will use the same version of bx as well.

This package is very similar to the one for bx otherwise (#13866) and the notes from there apply here as well.


@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

recipes/bimg/all/conanfile.py Outdated Show resolved Hide resolved
Comment on lines 97 to 98
if not self.options.get_safe("fPIC", True):
raise ConanInvalidConfiguration("This package does not support builds without fPIC.")
Copy link
Member

Choose a reason for hiding this comment

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

I would say if it's not optional, you could remove it from options

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't the cci linter complain if fPIC is not an option? If not, I don't mind removing it, and will change bx later to do the same for consistency

Copy link
Member

Choose a reason for hiding this comment

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

It will submit a warning message: WARN: [FPIC OPTION (KB-H006)] This recipe does not include an 'fPIC' option. Make sure you are using the right casing But no error will raise

get(self, **self.conan_data["sources"][self.version], strip_root=True,
destination=os.path.join(self.source_folder, self._bimg_folder))
#We need bx source too
get(self, **self.dependencies["bx"].conan_data["sources"][self._bx_version[self.version]], strip_root=True,
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to patch instead and consume bx as package instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be very difficult as the entire build system (genie project) relies on it being that way, and I'm not sure if I'm good enough with genie to modify it to do it that way instead. I could try to play around with doing that but I think it might be too much work (with even more in the future to keep it working) than it would be worth, considering it wouldn't actually affect projects that just use bgfx/bimg/bx and that grabbing bx source from the dependency package when building is easy and straightforward.

Copy link
Member

Choose a reason for hiding this comment

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

I remember about the discussion using genie in another PR. If say it's very difficult, please, keep doing dual download, but add a comment in the recipe explaining it. So far, this build system is one of most exotics that we have in CCI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fact that bimg needs bx source (and bgfx needs bimg and bx source) isn't really genie's fault, but it is how the genie projects for them are set up.
The initial reason was that bx and bimg were basically part of bgfx and they were only split out as separate projects when they started getting bigger, and it was decided to just need their source to make it easy for people to build bgfx (and bimg and bx) without dealing with managing dependencies, just by also cloning bimg and bx in the same place. This was, of course, back when dependency management didn't have many or any good options like conan.
Perhaps in the future this can be changed, maybe even by using conan, but at the moment there aren't really any plans for it upstream. I will add a comment explaining this for now, thanks for the feedback!

Remove unnecessary @ in requires
Further clarify why we need bx source
@conan-center-bot

This comment has been minimized.

@RazielXYZ
Copy link
Contributor Author

Oh, there's a conan v2 pipeline going now? How exciting!

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

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

Just a small comment about reducing the test package. Looking good.

Comment on lines 8 to 12
find_package(bimg REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
target_link_libraries(${PROJECT_NAME} bimg::bimg)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
find_package(bimg REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
target_link_libraries(${PROJECT_NAME} bimg::bimg)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
${CMAKE_CURRENT_BINARY_DIR}/test_package/)

You can avoid duplication by loading ../test_package

@@ -0,0 +1,26 @@
#include <bx/bx.h>
Copy link
Member

Choose a reason for hiding this comment

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

Once you have re-used the test_package folder, it will use test_package/test_package.cpp instead of this duplicated file, so you can delete this file.

All this is part of a template that we have been using in CCI and may help you instead of writing for scratch for every new recipe: https://github.com/conan-io/conan-center-index/tree/master/docs/package_templates

Well, your build system is unique, so at least the test package you just need to copy/paste 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough! Testing that unfortunately revealed that the test_v1_package doesn't actually build correctly on windows msvc locally (with or without that change) so I'll have to figure out why that is first 😅

@RazielXYZ
Copy link
Contributor Author

Turns out, test_v1 wasn't working because I was using msvc rather than Visual Studio as the compiler in my profiles, and the old CMake generators don't correctly apply MT(d)/MD(d) from the newer msvc variant. 😞

@RazielXYZ RazielXYZ closed this Feb 10, 2023
@RazielXYZ RazielXYZ reopened this Feb 10, 2023
@RazielXYZ RazielXYZ closed this Feb 12, 2023
@RazielXYZ RazielXYZ reopened this Feb 12, 2023
@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 8 (cea9f501f22bd30492c610b7da36d1d9883e3d2e):

  • bimg/cci.20230114@:
    All packages built successfully! (All logs)

Conan v2 pipeline (informative, not required for merge) ❌

Note: Conan v2 builds are informative and they are not required for the PR to be merged.

The v2 pipeline failed. Please, review the errors and note this will be required for pull requests to be merged in the near future.

See details:

Failure in build 8 (cea9f501f22bd30492c610b7da36d1d9883e3d2e):

  • bimg/cci.20230114@:
    CI failed to create some packages (All logs)

    Logs for packageID 537a170cbf44f317de42887c6f93285a7de85b24:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.libcxx=libstdc++11
    compiler.version=11
    os=Linux
    
    [...]
    Downloading conanfile.py
    Downloading conanmanifest.txt
    Decompressing conan_export.tgz
    bx/cci.20221116: Downloaded recipe revision 3b61fd9ea59776992f661217bec13bb6
    genie/1170: Not found in local cache, looking in remotes...
    genie/1170: Checking remote: conan-center-v2
    genie/1170: Trying with 'conan-center-v2'...
    Downloading conan_export.tgz
    Downloading conanfile.py
    Downloading conanmanifest.txt
    Decompressing conan_export.tgz
    genie/1170: Downloaded recipe revision 83cec5ee811a1a23f3e3cae90fa9769c
    Graph root
        virtual
    Requirements
        bimg/cci.20230114#e6508ae8f3b912cd8a7d0ed0915f6a63 - Cache
        bx/cci.20221116#3b61fd9ea59776992f661217bec13bb6 - Downloaded (conan-center-v2)
    Build requirements
        genie/1170#83cec5ee811a1a23f3e3cae90fa9769c - Cache
    
    -------- Computing necessary packages --------
    bimg/cci.20230114: Forced build from source
    Requirements
        bimg/cci.20230114#e6508ae8f3b912cd8a7d0ed0915f6a63:537a170cbf44f317de42887c6f93285a7de85b24 - Build
        bx/cci.20221116#3b61fd9ea59776992f661217bec13bb6:51ff40e453303200e076980d1b11d6e563deb2cd - Missing
    Build requirements
        genie/1170#83cec5ee811a1a23f3e3cae90fa9769c:3593751651824fb813502c69c971267624ced41a#dac62bdfe662a9596bb49be6e6da2448 - Download (conan-center-v2)
    
    -------- Installing packages --------
    
    -------- Installing (downloading, building) binaries... --------
    ERROR: Missing binary: bx/cci.20221116:51ff40e453303200e076980d1b11d6e563deb2cd
    
    bx/cci.20221116: WARN: Can't find a 'bx/cci.20221116' package binary '51ff40e453303200e076980d1b11d6e563deb2cd' for the configuration:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.libcxx=libstdc++11
    compiler.version=11
    os=Linux
    [options]
    fPIC=True
    tools=False
    
    ERROR: Missing prebuilt package for 'bx/cci.20221116'
    Use 'conan list packages bx/cci.20221116 --format=html -r=remote > table.html' and open the table.html file to see available packages
    Or try to build locally from sources with '--build=bx/cci.20221116'
    
    More Info at 'https://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package'
    

Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

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

LGTM

@conan-center-bot conan-center-bot merged commit 1f36ae8 into conan-io:master Feb 13, 2023
@RazielXYZ RazielXYZ mentioned this pull request Feb 19, 2023
3 tasks
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.

5 participants