-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wayland: Switch to MesonToolchain generator to allow cross-compiling
- Loading branch information
1 parent
5dec193
commit 5251310
Showing
3 changed files
with
111 additions
and
95 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
cmake_minimum_required(VERSION 3.16) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
find_package(wayland COMPONENTS wayland-client REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
add_executable(test_package test_package.c) | ||
target_link_libraries(test_package PRIVATE wayland::wayland-client) |
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,22 +1,28 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.tools.build import cross_building | ||
from conan.tools.cmake import CMake | ||
from conan.tools.gnu import PkgConfig | ||
from conan.tools.layout import basic_layout | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "pkg_config" | ||
generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" | ||
|
||
def layout(self): | ||
basic_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
if not tools.cross_building(self, skip_x64_x86=True): | ||
with tools.environment_append({'PKG_CONFIG_PATH': "."}): | ||
pkg_config = tools.PkgConfig("wayland-scanner") | ||
self.run('%s --version' % pkg_config.variables["wayland_scanner"], run_environment=True) | ||
if not cross_building(self): | ||
pkg_config = PkgConfig(self, "wayland-scanner", self.generators_folder) | ||
self.run('%s --version' % pkg_config.variables["wayland_scanner"], env="conanrun") | ||
|
||
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 not cross_building(self): | ||
cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(cmd, env="conanrun") |