Skip to content

Commit 8ae78aa

Browse files
Merge pull request #135 from dreamer-coding/conan_package
2 parents 317e23d + 8a58f95 commit 8ae78aa

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

.github/workflows/conan_ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Conan CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.11"
23+
24+
- name: Install system packages
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y ninja-build pkg-config python3-pip build-essential
28+
29+
- name: Install Meson and Conan
30+
run: |
31+
pip install --upgrade pip
32+
pip install meson==1.3.2 conan==2.3.2
33+
34+
- name: Detect Conan profile
35+
run: conan profile detect
36+
37+
- name: Install dependencies
38+
run: conan install . --profile default --build=missing
39+
40+
- name: Build
41+
run: |
42+
meson setup builddir
43+
meson compile -C builddir
44+
45+
- name: Test
46+
run: meson test -C builddir
47+
48+
- name: Package
49+
run: conan create . --name=pizza_test --version=1.2.7

conanfile.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
from conan import ConanFile
2+
from conan.tools.meson import Meson, MesonToolchain
3+
from conan.tools.files import copy
4+
import os
5+
6+
class PizzaTestConan(ConanFile):
7+
name = "pizza_test"
8+
version = "1.2.7"
9+
license = "MPL-2.0"
10+
author = "Fossil Logic <[email protected]>"
11+
url = "https://github.com/fossillogic/fossil-test"
12+
description = "Unit testing framework for software projects"
13+
topics = ("testing", "mocking", "framework")
14+
15+
settings = "os", "compiler", "build_type", "arch"
16+
options = {"shared": [True, False]}
17+
default_options = {"shared": False}
18+
19+
exports_sources = "code/**", "meson.build", "meson.options"
20+
generators = "PkgConfigDeps"
21+
22+
def layout(self):
23+
"""Define a basic build/source folder layout"""
24+
self.folders.source = "."
25+
self.folders.build = "builddir"
26+
27+
def generate(self):
28+
"""Generate Meson toolchain files"""
29+
tc = MesonToolchain(self)
30+
tc.generate()
31+
32+
def build(self):
33+
"""Configure and build the project using Meson"""
34+
meson = Meson(self)
35+
meson.configure()
36+
meson.build()
37+
38+
def package(self):
39+
"""Install headers and libraries into package folder"""
40+
meson = Meson(self)
41+
meson.install()
42+
43+
# Ensure headers are included even if not installed by Meson
44+
copy(self, "*.h",
45+
src="code/logic/fossil/pizza",
46+
dst=os.path.join(self.package_folder, "include", "fossil", "pizza"))
47+
48+
def package_info(self):
49+
"""Set information for consumers of the package"""
50+
self.cpp_info.libs = ["pizza_test"]
51+
self.cpp_info.includedirs = ["include"]

0 commit comments

Comments
 (0)