Skip to content
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

qgeoview: add qgeoview/1.0.4 #19694

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/qgeoview/all/conandata.yml
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"
73 changes: 73 additions & 0 deletions recipes/qgeoview/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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"
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
xakod marked this conversation as resolved.
Show resolved Hide resolved
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"fPIC": True,
}

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def requirements(self):
self.requires("qt/6.5.3")

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):
self.cpp_info.libs = ["qgeoview"]
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"]
19 changes: 19 additions & 0 deletions recipes/qgeoview/all/test_package/CMakeLists.txt
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()
32 changes: 32 additions & 0 deletions recipes/qgeoview/all/test_package/conanfile.py
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")
14 changes: 14 additions & 0 deletions recipes/qgeoview/all/test_package/test_package.cpp
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;
}
3 changes: 3 additions & 0 deletions recipes/qgeoview/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.0.4":
folder: all
Loading