-
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
ios-cmake: migrate to Conan v2, improve test_package #21532
Draft
valgur
wants to merge
8
commits into
conan-io:master
Choose a base branch
from
valgur:migrate/ios-cmake
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+161
−99
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
47e9cde
ios-cmake: migrate to Conan v2, improve test_package
valgur 6a7f72e
ios-cmake: fix build
valgur f2d764e
ios-cmake: set default toolchain_target in config_options()
valgur 3b49f26
ios-cmake: drop a linter workaround
valgur 45c3127
Allow users to pass auto and have it be guessed
AbrilRBS 22f6f51
Revert "Allow users to pass auto and have it be guessed"
valgur f7cb71c
ios-cmake: allow toolchain_target to be set to 'auto'
valgur 796625d
ios-cmake: drop test_v1_package
valgur 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
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
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,2 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(empty) |
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,14 +1,31 @@ | ||
|
||
import os | ||
from conans import ConanFile | ||
|
||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os" | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "VirtualBuildEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build_requirements(self): | ||
self.tool_requires(self.tested_reference_str) | ||
|
||
def generate(self): | ||
info = self.dependencies.build["ios-cmake"].conf_info | ||
cmake_prog = info.get("user.ios-cmake:cmake_program", check_type=str) | ||
toolchain = info.get("user.ios-cmake:cmake_toolchain_file", check_type=str) | ||
assert os.path.basename(cmake_prog) == "cmake-wrapper" | ||
assert os.path.isfile(cmake_prog) | ||
assert os.path.basename(toolchain) == "ios.toolchain.cmake" | ||
assert os.path.isfile(toolchain) | ||
|
||
def test(self): | ||
if self.settings.os == "iOS": | ||
cmake_prog = os.environ.get("CONAN_CMAKE_PROGRAM") | ||
toolchain = os.environ.get("CONAN_CMAKE_TOOLCHAIN_FILE") | ||
assert (os.path.basename(cmake_prog) == "cmake-wrapper") | ||
assert (os.path.basename(toolchain) == "ios.toolchain.cmake") | ||
if can_run(self): | ||
self.run(f"cmake-wrapper {self.source_folder}") | ||
self.run("cmake-wrapper --build .") |
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 |
---|---|---|
|
@@ -7,3 +7,5 @@ versions: | |
folder: all | ||
"4.2.0": | ||
folder: all | ||
"4.4.1": | ||
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.
I think we can use the fact that we're migrating this to Conan 2 to remove the auto value altogether so we don't need to check for it later? wdyt @valgur?
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 don't think that would work. The logic in
config_options()
sets the default value to an appropriate one based onself.settings.os
and falls back toauto
if it cannot be determined. Theself._default_toolchain_target
property does not cover several Apple OS-s, notablyMacos
.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.
Oh so then the idea is that if it's not able to be guessed, we fail later in the validate if it's still set to auto? My only concern is that then running
conan create ... -o="&:toolchain_target=auto"
will always fail, the CLI value is overriding the decision in config_optionsThere 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.
Oh I see - I've pushed a minor change to let users pass auto and have it be still auto-guessed, let me know if it works for you :)
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.
Uhm...
self.options
always report their default value inconfigure()
, even if the user overrides them. But only ifpackge_type = "build-scripts"
for some reason.Second, it always fails with:
It would be great if the Conan client got rid of that artificial limitation. :/
The VTK PR (#10776) actually manages to work around that limitation through some black magic, basically doing:
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.
The
build-scripts
package type is super-buggy or simply inconsistent with the options handling overall, for some reason. The user-supplied option values are simply ignored and not even validated to be one of the allowed values.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.
Oooh... the options actually work, but only if I use
-o:b toolchain_target=...
. This could maybe be documented better.