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

eigen: Use export_conanadata_patches and explicit test_type #13721

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 6 additions & 7 deletions recipes/eigen/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain
from conan.tools.files import apply_conandata_patches, copy, get, rmdir
from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir

required_conan_version = ">=1.50.0"
required_conan_version = ">=1.52.0"


class EigenConan(ConanFile):
Expand All @@ -13,8 +13,7 @@ class EigenConan(ConanFile):
homepage = "http://eigen.tuxfamily.org"
description = "Eigen is a C++ template library for linear algebra: matrices, vectors," \
" numerical solvers, and related algorithms."
topics = ("eigen", "algebra", "linear-algebra", "vector", "numerical")

topics = ("algebra", "linear-algebra", "matrix", "vector", "numerical")
settings = "os", "arch", "compiler", "build_type"
options = {
"MPL2_only": [True, False],
Expand All @@ -31,14 +30,14 @@ def layout(self):
cmake_layout(self, src_folder="src")

def export_sources(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
copy(self, patch["patch_file"], self.recipe_folder, self.export_sources_folder)
export_conandata_patches(self)

def package_id(self):
self.info.clear()

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
Expand Down
6 changes: 3 additions & 3 deletions recipes/eigen/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16)
project(test_package)
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES CXX)

find_package(Eigen3 REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} Eigen3::Eigen)
target_link_libraries(${PROJECT_NAME} PRIVATE Eigen3::Eigen)
1 change: 1 addition & 0 deletions recipes/eigen/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)
Expand Down
4 changes: 2 additions & 2 deletions recipes/eigen/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ int main(void)
Eigen::MatrixXi A(N, N);
A.setRandom();

std::cout << "A =\n" << A << '\n' <<std::endl;
std::cout << "A(2..3,:) =\n" << A.middleRows(2, 2) << std::endl;
std::cout << "A =\n" << A << "\n\n"
<< "A(2..3,:) =\n" << A.middleRows(2, 2) << "\n";

return 0;
}
6 changes: 2 additions & 4 deletions recipes/eigen/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ project(test_package)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

find_package(Eigen3 REQUIRED CONFIG)

add_executable(${PROJECT_NAME} ../test_package/test_package.cpp)
target_link_libraries(${PROJECT_NAME} Eigen3::Eigen)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
${CMAKE_CURRENT_BINARY_DIR}/test_package/)