-
Notifications
You must be signed in to change notification settings - Fork 3
Add conan recipe #13
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
Merged
Merged
Add conan recipe #13
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f8d25e6
Add conanfile
Hind-M 3fe3ae0
Add conan workflow
Hind-M 6363264
Use available flatbuffers version
Hind-M 655001f
Add flatbuffers as build requirement
Hind-M 23f0222
Handle conan package name and flatc target
Hind-M 5d9acc3
Use var for flatbuffers version
Hind-M 1d74156
Use hankhsu1996/setup-conan@v1.1.0
Hind-M 59c00fa
Use sccache
Hind-M File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: Conan | ||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| conan-package: | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
| - name: Run sccache-cache | ||
| uses: mozilla-actions/sccache-action@v0.0.9 | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Conan Environment | ||
| uses: hankhsu1996/setup-conan@v1.1.0 | ||
| with: | ||
| cache-dependencies: true | ||
| cache-tool: true | ||
|
|
||
| - name: Install conan dependencies | ||
| run: | | ||
| conan profile detect --force | ||
| conan install . --output-folder=build --build=missing -s:a compiler.cppstd=20 -o:a build_tests=True | ||
|
|
||
| - name: CMake configuration | ||
| run: | | ||
| cmake --preset conan-release \ | ||
| -DSPARROW_IPC_BUILD_TESTS=ON \ | ||
| -DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING \ | ||
| -DCMAKE_C_COMPILER_LAUNCHER=sccache \ | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=sccache | ||
|
|
||
| - name: Build tests | ||
| working-directory: build/build/Release | ||
| run: cmake --build . --config Release --target test_sparrow_ipc_lib | ||
|
|
||
| - name: Run tests | ||
| working-directory: build/build/Release | ||
| run: cmake --build . --config Release --target run_tests_with_junit_report | ||
|
|
||
| - name: Run sccache stat for check | ||
| shell: bash | ||
| run: ${SCCACHE_PATH} --show-stats |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| from conan import ConanFile | ||
| from conan.errors import ConanInvalidConfiguration | ||
| from conan.tools.build.cppstd import check_min_cppstd | ||
| from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout | ||
| from conan.tools.files import copy | ||
| from conan.tools.scm import Version | ||
| import os | ||
|
|
||
| required_conan_version = ">=2.0" | ||
|
|
||
| class SparrowIPCRecipe(ConanFile): | ||
| name = "sparrow-ipc" | ||
| description = "C++20 library for memory-mapped serialization of Apache Arrow data." | ||
| license = "BSD-3-Clause" | ||
| author = "QuantStack" | ||
| url = "https://github.com/QuantStack/sparrow-ipc" | ||
| homepage = "https://github.com/QuantStack/sparrow-ipc" | ||
| topics = ("arrow", "apache arrow", "columnar format", "dataframe", "ipc", "serialization", "deserialization", "flatbuffers") | ||
| package_type = "library" | ||
| settings = "os", "arch", "compiler", "build_type" | ||
| exports_sources = "include/*", "src/*", "cmake/*", "CMakeLists.txt", "LICENSE" | ||
| options = { | ||
| "shared": [True, False], | ||
| "fPIC": [True, False], | ||
| "build_tests": [True, False], | ||
| } | ||
| default_options = { | ||
| "shared": False, | ||
| "fPIC": True, | ||
| "build_tests": False, | ||
| } | ||
|
|
||
| _flatbuffers_version = "24.12.23" | ||
|
|
||
| def config_options(self): | ||
| if self.settings.os == "Windows": | ||
| del self.options.fPIC | ||
|
|
||
| def configure(self): | ||
| if self.options.shared: | ||
| self.options.rm_safe("fPIC") | ||
|
|
||
| def requirements(self): | ||
| self.requires("sparrow/1.0.0") | ||
| self.requires(f"flatbuffers/{self._flatbuffers_version}") | ||
| if self.options.get_safe("build_tests"): | ||
| self.test_requires("doctest/2.4.12") | ||
|
|
||
| def build_requirements(self): | ||
| self.tool_requires("cmake/[>=3.28.1 <4.2.0]") | ||
| self.tool_requires(f"flatbuffers/{self._flatbuffers_version}") | ||
|
|
||
| @property | ||
| def _min_cppstd(self): | ||
| return 20 | ||
|
|
||
| @property | ||
| def _compilers_minimum_version(self): | ||
| return { | ||
| "apple-clang": "16", | ||
| "clang": "18", | ||
| "gcc": "12", | ||
| "msvc": "194" | ||
| } | ||
|
|
||
| def validate(self): | ||
| if self.settings.compiler.get_safe("cppstd"): | ||
| check_min_cppstd(self, self._min_cppstd) | ||
|
|
||
| minimum_version = self._compilers_minimum_version.get( | ||
| str(self.settings.compiler), False) | ||
| if minimum_version and Version(self.settings.compiler.version) < minimum_version: | ||
| raise ConanInvalidConfiguration( | ||
| f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." | ||
| ) | ||
|
|
||
| def layout(self): | ||
| cmake_layout(self, src_folder=".") | ||
|
|
||
| def generate(self): | ||
| deps = CMakeDeps(self) | ||
| deps.generate() | ||
|
|
||
| tc = CMakeToolchain(self) | ||
| tc.variables["SPARROW_IPC_BUILD_SHARED"] = self.options.shared | ||
| tc.variables["SPARROW_IPC_BUILD_TESTS"] = self.options.build_tests | ||
| tc.generate() | ||
|
|
||
| def build(self): | ||
| cmake = CMake(self) | ||
| cmake.configure() | ||
| cmake.build() | ||
|
|
||
| def package(self): | ||
| copy(self, "LICENSE", | ||
| dst=os.path.join(self.package_folder, "licenses"), | ||
| src=self.source_folder) | ||
| cmake = CMake(self) | ||
| cmake.install() | ||
|
|
||
| def package_info(self): | ||
| self.cpp_info.libs = ["sparrow-ipc"] | ||
| self.cpp_info.set_property("cmake_file_name", "sparrow-ipc") | ||
| self.cpp_info.set_property("cmake_target_name", "sparrow-ipc::sparrow-ipc") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just passing always pass "flatbuffers" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oups I didn't see this comment before (didn't get any notifications...sorry for the late reply):
Because when getting
flatbuffersfrom source (from GH repo), the package name isFlatBuffers: https://github.com/google/flatbuffers/blob/master/CMakeLists.txt#L7