Skip to content

Commit

Permalink
Merge pull request #213 from Ultimaker/5.1
Browse files Browse the repository at this point in the history
5.1
  • Loading branch information
casperlamboo authored Jul 13, 2022
2 parents 7e8fdce + 2e275d6 commit cd59fc9
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/conan-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: conan-package

# Exports the recipe, sources and binaries for Mac, Windows and Linux and upload these to the server such that these can
# be used downstream.
#
# It should run on pushes against main or CURA-* branches, but it will only create the binaries for main and release branches

on:
push:
paths:
- '*.material'
- '*.sig'
- 'conanfile.py'
- '.github/workflows/conan-package.yml'
- 'GitVersion.yml'
branches:
- main
- 'CURA-*'
- '[0-9]+.[0-9]+'
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
conan-recipe-version:
uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@main
with:
project_name: fdm_materials

conan-package-export-linux:
needs: [ conan-recipe-version ]
uses: ultimaker/cura/.github/workflows/conan-recipe-export.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }}
recipe_id_pr: ${{ needs.conan-recipe-version.outputs.recipe_id_pr }}
runs_on: 'ubuntu-20.04'
python_version: '3.10.4'
conan_config_branch: 'master'
conan_logging_level: 'info'
conan_export_binaries: true
secrets: inherit

notify-export:
if: ${{ always() }}
needs: [ conan-package-export-linux ]

uses: ultimaker/cura/.github/workflows/notify.yml@main
with:
success: ${{ contains(join(needs.*.result, ','), 'success') }}
success_title: "New Conan recipe exported in ${{ github.repository }}"
success_body: "Exported ${{ needs.conan-recipe-version.outputs.recipe_id_full }}"
failure_title: "Failed to export Conan Export in ${{ github.repository }}"
failure_body: "Failed to exported ${{ needs.conan-recipe-version.outputs.recipe_id_full }}"
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/requirements-conan-package.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
conan
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ _build_armhf/*
!cura_build/CMakeList.txt
!jedi_build/CMakeList.txt
!jedi_build/CPackConfig.cmake
/conanbuildinfo.txt
/graph_info.json
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# For MSVC flags, will be ignored on non-Windows OS's and this project in general. Only needed for cura-build-environment.
cmake_policy(SET CMP0091 NEW)

project(fdm-materials NONE)

cmake_minimum_required(VERSION 2.8.12)
Expand Down
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# fdm_materials

<p align="center">
<a href="https://github.com/Ultimaker/fdm_materials/actions/workflows/cicd.yml" alt="Unit Tests">
<img src="https://github.com/Ultimaker/fdm_materials/actions/workflows/cicd.yml/badge.svg" /></a>
<a href="https://github.com/Ultimaker/fdm_materials/actions/workflows/conan-package.yml" alt="Unit Tests">
<img src="https://github.com/Ultimaker/fdm_materials/actions/workflows/conan-package.yml/badge.svg" /></a>
<a href="https://github.com/Ultimaker/fdm_materials/issues" alt="Open Issues">
<img src="https://img.shields.io/github/issues/ultimaker/fdm_materials" /></a>
<a href="https://github.com/Ultimaker/fdm_materials/issues?q=is%3Aissue+is%3Aclosed" alt="Closed Issues">
<img src="https://img.shields.io/github/issues-closed/ultimaker/fdm_materials?color=g" /></a>
<a href="https://github.com/Ultimaker/fdm_materials/pulls" alt="Pull Requests">
<img src="https://img.shields.io/github/issues-pr/ultimaker/fdm_materials" /></a>
<a href="https://github.com/Ultimaker/fdm_materials/graphs/contributors" alt="Contributors">
<img src="https://img.shields.io/github/contributors/ultimaker/fdm_materials" /></a>
<a href="https://github.com/Ultimaker/fdm_materials" alt="Repo Size">
<img src="https://img.shields.io/github/repo-size/ultimaker/fdm_materials?style=flat" /></a>
<a href="https://github.com/Ultimaker/fdm_materials/blob/master/LICENSE" alt="License">
<img src="https://img.shields.io/github/license/ultimaker/fdm_materials?style=flat" /></a>
</p>


FDM material database, used in Cura.

## License

![License](https://img.shields.io/github/license/ultimaker/fdm_materials?style=flat)
fdm_materials is released under terms of the CC0-1.0 License. Terms of the license can be found in the LICENSE file. Or at
https://creativecommons.org/publicdomain/zero/1.0/

> But in general it boils down to:
> **We waive all rights to the extend of the law. You can copy, modify, distribute as you like, even for commercial purposes**
## How to set up a development environment

**FIXME: Add fdm_material specific instructions here.**

> **Note:**
> We are currently in the process of switch our builds and pipelines to an approach which uses [Conan](https://conan.io/)
> and pip to manage our dependencies, which are stored on our JFrog Artifactory server and in the pypi.org.
> At the moment not everything is fully ported yet, so bare with us.
If you want to develop Cura with fdm_materials see the Cura Wiki: [Running Cura from source](https://github.com/Ultimaker/Cura/wiki/Running-Cura-from-Source)

If you have never used [Conan](https://conan.io/) read their [documentation](https://docs.conan.io/en/latest/index.html)
which is quite extensive and well maintained. Conan is a Python program and can be installed using pip

```bash
pip install conan --upgrade
conan config install https://github.com/ultimaker/conan-config.git
conan profile new default --detect
```

**Community developers would have to remove the Conan `cura` repository because that one requires credentials.**
```bash
conan remote remove cura
```

## Creating a new fdm_materials Conan package

To create a new fdm_materials Conan package such that it can be used in Cura, run the following command:

```shell
conan export-pkg . uranium/<version>@<username>/<channel>
```

This package will be stored in the local Conan cache (`~/.conan/data` or `C:\Users\username\.conan\data` ) and can be used in downstream
projects, such as Cura, by adding it as a requirement in the `conanfile.py` or in `conandata.yml` if that project is set up
in such a way. You can also specify the override at the commandline, to use the newly created package, when you execute the `conan install`
command in the root of the consuming project, with:

```shell
conan install . -build=missing --update --require-override=fdm_materials/<version>@<username>/<channel>
```
43 changes: 43 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os

from conan import ConanFile
from conans import tools
from conan.errors import ConanInvalidConfiguration

required_conan_version = ">=1.47.0"


class FDM_MaterialsConan(ConanFile):
name = "fdm_materials"
license = "LGPL-3.0"
author = "Ultimaker B.V."
url = "https://github.com/Ultimaker/fdm_materials"
description = "FDM Material database"
topics = ("conan", "profiles", "cura", "ultimaker", "filament")
build_policy = "missing"
exports = "LICENSE*"
settings = "os", "compiler", "build_type", "arch"
no_copy_source = True
scm = {
"type": "git",
"subfolder": ".",
"url": "auto",
"revision": "auto"
}

def validate(self):
if tools.Version(self.version) <= tools.Version("4"):
raise ConanInvalidConfiguration("Only versions 5+ are support")

def layout(self):
self.cpp.package.resdirs = ["materials"]

def package(self):
self.copy("*.fdm_material", src = ".", dst = self.cpp.package.resdirs[0])
self.copy("*.sig", src = ".", dst = self.cpp.package.resdirs[0])

def package_id(self):
del self.info.settings.os
del self.info.settings.compiler
del self.info.settings.build_type
del self.info.settings.arch

0 comments on commit cd59fc9

Please sign in to comment.