diff --git a/.travis.yml b/.travis.yml index e32e2df..7895e55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ env: global: - - CONAN_REFERENCE: "Qt/5.8.0" + - CONAN_REFERENCE: "Qt/5.9.2" - CONAN_USERNAME: "osechet" - - CONAN_CHANNEL: "testing" + - CONAN_CHANNEL: "stable" - CONAN_TOTAL_PAGES: 2 linux: &linux diff --git a/.travis/before_script.sh b/.travis/before_script.sh old mode 100644 new mode 100755 diff --git a/.travis/install.sh b/.travis/install.sh old mode 100644 new mode 100755 index eb73767..e55a2a5 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -20,4 +20,3 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then fi pip install conan_package_tools # It install conan too -conan user diff --git a/.travis/run.sh b/.travis/run.sh old mode 100644 new mode 100755 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..1e25348 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,5 @@ +@Library('jenkins-pipeline') _ + +// Implementation at: +// https://github.com/ufz/jenkins-pipeline-library/blob/master/vars/conanBuild.groovy +conanBuild("Qt/5.9.2") diff --git a/README.md b/README.md index 1e95eab..f3ae6f6 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ Conan package for Qt -------------------------------------------- -[![Build Status](https://travis-ci.org/osechet/conan-qt.svg?branch=testing/5.8.0)](https://travis-ci.org/osechet/conan-qt) +[![Build Status](https://travis-ci.org/osechet/conan-qt.svg?branch=stable/5.9.2)](https://travis-ci.org/osechet/conan-qt) -[![Build status](https://ci.appveyor.com/api/projects/status/gboj3x82d42eoasw/branch/testing/5.8.0?svg=true)](https://ci.appveyor.com/project/osechet/conan-qt) +[![Build status](https://ci.appveyor.com/api/projects/status/gboj3x82d42eoasw/branch/release/5.9.2?svg=true)](https://ci.appveyor.com/project/osechet/conan-qt) -[ ![Download](https://api.bintray.com/packages/osechet/Conan/Qt%3Aosechet/images/download.svg?version=5.8.0%3Atesting) ](https://bintray.com/osechet/Conan/Qt%3Aosechet/5.8.0%3Atesting/link) +[ ![Download](https://api.bintray.com/packages/osechet/Conan/Qt%3Aosechet/images/download.svg?version=5.9.2%3Astable) ](https://bintray.com/osechet/Conan/Qt%3Aosechet/5.9.2%3Astable/link) [Conan.io](https://conan.io) package for [Qt](https://www.qt.io) library. This package includes by default the Qt Base module (Core, Gui, Widgets, Network, ...). Others modules can be added using options. @@ -16,7 +16,7 @@ The packages generated with this **conanfile** can be found in [bintray.com](htt ### Basic setup ``` -$ conan install Qt/5.8.0@osechet/testing +$ conan install Qt/5.9.2@osechet/stable ``` ### Project setup @@ -25,7 +25,7 @@ If you handle multiple dependencies in your project is better to add a *conanfil ``` [requires] - Qt/5.8.0@osechet/testing + Qt/5.9.2@osechet/stable [options] Qt:shared=true # false @@ -57,4 +57,4 @@ Project setup installs the library (and all his dependencies) and generates the ### Upload packages to server - $ conan upload Qt/5.8.0@osechet/testing --all + $ conan upload Qt/5.9.2@osechet/stable --all diff --git a/appveyor.yml b/appveyor.yml index 0895b7f..c5822c8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,9 +5,9 @@ environment: PYTHON_VERSION: "2.7.8" PYTHON_ARCH: "32" - CONAN_REFERENCE: "Qt/5.8.0" + CONAN_REFERENCE: "Qt/5.9.2" CONAN_USERNAME: "osechet" - CONAN_CHANNEL: "testing" + CONAN_CHANNEL: "stable" VS150COMNTOOLS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\Tools\\" matrix: diff --git a/build.py b/build.py index d6a4c0d..9de59ca 100644 --- a/build.py +++ b/build.py @@ -1,22 +1,20 @@ - from conan.packager import ConanMultiPackager +import copy def main(): - """ - Main function. - """ - - builder = ConanMultiPackager(username="osechet", channel="testing") - builder.add_common_builds() + builder = ConanMultiPackager(username="osechet", archs = ["x86_64"]) + builder.add_common_builds(pure_c=False) filtered_builds = [] for settings, options, env_vars, build_requires in builder.builds: if settings["compiler"] == "Visual Studio": if settings["compiler.runtime"] == "MT" or settings["compiler.runtime"] == "MTd": # Ignore MT runtime continue - if settings["arch"] != "x86_64": - continue + new_options = copy.copy(options) + new_options["Qt:xmlpatterns"] = True + + filtered_builds.append([settings, new_options, env_vars, build_requires]) filtered_builds.append([settings, options, env_vars, build_requires]) builder.builds = filtered_builds diff --git a/conanfile.py b/conanfile.py index caa0d67..610b20c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,8 +1,8 @@ - import os from distutils.spawn import find_executable from conans import AutoToolsBuildEnvironment, ConanFile, tools, VisualStudioBuildEnvironment from conans.tools import cpu_count, os_info, SystemPackageTool +from distutils.util import strtobool def which(program): """ @@ -31,7 +31,7 @@ class QtConan(ConanFile): """ Qt Conan package """ name = "Qt" - version = "5.8.0" + version = "5.9.2" description = "Conan.io package for Qt library." source_dir = "qt5" settings = "os", "arch", "compiler", "build_type" @@ -49,9 +49,13 @@ class QtConan(ConanFile): "webengine": [True, False], "websockets": [True, False], "xmlpatterns": [True, False], + "x11extras": [True, False], "openssl": ["no", "yes", "linked"] } - default_options = "shared=True", "opengl=desktop", "canvas3d=False", "gamepad=False", "graphicaleffects=False", "imageformats=False", "location=False", "serialport=False", "svg=False", "tools=False", "webengine=False", "websockets=False", "xmlpatterns=False", "openssl=no" + default_options = ("shared=True", "opengl=desktop", "canvas3d=False", "gamepad=False", + "graphicaleffects=False", "imageformats=False", "location=False", + "serialport=False", "svg=False", "tools=False", "webengine=False", + "websockets=False", "xmlpatterns=False", "x11extras=True", "openssl=no") url = "http://github.com/osechet/conan-qt" license = "http://doc.qt.io/qt-5/lgpl.html" short_paths = True @@ -74,18 +78,23 @@ def system_requirements(self): full_pack_names += [pack_name + ":i386"] pack_names = full_pack_names + if os_info.linux_distro == "debian": + pack_names = ["libx11-dev", "libxext-dev", "libglu-dev"] + if pack_names: installer = SystemPackageTool() installer.update() # Update the package database installer.install(" ".join(pack_names)) # Install the package def config_options(self): - if self.settings.os != "Windows": + if not os_info.is_windows: del self.options.opengl del self.options.openssl + if not os_info.is_linux: + del self.options.x11extras def requirements(self): - if self.settings.os == "Windows": + if os_info.is_windows: if self.options.openssl == "yes": self.requires("OpenSSL/1.0.2l@conan/stable", dev=True) elif self.options.openssl == "linked": @@ -94,38 +103,21 @@ def requirements(self): def source(self): submodules = ["qtbase"] - if self.options.canvas3d: - submodules.append("qtcanvas3d") - if self.options.gamepad: - submodules.append("qtgamepad") - if self.options.graphicaleffects: - submodules.append("qtgraphicaleffects") - if self.options.imageformats: - submodules.append("qtimageformats") - if self.options.location: - submodules.append("qtlocation") - if self.options.serialport: - submodules.append("qtserialport") - if self.options.svg: - submodules.append("qtsvg") - if self.options.tools: - submodules.append("qttools") - if self.options.webengine: - submodules.append("qtwebengine") - if self.options.websockets: - submodules.append("qtwebsockets") - if self.options.xmlpatterns: - submodules.append("qtxmlpatterns") + for key, value in self.options.items(): + if key in ["shared"]: + continue + if (value == "False" or value == "True") and strtobool(value) == True: + submodules.append('qt' + key) major = ".".join(self.version.split(".")[:2]) - self.run("git clone https://code.qt.io/qt/qt5.git") + self.run("git clone http://code.qt.io/qt/qt5.git") self.run("cd %s && git checkout %s" % (self.source_dir, major)) self.run("cd %s && perl init-repository --no-update --module-subset=%s" % (self.source_dir, ",".join(submodules))) self.run("cd %s && git checkout v%s && git submodule update" % (self.source_dir, self.version)) - if self.settings.os != "Windows": + if not os_info.is_windows: self.run("chmod +x ./%s/configure" % self.source_dir) else: # Fix issue with sh.exe and cmake on Windows @@ -140,7 +132,7 @@ def build(self): to reuse it later in any other project. """ args = ["-opensource", "-confirm-license", "-nomake examples", "-nomake tests", - "-prefix %s" % self.package_folder] + "-qt-zlib", "-prefix %s" % self.package_folder] if not self.options.shared: args.insert(0, "-static") if self.settings.build_type == "Debug": @@ -148,7 +140,7 @@ def build(self): else: args.append("-release") - if self.settings.os == "Windows": + if os_info.is_windows: if self.settings.compiler == "Visual Studio": self._build_msvc(args) else: @@ -166,9 +158,9 @@ def _build_msvc(self, args): self.output.info("Using '%s %s' to build" % (build_command, " ".join(build_args))) env = {} - env.update({'PATH': ['%s/qtbase/bin' % self.conanfile_directory, - '%s/gnuwin32/bin' % self.conanfile_directory, - '%s/qtrepotools/bin' % self.conanfile_directory]}) + env.update({'PATH': ['%s/qtbase/bin' % self.source_folder, + '%s/gnuwin32/bin' % self.source_folder, + '%s/qtrepotools/bin' % self.source_folder]}) # it seems not enough to set the vcvars for older versions if self.settings.compiler == "Visual Studio": if self.settings.compiler.version == "14": @@ -186,35 +178,29 @@ def _build_msvc(self, args): env_build = VisualStudioBuildEnvironment(self) env.update(env_build.vars) + vcvars = tools.vcvars_command(self.settings) - # Workaround for conan-io/conan#1408 - for name, value in env.items(): - if not value: - del env[name] - with tools.environment_append(env): - vcvars = tools.vcvars_command(self.settings) - - args += ["-opengl %s" % self.options.opengl] - if self.options.openssl == "no": - args += ["-no-openssl"] - elif self.options.openssl == "yes": - args += ["-openssl"] - else: - args += ["-openssl-linked"] + args += ["-opengl %s" % self.options.opengl] + if self.options.openssl == "no": + args += ["-no-openssl"] + elif self.options.openssl == "yes": + args += ["-openssl"] + else: + args += ["-openssl-linked"] - self.run("cd %s && %s && set" % (self.source_dir, vcvars)) - self.run("cd %s && %s && configure %s" - % (self.source_dir, vcvars, " ".join(args))) - self.run("cd %s && %s && %s %s" - % (self.source_dir, vcvars, build_command, " ".join(build_args))) - self.run("cd %s && %s && %s install" % (self.source_dir, vcvars, build_command)) + self.run("%s && cd %s && set" % (vcvars, self.source_dir)) + self.run("%s && cd %s && configure %s" + % (vcvars, self.source_dir, " ".join(args))) + self.run("%s && cd %s && %s %s" + % (vcvars, self.source_dir, build_command, " ".join(build_args))) + self.run("%s && cd %s && %s install" % (vcvars, self.source_dir, build_command)) def _build_mingw(self, args): env_build = AutoToolsBuildEnvironment(self) - env = {'PATH': ['%s/bin' % self.conanfile_directory, - '%s/qtbase/bin' % self.conanfile_directory, - '%s/gnuwin32/bin' % self.conanfile_directory, - '%s/qtrepotools/bin' % self.conanfile_directory], + env = {'PATH': ['%s/bin' % self.source_folder, + '%s/qtbase/bin' % self.source_folder, + '%s/gnuwin32/bin' % self.source_folder, + '%s/qtrepotools/bin' % self.source_folder], 'QMAKESPEC': 'win32-g++'} env.update(env_build.vars) with tools.environment_append(env): @@ -237,7 +223,7 @@ def _build_mingw(self, args): self.run("cd %s && mingw32-make install" % (self.source_dir)) def _build_unix(self, args): - if self.settings.os == "Linux": + if os_info.is_linux: args += ["-silent", "-xcb"] if self.settings.arch == "x86": args += ["-platform linux-g++-32"] @@ -255,19 +241,21 @@ def package_info(self): libs = ['Concurrent', 'Core', 'DBus', 'Gui', 'Network', 'OpenGL', 'Sql', 'Test', 'Widgets', 'Xml'] + if 'x11extras' in self.options and self.options.x11extras == True: + libs += ['X11Extras'] self.cpp_info.libs = [] self.cpp_info.includedirs = ["include"] for lib in libs: - if self.settings.os == "Windows" and self.settings.build_type == "Debug": + if os_info.is_windows and self.settings.build_type == "Debug": suffix = "d" - elif self.settings.os == "Macos" and self.settings.build_type == "Debug": + elif os_info.is_macos and self.settings.build_type == "Debug": suffix = "_debug" else: suffix = "" self.cpp_info.libs += ["Qt5%s%s" % (lib, suffix)] self.cpp_info.includedirs += ["include/Qt%s" % lib] - if self.settings.os == "Windows": + if os_info.is_windows: # Some missing shared libs inside QML and others, but for the test it works self.env_info.path.append(os.path.join(self.package_folder, "bin")) diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index 9ec0cdf..90535d8 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -9,7 +9,7 @@ if(APPLE) set(CMAKE_SKIP_RPATH 0) endif(APPLE) -configure_file(qt.conf.in ${CMAKE_BINARY_DIR}/bin/qt.conf) +configure_file(qt.conf.in ${PROJECT_BINARY_DIR}/bin/qt.conf) find_package(Qt5Core REQUIRED) diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 26336e9..a2b176f 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -1,22 +1,27 @@ - +from conans.model.conan_file import ConanFile +from conans import CMake import os -from conans import ConanFile, CMake -# This easily allows to copy the package in other user or channel -CHANNEL = os.getenv("CONAN_CHANNEL", "testing") -USERNAME = os.getenv("CONAN_USERNAME", "osechet") +############### CONFIGURE THESE VALUES ################## +default_user = "osechet" +default_channel = "stable" +######################################################### + +channel = os.getenv("CONAN_CHANNEL", default_channel) +username = os.getenv("CONAN_USERNAME", default_user) class QtTestConan(ConanFile): """ Qt Conan package test """ - - requires = "Qt/5.8.0@%s/%s" % (USERNAME, CHANNEL) + name = "DefaultName" + version = "0.1" + requires = "Qt/5.9.2@%s/%s" % (username, channel) settings = "os", "compiler", "build_type", "arch" generators = "cmake", "virtualenv" def build(self): - cmake = CMake(self.settings) - self.run('cmake "%s" %s' % (self.conanfile_directory, cmake.command_line)) - self.run("cmake --build . %s" % cmake.build_config) + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): if self.settings.os == "Windows":