-
Notifications
You must be signed in to change notification settings - Fork 947
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 VxWorks to os in default settings.yml. (#10313) #10315
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import platform | ||
import textwrap | ||
|
||
import pytest | ||
|
||
from conans.test.assets.cmake import gen_cmakelists | ||
from conans.test.assets.sources import gen_function_cpp | ||
from conans.test.utils.tools import TestClient | ||
from conans.util.files import save | ||
|
||
|
||
@pytest.fixture | ||
def client(): | ||
c = TestClient() | ||
save(c.cache.new_config_path, "tools.env.virtualenv:auto_use=True") | ||
clang_profile = textwrap.dedent(""" | ||
[settings] | ||
arch=armv7 | ||
build_type=RelWithDebInfo | ||
compiler=clang | ||
compiler.libcxx=libstdc++11 | ||
compiler.version=12 | ||
os=VxWorks | ||
os.version=7 | ||
|
||
[buildenv] | ||
CC=clang | ||
CXX=clang++ | ||
""") | ||
conanfile = textwrap.dedent(""" | ||
import os | ||
from conans import ConanFile | ||
from conan.tools.cmake import CMake | ||
from conan.tools.layout import cmake_layout | ||
class Pkg(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
exports_sources = "*" | ||
generators = "CMakeToolchain" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
cmd = os.path.join(self.cpp.build.bindirs[0], "my_app") | ||
self.run(cmd, env=["conanrunenv"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This self.run() should fail if the binary was actually cross-built for vxwork os. It should be replaced for some check of the binary. |
||
""") | ||
c.save({"conanfile.py": conanfile, | ||
"clang": clang_profile, | ||
"CMakeLists.txt": gen_cmakelists(appname="my_app", appsources=["src/main.cpp"]), | ||
"src/main.cpp": gen_function_cpp(name="main")}) | ||
return c | ||
|
||
|
||
@pytest.mark.tool_cmake | ||
@pytest.mark.tool_clang(version="12") | ||
def test_clang_cmake_ninja(client): | ||
client.run("create . pkg/0.1@ -pr=clang -c tools.cmake.cmaketoolchain:generator=Ninja") | ||
assert 'cmake -G "Ninja"' in client.out | ||
assert "main __clang_major__12" in client.out | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In theory the binary created will not run in the current platform, is not executable, this shouldn't be possible. |
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.
Is
clang
the compiler used to cross-compile tovxworks
?For cross compiling, it is typically necessary to provide a
CC=full/path/to/cross/compiler
env-varThere 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.
clang and ldarm are available in the path in my docker container.
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.
Ok, good, I was mostly wondering if
clang
is the compiler actually used to compile to vxworks, and no other compiler should go here.