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

added recipe for qwt 6.1.6 #4528

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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/qwt/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"6.1.6":
url: "https://sourceforge.net/projects/qwt/files/qwt/6.1.6/qwt-6.1.6.zip"
sha256: "4b2452662ae64656aca92f1bef44a281229f77056689100af62c4b9f24462873"
108 changes: 108 additions & 0 deletions recipes/qwt/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import os
from conans import ConanFile, tools
from conans.errors import ConanInvalidConfiguration
boussaffawalid marked this conversation as resolved.
Show resolved Hide resolved


class QwtConan(ConanFile):
name = "qwt"
license = "Qwt License, Version 1.0"
boussaffawalid marked this conversation as resolved.
Show resolved Hide resolved
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://qwt.sourceforge.io/"
topics = ("conan", "archive", "compression")
description = (
"The Qwt library contains GUI Components and utility classes which are primarily useful for programs "
"with a technical background. Beside a framework for 2D plots it provides scales, sliders, dials, compasses, "
"thermometers, wheels and knobs to control or display values, arrays, or ranges of type double."
)
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
"plot": [True, False],
"widgets": [True, False],
"svg": [True, False],
"opengl": [True, False],
"mathml": [True, False],
"designer": [True, False]
}
default_options = {
"shared": False,
"fPIC": True,
"plot": True,
"widgets": True,
"opengl": True,
"designer": True,
"mathml": False,
"svg": False

}
generators = "qmake"

@property
def _source_subfolder(self):
return "source_subfolder"

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

boussaffawalid marked this conversation as resolved.
Show resolved Hide resolved
def requirements(self):
self.requires("qt/5.15.2")

def source(self):
tools.get(**self.conan_data["sources"][self.version])
os.rename("qwt-{}".format(self.version), self._source_subfolder)
boussaffawalid marked this conversation as resolved.
Show resolved Hide resolved

def _patch_qwt_config_files(self):
# qwtconfig.pri
qwtconfig_path = os.path.join(self.source_folder, self._source_subfolder, "qwtconfig.pri")
qwtconfig = tools.load(qwtconfig_path)

qwtconfig = "CONFIG += conan_basic_setup\ninclude(../conanbuildinfo.pri)\n" + qwtconfig
qwtconfig += "QWT_CONFIG {}= QwtDll\n".format("+" if self.options.shared else "-")
qwtconfig += "QWT_CONFIG {}= QwtPlot\n".format("+" if self.options.plot else "-")
qwtconfig += "QWT_CONFIG {}= QwtWidgets\n".format("+" if self.options.widgets else "-")
qwtconfig += "QWT_CONFIG {}= QwtSvg\n".format("+" if self.options.svg else "-")
qwtconfig += "QWT_CONFIG {}= QwtOpenGL\n".format("+" if self.options.opengl else "-")
qwtconfig += "QWT_CONFIG {}= QwtMathML\n".format("+" if self.options.mathml else "-")
qwtconfig += "QWT_CONFIG {}= QwtDesigner\n".format("+" if self.options.designer else "-")
tools.save(qwtconfig_path, qwtconfig)

# qwtbuild.pri
qwtbuild_path = os.path.join(self.source_folder, self._source_subfolder, "qwtbuild.pri")
qwtbuild = tools.load(qwtbuild_path)
# set build type
qwtbuild += "CONFIG -= debug_and_release\n"
qwtbuild += "CONFIG -= build_all\n"
qwtbuild += "CONFIG -= release\n"
qwtbuild += "CONFIG += {}\n".format("debug" if self.settings.build_type == "Debug" else "release")
if self.settings.build_type == "RelWithDebInfo":
qwtbuild += "CONFIG += force_debug_info\n"
tools.save(qwtbuild_path, qwtbuild)

def build(self):
self._patch_qwt_config_files()

if self.settings.os == "Windows":
boussaffawalid marked this conversation as resolved.
Show resolved Hide resolved
vcvars = tools.vcvars_command(self.settings)
self.run("{} && qmake {}".format(vcvars, self._source_subfolder), run_environment=True)
self.run("{} && nmake".format(vcvars))
else:
self.run("qmake {}".format(self._source_subfolder), run_environment=True)
self.run("make -j {}".format(tools.cpu_count()))

def package(self):
self.copy("COPYING", src=os.path.join(self._source_subfolder), dst="licenses")
self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "src"))
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.so*", dst="lib", keep_path=False, symlinks=True)
self.copy("*.dylib", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)

def package_info(self):
self.cpp_info.includedirs = ['include']
self.cpp_info.libs = ["qwtd"] if self.settings.build_type == "Debug" else ["qwt"]
self.env_info.QT_PLUGIN_PATH.append(os.path.join(self.package_folder, 'bin'))
self.env_info.QT_PLUGIN_PATH.append(os.path.join(self.package_folder, 'lib'))
self.cpp_info.defines = ['HAVE_QWT', 'QWT_DLL'] if self.options.shared else ['HAVE_QWT']
9 changes: 9 additions & 0 deletions recipes/qwt/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.5)
project(PackageTest CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

add_executable(example example.cpp)
target_link_libraries(example CONAN_PKG::qt CONAN_PKG::qwt)

16 changes: 16 additions & 0 deletions recipes/qwt/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from conans import ConanFile, CMake, tools
import os

class QwtTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "example")
self.run(bin_path, run_environment=True)
7 changes: 7 additions & 0 deletions recipes/qwt/all/test_package/example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <qwt_plot.h>

int main()
{
QwtPlot* plot;
return 0;
boussaffawalid marked this conversation as resolved.
Show resolved Hide resolved
}
3 changes: 3 additions & 0 deletions recipes/qwt/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"6.1.6":
folder: "all"