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 proposal/7.5.1 and update recipe for conan2 #16851

Merged
merged 17 commits into from
Apr 14, 2023
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
75 changes: 39 additions & 36 deletions recipes/proposal/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
sources:
"7.0.2":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.2.tar.gz"
sha256: "8166ffca150abce77cc4254343bb89d3476e17910e96fa4936b87dafcc72d592"
"7.0.4":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.4.tar.gz"
sha256: "1442b9f5d8824e7794e97a2eca3f5f109e33c423a37714ada9ad98435b4d4b01"
"7.0.5":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.5.tar.gz"
sha256: "232f84e410f439e6bc1b721fc65280906e9f6ad5b39490561870d42a1ee1af17"
"7.0.7":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.7.tar.gz"
sha256: "e366e9280fbe99e68bc5b31a74f51610e27ca8a646dff28e883573893572ab75"
"7.1.0":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.1.0.tar.gz"
sha256: "98faba7cd9d743dae2a8bec70b1c4a382339b9fa40b71fda2936c9d7054d7a85"
"7.1.1":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.1.1.tar.gz"
sha256: "090e885d6f241b87a98234571cc1bd2ff935933365717e327602ea37f4d3548a"
"7.2.1":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.2.1.tar.gz"
sha256: "279c1b897c8ae426a493ca77e01c8cfd47e8cd313f3e35ed3ddf098dcccdeeda"
"7.3.0":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.3.0.tar.gz"
sha256: "fa3763fee656164e5f3a7d6a11f08771dd70700adb93de9db4625ad981e0defb"
"7.3.1":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.3.1.tar.gz"
sha256: "260426f71226c888832a6da47c55c05dab31b8240dbbc67b4b2466af24d962d3"
"7.4.0":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.0.tar.gz"
sha256: "34865a84052c670fbc4554361acef716655906f65f5bba88e3fd73dff92989de"
"7.4.1":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.1.tar.gz"
sha256: "e6ff9749f402dd77f320a2a28b77a45636cbe186f926d9b5a7b54ea6ee631ada"
"7.4.2":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.2.tar.gz"
sha256: "f0db44c96a80a6ce3dda02c598574f5f0209376bd2c6c176797710da8eb3e108"
"7.5.1":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.5.1.tar.gz"
sha256: "2a283bfc335c4b6b01d2acc1eea1a5e4c456bd3dd11e41ef24ca3d955c9655a3"
"7.5.0":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.5.0.tar.gz"
sha256: "ba31bd0a2337f3717a1ad88a3b3f7fefa3f1e4dae4fc922e72144cfecffe5e94"
"7.4.2":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.2.tar.gz"
sha256: "f0db44c96a80a6ce3dda02c598574f5f0209376bd2c6c176797710da8eb3e108"
"7.4.1":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.1.tar.gz"
sha256: "e6ff9749f402dd77f320a2a28b77a45636cbe186f926d9b5a7b54ea6ee631ada"
"7.4.0":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.0.tar.gz"
sha256: "34865a84052c670fbc4554361acef716655906f65f5bba88e3fd73dff92989de"
"7.3.1":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.3.1.tar.gz"
sha256: "260426f71226c888832a6da47c55c05dab31b8240dbbc67b4b2466af24d962d3"
"7.3.0":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.3.0.tar.gz"
sha256: "fa3763fee656164e5f3a7d6a11f08771dd70700adb93de9db4625ad981e0defb"
"7.2.1":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.2.1.tar.gz"
sha256: "279c1b897c8ae426a493ca77e01c8cfd47e8cd313f3e35ed3ddf098dcccdeeda"
"7.1.1":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.1.1.tar.gz"
sha256: "090e885d6f241b87a98234571cc1bd2ff935933365717e327602ea37f4d3548a"
"7.1.0":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.1.0.tar.gz"
sha256: "98faba7cd9d743dae2a8bec70b1c4a382339b9fa40b71fda2936c9d7054d7a85"
"7.0.7":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.7.tar.gz"
sha256: "e366e9280fbe99e68bc5b31a74f51610e27ca8a646dff28e883573893572ab75"
"7.0.5":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.5.tar.gz"
sha256: "232f84e410f439e6bc1b721fc65280906e9f6ad5b39490561870d42a1ee1af17"
"7.0.4":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.4.tar.gz"
sha256: "1442b9f5d8824e7794e97a2eca3f5f109e33c423a37714ada9ad98435b4d4b01"
"7.0.2":
url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.2.tar.gz"
sha256: "8166ffca150abce77cc4254343bb89d3476e17910e96fa4936b87dafcc72d592"
70 changes: 36 additions & 34 deletions recipes/proposal/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
import os
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.files import get, rmdir, copy
from conan.tools.cmake import CMake, CMakeToolchain
from conan.errors import ConanInvalidConfiguration
from conan.tools.scm import Version
from conan.tools.microsoft import is_msvc

required_conan_version = ">=1.43.0"
required_conan_version = ">=1.53.0"


class PROPOSALConan(ConanFile):
name = "proposal"
homepage = "https://github.com/tudo-astroparticlephysics/PROPOSAL"
license = "LGPL-3.0"
exports_sources = "CMakeLists.txt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is not required anymore

