diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c43d7527..85d3737ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ set(AGENT_VERSION_MAJOR 2) set(AGENT_VERSION_MINOR 6) set(AGENT_VERSION_PATCH 0) -set(AGENT_VERSION_BUILD 0) +set(AGENT_VERSION_BUILD 1) set(AGENT_VERSION_RC "") # This minimum version is to support Visual Studio 2019 and C++ feature checking and FetchContent diff --git a/conan/cmake/conandata.yml b/conan/cmake/conandata.yml deleted file mode 100644 index da33ab402..000000000 --- a/conan/cmake/conandata.yml +++ /dev/null @@ -1,25 +0,0 @@ -sources: - "3.19.8": - url: https://github.com/Kitware/CMake/releases/download/v3.19.8/cmake-3.19.8.tar.gz - sha256: 09b4fa4837aae55c75fb170f6a6e2b44818deba48335d1969deddfbb34e30369 - "3.20.6": - url: https://github.com/Kitware/CMake/releases/download/v3.20.6/cmake-3.20.6.tar.gz - sha256: a0bd485e1a38dd13c0baec89d5f4adbf61c7fd32fddb38eabc69a75bc0b65d72 - "3.21.7": - url: https://github.com/Kitware/CMake/releases/download/v3.21.7/cmake-3.21.7.tar.gz - sha256: 3523c4a5afc61ac3d7c92835301cdf092129c9b672a6ee17e68c92e928c1375a - "3.22.6": - url: https://github.com/Kitware/CMake/releases/download/v3.22.6/cmake-3.22.6.tar.gz - sha256: 73933163670ea4ea95c231549007b0c7243282293506a2cf4443714826ad5ec3 - "3.23.5": - url: "https://github.com/Kitware/CMake/releases/download/v3.23.5/cmake-3.23.5.tar.gz" - sha256: "f2944cde7a140b992ba5ccea2009a987a92413762250de22ebbace2319a0f47d" - "3.24.3": - url: "https://github.com/Kitware/CMake/releases/download/v3.24.3/cmake-3.24.3.tar.gz" - sha256: "b53aa10fa82bff84ccdb59065927b72d3bee49f4d86261249fc0984b3b367291" - "3.25.2": - url: "https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2.tar.gz" - sha256: "c026f22cb931dd532f648f087d587f07a1843c6e66a3dfca4fb0ea21944ed33c" - "3.26.4": - url: "https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4.tar.gz" - sha256: "313b6880c291bd4fe31c0aa51d6e62659282a521e695f30d5cc0d25abbd5c208" diff --git a/conan/cmake/conanfile.py b/conan/cmake/conanfile.py deleted file mode 100644 index f6de58331..000000000 --- a/conan/cmake/conanfile.py +++ /dev/null @@ -1,166 +0,0 @@ -from conan import ConanFile -from conan.tools.files import chdir, copy, rmdir, get, save, load -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps -from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps -from conan.tools.layout import basic_layout -from conan.tools.build import build_jobs, cross_building, check_min_cppstd -from conan.tools.scm import Version -from conan.tools.microsoft import is_msvc -from conan.errors import ConanInvalidConfiguration - -import os -import json - -required_conan_version = ">=1.51.0" - -class CMakeConan(ConanFile): - name = "cmake" - package_type = "application" - description = "Conan installer for CMake" - topics = ("cmake", "build", "installer") - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/Kitware/CMake" - license = "BSD-3-Clause" - settings = "os", "arch", "compiler", "build_type" - - options = { - "with_openssl": [True, False], - "bootstrap": [True, False], - } - default_options = { - "with_openssl": True, - "bootstrap": False, - } - - def config_options(self): - if self.settings.os == "Windows": - self.options.with_openssl = False - - def requirements(self): - if self.options.with_openssl: - self.requires("openssl/1.1.1t") - - def validate_build(self): - if self.settings.os == "Windows" and self.options.bootstrap: - raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") - - minimal_cpp_standard = "11" - if self.settings.get_safe("compiler.cppstd"): - check_min_cppstd(self, minimal_cpp_standard) - - minimal_version = { - "gcc": "4.8", - "clang": "3.3", - "apple-clang": "9", - "Visual Studio": "14", - "msvc": "190", - } - - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warning( - f"{self.name} recipe lacks information about the {compiler} compiler standard version support") - self.output.warning( - f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}") - return - - version = Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration( - f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}") - - def validate(self): - if self.settings.os == "Macos" and self.settings.arch == "x86": - raise ConanInvalidConfiguration("CMake does not support x86 for macOS") - - def layout(self): - if self.options.bootstrap: - basic_layout(self, src_folder="src") - else: - cmake_layout(self, src_folder="src") - - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) - rmdir(self, os.path.join(self.source_folder, "Tests", "RunCMake", "find_package")) - - def generate(self): - if self.options.bootstrap: - tc = AutotoolsToolchain(self) - tc.generate() - tc = AutotoolsDeps(self) - tc.generate() - bootstrap_cmake_options = ["--"] - bootstrap_cmake_options.append(f'-DCMAKE_CXX_STANDARD={"11" if not self.settings.compiler.cppstd else self.settings.compiler.cppstd}') - if self.settings.os == "Linux": - if self.options.with_openssl: - openssl = self.dependencies["openssl"] - bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=ON") - bootstrap_cmake_options.append(f'-DOPENSSL_USE_STATIC_LIBS={"FALSE" if openssl.options.shared else "TRUE"}') - bootstrap_cmake_options.append(f'-DOPENSSL_ROOT_DIR={openssl.package_path}') - else: - bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=OFF") - save(self, "bootstrap_args", json.dumps({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)})) - else: - tc = CMakeToolchain(self) - # Disabling testing because CMake tests build can fail in Windows in some cases - tc.variables["BUILD_TESTING"] = False - if not self.settings.compiler.cppstd: - tc.variables["CMAKE_CXX_STANDARD"] = 11 - tc.variables["CMAKE_BOOTSTRAP"] = False - if self.settings.os == "Linux": - tc.variables["CMAKE_USE_OPENSSL"] = self.options.with_openssl - if self.options.with_openssl: - openssl = self.dependencies["openssl"] - tc.variables["OPENSSL_USE_STATIC_LIBS"] = not openssl.options.shared - if cross_building(self): - tc.variables["HAVE_POLL_FINE_EXITCODE"] = '' - tc.variables["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' - # TODO: Remove after fixing https://github.com/conan-io/conan-center-index/issues/13159 - # C3I workaround to force CMake to choose the highest version of - # the windows SDK available in the system - if is_msvc(self) and not self.conf.get("tools.cmake.cmaketoolchain:system_version"): - tc.variables["CMAKE_SYSTEM_VERSION"] = "10.0" - tc.generate() - tc = CMakeDeps(self) - # CMake try_compile failure: https://github.com/conan-io/conan-center-index/pull/16073#discussion_r1110037534 - tc.set_property("openssl", "cmake_find_mode", "module") - tc.generate() - - - def build(self): - if self.options.bootstrap: - toolchain_file_content = json.loads(load(self, os.path.join(self.generators_folder, "bootstrap_args"))) - bootstrap_cmake_options = toolchain_file_content.get("bootstrap_cmake_options") - with chdir(self, self.source_folder): - self.run(f'./bootstrap --prefix="" --parallel={build_jobs(self)} {bootstrap_cmake_options}') - autotools = Autotools(self) - autotools.make() - else: - cmake = CMake(self) - cmake.configure() - cmake.build() - - def package(self): - copy(self, "Copyright.txt", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False) - if self.options.bootstrap: - with chdir(self, self.source_folder): - autotools = Autotools(self) - autotools.install() - else: - cmake = CMake(self) - cmake.install() - rmdir(self, os.path.join(self.package_folder, "doc")) - - def package_id(self): - del self.info.settings.compiler - del self.info.options.bootstrap - - def package_info(self): - self.cpp_info.includedirs = [] - self.cpp_info.libdirs = [] - - # Needed for compatibility with v1.x - Remove when 2.0 becomes the default - bindir = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bindir}") - self.env_info.PATH.append(bindir) diff --git a/conan/cmake/test_package/conanfile.py b/conan/cmake/test_package/conanfile.py deleted file mode 100644 index df50a01c3..000000000 --- a/conan/cmake/test_package/conanfile.py +++ /dev/null @@ -1,24 +0,0 @@ -from six import StringIO -from conan import ConanFile -import re - - -class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "VirtualBuildEnv" - test_type = "explicit" - - def build_requirements(self): - self.tool_requires(self.tested_reference_str) - - def test(self): - output = StringIO() - # Third arg to self.run renamed "stdout" in Conan 2.0 but 1.x linter doesn't like it - self.run("cmake --version", output) - output_str = str(output.getvalue()) - self.output.info("Installed version: {}".format(output_str)) - tokens = re.split('[@#]', self.tested_reference_str) - require_version = tokens[0].split("/", 1)[1] - self.output.info("Expected version: {}".format(require_version)) - assert_cmake_version = "cmake version %s" % require_version - assert(assert_cmake_version in output_str) diff --git a/conan/cmake/test_v1_package/conanfile.py b/conan/cmake/test_v1_package/conanfile.py deleted file mode 100644 index df9415b7c..000000000 --- a/conan/cmake/test_v1_package/conanfile.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -from six import StringIO -from conan import ConanFile -import re - - -class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - test_type = "explicit" - - def build_requirements(self): - self.tool_requires(self.tested_reference_str) - - def test(self): - output = StringIO() - self.run("cmake --version", output=output, run_environment=False) - output_str = str(output.getvalue()) - self.output.info("Installed version: {}".format(output_str)) - tokens = re.split('[@#]', self.tested_reference_str) - require_version = tokens[0].split("/", 1)[1] - self.output.info("Expected version: {}".format(require_version)) - assert_cmake_version = "cmake version %s" % require_version - assert(assert_cmake_version in output_str) diff --git a/conan/mruby/conanfile.py b/conan/mruby/conanfile.py index e74fdedbb..f1c85b456 100644 --- a/conan/mruby/conanfile.py +++ b/conan/mruby/conanfile.py @@ -25,7 +25,7 @@ class MRubyConan(ConanFile): options = { "shared": [True, False], "trace": [True, False] } - requires = ["oniguruma/6.9.8"] + requires = ["oniguruma/6.9.10"] default_options = { "shared": False, diff --git a/conan/oniguruma/conanfile.py b/conan/oniguruma/conanfile.py new file mode 100644 index 000000000..bee152d3c --- /dev/null +++ b/conan/oniguruma/conanfile.py @@ -0,0 +1,90 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.54.0" + + +class OnigurumaConan(ConanFile): + name = "oniguruma" + description = "Oniguruma is a modern and flexible regular expressions library." + license = "BSD-2-Clause" + topics = ("oniguruma", "regex") + homepage = "https://github.com/kkos/oniguruma" + url = "https://github.com/conan-io/conan-center-index" + version = "6.9.10" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "posix_api": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "posix_api": 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") + 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, "https://github.com/kkos/oniguruma/releases/download/v6.9.10/onig-6.9.10.tar.gz", strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_POSIX_API"] = self.options.posix_api + tc.variables["ENABLE_BINARY_COMPATIBLE_POSIX_API"] = self.options.posix_api + if Version(self.version) >= "6.9.8": + tc.variables["INSTALL_DOCUMENTATION"] = False + tc.variables["INSTALL_EXAMPLES"] = False + tc.generate() + + def build(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", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + if Version(self.version) < "6.9.8": + rmdir(self, os.path.join(self.package_folder, "share")) + else: + if self.settings.os == "Windows" and self.options.shared: + rm(self, "onig-config", os.path.join(self.package_folder, "bin")) + else: + rmdir(self, os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "oniguruma") + self.cpp_info.set_property("cmake_target_name", "oniguruma::onig") + self.cpp_info.set_property("pkg_config_name", "oniguruma") + # TODO: back to global scope after conan v2 once cmake_find_package_* removed + self.cpp_info.components["onig"].libs = ["onig"] + if not self.options.shared: + self.cpp_info.components["onig"].defines.append("ONIG_STATIC") + + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed + self.cpp_info.components["onig"].set_property("cmake_target_name", "oniguruma::onig") + self.cpp_info.components["onig"].set_property("pkg_config_name", "oniguruma") + self.cpp_info.components["onig"].names["cmake_find_package"] = "onig" + self.cpp_info.components["onig"].names["cmake_find_package_multi"] = "onig" + self.cpp_info.components["onig"].names["pkg_config"] = "oniguruma" diff --git a/conan/profiles/macos b/conan/profiles/macos index f0920993e..822d173c7 100644 --- a/conan/profiles/macos +++ b/conan/profiles/macos @@ -5,4 +5,7 @@ compiler=apple-clang compiler.cppstd=gnu17 [system_tools] -cmake/>3.26.0 \ No newline at end of file +cmake/>3.26.0 + + + diff --git a/conan/profiles/xcode b/conan/profiles/xcode index 638660764..3121ffdd6 100644 --- a/conan/profiles/xcode +++ b/conan/profiles/xcode @@ -3,8 +3,9 @@ include(default) [settings] compiler.cppstd=17 -[system_tools] -cmake/>3.23.0 +[platform_tool_requires] +cmake/3.26.4 [conf] tools.cmake.cmaketoolchain:generator=Xcode + diff --git a/conanfile.py b/conanfile.py index 3a10a0633..60702ba63 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,7 @@ class MTConnectAgentConan(ConanFile): name = "mtconnect_agent" - version = "2.5" + version = "2.6" url = "https://github.com/mtconnect/cppagent.git" license = "Apache License 2.0" settings = "os", "compiler", "arch", "build_type" @@ -72,7 +72,7 @@ class MTConnectAgentConan(ConanFile): } exports_sources = "*", "!build", "!test_package/build", "!*~" - exports = "conan/mqtt_cpp/*", "conan/mruby/*" + exports = "conan/mqtt_cpp/*", "conan/mruby/*", "conan/oniguruma/*" def validate(self): if is_msvc(self) and self.options.shared and self.settings.compiler.runtime != 'dynamic': @@ -120,7 +120,7 @@ def build_requirements(self): def requirements(self): self.requires("boost/1.85.0", headers=True, libs=True, transitive_headers=True, transitive_libs=True) self.requires("libxml2/2.10.3", headers=True, libs=True, visible=True, transitive_headers=True, transitive_libs=True) - self.requires("date/2.4.1", headers=True, libs=True, transitive_headers=True, transitive_libs=True) + self.requires("date/3.0.4", headers=True, libs=True, transitive_headers=True, transitive_libs=True) self.requires("nlohmann_json/3.9.1", headers=True, libs=False, transitive_headers=True, transitive_libs=False) self.requires("openssl/3.0.8", headers=True, libs=True, transitive_headers=True, transitive_libs=True) self.requires("rapidjson/cci.20220822", headers=True, libs=False, transitive_headers=True, transitive_libs=False) @@ -157,6 +157,7 @@ def configure(self): self.run("conan export conan/mqtt_cpp", cwd=os.path.dirname(__file__)) if self.options.with_ruby: self.run("conan export conan/mruby", cwd=os.path.dirname(__file__)) + self.run("conan export conan/oniguruma", cwd=os.path.dirname(__file__)) if not self.options.cpack_generator: if is_msvc(self): diff --git a/src/mtconnect/printer/xml_printer.hpp b/src/mtconnect/printer/xml_printer.hpp index 33d08c0fe..71dc5287a 100644 --- a/src/mtconnect/printer/xml_printer.hpp +++ b/src/mtconnect/printer/xml_printer.hpp @@ -64,7 +64,7 @@ namespace mtconnect { const uint64_t anInstanceId, const unsigned int bufferSize, const unsigned int assetCount, const asset::AssetList &asset, bool pretty = false, const std::optional requestId = std::nullopt) const override; - std::string mimeType() const override { return "application/mtconnect+xml"; } + std::string mimeType() const override { return "application/xml"; } /// @brief Print a single device in XML /// @param device A device poiinter