diff --git a/recipes/quickfix/all/conandata.yml b/recipes/quickfix/all/conandata.yml index 10fb6fab3f55b..ddd0268948b2f 100644 --- a/recipes/quickfix/all/conandata.yml +++ b/recipes/quickfix/all/conandata.yml @@ -5,10 +5,12 @@ sources: patches: "1.15.1": - patch_file: "patches/0001-inc.-required-CMake-version-add-conan-basic-setup-an.patch" - base_path: "quickfix" + base_path: "source_subfolder" - patch_file: "patches/0002-fix-condition-for-using-tr1-namespace.patch" - base_path: "quickfix" + base_path: "source_subfolder" - patch_file: "patches/0003-remove-tests-from-compilatin-unit-performance-and-ac.patch" - base_path: "quickfix" + base_path: "source_subfolder" - patch_file: "patches/0004-Fix-build-for-C-17-replace-throw-.-with-EXCEPT.patch" - base_path: "quickfix" + base_path: "source_subfolder" + - patch_file: "patches/0005-except-copy.patch" + base_path: "source_subfolder" diff --git a/recipes/quickfix/all/conanfile.py b/recipes/quickfix/all/conanfile.py index a21a59d511510..880644152243a 100644 --- a/recipes/quickfix/all/conanfile.py +++ b/recipes/quickfix/all/conanfile.py @@ -1,7 +1,5 @@ from conans import ConanFile, CMake, tools -import shutil import os -import re class QuickfixConan(ConanFile): @@ -16,25 +14,20 @@ class QuickfixConan(ConanFile): "ssl": [True, False]} default_options = {"ssl": False, "fPIC": True} generators = "cmake" - file_pattern = re.compile(r'quickfix-(.*)') exports_sources = "patches/**" + _cmake = None @property def _source_subfolder(self): - return "quickfix" + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" def source(self): tools.get(**self.conan_data["sources"][self.version]) - files = os.listdir() - match_dirs = list(filter(self.file_pattern.search, files)) - extracted_dir = match_dirs[0] - os.rename(extracted_dir, self._source_subfolder) - - self._patch_sources() - - os.makedirs(f"{self._source_subfolder}/include") - shutil.copyfile(f"{self._source_subfolder}/src/C++/Except.h", - f"{self._source_subfolder}/include/Except.h") + os.rename(self.name + "-" + self.version, self._source_subfolder) def requirements(self): if self.options.ssl: @@ -44,7 +37,17 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def _configure_cmake(self): + if not self._cmake: + self._cmake = CMake(self) + self._cmake.definitions["HAVE_SSL"] = self.options.ssl + self._cmake.configure(source_folder=self._source_subfolder) + return self._cmake + def build(self): + for patch in self.conan_data["patches"][self.version]: + tools.patch(**patch) + cmake = self._configure_cmake() cmake.build(target="quickfix") @@ -52,7 +55,7 @@ def package(self): cmake = self._configure_cmake() cmake.install() self.copy("config.h", dst="include", src=self._source_subfolder) - self.copy("Except.h", dst="include", src=f"{self._source_subfolder}/src/C++") + self.copy("Except.h", dst="include", src=os.path.join(self._source_subfolder, "src", "C++")) self.copy("LICENSE", dst="licenses", src=self._source_subfolder) tools.rmdir(os.path.join(self.package_folder, "share")) @@ -64,16 +67,3 @@ def package_info(self): if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["ws2_32"]) - - def _configure_cmake(self): - cmake = CMake(self) - - if self.options.ssl: - cmake.definitions["HAVE_SSL"] = "ON" - - cmake.configure(source_folder=self._source_subfolder) - return cmake - - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) diff --git a/recipes/quickfix/all/patches/0005-except-copy.patch b/recipes/quickfix/all/patches/0005-except-copy.patch new file mode 100644 index 0000000000000..0baa939053cf7 --- /dev/null +++ b/recipes/quickfix/all/patches/0005-except-copy.patch @@ -0,0 +1,39 @@ +diff --git a/include/Except.h b/include/Except.h +new file mode 100644 +index 0000000..fded28e +--- /dev/null ++++ b/include/Except.h +@@ -0,0 +1,33 @@ ++/* -*- C++ -*- */ ++ ++/**************************************************************************** ++** Copyright (c) 2001-2014 ++** ++** This file is part of the QuickFIX FIX Engine ++** ++** This file may be distributed under the terms of the quickfixengine.org ++** license as defined by quickfixengine.org and appearing in the file ++** LICENSE included in the packaging of this file. ++** ++** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ++** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ++** ++** See http://www.quickfixengine.org/LICENSE for licensing information. ++** ++** Contact ask@quickfixengine.org if any conditions of this licensing are ++** not clear to you. ++** ++****************************************************************************/ ++ ++#ifndef FIX_EXCEPT_H ++#define FIX_EXCEPT_H ++ ++#ifdef __cpp_noexcept_function_type ++#define NOEXCEPT noexcept ++#define EXCEPT(...) noexcept(false) ++#else ++#define NOEXCEPT throw() ++#define EXCEPT(...) throw(__VA_ARGS__) ++#endif ++ ++#endif diff --git a/recipes/quickfix/all/test_package/CMakeLists.txt b/recipes/quickfix/all/test_package/CMakeLists.txt index 3bdd0f786f3d9..e024ffd9a1a7c 100644 --- a/recipes/quickfix/all/test_package/CMakeLists.txt +++ b/recipes/quickfix/all/test_package/CMakeLists.txt @@ -1,15 +1,8 @@ -cmake_minimum_required(VERSION 3.16 FATAL_ERROR) +cmake_minimum_required(VERSION 2.8.11) project(PackageTest CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() add_executable(executor ${PROJECT_SOURCE_DIR}/executor.cpp) - target_link_libraries(executor ${CONAN_LIBS}) - -# CTest is a testing tool that can be used to test your project. -# enable_testing() -# add_test(NAME example -# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin -# COMMAND example) diff --git a/recipes/quickfix/all/test_package/conanfile.py b/recipes/quickfix/all/test_package/conanfile.py index 21d9e6fd8b56f..a68d648c5c5b5 100644 --- a/recipes/quickfix/all/test_package/conanfile.py +++ b/recipes/quickfix/all/test_package/conanfile.py @@ -5,27 +5,14 @@ class QuickfixTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - options = {"ssl": [True, False], "fPIC": [True, False]} - default_options = "ssl=False", "fPIC=True" generators = "cmake" - def configure(self): - if self.settings.os == 'Windows': - del self.options.fPIC - else: - self.options["quickfix"].fPIC = self.options.fPIC - - self.options["quickfix"].ssl = self.options.ssl - def build(self): - self.source() cmake = CMake(self) cmake.configure() cmake.build() def test(self): if not tools.cross_building(self): - program = "executor" - - self.run(f".{os.sep}{program}", run_environment=True, - cwd=f"{self.build_folder}{os.sep}bin") + bin_path = os.path.join("bin", "executor") + self.run(bin_path, run_environment=True)