package_type = "library"
url = "https://github.com/conan-io/conan-center-index"
description = "monte Carlo based lepton and photon propagator"
topics = ("propagator", "lepton", "photon", "stochastic")
Expand All @@ -26,29 +32,28 @@ class PROPOSALConan(ConanFile):
"with_python": False,
}

generators = "cmake", "cmake_find_package"
_cmake = None
generators = "CMakeDeps"

@property
def _source_subfolder(self):
return "source_subfolder"
Comment on lines 37 to 39
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a layout is missing, and this attribute could be removed


@property
def _is_msvc(self):
return str(self.settings.compiler) in ["Visual Studio", "msvc"]

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
self.options.rm_safe("fPIC")

def configure(self):
if self.options.shared:
del self.options.fPIC
self.options.rm_safe("fPIC")

def requirements(self):
self.requires("cubicinterpolation/0.1.4")
self.requires("spdlog/1.9.2")
self.requires("nlohmann_json/3.10.5")
# cubicinterpolation: headers are transitively included, and function calls are made
# from implementation in headers (templates)
self.requires("cubicinterpolation/0.1.4", transitive_headers=True, transitive_libs=True)
# spdlog: requires transitive_libs due to direct calls to functionality from headers
self.requires("spdlog/1.9.2", transitive_headers=True, transitive_libs=True)
# nlohmann_json: public headers include json.hpp and json_fwd.hpp
self.requires("nlohmann_json/3.10.5", transitive_headers=True)
if self.options.with_python:
self.requires("pybind11/2.9.1")

Expand All @@ -57,48 +62,45 @@ def _minimum_compilers_version(self):
return {"Visual Studio": "15", "gcc": "5", "clang": "5", "apple-clang": "5"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can add "msvc": "191" to this dictionary


def validate(self):
if self._is_msvc and self.options.shared:
if is_msvc(self) and self.options.shared:
raise ConanInvalidConfiguration(
"Can not build shared library on Visual Studio."
)
if self.settings.compiler.get_safe("cppstd"):
tools.check_min_cppstd(self, "14")
check_min_cppstd(self, "14")

minimum_version = self._minimum_compilers_version.get(
str(self.settings.compiler), False
)
if not minimum_version:
self.output.warn(
self.output.warning(
"PROPOSAL requires C++14. Your compiler is unknown. Assuming it supports C++14."
)
elif tools.Version(self.settings.compiler.version) < minimum_version:
elif Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
"PROPOSAL requires gcc >= 5, clang >= 5 or Visual Studio >= 15 as a compiler!"
)

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

def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions["BUILD_TESTING"] = False
self._cmake.definitions["BUILD_PYTHON"] = self.options.with_python
self._cmake.definitions["BUILD_DOCUMENTATION"] = False
self._cmake.configure()
return self._cmake
get(self, **self.conan_data["sources"][self.version], strip_root=True)

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

def package(self):
self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder)
cmake = self._configure_cmake()
copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))

def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["BUILD_TESTING"] = False
tc.cache_variables["BUILD_PYTHON"] = self.options.with_python
tc.cache_variables["BUILD_DOCUMENTATION"] = False
tc.generate()

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "PROPOSAL")
Expand Down
3 changes: 0 additions & 3 deletions recipes/proposal/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
cmake_minimum_required(VERSION 3.1)
project(test_package CXX)

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

find_package(PROPOSAL REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
Expand Down
19 changes: 13 additions & 6 deletions recipes/proposal/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
from conans import ConanFile, CMake, tools
import os

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

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

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):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")
3 changes: 3 additions & 0 deletions recipes/proposal/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "PROPOSAL/PROPOSAL.h"
#include "PROPOSAL/Logging.h"
#include <iostream>
#include <memory>

Expand All @@ -18,4 +19,6 @@ int main()
<< particle.name << " in " << target.GetName()
<< " is: " << dEdx << " MeV * cm^2 / g" << std::endl;
}

PROPOSAL::Logging::Get("proposal.conan_test_package")->warn("logging test");
}
8 changes: 8 additions & 0 deletions recipes/proposal/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package CXX)

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

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
17 changes: 17 additions & 0 deletions recipes/proposal/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from conans import ConanFile, CMake, tools
import os


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

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

def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
26 changes: 14 additions & 12 deletions recipes/proposal/config.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
versions:
"7.0.2":
"7.5.1":
folder: all
"7.0.4":
"7.5.0":
folder: all
"7.0.5":
"7.4.2":
folder: all
"7.0.7":
"7.4.1":
folder: all
"7.1.0":
"7.4.0":
folder: all
"7.1.1":
"7.3.1":
folder: all
"7.3.0":
folder: all
"7.2.1":
folder: all
"7.3.0":
"7.1.1":
folder: all
"7.3.1":
"7.1.0":
folder: all
"7.4.0":
"7.0.7":
folder: all
"7.4.1":
"7.0.5":
folder: all
"7.4.2":
"7.0.4":
folder: all
"7.5.0":
"7.0.2":
folder: all