Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Configure and build (Windows)
if: runner.os == 'Windows'
run: |
conan install conanfile.py -of=build/ \
conan install conan/conanfile.py -of=build/ \
-pr:b conan/profile_windows_x86_64.txt \
-pr:h conan/profile_windows_x86_64.txt \
-o "&:unit_tests=True" \
Expand All @@ -75,6 +75,21 @@ jobs:
run: ./kickmsg_microbench --benchmark_min_time=0.1s
shell: bash

# Verify the Conan package recipe is well-formed and the package builds
# cleanly from the recipe (no local source leaking in).
conan-create:
name: Conan Create
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-conan

- name: conan create
run: |
conan profile detect
conan create conan/all --version=0.0.0 --build=missing
shell: bash

# Cross-compile for ARM64 (no run — just verify it compiles)
cross_arm64:
name: Cross-compile (linux-aarch64)
Expand Down Expand Up @@ -133,7 +148,7 @@ jobs:
# PyPI project must list this repository + environment `maintainer` as
# a trusted publisher). No API tokens stored in GitHub secrets.
release:
needs: [build, cross_arm64, build-wheels]
needs: [build, conan-create, cross_arm64, build-wheels]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-24.04
environment:
Expand Down
69 changes: 69 additions & 0 deletions conan/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout
from conan.tools.files import copy
import os

required_conan_version = ">=2.10.0"


class KickmsgRecipe(ConanFile):
name = "kickmsg"
license = "CeCILL-C"
url = "https://github.com/leducp/kickmsg"
description = "Lock-free shared-memory MPMC messaging library"
topics = ("ipc", "shared-memory", "lock-free", "pub-sub", "zero-copy")
package_type = "library"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}

def export_sources(self):
root = os.path.abspath(os.path.join(self.recipe_folder, "../.."))
copy(self, "CMakeLists.txt", src=root, dst=self.export_sources_folder)
copy(self, "include/*", src=root, dst=self.export_sources_folder)
copy(self, "src/*", src=root, dst=self.export_sources_folder)
copy(self, "cmake/*", src=root, dst=self.export_sources_folder)
copy(self, "LICENSE", src=root, dst=self.export_sources_folder)

def configure(self):
if self.options.get_safe("shared"):
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self)

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, 17)

def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["BUILD_UNIT_TESTS"] = "OFF"
tc.cache_variables["BUILD_BENCHMARKS"] = "OFF"
tc.cache_variables["BUILD_EXAMPLES"] = "OFF"
tc.cache_variables["ENABLE_TSAN"] = "OFF"
tc.generate()
deps = CMakeDeps(self)
deps.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
copy(self, "LICENSE", src=self.source_folder,
dst=os.path.join(self.package_folder, "licenses"))
copy(self, "*.h", src=os.path.join(self.source_folder, "include"),
dst=os.path.join(self.package_folder, "include"))
copy(self, "*.a", src=self.build_folder,
dst=os.path.join(self.package_folder, "lib"), keep_path=False)
copy(self, "*.lib", src=self.build_folder,
dst=os.path.join(self.package_folder, "lib"), keep_path=False)

def package_info(self):
self.cpp_info.libs = ["kickmsg"]
if self.settings.os == "Linux":
self.cpp_info.system_libs = ["rt", "pthread"]
73 changes: 25 additions & 48 deletions conan/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,32 @@
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy

import os

class KickmsgDev(ConanFile):
"""Local development conanfile — installs dependencies based on build options.

class KickmsgConan(ConanFile):
"""Conan package recipe for kickmsg.

For consumers: add kickmsg as a requirement in your conanfile:
self.requires("kickmsg/<version>")
Options mirror those in scripts/configure.sh and CMakeLists.txt.
setup_build.sh passes them via -o when calling conan install.
"""
name = "kickmsg"
license = "CeCILL-C"
url = "https://github.com/leducp/kickmsg"
description = "Lock-free shared-memory MPMC messaging library"
topics = ("ipc", "shared-memory", "lock-free", "pub-sub", "zero-copy")

settings = "os", "compiler", "build_type", "arch"

exports_sources = (
"CMakeLists.txt",
"include/*",
"src/*",
"os/*",
"LICENSE",
)

def layout(self):
cmake_layout(self)

def generate(self):
tc = CMakeToolchain(self)
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
copy(self, "LICENSE", src=self.source_folder,
dst=os.path.join(self.package_folder, "licenses"))
copy(self, "*.h", src=os.path.join(self.source_folder, "include"),
dst=os.path.join(self.package_folder, "include"))
copy(self, "*.a", src=self.build_folder,
dst=os.path.join(self.package_folder, "lib"), keep_path=False)
copy(self, "*.lib", src=self.build_folder,
dst=os.path.join(self.package_folder, "lib"), keep_path=False)

def package_info(self):
self.cpp_info.libs = ["kickmsg"]
if self.settings.os == "Linux":
self.cpp_info.system_libs = ["rt", "pthread"]
options = {
"unit_tests": [True, False],
"benchmarks": [True, False],
}
default_options = {
"unit_tests": False,
"benchmarks": False,
}

generators = "CMakeDeps"

def requirements(self):
if self.options.unit_tests:
self.requires("gtest/1.15.0")

if self.options.benchmarks:
self.requires("benchmark/1.9.1")

def configure(self):
if self.options.unit_tests:
self.options["gtest"].build_gmock = True
28 changes: 0 additions & 28 deletions conanfile.py

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/setup_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ fi
# Conan install
step "Installing Conan dependencies"
info "Installing $BUILD_TYPE dependencies..."
conan install "$PROJECT_DIR/conanfile.py" -of="$build_dir" $CONAN_PROFILE_ARGS $CONAN_OPTIONS --build=missing -s build_type=$BUILD_TYPE
conan install "$PROJECT_DIR/conan/conanfile.py" -of="$build_dir" $CONAN_PROFILE_ARGS $CONAN_OPTIONS --build=missing -s build_type=$BUILD_TYPE

# CMake configure
step "Configuring CMake ($BUILD_TYPE)"
Expand Down
Loading