[DO-981] qt package (!15)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/15
This commit is contained in:
31
recipes/expat/all/conandata.yml
Normal file
31
recipes/expat/all/conandata.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
sources:
|
||||
"2.6.4":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libexpat/libexpat/releases/download/R_2_6_4/expat-2.6.4.tar.xz"
|
||||
sha256: "a695629dae047055b37d50a0ff4776d1d45d0a4c842cf4ccee158441f55ff7ee"
|
||||
"2.6.3":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.xz"
|
||||
sha256: "274db254a6979bde5aad404763a704956940e465843f2a9bd9ed7af22e2c0efc"
|
||||
"2.6.2":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libexpat/libexpat/releases/download/R_2_6_2/expat-2.6.2.tar.xz"
|
||||
sha256: "ee14b4c5d8908b1bec37ad937607eab183d4d9806a08adee472c3c3121d27364"
|
||||
"2.6.0":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libexpat/libexpat/releases/download/R_2_6_0/expat-2.6.0.tar.xz"
|
||||
sha256: "cb5f5a8ea211e1cabd59be0a933a52e3c02cc326e86a4d387d8d218e7ee47a3e"
|
||||
"2.5.0":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.xz"
|
||||
sha256: "ef2420f0232c087801abf705e89ae65f6257df6b7931d37846a193ef2e8cdcbe"
|
||||
"2.4.9":
|
||||
sha256: "6e8c0728fe5c7cd3f93a6acce43046c5e4736c7b4b68e032e9350daa0efc0354"
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libexpat/libexpat/releases/download/R_2_4_9/expat-2.4.9.tar.xz"
|
||||
"2.4.8":
|
||||
sha256: "f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df479dcaf25"
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.xz"
|
||||
"2.3.0":
|
||||
sha256: "89df123c62f2c2e2b235692d9fe76def6a9ab03dbe95835345bf412726eb1987"
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libexpat/libexpat/releases/download/R_2_3_0/expat-2.3.0.tar.gz"
|
||||
"2.2.10":
|
||||
sha256: "bf42d1f52371d23684de36cc6d2f0f1acd02de264d1105bdc17792bbeb7e7ceb"
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libexpat/libexpat/releases/download/R_2_2_10/expat-2.2.10.tar.gz"
|
||||
patches:
|
||||
"2.3.0":
|
||||
- patch_file: "patches/0001-2.3.0-relax-vs-restriction.patch"
|
||||
102
recipes/expat/all/conanfile.py
Normal file
102
recipes/expat/all/conanfile.py
Normal file
@@ -0,0 +1,102 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir
|
||||
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.53.0"
|
||||
|
||||
|
||||
class ExpatConan(ConanFile):
|
||||
name = "expat"
|
||||
description = "Fast streaming XML parser written in C."
|
||||
license = "MIT"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://github.com/libexpat/libexpat"
|
||||
topics = ("xml", "parsing")
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"char_type": ["char", "wchar_t", "ushort"],
|
||||
"large_size": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"char_type": "char",
|
||||
"large_size": False,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
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")
|
||||
self.settings.rm_safe("compiler.cppstd")
|
||||
self.settings.rm_safe("compiler.libcxx")
|
||||
|
||||
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["EXPAT_BUILD_DOCS"] = False
|
||||
tc.variables["EXPAT_BUILD_EXAMPLES"] = False
|
||||
tc.variables["EXPAT_SHARED_LIBS"] = self.options.shared
|
||||
tc.variables["EXPAT_BUILD_TESTS"] = False
|
||||
tc.variables["EXPAT_BUILD_TOOLS"] = False
|
||||
tc.variables["EXPAT_CHAR_TYPE"] = self.options.char_type
|
||||
if is_msvc(self):
|
||||
tc.variables["EXPAT_MSVC_STATIC_CRT"] = is_msvc_static_runtime(self)
|
||||
tc.variables["EXPAT_BUILD_PKGCONFIG"] = False
|
||||
tc.variables["EXPAT_LARGE_SIZE"] = self.options.large_size
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
rmdir(self, os.path.join(self.package_folder, "share"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_find_mode", "both")
|
||||
self.cpp_info.set_property("cmake_module_file_name", "EXPAT")
|
||||
self.cpp_info.set_property("cmake_module_target_name", "EXPAT::EXPAT")
|
||||
self.cpp_info.set_property("cmake_file_name", "expat")
|
||||
self.cpp_info.set_property("cmake_target_name", "expat::expat")
|
||||
self.cpp_info.set_property("pkg_config_name", "expat")
|
||||
|
||||
self.cpp_info.libs = collect_libs(self)
|
||||
if not self.options.shared:
|
||||
self.cpp_info.defines = ["XML_STATIC"]
|
||||
if self.options.get_safe("char_type") in ("wchar_t", "ushort"):
|
||||
self.cpp_info.defines.append("XML_UNICODE")
|
||||
elif self.options.get_safe("char_type") == "wchar_t":
|
||||
self.cpp_info.defines.append("XML_UNICODE_WCHAR_T")
|
||||
if self.options.large_size:
|
||||
self.cpp_info.defines.append("XML_LARGE_SIZE")
|
||||
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.system_libs.append("m")
|
||||
|
||||
# TODO: to remove in conan v2
|
||||
self.cpp_info.names["cmake_find_package"] = "EXPAT"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "expat"
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt
|
||||
index e3564691..0dc5cf80 100644
|
||||
--- CMakeLists.txt
|
||||
+++ CMakeLists.txt
|
||||
@@ -133,7 +133,7 @@ if(MSVC)
|
||||
# Minimum supported MSVC version is 1910 = Visual Studio 15.0/2017
|
||||
# See also https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
|
||||
if(MSVC_VERSION VERSION_LESS 1910)
|
||||
- message(SEND_ERROR "MSVC_VERSION ${MSVC_VERSION} is not a supported Visual Studio compiler version. Please use Visual Studio 15.0/2017 or any later version.")
|
||||
+ message(WARNING "MSVC_VERSION ${MSVC_VERSION} is not a supported Visual Studio compiler version. Please use Visual Studio 15.0/2017 or any later version.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
7
recipes/expat/all/test_package/CMakeLists.txt
Normal file
7
recipes/expat/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(expat REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE expat::expat)
|
||||
10
recipes/expat/all/test_package/CMakeUserPresets.json
Normal file
10
recipes/expat/all/test_package/CMakeUserPresets.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"version": 4,
|
||||
"vendor": {
|
||||
"conan": {}
|
||||
},
|
||||
"include": [
|
||||
"build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json",
|
||||
"build/gcc-11.5-x86_64-17-release/generators/CMakePresets.json"
|
||||
]
|
||||
}
|
||||
26
recipes/expat/all/test_package/conanfile.py
Normal file
26
recipes/expat/all/test_package/conanfile.py
Normal file
@@ -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", "arch", "compiler", "build_type"
|
||||
generators = "CMakeDeps", "CMakeToolchain", "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")
|
||||
64
recipes/expat/all/test_package/test_package.c
Normal file
64
recipes/expat/all/test_package/test_package.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* This is simple demonstration of how to use expat. This program
|
||||
reads an XML document from standard input and writes a line with
|
||||
the name of each element to standard output indenting child
|
||||
elements by one tab stop more than their parent element.
|
||||
It must be used with Expat compiled for UTF-8 output.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "expat.h"
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#ifdef XML_LARGE_SIZE
|
||||
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
|
||||
#define XML_FMT_INT_MOD "I64"
|
||||
#else
|
||||
#define XML_FMT_INT_MOD "ll"
|
||||
#endif
|
||||
#else
|
||||
#define XML_FMT_INT_MOD "l"
|
||||
#endif
|
||||
|
||||
static void XMLCALL
|
||||
startElement(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
int i;
|
||||
int *depthPtr = (int *)userData;
|
||||
(void)atts;
|
||||
|
||||
for (i = 0; i < *depthPtr; i++)
|
||||
putchar('\t');
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
fputws(name, stdout);
|
||||
#else
|
||||
puts(name);
|
||||
#endif
|
||||
*depthPtr += 1;
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
endElement(void *userData, const XML_Char *name)
|
||||
{
|
||||
int *depthPtr = (int *)userData;
|
||||
(void)name;
|
||||
|
||||
*depthPtr -= 1;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
int depth = 0;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
XML_SetUserData(parser, &depth);
|
||||
XML_SetElementHandler(parser, startElement, endElement);
|
||||
XML_ParserFree(parser);
|
||||
printf("Test application successfully ran!\n");
|
||||
return 0;
|
||||
}
|
||||
22
recipes/expat/all/test_package_module/CMakeLists.txt
Normal file
22
recipes/expat/all/test_package_module/CMakeLists.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(EXPAT REQUIRED MODULE)
|
||||
|
||||
add_executable(${PROJECT_NAME} ../test_package/test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE EXPAT::EXPAT)
|
||||
|
||||
# Test whether variables from https://cmake.org/cmake/help/latest/module/FindEXPAT.html
|
||||
# are properly defined in conan generators
|
||||
set(_custom_vars
|
||||
EXPAT_INCLUDE_DIRS
|
||||
EXPAT_LIBRARIES
|
||||
EXPAT_FOUND
|
||||
)
|
||||
foreach(_custom_var ${_custom_vars})
|
||||
if(DEFINED ${_custom_var})
|
||||
message(STATUS "${_custom_var}: ${${_custom_var}}")
|
||||
else()
|
||||
message(FATAL_ERROR "${_custom_var} not defined")
|
||||
endif()
|
||||
endforeach()
|
||||
26
recipes/expat/all/test_package_module/conanfile.py
Normal file
26
recipes/expat/all/test_package_module/conanfile.py
Normal file
@@ -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", "arch", "compiler", "build_type"
|
||||
generators = "CMakeDeps", "CMakeToolchain", "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")
|
||||
8
recipes/expat/all/test_v1_package/CMakeLists.txt
Normal file
8
recipes/expat/all/test_v1_package/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
|
||||
18
recipes/expat/all/test_v1_package/conanfile.py
Normal file
18
recipes/expat/all/test_v1_package/conanfile.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from conans import ConanFile, CMake
|
||||
from conan.tools.build import cross_building
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageV1Conan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "cmake", "cmake_find_package_multi"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
||||
8
recipes/expat/all/test_v1_package_module/CMakeLists.txt
Normal file
8
recipes/expat/all/test_v1_package_module/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package_module/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package_module/)
|
||||
18
recipes/expat/all/test_v1_package_module/conanfile.py
Normal file
18
recipes/expat/all/test_v1_package_module/conanfile.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from conans import ConanFile, CMake
|
||||
from conan.tools.build import cross_building
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageV1Conan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "cmake", "cmake_find_package"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
||||
Reference in New Issue
Block a user