-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 ignition-cmake #3268
Merged
Merged
Add ignition-cmake #3268
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a29b1e4
Add ignition-cmake
ad48778
Update recipes/ignition-cmake/all/conanfile.py
joxoby 6616199
Update recipes/ignition-cmake/all/test_package/CMakeLists.txt
joxoby 3b4b227
Update recipes/ignition-cmake/all/test_package/conanfile.py
joxoby 4594c32
Update recipes/ignition-cmake/all/conanfile.py
joxoby fc26c32
add dummy test cpp
cb6a367
Fix typo
2fa671d
Fixes
07e0368
Add patches and cmake wrapper
2333c24
ignition-cmake: get it building + succeed tests (#3)
madebr bf44e0e
Update recipes/ignition-cmake/all/test_package/src/CMakeLists.txt
joxoby 1bd6188
Update recipes/ignition-cmake/all/conanfile.py
joxoby 96b2ed3
Use build_modules
016020e
Revert "Use build_modules"
ee638b8
trigger CI
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"2.5.0": | ||
url: "https://github.com/ignitionrobotics/ign-cmake/archive/ignition-cmake2_2.5.0.zip" | ||
sha256: "6d35f015e259ec955f3abda64358a705ce5b3376c3df2ab5f0c17bea4b4e2f68" |
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,81 @@ | ||
import glob | ||
import os | ||
|
||
from conans import CMake, ConanFile, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
|
||
|
||
class IgnitionCmakeConan(ConanFile): | ||
name = "ignition-cmake" | ||
license = "Apache-2.0" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/ignitionrobotics/ign-cmake" | ||
description = "A set of CMake modules that are used by the C++-based Ignition projects." | ||
topics = ("ignition", "robotics", "cmake") | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
joxoby marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
_cmake = None | ||
|
||
@property | ||
def _minimum_cpp_standard(self): | ||
return 17 | ||
|
||
@property | ||
def _minimum_compilers_version(self): | ||
return { | ||
"Visual Studio": "16", | ||
"gcc": "7", | ||
"clang": "5", | ||
"apple-clang": "10", | ||
} | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
def _configure_cmake(self): | ||
if self._cmake is not None: | ||
return self._cmake | ||
self._cmake = CMake(self) | ||
self._cmake.configure(source_folder=self._source_subfolder) | ||
return self._cmake | ||
|
||
def configure(self): | ||
if self.settings.compiler.cppstd: | ||
tools.check_min_cppstd(self, self._minimum_cpp_standard) | ||
min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) | ||
if not min_version: | ||
self.output.warn( | ||
"{} recipe lacks information about the {} compiler support.".format( | ||
self.name, self.settings.compiler | ||
) | ||
) | ||
else: | ||
if tools.Version(self.settings.compiler.version) < min_version: | ||
raise ConanInvalidConfiguration( | ||
"{} requires c++17 support. The current compiler {} {} does not support it.".format( | ||
self.name, | ||
self.settings.compiler, | ||
self.settings.compiler.version, | ||
) | ||
) | ||
|
||
def source(self): | ||
joxoby marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tools.get(**self.conan_data["sources"][self.version]) | ||
os.rename(glob.glob("ign-cmake*")[0], self._source_subfolder) | ||
|
||
def build(self): | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy("LICENSE", dst="licenses", src=self._source_subfolder) | ||
cmake = self._configure_cmake() | ||
cmake.install() | ||
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
|
||
def package_info(self): | ||
version_major = tools.Version(self.version).major | ||
self.cpp_info.names["cmake_find_package"] = "ignition-cmake{}".format(self.version_major) | ||
self.cpp_info.names["cmake_find_package_multi"] = "ignition-cmake{}".format(self.version_major) | ||
joxoby marked this conversation as resolved.
Show resolved
Hide resolved
|
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,9 @@ | ||
cmake_minimum_required(VERSION 3.10.2) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
find_package(ignition-cmake2) | ||
joxoby marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
include(IgnUtils) | ||
joxoby marked this conversation as resolved.
Show resolved
Hide resolved
|
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,15 @@ | ||
import os | ||
|
||
from conans import CMake, ConanFile, tools | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
|
||
def test(self): | ||
pass | ||
joxoby marked this conversation as resolved.
Show resolved
Hide resolved
|
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,3 @@ | ||
versions: | ||
"2.5.0": | ||
folder: all |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to see on mobile but I believe the settings are not used.. can they be removed in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. Will remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the cmake script builds a test library.
I left it in to be certain it would select the correct toolchain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing
settings
results in error:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove
cmake_find_package
fromgenerators
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's currently not part of
generators
. You mean line:?