-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removed Conan1 build.py file using conan package tools that are no longer supported * Working conan 1 and 2 build with the test package. updated the test_package to be updated to conan 2 and fixed missing cmake. Still need to check that the license file is packaged up and that the packages look identical before the changes * Removing debug prints and the license check that isn't working yet * Working license file copied over as it was before * Migrated the properties of cpp_info to conan 2. Keeping conan 1 support by checking the version of conan https://docs.conan.io/1/migrating_to_2.0/properties.html * Revert "Removed Conan1 build.py file using conan package tools that are no longer supported" This reverts commit a606d1d. * Need to add a set_version to parse the version from CMakeLists.txt Adding a package build yaml to ensure conan keeps building on 1 and 2 * Setting lowercase catch2 for pkg_config and cmake_target_name * Fixing the namespace for conan file cmake_target_name
- Loading branch information
1 parent
b817497
commit 62d4aec
Showing
5 changed files
with
127 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.2.0) | ||
project(test_package CXX) | ||
cmake_minimum_required(VERSION 3.15) | ||
project(PackageTest CXX) | ||
|
||
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") | ||
conan_basic_setup() | ||
find_package(Catch2 CONFIG REQUIRED) | ||
|
||
find_package(Catch2 REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
|
||
target_link_libraries(${PROJECT_NAME} Catch2::Catch2WithMain) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14) | ||
add_executable(test_package test_package.cpp) | ||
target_link_libraries(test_package Catch2::Catch2WithMain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,33 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
from conans import ConanFile, CMake | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, cmake_layout | ||
from conan.tools.build import can_run | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake_find_package_multi", "cmake" | ||
generators = "CMakeToolchain", "CMakeDeps" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
assert os.path.isfile(os.path.join( | ||
self.deps_cpp_info["catch2"].rootpath, "licenses", "LICENSE.txt")) | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run("%s -s" % bin_path, run_environment=True) | ||
if can_run(self): | ||
cmd = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(cmd, env="conanrun") | ||
|
||
# If we are on conan 2 we can check the license info is populated | ||
if hasattr(self, 'dependencies'): | ||
catch2 = self.dependencies["catch2"] | ||
assert os.path.exists(f'{catch2.package_folder}/licenses/LICENSE.txt') | ||
assert catch2.license == 'BSL-1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Package Manager Builds | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
conan_builds: | ||
name: Conan ${{matrix.conan_version}} | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
conan_version: | ||
- '1.62' | ||
- '2.0' | ||
|
||
include: | ||
# Conan 1 has default profiles installed | ||
- conan_version: '1.62' | ||
profile_generate: 'false' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install conan | ||
run: pip install conan==${{matrix.conan_version}} | ||
|
||
- name: Setup conan profiles | ||
if: matrix.profile_generate != 'false' | ||
run: conan profile detect | ||
|
||
- name: Run conan package create | ||
run: conan create . -tf .conan/test_package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters