From 2e7741e6f6fe81a125594e7edad81c00c105c1b8 Mon Sep 17 00:00:00 2001 From: Garrick Meeker Date: Fri, 24 Nov 2023 11:58:59 -0800 Subject: [PATCH] (#5190) (#19991) (#20092) new wxwidgets recipe; ported from bincrafters to v2 --- recipes/wxwidgets/all/CMakeLists.txt | 11 + recipes/wxwidgets/all/conandata.yml | 22 + recipes/wxwidgets/all/conanfile.py | 473 ++++++++++++++++++ ...aa8b76128613a84f3d085eb1e4b05631083a.patch | 17 + .../wxwidgets/all/test_package/CMakeLists.txt | 13 + .../wxwidgets/all/test_package/conanfile.py | 26 + .../all/test_package/test_package.cpp | 27 + .../all/test_v1_package/CMakeLists.txt | 15 + .../all/test_v1_package/conanfile.py | 17 + recipes/wxwidgets/config.yml | 13 + 10 files changed, 634 insertions(+) create mode 100644 recipes/wxwidgets/all/CMakeLists.txt create mode 100644 recipes/wxwidgets/all/conandata.yml create mode 100644 recipes/wxwidgets/all/conanfile.py create mode 100644 recipes/wxwidgets/all/patches/d9deaa8b76128613a84f3d085eb1e4b05631083a.patch create mode 100644 recipes/wxwidgets/all/test_package/CMakeLists.txt create mode 100644 recipes/wxwidgets/all/test_package/conanfile.py create mode 100644 recipes/wxwidgets/all/test_package/test_package.cpp create mode 100644 recipes/wxwidgets/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/wxwidgets/all/test_v1_package/conanfile.py create mode 100644 recipes/wxwidgets/config.yml diff --git a/recipes/wxwidgets/all/CMakeLists.txt b/recipes/wxwidgets/all/CMakeLists.txt new file mode 100644 index 00000000000000..61f6e5ee39c9cb --- /dev/null +++ b/recipes/wxwidgets/all/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 2.8.12) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +if(APPLE) + add_definitions(-D__STDC_WANT_LIB_EXT1__) +endif() + +add_subdirectory("source_subfolder") diff --git a/recipes/wxwidgets/all/conandata.yml b/recipes/wxwidgets/all/conandata.yml new file mode 100644 index 00000000000000..a627427283f596 --- /dev/null +++ b/recipes/wxwidgets/all/conandata.yml @@ -0,0 +1,22 @@ +sources: + "3.1.4": + url: "https://github.com/wxWidgets/wxWidgets/archive/v3.1.4.tar.gz" + sha256: "f2698297b2d2c6d2372c23144c133e531248a64286c78ae17179155c94971d6f" + "3.1.5": + url: "https://github.com/wxWidgets/wxWidgets/archive/v3.1.5.tar.gz" + sha256: "e8fd5f9fbff864562aa4d9c094f898c97f5e1274c90f25beb0bfd5cb61319dea" + "3.2.0": + url: "https://github.com/wxWidgets/wxWidgets/archive/v3.2.0.tar.gz" + sha256: "43480e3887f32924246eb439520a3a2bc04d7947712de1ea0590c5b58dedadd9" + "3.2.1": + url: "https://github.com/wxWidgets/wxWidgets/archive/v3.2.1.tar.gz" + sha256: "89065a28e03fbf4ae90f2f56b7badb4c408daa6fd5df2986505e6057eba75144" + "3.2.2.1": + url: "https://github.com/wxWidgets/wxWidgets/archive/v3.2.2.1.tar.gz" + sha256: "0b96807e700288652f1538d8f7db25559cbb890f15fe2001ca7eef6f7cce3262" + "3.2.3": + url: "https://github.com/wxWidgets/wxWidgets/archive/v3.2.3.tar.gz" + sha256: "0eb9499c06778c6746dbd4aee2a124f1995a5db331e282d15237b0046c1788af" +patches: + "3.1.4": + - patch_file: "patches/d9deaa8b76128613a84f3d085eb1e4b05631083a.patch" diff --git a/recipes/wxwidgets/all/conanfile.py b/recipes/wxwidgets/all/conanfile.py new file mode 100644 index 00000000000000..bc01d70db35106 --- /dev/null +++ b/recipes/wxwidgets/all/conanfile.py @@ -0,0 +1,473 @@ +import os + +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file +from conan.tools.scm import Version +from conan.tools.system import package_manager + + +class wxWidgetsConan(ConanFile): + name = "wxwidgets" + description = "wxWidgets is a C++ library that lets developers create applications for Windows, macOS, " \ + "Linux and other platforms with a single code base." + topics = ("wxwidgets", "gui", "ui") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.wxwidgets.org" + license = "wxWidgets" + settings = "os", "arch", "compiler", "build_type" + + options = {"shared": [True, False], + "fPIC": [True, False], + "unicode": [True, False], + "compatibility": ["2.8", "3.0", "3.1", None], + "zlib": ["off", "zlib"], + "png": ["off", "libpng"], + "jpeg": ["off", "libjpeg", "libjpeg-turbo", "mozjpeg"], + "tiff": ["off", "libtiff"], + "expat": ["off", "expat"], + "regex": ["off", "regex"], + "svg": ["off", "nanosvg"], # TODO: cmake currently can't find "nanosvg" + "secretstore": [True, False], + "aui": [True, False], + "opengl": [True, False], + "html": [True, False], + "mediactrl": [True, False], + "propgrid": [True, False], + "debugreport": [True, False], + "ribbon": [True, False], + "richtext": [True, False], + "sockets": [True, False], + "stc": [True, False], + "webview": [True, False], + "xml": [True, False], + "xrc": [True, False], + "cairo": [True, False], + "help": [True, False], + "html_help": [True, False], + "url": [True, False], + "protocol": [True, False], + "fs_inet": [True, False], + "custom_enables": ["ANY"], # comma splitted list + "custom_disables": ["ANY"]} + default_options = { + "shared": False, + "fPIC": True, + "unicode": True, + "compatibility": "3.0", + "zlib": "zlib", + "png": "libpng", + "jpeg": "libjpeg", + "tiff": "libtiff", + "expat": "expat", + "regex": "regex", + "svg": "off", + "secretstore": True, + "aui": True, + "opengl": True, + "html": True, + "mediactrl": False, + "propgrid": True, + "debugreport": True, + "ribbon": True, + "richtext": True, + "sockets": True, + "stc": True, + "webview": True, + "xml": True, + "xrc": True, + "cairo": True, + "help": True, + "html_help": True, + "url": True, + "protocol": True, + "fs_inet": True, + "custom_enables": "", + "custom_disables": "" + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe('fPIC') + if self.settings.os != "Linux": + self.options.rm_safe("secretstore") + self.options.rm_safe("cairo") + if self.options.compatibility > Version(self.version): + self.options.compatibility = "3.0" + + def system_requirements(self): + apt = package_manager.Apt(self) + packages = [] + if self.options.webview: + # TODO: Why is libsoup required? + # Can't find a reference in the docs + packages.extend(['libsoup2.4-dev', + 'libwebkit2gtk-4.0-dev']) + if self.options.get_safe("cairo"): + packages.append("libcairo2-dev") + for package in packages: + apt.install(package) + + yum = package_manager.Yum(self) + packages = [] + if self.options.webview: + packages.append("webkit2gtk3-devel") + if self.options.get_safe("cairo"): + packages.append("cairo-devel") + for package in packages: + yum.install(package) + + def build_requirements(self): + self.tool_requires("ninja/1.11.1") + + def requirements(self): + if self.settings.os == 'Linux': + # To solve versions conflicts: + self.requires("glib/2.70.4", override=True) + + self.requires('xorg/system') + self.requires("gtk/3.24.24") + if self.options.opengl: + self.requires('opengl/system') + if self.options.png == 'libpng': + self.requires('libpng/1.6.40') + if self.options.jpeg == 'libjpeg': + self.requires('libjpeg/9e') + elif self.options.jpeg == 'libjpeg-turbo': + self.requires('libjpeg-turbo/3.0.0') + elif self.options.jpeg == 'mozjpeg': + self.requires('mozjpeg/4.1.3') + if self.options.tiff == 'libtiff': + self.requires('libtiff/4.6.0') + if self.options.zlib == 'zlib': + self.requires('zlib/[>=1.2.11 <2]') + if self.options.expat == 'expat': + self.requires('expat/2.5.0') + # TODO: Does not work right now + # if self.options.get_safe("cairo"): + # self.requires("cairo/1.18.0") + if self.options.mediactrl: + self.requires("gstreamer/1.22.3") + self.requires("gst-plugins-base/1.19.2") + if self.options.get_safe("secretstore"): + self.requires("libsecret/0.20.5") + if self.options.regex == 'regex' and self.version >= '3.1.6': + self.requires('pcre2/10.42') + if self.options.svg == 'nanosvg' and self.version >= '3.1.7': + self.requires('nanosvg/cci.20210904') + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def _patch_sources(self): + apply_conandata_patches(self) + # Don't change library names when cross-compiling + replace_in_file(self, os.path.join(self.source_folder, "build", "cmake", "functions.cmake"), + 'set(cross_target "-${CMAKE_SYSTEM_NAME}")', + 'set(cross_target)') + # Don't override Conan's toolchain + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + 'CMAKE_OSX_DEPLOYMENT_TARGET', + 'CMAKE_OSX_DEPLOYMENT_TARGET_IGNORED') + # Fix for strcpy_s (fix upstream?) + if is_apple_os(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + 'cmake_minimum_required(VERSION 3.0)', + 'cmake_minimum_required(VERSION 3.0)\nadd_definitions(-D__STDC_WANT_LIB_EXT1__)') + # expat library isn't linked? + replace_in_file(self, os.path.join(self.source_folder, "build", "cmake", "lib", "xml", "CMakeLists.txt"), + '${EXPAT_LIBRARIES}', + 'expat::expat') + + def generate(self): + tc = CMakeToolchain(self) + + # generic build options + tc.variables['wxBUILD_SHARED'] = self.options.shared + tc.variables['wxBUILD_SAMPLES'] = 'OFF' + tc.variables['wxBUILD_TESTS'] = 'OFF' + tc.variables['wxBUILD_DEMOS'] = 'OFF' + tc.variables['wxBUILD_INSTALL'] = True + tc.variables['wxBUILD_COMPATIBILITY'] = 'NONE' if self.options.compatibility is None else self.options.compatibility + if self.settings.compiler == 'clang': + tc.variables['wxBUILD_PRECOMP'] = 'OFF' + + # platform-specific options + if self.settings.os == 'Windows': + tc.variables['wxBUILD_USE_STATIC_RUNTIME'] = 'MT' in str(self.settings.compiler.runtime) + tc.variables['wxBUILD_MSVC_MULTIPROC'] = True + if self.settings.os == 'Linux': + tc.variables['wxBUILD_TOOLKIT'] = 'gtk3' + tc.variables['wxUSE_CAIRO'] = self.options.cairo + # Disable some optional libraries that will otherwise lead to non-deterministic builds + if self.settings.os != "Windows": + tc.variables['wxUSE_LIBSDL'] = 'OFF' + tc.variables['wxUSE_LIBICONV'] = 'OFF' + tc.variables['wxUSE_LIBNOTIFY'] = 'OFF' + tc.variables['wxUSE_LIBMSPACK'] = 'OFF' + tc.variables['wxUSE_LIBGNOMEVFS'] = 'OFF' + + tc.variables['wxUSE_LIBPNG'] = 'sys' if self.options.png != 'off' else 'OFF' + tc.variables['wxUSE_LIBJPEG'] = 'sys' if self.options.jpeg != 'off' else 'OFF' + tc.variables['wxUSE_LIBTIFF'] = 'sys' if self.options.tiff != 'off' else 'OFF' + tc.variables['wxUSE_ZLIB'] = 'sys' if self.options.zlib != 'off' else 'OFF' + tc.variables['wxUSE_EXPAT'] = 'sys' if self.options.expat != 'off' else 'OFF' + tc.variables['wxUSE_REGEX'] = 'sys' if self.options.regex != 'off' else 'OFF' + tc.variables['wxUSE_NANOSVG'] = 'sys' if self.options.svg != 'off' else 'OFF' + + # wxWidgets features + tc.variables['wxUSE_UNICODE'] = self.options.unicode + tc.variables['wxUSE_SECRETSTORE'] = self.options.get_safe("secretstore") + + # wxWidgets libraries + tc.variables['wxUSE_AUI'] = self.options.aui + tc.variables['wxUSE_OPENGL'] = self.options.opengl + tc.variables['wxUSE_HTML'] = self.options.html + tc.variables['wxUSE_MEDIACTRL'] = self.options.mediactrl + tc.variables['wxUSE_PROPGRID'] = self.options.propgrid + tc.variables['wxUSE_DEBUGREPORT'] = self.options.debugreport + tc.variables['wxUSE_RIBBON'] = self.options.ribbon + tc.variables['wxUSE_RICHTEXT'] = self.options.richtext + tc.variables['wxUSE_SOCKETS'] = self.options.sockets + tc.variables['wxUSE_STC'] = self.options.stc + tc.variables['wxUSE_WEBVIEW'] = self.options.webview + tc.variables['wxUSE_XML'] = self.options.xml + tc.variables['wxUSE_XRC'] = self.options.xrc + tc.variables['wxUSE_HELP'] = self.options.help + tc.variables['wxUSE_WXHTML_HELP'] = self.options.html_help + tc.variables['wxUSE_URL'] = self.options.protocol + tc.variables['wxUSE_PROTOCOL'] = self.options.protocol + tc.variables['wxUSE_FS_INET'] = self.options.fs_inet + + for item in str(self.options.custom_enables).split(","): + if len(item) > 0: + tc.variables[item] = True + for item in str(self.options.custom_disables).split(","): + if len(item) > 0: + tc.variables[item] = False + + tc.generate() + cd = CMakeDeps(self) + cd.generate() + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern='licence.txt', + src=os.path.join(self.source_folder, 'docs'), + dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + # copy setup.h + copy(self, pattern='*setup.h', + src=os.path.join(self.build_folder, 'lib'), + dst=os.path.join(self.package_folder, 'include', 'wx'), + keep_path=False) + + if self.settings.os == 'Windows': + # copy wxrc.exe + copy(self, pattern='*', + src=os.path.join(self.build_folder, 'bin'), + dst=os.path.join(self.package_folder, 'bin'), + keep_path=False) + else: + # make relative symlink + bin_dir = os.path.join(self.package_folder, 'bin') + for x in os.listdir(bin_dir): + filename = os.path.join(bin_dir, x) + if os.path.islink(filename): + target = os.readlink(filename) + if os.path.isabs(target): + rel = os.path.relpath(target, bin_dir) + os.remove(filename) + os.symlink(rel, filename) + + def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "wxWidgets") + self.cpp_info.set_property("cmake_target_name", "wxWidgets::wxWidgets") + self.cpp_info.set_property("pkg_config_name", "wxwidgets") + + _version = Version(self.version) + version_suffix_major_minor = '-%s.%s' % (_version.major, _version.minor) + unicode = 'u' if self.options.unicode else '' + + # wx no longer uses a debug suffix for non-windows platforms from 3.1.3 onwards + use_debug_suffix = False + if self.settings.build_type == 'Debug' and self.settings.os == 'Windows': + use_debug_suffix = True + + debug = 'd' if use_debug_suffix else '' + + if self.settings.os == 'Linux': + prefix = 'wx_' + toolkit = 'gtk3' + version = '' + suffix = version_suffix_major_minor + elif self.settings.os == 'Macos': + prefix = 'wx_' + toolkit = 'osx_cocoa' + version = '' + suffix = version_suffix_major_minor + elif self.settings.os == 'Windows': + toolkit = 'msw' + if self.settings.compiler == 'gcc': + prefix = 'wx_' + version = '' + suffix = version_suffix_major_minor + else: + prefix = 'wx' + version = '%s%s' % (version_major, version_minor) + suffix = '' + + def base_library_pattern(library): + return '{prefix}base{version}{unicode}{debug}_%s{suffix}' % library + + def library_pattern(library): + return '{prefix}{toolkit}{version}{unicode}{debug}_%s{suffix}' % library + + libs = [] + if not self.options.shared and self.version < '3.1.6': + regex_suffix = '{debug}' if self.settings.os == "Windows" else '{suffix}' + libs.append('wxregex{unicode}' + regex_suffix) + libs.append('{prefix}base{version}{unicode}{debug}{suffix}') + libs.append(library_pattern('core')) + libs.append(library_pattern('adv')) + if self.options.sockets: + libs.append(base_library_pattern('net')) + if self.options.xml: + libs.append(base_library_pattern('xml')) + if self.options.aui: + libs.append(library_pattern('aui')) + if self.options.opengl: + libs.append(library_pattern('gl')) + if self.options.html: + libs.append(library_pattern('html')) + if self.options.mediactrl: + libs.append(library_pattern('media')) + if self.options.propgrid: + libs.append(library_pattern('propgrid')) + if self.options.debugreport: + libs.append(library_pattern('qa')) + if self.options.ribbon: + libs.append(library_pattern('ribbon')) + if self.options.richtext: + libs.append(library_pattern('richtext')) + if self.options.stc: + if not self.options.shared: + scintilla_suffix = '{debug}' if self.settings.os == "Windows" else '{suffix}' + libs.append('wxscintilla' + scintilla_suffix) + libs.append(library_pattern('stc')) + if self.options.webview: + libs.append(library_pattern('webview')) + if self.options.xrc: + libs.append(library_pattern('xrc')) + for lib in reversed(libs): + self.cpp_info.libs.append(lib.format(prefix=prefix, + toolkit=toolkit, + version=version, + unicode=unicode, + debug=debug, + suffix=suffix)) + + self.cpp_info.defines.append('wxUSE_GUI=1') + if self.settings.build_type == 'Debug': + self.cpp_info.defines.append('__WXDEBUG__') + if self.options.shared: + self.cpp_info.defines.append('WXUSINGDLL') + if self.settings.os == 'Linux': + self.cpp_info.defines.append('__WXGTK__') + self.cpp_info.system_libs.extend(['dl', 'pthread', 'SM']) + elif self.settings.os == 'Macos': + self.cpp_info.defines.extend(['__WXMAC__', '__WXOSX__', '__WXOSX_COCOA__']) + for framework in ['Carbon', + 'Cocoa', + 'AudioToolbox', + 'OpenGL', + 'AVKit', + 'AVFoundation', + 'Foundation', + 'IOKit', + 'ApplicationServices', + 'CoreText', + 'CoreGraphics', + 'CoreServices', + 'CoreMedia', + 'Security', + 'ImageIO', + 'System', + 'WebKit', + 'QuartzCore']: + self.cpp_info.frameworks.append(framework) + elif self.settings.os == 'Windows': + # see cmake/init.cmake + compiler_prefix = {'Visual Studio': 'vc', + 'msvc': 'vc', + 'gcc': 'gcc', + 'clang': 'clang'}.get(str(self.settings.compiler)) + + arch_suffix = '_x64' if self.settings.arch == 'x86_64' else '' + lib_suffix = '_dll' if self.options.shared else '_lib' + libdir = '%s%s%s' % (compiler_prefix, arch_suffix, lib_suffix) + libdir = os.path.join('lib', libdir) + self.cpp_info.bindirs.append(libdir) + self.cpp_info.libdirs.append(libdir) + self.cpp_info.defines.append('__WXMSW__') + # disable annoying auto-linking + self.cpp_info.defines.extend(['wxNO_NET_LIB', + 'wxNO_XML_LIB', + 'wxNO_REGEX_LIB', + 'wxNO_ZLIB_LIB', + 'wxNO_JPEG_LIB', + 'wxNO_PNG_LIB', + 'wxNO_TIFF_LIB', + 'wxNO_ADV_LIB', + 'wxNO_HTML_LIB', + 'wxNO_GL_LIB', + 'wxNO_QA_LIB', + 'wxNO_XRC_LIB', + 'wxNO_AUI_LIB', + 'wxNO_PROPGRID_LIB', + 'wxNO_RIBBON_LIB', + 'wxNO_RICHTEXT_LIB', + 'wxNO_MEDIA_LIB', + 'wxNO_STC_LIB', + 'wxNO_WEBVIEW_LIB']) + self.cpp_info.system_libs.extend(['kernel32', + 'user32', + 'gdi32', + 'comdlg32', + 'winspool', + 'shell32', + 'comctl32', + 'ole32', + 'oleaut32', + 'imm32', + 'uuid', + 'wininet', + 'rpcrt4', + 'winmm', + 'advapi32', + 'wsock32']) + # Link a few libraries that are needed when using gcc on windows + if self.settings.compiler == 'gcc': + self.cpp_info.system_libs.extend(['uxtheme', + 'version', + 'shlwapi', + 'oleacc']) + if self.settings.os == 'Windows': + self.cpp_info.includedirs.append(os.path.join('include', 'msvc')) + else: + include_path = os.path.join("include", "wx{}".format(version_suffix_major_minor)) + self.cpp_info.includedirs = [include_path] + self.cpp_info.includedirs diff --git a/recipes/wxwidgets/all/patches/d9deaa8b76128613a84f3d085eb1e4b05631083a.patch b/recipes/wxwidgets/all/patches/d9deaa8b76128613a84f3d085eb1e4b05631083a.patch new file mode 100644 index 00000000000000..eb02dfae3da333 --- /dev/null +++ b/recipes/wxwidgets/all/patches/d9deaa8b76128613a84f3d085eb1e4b05631083a.patch @@ -0,0 +1,17 @@ +diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake +index 90277f3955..966be07ec8 100644 +--- a/build/cmake/config.cmake ++++ b/build/cmake/config.cmake +@@ -34,6 +34,11 @@ macro(wx_get_dependencies var lib) + foreach(dep IN LISTS deps) + if(TARGET ${dep}) +- get_target_property(dep_name ${dep} OUTPUT_NAME) ++ get_target_property(dep_type ${dep} TYPE) ++ if (dep_type STREQUAL "INTERFACE_LIBRARY") ++ get_target_property(dep_name ${dep} INTERFACE_OUTPUT_NAME) ++ else() ++ get_target_property(dep_name ${dep} OUTPUT_NAME) ++ endif() + set(dep_name "-l${dep_name}") + else() + get_filename_component(dep_name ${dep} NAME) diff --git a/recipes/wxwidgets/all/test_package/CMakeLists.txt b/recipes/wxwidgets/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..c4d40ad29eb0fe --- /dev/null +++ b/recipes/wxwidgets/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +find_package(wxWidgets REQUIRED) + +if(MSVC) + add_definitions("-DUNICODE") + add_definitions("-D_UNICODE") + add_definitions("-D_CRT_SECURE_NO_WARNINGS") +endif() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} wxWidgets::wxWidgets) diff --git a/recipes/wxwidgets/all/test_package/conanfile.py b/recipes/wxwidgets/all/test_package/conanfile.py new file mode 100644 index 00000000000000..91817d9f2df179 --- /dev/null +++ b/recipes/wxwidgets/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wxwidgets/all/test_package/test_package.cpp b/recipes/wxwidgets/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..40a8f99c42fac1 --- /dev/null +++ b/recipes/wxwidgets/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include +#include +#include +#include +#if wxUSE_STC +#include +#endif + +int main() +{ + int argc = 0; + wxChar * argv[] = {NULL}; + if (!wxEntryStart(argc, argv)) { + std::cerr << "wxEntryStart failed!" << std::endl; + return EXIT_FAILURE; + } + wxVersionInfo vi = wxGetLibraryVersionInfo(); + std::cout << "wxWidgets version: "; + std::cout << vi.GetMajor() << "."; + std::cout << vi.GetMinor() << "."; + std::cout << vi.GetMicro() << std::endl; +#if wxUSE_STC + wxStyledTextCtrl * stc = new wxStyledTextCtrl(); +#endif + wxEntryCleanup(); + return EXIT_SUCCESS; +} diff --git a/recipes/wxwidgets/all/test_v1_package/CMakeLists.txt b/recipes/wxwidgets/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..84a4a7c96dfa2d --- /dev/null +++ b/recipes/wxwidgets/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +if(MSVC) + add_definitions("-DUNICODE") + add_definitions("-D_UNICODE") + add_definitions("-D_CRT_SECURE_NO_WARNINGS") +endif() + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/wxwidgets/all/test_v1_package/conanfile.py b/recipes/wxwidgets/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..bd7165a553cf41 --- /dev/null +++ b/recipes/wxwidgets/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/wxwidgets/config.yml b/recipes/wxwidgets/config.yml new file mode 100644 index 00000000000000..3c9c5e31f4df5f --- /dev/null +++ b/recipes/wxwidgets/config.yml @@ -0,0 +1,13 @@ +versions: + "3.2.3": + folder: "all" + "3.2.2.1": + folder: "all" + "3.2.1": + folder: "all" + "3.2.0": + folder: "all" + "3.1.5": + folder: "all" + "3.1.4": + folder: "all"