Skip to content

Commit

Permalink
Change Conan stuff: it now (only) works with Conan 2.X
Browse files Browse the repository at this point in the history
  • Loading branch information
Morwenn committed Aug 11, 2023
1 parent a10a6fc commit 6605d2c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,7 +1,7 @@
![cpp-sort logo](docs/images/cpp-sort-logo.svg)

[![Latest Release](https://img.shields.io/badge/release-1.15.0-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/1.15.0)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F1.15.0-blue.svg)](https://conan.io/center/cpp-sort?version=1.15.0)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F1.15.0-blue.svg)](https://conan.io/center/recipes/cpp-sort?version=1.15.0)
[![Code Coverage](https://codecov.io/gh/Morwenn/cpp-sort/branch/develop/graph/badge.svg)](https://codecov.io/gh/Morwenn/cpp-sort)
[![Pitchfork Layout](https://img.shields.io/badge/standard-PFL-orange.svg)](https://github.com/vector-of-bool/pitchfork)

Expand Down
4 changes: 2 additions & 2 deletions conanfile.py
Expand Up @@ -58,12 +58,12 @@ def package(self):

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "cpp-sort")
self.cpp_info.set_property("cmake_target_name", "cpp-sort")
self.cpp_info.set_property("cmake_target_name", "cpp-sort::cpp-sort")
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []

if is_msvc(self):
self.cpp_info.cxxflags = ["/permissive-"]
self.cpp_info.cxxflags = ["/permissive-", "/Zc:preprocessor"]

def package_id(self):
self.info.clear() # Header-only
10 changes: 6 additions & 4 deletions docs/Tooling.md
Expand Up @@ -60,16 +60,18 @@ Note: when `CPPSORT_ENABLE_AUDITS` is `ON`, assertions in the library are enable
**cpp-sort** is available directly on [Conan Center][conan-center]. You can find the different versions available with the following command:

```sh
conan search cpp-sort --remote=conan-center
conan search cpp-sort --remote=conancenter
```

And then install any version to your local cache as follows (here with version 1.15.0):

```sh
conan install cpp-sort/1.15.0
conan install --requires=cpp-sort/1.15.0
```

The packages downloaded from conan-center are minimal and only contain the files required to use **cpp-sort** as a library: the headers, CMake files and licensing information. If you need anything else you have to build your own package with the `conanfile.py` available in this repository.
The packages downloaded from conan-center are minimal and only contain the files required to use **cpp-sort** as a library: the headers, CMake files and licensing information. If you need anything else you have to create your own package with the `conanfile.py` available in this repository.

*Changed in version 1.15.0:* the recipes now only target conan 2.X.

## Gollum

Expand All @@ -88,6 +90,6 @@ Due to slight markup differences, some pages might not fully render correctly bu
[catch2]: https://github.com/catchorg/Catch2
[cmake]: https://cmake.org/
[conan]: https://conan.io/
[conan-center]: https://conan.io/center/cpp-sort
[conan-center]: https://conan.io/center/recipes/cpp-sort
[gollum]: https://github.com/gollum/gollum
[libassert]: https://github.com/jeremy-rifkin/libassert
5 changes: 1 addition & 4 deletions test_package/CMakeLists.txt
@@ -1,13 +1,10 @@
# Copyright (c) 2018-2021 Morwenn
# Copyright (c) 2018-2023 Morwenn
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 2.8.11)

project(test_package LANGUAGES CXX)

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

find_package(cpp-sort REQUIRED CONFIG)

add_executable(${PROJECT_NAME} cpp-sort-integrity.cpp)
Expand Down
20 changes: 14 additions & 6 deletions test_package/conanfile.py
@@ -1,24 +1,32 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2018-2021 Morwenn
# Copyright (c) 2018-2023 Morwenn
# SPDX-License-Identifier: MIT

import os.path

from conans import CMake, ConanFile, tools
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run


class CppsortTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package_multi"
generators = "CMakeDeps", "CMakeToolchain"

def requirements(self):
self.requires(self.tested_reference_str)

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

def layout(self):
cmake_layout(self)

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
if can_run(self):
cmd = os.path.join(self.cpp.build.bindir, "test_package")
self.run(cmd, env="conanrun")

0 comments on commit 6605d2c

Please sign in to comment.