-
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.
- Loading branch information
Showing
8 changed files
with
177 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"1.0.4": | ||
url: "https://github.com/AmonRaNet/QGeoView/archive/refs/tags/1.0.4.tar.gz" | ||
sha256: "fb2a7c10b4f89b5ea7faa6d1e33947a8937444eeb71f307c531e4d8e497a40ee" |
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,77 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout | ||
from conan.tools.files import copy, get | ||
from conan.tools.scm import Version | ||
import os | ||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class QGeoViewConan(ConanFile): | ||
name = "qgeoview" | ||
description = "QGeoView is a Qt / C ++ widget for visualizing geographic data. " | ||
license = "LGPL-3.0" | ||
topics = ("geo", "geospatial", "qt") | ||
homepage = "https://github.com/AmonRaNet/QGeoView" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"fPIC": True, | ||
} | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
self.options.rm_safe("fPIC") | ||
# FIXME: we shouldn't have to force shared in qt, but config file | ||
# generated by conan in qt static is likely broken, or maybe env vars. | ||
self.options["qt"].shared = True | ||
|
||
def requirements(self): | ||
if Version(self.version) >= "2.0.0": | ||
self.requires("qt/6.4.1") | ||
else: | ||
self.requires("qt/5.15.9") | ||
|
||
def validate(self): | ||
if self.info.settings.compiler.cppstd: | ||
min_cppstd = "11" if Version(self.dependencies["qt"].ref.version) < "6.0.0" else "17" | ||
check_min_cppstd(self, min_cppstd) | ||
if not (self.dependencies["qt"].options.gui and self.dependencies["qt"].options.widgets): | ||
raise ConanInvalidConfiguration(f"{self.ref} requires qt gui and widgets") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["QT_VERSION"] = self.dependencies["qt"].ref.version | ||
tc.generate() | ||
deps = CMakeDeps(self) | ||
deps.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) | ||
cmake = CMake(self) | ||
cmake.install() | ||
|
||
def package_info(self): | ||
postfix = "d" if self.settings.build_type == "Debug" else "" | ||
self.cpp_info.libs = [f"qgeoview{postfix}"] | ||
self.cpp_info.libdirs = ['lib', os.path.join('lib','static')] # Directories where libraries can be found | ||
self.cpp_info.requires = ["qt::qtCore", "qt::qtGui", "qt::qtWidgets", "qt::qtNetwork"] |
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,19 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package LANGUAGES CXX) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
|
||
find_package(qgeoview REQUIRED CONFIG) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE qgeoview::qgeoview) | ||
|
||
if(QT_VERSION VERSION_GREATER_EQUAL "6.0.0") | ||
find_package(Qt6 COMPONENTS Core Widgets REQUIRED CONFIG) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Widgets) | ||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) | ||
elseif(QT_VERSION VERSION_GREATER_EQUAL "5.0.0") | ||
find_package(Qt5 COMPONENTS Core Widgets REQUIRED CONFIG) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Widgets) | ||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) | ||
else() | ||
message(FATAL_ERROR "Qt < 5 not yet supported in this recipe") | ||
endif() |
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,32 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["QT_VERSION"] = self.dependencies["qt"].ref.version | ||
tc.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
# can't run in Linux agents (headless) | ||
if can_run(self) and self.settings.os != "Linux": | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
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,14 @@ | ||
#include <QGeoView/QGVWidget.h> | ||
|
||
#include <QApplication> | ||
#include <QMainWindow> | ||
|
||
int main(int argc, char *argv[]) { | ||
QApplication app(argc, argv); | ||
QMainWindow window; | ||
|
||
QGVWidget gvWidget; | ||
window.setCentralWidget(&gvWidget); | ||
|
||
return 0; | ||
} |
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,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ | ||
${CMAKE_CURRENT_BINARY_DIR}/test_package/) |
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,20 @@ | ||
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): | ||
with tools.run_environment(self): | ||
cmake = CMake(self) | ||
cmake.definitions["QT_VERSION"] = self.deps_cpp_info["qt"].version | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
# can't run in Linux agents (headless) | ||
if not (tools.cross_building(self) or self.settings.os == "Linux"): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
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: | ||
"1.0.4": | ||
folder: all |