Skip to content
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

Add recipe for artery-font-format #6705

Merged
merged 8 commits into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions recipes/artery-font-format/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
Jairard marked this conversation as resolved.
Show resolved Hide resolved
"1.0":
url: "https://github.com/Chlumsky/artery-font-format/archive/refs/tags/v1.0.tar.gz"
sha256: "311172C09E6B74574C93C382EBB92212FFC1710DFCF04FC25376A575DFE16DA8"
22 changes: 22 additions & 0 deletions recipes/artery-font-format/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from conans import ConanFile, CMake, tools


class ArteryFontFormatConan(ConanFile):
Jairard marked this conversation as resolved.
Show resolved Hide resolved
name = "artery-font-format"
version = "1.0"
Jairard marked this conversation as resolved.
Show resolved Hide resolved
license = "MIT"
homepage = "https://github.com/Chlumsky/artery-font-format"
url = "https://github.com/conan-io/conan-center-index"
description = "Artery Atlas Font format library"
topics = ("conan", "artery", "font", "atlas")
no_copy_source = True

def source(self):
Jairard marked this conversation as resolved.
Show resolved Hide resolved
tools.get(**self.conan_data["sources"][self.version],
strip_root=True, destination=self.source_folder)
Jairard marked this conversation as resolved.
Show resolved Hide resolved
tools.tools_files.rename("artery-font", "include/artery-font")
Jairard marked this conversation as resolved.
Show resolved Hide resolved

def package(self):
self.copy("*.h")
self.copy("*.hpp")
self.copy("LICENSE.txt", dst="licenses", src=self.source_folder)
Jairard marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions recipes/artery-font-format/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.1)
project(test_package CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
file(COPY example.arfont DESTINATION ${CMAKE_BINARY_DIR})
Jairard marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 19 additions & 0 deletions recipes/artery-font-format/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from conans import ConanFile, CMake, tools
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package"
Jairard marked this conversation as resolved.
Show resolved Hide resolved

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

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

def test(self):
if not tools.cross_building(self.settings):
Jairard marked this conversation as resolved.
Show resolved Hide resolved
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
Jairard marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
28 changes: 28 additions & 0 deletions recipes/artery-font-format/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <cstdio>
#include <cstdlib>
#include <iostream>

#include <artery-font/std-artery-font.h>
#include <artery-font/stdio-serialization.h>
#include <stdlib.h>
Jairard marked this conversation as resolved.
Show resolved Hide resolved

int main() {
FILE *const font_file = fopen("example.arfont", "rb");
Jairard marked this conversation as resolved.
Show resolved Hide resolved
if (font_file == nullptr) {
std::cerr << "couldn't open font file" << std::endl;
return EXIT_FAILURE;
}

artery_font::StdArteryFont<float> font;
if (!artery_font::read(font, font_file)) {
std::cerr << "couldn't read artery font" << std::endl;
return EXIT_FAILURE;
}

if (fclose(font_file) != 0) {
std::cerr << "an error occured when closing font file" << std::endl;
return EXIT_FAILURE;
}

return EXIT_SUCCESS;
}
3 changes: 3 additions & 0 deletions recipes/artery-font-format/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.0":
folder: all