{"id":15136989,"url":"https://github.com/shreyasbharath/conan-package-binary-example","last_synced_at":"2025-10-23T11:32:09.529Z","repository":{"id":44895086,"uuid":"96260103","full_name":"shreyasbharath/conan-package-binary-example","owner":"shreyasbharath","description":"A working example of packaging pre-built binaries (libs + header files) and uploading them to a Conan remote for consumption","archived":false,"fork":false,"pushed_at":"2017-08-17T21:25:54.000Z","size":10,"stargazers_count":8,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T18:38:23.778Z","etag":null,"topics":["conan","conan-recipe","package-manager"],"latest_commit_sha":null,"homepage":"https://www.conan.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shreyasbharath.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-04T23:54:25.000Z","updated_at":"2024-10-28T10:17:04.000Z","dependencies_parsed_at":"2022-09-19T01:10:14.702Z","dependency_job_id":null,"html_url":"https://github.com/shreyasbharath/conan-package-binary-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shreyasbharath%2Fconan-package-binary-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shreyasbharath%2Fconan-package-binary-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shreyasbharath%2Fconan-package-binary-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shreyasbharath%2Fconan-package-binary-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shreyasbharath","download_url":"https://codeload.github.com/shreyasbharath/conan-package-binary-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237821715,"owners_count":19371813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conan","conan-recipe","package-manager"],"created_at":"2024-09-26T06:42:31.285Z","updated_at":"2025-10-23T11:32:04.185Z","avatar_url":"https://github.com/shreyasbharath.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Packaging Existing Artifacts\nThis repository is an example of integrating Conan into your existing build process where the artifacts already exist.\n\nThe structure of the example project is as follows -\n  - code\n    - inc -\u003e contains public APIs (header files) of modules\n    - ModuleA -\u003e contains source files for ModuleA\n    - ModuleB -\u003e contains source files for ModuleB\n  - obj\n    - libs -\u003e pre-built static libraries of ModuleA and ModuleB\n    - ModuleA -\u003e corresponding object files for source files of ModuleA\n    - ModuleB -\u003e corresponding object files for source files of ModuleB\n    \nThe idea is to create a package that has the public header files and the pre-compiled static libraries from this project.\n\nConan in its current form is heavily geared towards building from source and publishing the artifacts as a result of that build. However, in our case we want Conan to simply slot in to an existing build process and only be responsible for creating a package from existing artifacts and publishing it to a remote for consumption by other projects.\n\nThe main scripts of interest are `build.py` and `conanfile.py`. Below are the list of steps they run -\n\n  - Create a temporary directory called 'mypkg' and change to that directory\n  - Execute command `conan package .. --build_folder..`, where the arguments `..` points to where the conanfile.py is located and the `--build_folder=..` also points to where the build artifacts are located (both are in the same location). This copies the public header files and static libraries into the `include` and `lib` directories respectively.\n  - Execute command `cd .. \u0026\u0026 conan export myuser/testing` which copies the package recipe into the local Conan cache for the user `myuser` and the `testing` channel\n  - Execute command `cd mypkg \u0026\u0026 conan package_files Test/0.1@myuser/testing -f` packages everything under the `mypkg` directory and copies it to the local Conan cache\n  - Execute command `conan upload Test/0.1@myuser/testing --all -r=artifactory` uploads the package recipe and its artifacts to the remote named `artifactory`\n\n# Changing Configuration of Package\nIf you are packaging binaries outside a build process it is likely that the binaries will have been built using different settings than the default profile which is used when running `conan package_files Test/0.1@myuser/testing -f`. To change the settings you have two options:\n\n  - Use the -s flag to override specific default settings: `conan package_files Test/0.1@myuser/testing -f -s arch=x86` (if the binaries were built for 32 bit architecture)\n  - Use the -pr flag to specify a different conan profile created to match the settings that the binaries were build under `conan package_files Test/0.1@myuser/testing -f -pr profileName`\n\n# Consumption of Uploaded Package\nSee [conan-package-binary-consume-example](https://github.com/shreyasbharath/conan-package-binary-consume-example) to understand how to extract the contents of the uploaded package to a client project for consumption by the client project's build process.\n\n# Credits\nA big thanks to @memsharded and @drodri for their help.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshreyasbharath%2Fconan-package-binary-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshreyasbharath%2Fconan-package-binary-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshreyasbharath%2Fconan-package-binary-example/lists"}