From 9fcbbe0532819425e31eaabadde6f72815ce0db6 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 13:36:15 +0000 Subject: [PATCH 01/51] Copy in files from szip as a starting point --- recipes/cpputest/all/CMakeLists.txt | 7 ++ recipes/cpputest/all/conandata.yml | 10 +++ recipes/cpputest/all/conanfile.py | 78 ++++++++++++++++++ .../build_either_static_or_shared.patch | 31 +++++++ .../all/patches/fix_unknown_size_t.patch | 11 +++ .../cpputest/all/test_package/CMakeLists.txt | 8 ++ .../cpputest/all/test_package/conanfile.py | 17 ++++ .../cpputest/all/test_package/test_package.c | 80 +++++++++++++++++++ recipes/cpputest/config.yml | 3 + 9 files changed, 245 insertions(+) create mode 100644 recipes/cpputest/all/CMakeLists.txt create mode 100644 recipes/cpputest/all/conandata.yml create mode 100644 recipes/cpputest/all/conanfile.py create mode 100644 recipes/cpputest/all/patches/build_either_static_or_shared.patch create mode 100644 recipes/cpputest/all/patches/fix_unknown_size_t.patch create mode 100644 recipes/cpputest/all/test_package/CMakeLists.txt create mode 100644 recipes/cpputest/all/test_package/conanfile.py create mode 100644 recipes/cpputest/all/test_package/test_package.c create mode 100644 recipes/cpputest/config.yml diff --git a/recipes/cpputest/all/CMakeLists.txt b/recipes/cpputest/all/CMakeLists.txt new file mode 100644 index 0000000000000..217b9530b904d --- /dev/null +++ b/recipes/cpputest/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/cpputest/all/conandata.yml b/recipes/cpputest/all/conandata.yml new file mode 100644 index 0000000000000..52d2161a0f0cf --- /dev/null +++ b/recipes/cpputest/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "2.1.1": + url: "https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz" + sha256: "21ee958b4f2d4be2c9cabfa5e1a94877043609ce86fde5f286f105f7ff84d412" +patches: + "2.1.1": + - patch_file: "patches/fix_unknown_size_t.patch" + base_path: "source_subfolder" + - patch_file: "patches/build_either_static_or_shared.patch" + base_path: "source_subfolder" diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py new file mode 100644 index 0000000000000..28cdabd6dae81 --- /dev/null +++ b/recipes/cpputest/all/conanfile.py @@ -0,0 +1,78 @@ +import os + +from conans import ConanFile, CMake, tools + +class SzipConan(ConanFile): + name = "szip" + description = "C Implementation of the extended-Rice lossless compression " \ + "algorithm, suitable for use with scientific data." + license = "Szip License" + topics = ("conan", "szip", "compression", "decompression") + homepage = "https://support.hdfgroup.org/doc_resource/SZIP/" + url = "https://github.com/conan-io/conan-center-index" + exports_sources = ["CMakeLists.txt", "patches/**"] + generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "enable_encoding": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "enable_encoding": False + } + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + os.rename(self.name + "-" + self.version, self._source_subfolder) + + def build(self): + for patch in self.conan_data["patches"][self.version]: + tools.patch(**patch) + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + cmake = self._configure_cmake() + cmake.build() + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["SZIP_ENABLE_ENCODING"] = self.options.enable_encoding + self._cmake.definitions["SZIP_EXTERNALLY_CONFIGURED"] = True + self._cmake.definitions["BUILD_TESTING"] = False + self._cmake.definitions["SZIP_BUILD_FRAMEWORKS"] = False + self._cmake.definitions["SZIP_PACK_MACOSX_FRAMEWORK"] = False + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def package(self): + self.copy("COPYING", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "SZIP" + self.cpp_info.names["cmake_find_package_multi"] = "SZIP" + + self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/cpputest/all/patches/build_either_static_or_shared.patch b/recipes/cpputest/all/patches/build_either_static_or_shared.patch new file mode 100644 index 0000000000000..4400c5e91c578 --- /dev/null +++ b/recipes/cpputest/all/patches/build_either_static_or_shared.patch @@ -0,0 +1,31 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -22,6 +22,7 @@ set (SZIP_PUBLIC_HEADERS + ${SZIP_SRC_SOURCE_DIR}/szlib.h + ) + ++if (NOT BUILD_SHARED_LIBS) + add_library (${SZIP_LIB_TARGET} STATIC ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS}) + #set_target_properties (${SZIP_LIB_TARGET} + # PROPERTIES +@@ -37,7 +38,7 @@ set_global_variable (SZIP_LIBRARIES_TO_EXPORT ${SZIP_LIB_TARGET}) + SZIP_SET_LIB_OPTIONS (${SZIP_LIB_TARGET} ${SZIP_LIB_NAME} STATIC) + set (install_targets ${SZIP_LIB_TARGET}) + +-if (BUILD_SHARED_LIBS) ++else() + add_library (${SZIP_LIBSH_TARGET} SHARED ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS}) + # set_target_properties (${SZIP_LIB_TARGET} + # PROPERTIES +@@ -62,8 +63,9 @@ endif () + if (SZIP_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) + INSTALL_TARGET_PDB (${SZIP_LIBSH_TARGET} ${SZIP_INSTALL_BIN_DIR} libraries) +- endif (BUILD_SHARED_LIBS) +- INSTALL_TARGET_PDB (${SZIP_LIB_TARGET} ${SZIP_INSTALL_BIN_DIR} libraries) ++ else() ++ INSTALL_TARGET_PDB (${SZIP_LIB_TARGET} ${SZIP_INSTALL_BIN_DIR} libraries) ++ endif() + + install ( + TARGETS diff --git a/recipes/cpputest/all/patches/fix_unknown_size_t.patch b/recipes/cpputest/all/patches/fix_unknown_size_t.patch new file mode 100644 index 0000000000000..a6b0458c524c2 --- /dev/null +++ b/recipes/cpputest/all/patches/fix_unknown_size_t.patch @@ -0,0 +1,11 @@ +--- a/src/szlib.h ++++ b/src/szlib.h +@@ -42,6 +42,8 @@ Post Falls, ID 83854. (208) 262-2008. + #include "ricehdf.h" + #include "szip_adpt.h" + ++#include ++ + #define SZLIB_VERSION "2.1.1" + + /* diff --git a/recipes/cpputest/all/test_package/CMakeLists.txt b/recipes/cpputest/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7b9b613cbb24a --- /dev/null +++ b/recipes/cpputest/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/cpputest/all/test_package/conanfile.py b/recipes/cpputest/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ea57a464900be --- /dev/null +++ b/recipes/cpputest/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + +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/cpputest/all/test_package/test_package.c b/recipes/cpputest/all/test_package/test_package.c new file mode 100644 index 0000000000000..11578ead7a9fb --- /dev/null +++ b/recipes/cpputest/all/test_package/test_package.c @@ -0,0 +1,80 @@ +#include +#include + +#include +#include +#include + +unsigned long szip_decoding(int bits_per_pixel, char *in, long size, char *out, long out_size, long buffer_size) { + int bytes_per_pixel; + int err; + sz_stream d_stream; + + strcpy((char*)out, "garbage"); + + d_stream.hidden = 0; + + d_stream.next_in = in; + d_stream.next_out = out; + + d_stream.avail_in = 0; + d_stream.avail_out = 0; + + d_stream.total_in = 0; + d_stream.total_out = 0; + + d_stream.options_mask = SZ_RAW_OPTION_MASK | SZ_NN_OPTION_MASK | SZ_MSB_OPTION_MASK; + d_stream.bits_per_pixel = bits_per_pixel; + d_stream.pixels_per_block = 8; + d_stream.pixels_per_scanline = 16; + + bytes_per_pixel = (bits_per_pixel + 7)/8; + if (bytes_per_pixel == 3) bytes_per_pixel = 4; + + d_stream.image_pixels = out_size/bytes_per_pixel; + + err = SZ_DecompressInit(&d_stream); + if (err != SZ_OK) { + fprintf(stderr, "SZ_DecompressEnd error: %d\n", err); + exit(0); + } + + while (d_stream.total_in < size) { + d_stream.avail_in = d_stream.avail_out = buffer_size; + if (d_stream.avail_in + d_stream.total_in > size) + d_stream.avail_in = size - d_stream.total_in; + + err = SZ_Decompress(&d_stream, SZ_NO_FLUSH); + if (err == SZ_STREAM_END) break; + + if (err != SZ_OK) { + fprintf(stderr, "SZ_Decompress error: %d\n", err); + exit(0); + } + } + + while (d_stream.total_out < out_size) { + d_stream.avail_out = buffer_size; + err = SZ_Decompress(&d_stream, SZ_FINISH); + if (err == SZ_STREAM_END) break; + + if (err != SZ_OK) { + fprintf(stderr, "SZ_Decompress error: %d\n", err); + exit(0); + } + } + + err = SZ_DecompressEnd(&d_stream); + if (err != SZ_OK) { + fprintf(stderr, "SZ_DecompressEnd error: %d\n", err); + exit(0); + } + + return d_stream.total_out; +} + +int main() { + char *out = (char *) malloc(1024*1024L); + unsigned long size = szip_decoding(8, NULL, 0, out, 0, 1); + return 0; +} diff --git a/recipes/cpputest/config.yml b/recipes/cpputest/config.yml new file mode 100644 index 0000000000000..9e751beac176c --- /dev/null +++ b/recipes/cpputest/config.yml @@ -0,0 +1,3 @@ +versions: + "2.1.1": + folder: all From 084c76d801a34801d3928a75c9a4ab24f1e07240 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 13:40:18 +0000 Subject: [PATCH 02/51] Update versions for cpputest --- recipes/cpputest/all/conandata.yml | 14 +++++--------- recipes/cpputest/config.yml | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/recipes/cpputest/all/conandata.yml b/recipes/cpputest/all/conandata.yml index 52d2161a0f0cf..a47da88789a2a 100644 --- a/recipes/cpputest/all/conandata.yml +++ b/recipes/cpputest/all/conandata.yml @@ -1,10 +1,6 @@ sources: - "2.1.1": - url: "https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz" - sha256: "21ee958b4f2d4be2c9cabfa5e1a94877043609ce86fde5f286f105f7ff84d412" -patches: - "2.1.1": - - patch_file: "patches/fix_unknown_size_t.patch" - base_path: "source_subfolder" - - patch_file: "patches/build_either_static_or_shared.patch" - base_path: "source_subfolder" + "4.0": + - url: "https://github.com/cpputest/cpputest/releases/download/v4.0/cpputest-4.0.tar.gz" + sha256: 21c692105db15299b5529af81a11a7ad80397f92c122bd7bf1e4a4b0e85654f7 + - url: "https://raw.githubusercontent.com/cpputest/cpputest/v4.0/COPYING" + sha256: d8fe282e4047197e1fbd6ef2527bde832a1514be6bd82fac7d1296ce184285c8 diff --git a/recipes/cpputest/config.yml b/recipes/cpputest/config.yml index 9e751beac176c..26b826fb2c5e4 100644 --- a/recipes/cpputest/config.yml +++ b/recipes/cpputest/config.yml @@ -1,3 +1,3 @@ versions: - "2.1.1": + 4.0: folder: all From a77a96a932f660fd827b008b1d7e25542111a6ce Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 13:43:29 +0000 Subject: [PATCH 03/51] Copy in values for CppUTest --- recipes/cpputest/all/conanfile.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 28cdabd6dae81..474160f30ecbf 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -2,13 +2,15 @@ from conans import ConanFile, CMake, tools -class SzipConan(ConanFile): - name = "szip" - description = "C Implementation of the extended-Rice lossless compression " \ - "algorithm, suitable for use with scientific data." - license = "Szip License" - topics = ("conan", "szip", "compression", "decompression") - homepage = "https://support.hdfgroup.org/doc_resource/SZIP/" +class CppUTestConan(ConanFile): + name = "cpputest" + description = \ +"CppUTest is a C /C++ based unit xUnit test framework for unit testing and for test-driving your code." \ +"It is written in C++ but is used in C and C++ projects and frequently" \ +"used in embedded systems but it works for any C/C++ project." + license = "BSD-3-Clause License" + topics = ("conan", "testing", "unit-testing") + homepage = "http://cpputest.github.io" url = "https://github.com/conan-io/conan-center-index" exports_sources = ["CMakeLists.txt", "patches/**"] generators = "cmake" @@ -72,7 +74,7 @@ def package(self): cmake.install() def package_info(self): - self.cpp_info.names["cmake_find_package"] = "SZIP" - self.cpp_info.names["cmake_find_package_multi"] = "SZIP" + self.cpp_info.names["cmake_find_package"] = "CppUTest" + self.cpp_info.names["cmake_find_package_multi"] = "CppUTest" self.cpp_info.libs = tools.collect_libs(self) From ce4a8c82509ddf4d5c9f5ca31e9e8b53889a71a0 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 13:45:47 +0000 Subject: [PATCH 04/51] Fix error: ERROR: cpputest/4.0: Error in source() method, line 48 tools.get(**self.conan_data["sources"][self.version]) TypeError: get() argument after ** must be a mapping, not list --- recipes/cpputest/all/conandata.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/recipes/cpputest/all/conandata.yml b/recipes/cpputest/all/conandata.yml index a47da88789a2a..d06d6d3fe54b1 100644 --- a/recipes/cpputest/all/conandata.yml +++ b/recipes/cpputest/all/conandata.yml @@ -1,6 +1,5 @@ sources: "4.0": - - url: "https://github.com/cpputest/cpputest/releases/download/v4.0/cpputest-4.0.tar.gz" - sha256: 21c692105db15299b5529af81a11a7ad80397f92c122bd7bf1e4a4b0e85654f7 - - url: "https://raw.githubusercontent.com/cpputest/cpputest/v4.0/COPYING" - sha256: d8fe282e4047197e1fbd6ef2527bde832a1514be6bd82fac7d1296ce184285c8 + url: "https://github.com/cpputest/cpputest/releases/download/v4.0/cpputest-4.0.tar.gz" + sha256: 21c692105db15299b5529af81a11a7ad80397f92c122bd7bf1e4a4b0e85654f7 + From 64bc2671b8c3130ab9e3483a16e4d3a4f7582d20 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 13:47:07 +0000 Subject: [PATCH 05/51] Remove references to patches --- recipes/cpputest/all/conanfile.py | 4 +-- .../build_either_static_or_shared.patch | 31 ------------------- .../all/patches/fix_unknown_size_t.patch | 11 ------- 3 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 recipes/cpputest/all/patches/build_either_static_or_shared.patch delete mode 100644 recipes/cpputest/all/patches/fix_unknown_size_t.patch diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 474160f30ecbf..d9966829c7675 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -12,7 +12,7 @@ class CppUTestConan(ConanFile): topics = ("conan", "testing", "unit-testing") homepage = "http://cpputest.github.io" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/**"] + exports_sources = ["CMakeLists.txt"] generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = { @@ -49,8 +49,6 @@ def source(self): os.rename(self.name + "-" + self.version, self._source_subfolder) def build(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") cmake = self._configure_cmake() diff --git a/recipes/cpputest/all/patches/build_either_static_or_shared.patch b/recipes/cpputest/all/patches/build_either_static_or_shared.patch deleted file mode 100644 index 4400c5e91c578..0000000000000 --- a/recipes/cpputest/all/patches/build_either_static_or_shared.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -22,6 +22,7 @@ set (SZIP_PUBLIC_HEADERS - ${SZIP_SRC_SOURCE_DIR}/szlib.h - ) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${SZIP_LIB_TARGET} STATIC ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS}) - #set_target_properties (${SZIP_LIB_TARGET} - # PROPERTIES -@@ -37,7 +38,7 @@ set_global_variable (SZIP_LIBRARIES_TO_EXPORT ${SZIP_LIB_TARGET}) - SZIP_SET_LIB_OPTIONS (${SZIP_LIB_TARGET} ${SZIP_LIB_NAME} STATIC) - set (install_targets ${SZIP_LIB_TARGET}) - --if (BUILD_SHARED_LIBS) -+else() - add_library (${SZIP_LIBSH_TARGET} SHARED ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS}) - # set_target_properties (${SZIP_LIB_TARGET} - # PROPERTIES -@@ -62,8 +63,9 @@ endif () - if (SZIP_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${SZIP_LIBSH_TARGET} ${SZIP_INSTALL_BIN_DIR} libraries) -- endif (BUILD_SHARED_LIBS) -- INSTALL_TARGET_PDB (${SZIP_LIB_TARGET} ${SZIP_INSTALL_BIN_DIR} libraries) -+ else() -+ INSTALL_TARGET_PDB (${SZIP_LIB_TARGET} ${SZIP_INSTALL_BIN_DIR} libraries) -+ endif() - - install ( - TARGETS diff --git a/recipes/cpputest/all/patches/fix_unknown_size_t.patch b/recipes/cpputest/all/patches/fix_unknown_size_t.patch deleted file mode 100644 index a6b0458c524c2..0000000000000 --- a/recipes/cpputest/all/patches/fix_unknown_size_t.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/szlib.h -+++ b/src/szlib.h -@@ -42,6 +42,8 @@ Post Falls, ID 83854. (208) 262-2008. - #include "ricehdf.h" - #include "szip_adpt.h" - -+#include -+ - #define SZLIB_VERSION "2.1.1" - - /* From ebb7a0be2d3407c9b0d447923b0ca5be8ac2a25a Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 13:47:57 +0000 Subject: [PATCH 06/51] Remove reference to CMAKE_POSITION_INDEPENDENT_CODE --- recipes/cpputest/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index d9966829c7675..ee8b0f9ac1bf4 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -49,8 +49,8 @@ def source(self): os.rename(self.name + "-" + self.version, self._source_subfolder) def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + # tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + # "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") cmake = self._configure_cmake() cmake.build() From c59cec446c270ca727298af761a5448988f59d3b Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 13:53:04 +0000 Subject: [PATCH 07/51] Copy in test code from https://github.com/cpputest/conan-cpputest/blob/c4cf311e7b03de0ec8dfc89f2626b7ef172b7367/test_package/example.cpp --- .../cpputest/all/test_package/test_package.c | 88 +++---------------- 1 file changed, 13 insertions(+), 75 deletions(-) diff --git a/recipes/cpputest/all/test_package/test_package.c b/recipes/cpputest/all/test_package/test_package.c index 11578ead7a9fb..c4d9ec5801af8 100644 --- a/recipes/cpputest/all/test_package/test_package.c +++ b/recipes/cpputest/all/test_package/test_package.c @@ -1,80 +1,18 @@ -#include -#include +#include +#include +#include -#include -#include -#include +TEST_GROUP(FirstTestGroup) +{ +}; -unsigned long szip_decoding(int bits_per_pixel, char *in, long size, char *out, long out_size, long buffer_size) { - int bytes_per_pixel; - int err; - sz_stream d_stream; - - strcpy((char*)out, "garbage"); - - d_stream.hidden = 0; - - d_stream.next_in = in; - d_stream.next_out = out; - - d_stream.avail_in = 0; - d_stream.avail_out = 0; - - d_stream.total_in = 0; - d_stream.total_out = 0; - - d_stream.options_mask = SZ_RAW_OPTION_MASK | SZ_NN_OPTION_MASK | SZ_MSB_OPTION_MASK; - d_stream.bits_per_pixel = bits_per_pixel; - d_stream.pixels_per_block = 8; - d_stream.pixels_per_scanline = 16; - - bytes_per_pixel = (bits_per_pixel + 7)/8; - if (bytes_per_pixel == 3) bytes_per_pixel = 4; - - d_stream.image_pixels = out_size/bytes_per_pixel; - - err = SZ_DecompressInit(&d_stream); - if (err != SZ_OK) { - fprintf(stderr, "SZ_DecompressEnd error: %d\n", err); - exit(0); - } - - while (d_stream.total_in < size) { - d_stream.avail_in = d_stream.avail_out = buffer_size; - if (d_stream.avail_in + d_stream.total_in > size) - d_stream.avail_in = size - d_stream.total_in; - - err = SZ_Decompress(&d_stream, SZ_NO_FLUSH); - if (err == SZ_STREAM_END) break; - - if (err != SZ_OK) { - fprintf(stderr, "SZ_Decompress error: %d\n", err); - exit(0); - } - } - - while (d_stream.total_out < out_size) { - d_stream.avail_out = buffer_size; - err = SZ_Decompress(&d_stream, SZ_FINISH); - if (err == SZ_STREAM_END) break; - - if (err != SZ_OK) { - fprintf(stderr, "SZ_Decompress error: %d\n", err); - exit(0); - } - } - - err = SZ_DecompressEnd(&d_stream); - if (err != SZ_OK) { - fprintf(stderr, "SZ_DecompressEnd error: %d\n", err); - exit(0); - } - - return d_stream.total_out; +TEST(FirstTestGroup, FirstTest) +{ + CHECK_TRUE(true); } -int main() { - char *out = (char *) malloc(1024*1024L); - unsigned long size = szip_decoding(8, NULL, 0, out, 0, 1); - return 0; +int main(int argc, const char** argv) +{ + CommandLineTestRunner runner(argc, argv, TestRegistry::getCurrentRegistry()); + return runner.runAllTestsMain(); } From 43bb36e18ed5411f36f5127ee51451d71d85228b Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 14:03:15 +0000 Subject: [PATCH 08/51] Fix building of cpputest test package --- recipes/cpputest/all/test_package/CMakeLists.txt | 4 ++-- .../all/test_package/{test_package.c => test_package.cpp} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename recipes/cpputest/all/test_package/{test_package.c => test_package.cpp} (100%) diff --git a/recipes/cpputest/all/test_package/CMakeLists.txt b/recipes/cpputest/all/test_package/CMakeLists.txt index 7b9b613cbb24a..7557711b6dc83 100644 --- a/recipes/cpputest/all/test_package/CMakeLists.txt +++ b/recipes/cpputest/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() -add_executable(${PROJECT_NAME} test_package.c) +add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/cpputest/all/test_package/test_package.c b/recipes/cpputest/all/test_package/test_package.cpp similarity index 100% rename from recipes/cpputest/all/test_package/test_package.c rename to recipes/cpputest/all/test_package/test_package.cpp From 5669bba65dd526a4f2a91da08c873993b4535b75 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 14:16:35 +0000 Subject: [PATCH 09/51] Remove remnant references to szip --- recipes/cpputest/all/conanfile.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index ee8b0f9ac1bf4..4272bc192611d 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -58,11 +58,7 @@ def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) - self._cmake.definitions["SZIP_ENABLE_ENCODING"] = self.options.enable_encoding - self._cmake.definitions["SZIP_EXTERNALLY_CONFIGURED"] = True self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["SZIP_BUILD_FRAMEWORKS"] = False - self._cmake.definitions["SZIP_PACK_MACOSX_FRAMEWORK"] = False self._cmake.configure(build_folder=self._build_subfolder) return self._cmake From cddb69ec85ba54fb1e5602fc64166cfb7278e7ed Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 15:16:13 +0000 Subject: [PATCH 10/51] Fix inconsistent quoting of version numbers --- recipes/cpputest/all/conandata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conandata.yml b/recipes/cpputest/all/conandata.yml index d06d6d3fe54b1..e999b178a60ab 100644 --- a/recipes/cpputest/all/conandata.yml +++ b/recipes/cpputest/all/conandata.yml @@ -1,5 +1,5 @@ sources: - "4.0": + 4.0: url: "https://github.com/cpputest/cpputest/releases/download/v4.0/cpputest-4.0.tar.gz" sha256: 21c692105db15299b5529af81a11a7ad80397f92c122bd7bf1e4a4b0e85654f7 From d98daa6518822f51aa3c11b0dc3399486766d3d9 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 15:43:22 +0000 Subject: [PATCH 11/51] Second attempt at fixing quoting of version numbers --- recipes/cpputest/all/conandata.yml | 2 +- recipes/cpputest/config.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/cpputest/all/conandata.yml b/recipes/cpputest/all/conandata.yml index e999b178a60ab..d06d6d3fe54b1 100644 --- a/recipes/cpputest/all/conandata.yml +++ b/recipes/cpputest/all/conandata.yml @@ -1,5 +1,5 @@ sources: - 4.0: + "4.0": url: "https://github.com/cpputest/cpputest/releases/download/v4.0/cpputest-4.0.tar.gz" sha256: 21c692105db15299b5529af81a11a7ad80397f92c122bd7bf1e4a4b0e85654f7 diff --git a/recipes/cpputest/config.yml b/recipes/cpputest/config.yml index 26b826fb2c5e4..2e78700e71475 100644 --- a/recipes/cpputest/config.yml +++ b/recipes/cpputest/config.yml @@ -1,3 +1,3 @@ versions: - 4.0: + "4.0": folder: all From 657c9bec0741b13232fd05379063123290714f6f Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 16:20:06 +0000 Subject: [PATCH 12/51] Fix PC-FILES (KB-H020) by deleting lib/pkgconfig directory --- recipes/cpputest/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 4272bc192611d..e8dbda9a090a7 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -66,6 +66,7 @@ def package(self): self.copy("COPYING", dst="licenses", src=self._source_subfolder) cmake = self._configure_cmake() cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.names["cmake_find_package"] = "CppUTest" From 86907bb13ac854a749bce98b3c7c41fcbda4c485 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 16:23:57 +0000 Subject: [PATCH 13/51] Fix CMAKE-MODULES-CONFIG-FILES (KB-H016) by deleting lib/CppUTest/cmake --- recipes/cpputest/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index e8dbda9a090a7..a191febbf35b1 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -67,6 +67,7 @@ def package(self): cmake = self._configure_cmake() cmake.install() tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + tools.rmdir(os.path.join(self.package_folder, "lib", "CppUTest", "cmake")) def package_info(self): self.cpp_info.names["cmake_find_package"] = "CppUTest" From 9558c6d38281361fbec768eb2e9cc6da6f26e5a9 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 17:29:54 +0000 Subject: [PATCH 14/51] Add options Copied in from: https://github.com/cpputest/conan-cpputest/blob/c4cf311e7b03de0ec8dfc89f2626b7ef172b7367/conanfile.py --- recipes/cpputest/all/conanfile.py | 32 +++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index a191febbf35b1..a7addbe157d94 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -18,12 +18,28 @@ class CppUTestConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "enable_encoding": [True, False] + "verbose": [True, False], + "use_std_c_lib": ["ON", "OFF"], + "use_std_cpp_lib": ["ON", "OFF"], + "use_cpp11": ["ON", "OFF"], + "detect_mem_leaks": ["ON", "OFF"], + "extensions": ["ON", "OFF"], + "longlong": ["ON", "OFF"], + "coverage": ["ON", "OFF"], + "tests": ["ON", "OFF"], } default_options = { "shared": False, - "fPIC": True, - "enable_encoding": False + "fPIC": False, + "verbose": False, + "use_std_c_lib": "ON", + "use_std_cpp_lib": "ON", + "use_cpp11": "ON", + "detect_mem_leaks": "ON", + "extensions": "ON", + "longlong": "ON", + "coverage": "OFF", + "tests": "ON", } _cmake = None @@ -58,7 +74,15 @@ def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False + self._cmake.verbose = self.options.verbose + self._cmake.definitions["STD_C"] = self.options.use_std_c_lib + self._cmake.definitions["STD_CPP"] = self.options.use_std_cpp_lib + self._cmake.definitions["C++11"] = self.options.use_cpp11 + self._cmake.definitions["MEMORY_LEAK_DETECTION"] = self.options.detect_mem_leaks + self._cmake.definitions["EXTENSIONS"] = self.options.extensions + self._cmake.definitions["LONGLONG"] = self.options.longlong + self._cmake.definitions["COVERAGE"] = self.options.coverage + self._cmake.definitions["TESTS"] = self.options.tests self._cmake.configure(build_folder=self._build_subfolder) return self._cmake From 1af011c68f00fcbd155fe50b220fa409a4885eb7 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Tue, 26 Jan 2021 17:31:39 +0000 Subject: [PATCH 15/51] Turn tests off, by default --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index a7addbe157d94..ad68d5464c49d 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -39,7 +39,7 @@ class CppUTestConan(ConanFile): "extensions": "ON", "longlong": "ON", "coverage": "OFF", - "tests": "ON", + "tests": "OFF", } _cmake = None From f4327a58da23afbf22b0b690efa0f80f302af63f Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 27 Jan 2021 15:09:52 +0000 Subject: [PATCH 16/51] Update recipes/cpputest/all/conanfile.py Co-authored-by: Chris Mc --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index ad68d5464c49d..e2ab9a1585481 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -8,7 +8,7 @@ class CppUTestConan(ConanFile): "CppUTest is a C /C++ based unit xUnit test framework for unit testing and for test-driving your code." \ "It is written in C++ but is used in C and C++ projects and frequently" \ "used in embedded systems but it works for any C/C++ project." - license = "BSD-3-Clause License" + license = "BSD-3-Clause" topics = ("conan", "testing", "unit-testing") homepage = "http://cpputest.github.io" url = "https://github.com/conan-io/conan-center-index" From a43fa98c59c858b3a66c1aec97037208ba0c7b3e Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 27 Jan 2021 15:17:28 +0000 Subject: [PATCH 17/51] Remove coverage and tests options - and force them to always be off. Addressing code review feedback. --- recipes/cpputest/all/conanfile.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index e2ab9a1585481..91ad437bf4c0f 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -25,8 +25,6 @@ class CppUTestConan(ConanFile): "detect_mem_leaks": ["ON", "OFF"], "extensions": ["ON", "OFF"], "longlong": ["ON", "OFF"], - "coverage": ["ON", "OFF"], - "tests": ["ON", "OFF"], } default_options = { "shared": False, @@ -38,8 +36,6 @@ class CppUTestConan(ConanFile): "detect_mem_leaks": "ON", "extensions": "ON", "longlong": "ON", - "coverage": "OFF", - "tests": "OFF", } _cmake = None @@ -81,8 +77,8 @@ def _configure_cmake(self): self._cmake.definitions["MEMORY_LEAK_DETECTION"] = self.options.detect_mem_leaks self._cmake.definitions["EXTENSIONS"] = self.options.extensions self._cmake.definitions["LONGLONG"] = self.options.longlong - self._cmake.definitions["COVERAGE"] = self.options.coverage - self._cmake.definitions["TESTS"] = self.options.tests + self._cmake.definitions["COVERAGE"] = "OFF" + self._cmake.definitions["TESTS"] = "OFF" self._cmake.configure(build_folder=self._build_subfolder) return self._cmake From e8ee75a888ce472523cef58a88e35fb281be3bbe Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 27 Jan 2021 19:36:39 +0000 Subject: [PATCH 18/51] Code review feedback: Fix use of find_package() --- recipes/cpputest/all/conanfile.py | 2 ++ recipes/cpputest/all/test_package/CMakeLists.txt | 4 +++- recipes/cpputest/all/test_package/conanfile.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 91ad437bf4c0f..213c658e743e3 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -90,6 +90,8 @@ def package(self): tools.rmdir(os.path.join(self.package_folder, "lib", "CppUTest", "cmake")) def package_info(self): + self.cpp_info.filenames["cmake_find_package"] = "CppUTest" + self.cpp_info.filenames["cmake_find_package_multi"] = "CppUTest" self.cpp_info.names["cmake_find_package"] = "CppUTest" self.cpp_info.names["cmake_find_package_multi"] = "CppUTest" diff --git a/recipes/cpputest/all/test_package/CMakeLists.txt b/recipes/cpputest/all/test_package/CMakeLists.txt index 7557711b6dc83..1bcc37e4efce8 100644 --- a/recipes/cpputest/all/test_package/CMakeLists.txt +++ b/recipes/cpputest/all/test_package/CMakeLists.txt @@ -4,5 +4,7 @@ project(test_package CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() +find_package(CppUTest REQUIRED CONFIG) + add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} CppUTest CppUTestExt) diff --git a/recipes/cpputest/all/test_package/conanfile.py b/recipes/cpputest/all/test_package/conanfile.py index ea57a464900be..84ee68733e516 100644 --- a/recipes/cpputest/all/test_package/conanfile.py +++ b/recipes/cpputest/all/test_package/conanfile.py @@ -4,7 +4,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) From 8f855a6feb4e863505ddc903877f74a7a0605bb0 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 27 Jan 2021 19:53:30 +0000 Subject: [PATCH 19/51] Correct homepage URL to use https --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 213c658e743e3..85cc03c447395 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -10,7 +10,7 @@ class CppUTestConan(ConanFile): "used in embedded systems but it works for any C/C++ project." license = "BSD-3-Clause" topics = ("conan", "testing", "unit-testing") - homepage = "http://cpputest.github.io" + homepage = "https://cpputest.github.io" url = "https://github.com/conan-io/conan-center-index" exports_sources = ["CMakeLists.txt"] generators = "cmake" From 380caae8c31dc0e8face5c340e7291099073d666 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 27 Jan 2021 19:53:49 +0000 Subject: [PATCH 20/51] Remove unnecessary quotes in add_subdirectory() call --- recipes/cpputest/all/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/CMakeLists.txt b/recipes/cpputest/all/CMakeLists.txt index 217b9530b904d..361b35d4c17d9 100644 --- a/recipes/cpputest/all/CMakeLists.txt +++ b/recipes/cpputest/all/CMakeLists.txt @@ -4,4 +4,4 @@ project(cmake_wrapper) include(conanbuildinfo.cmake) conan_basic_setup() -add_subdirectory("source_subfolder") +add_subdirectory(source_subfolder) From 3750ed8c159a566b6075b7c8576e23fbe36fab4b Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 27 Jan 2021 19:54:05 +0000 Subject: [PATCH 21/51] Whitespace change: Fix inconsistent indentation --- recipes/cpputest/all/test_package/test_package.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/test_package/test_package.cpp b/recipes/cpputest/all/test_package/test_package.cpp index c4d9ec5801af8..2675c3b7d443a 100644 --- a/recipes/cpputest/all/test_package/test_package.cpp +++ b/recipes/cpputest/all/test_package/test_package.cpp @@ -8,7 +8,7 @@ TEST_GROUP(FirstTestGroup) TEST(FirstTestGroup, FirstTest) { - CHECK_TRUE(true); + CHECK_TRUE(true); } int main(int argc, const char** argv) From d47ab82c51a14e98c68760a7f85b2e63b6b8ca40 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 27 Jan 2021 21:48:53 +0000 Subject: [PATCH 22/51] Make default fPIC value consistent with majority of other recipes --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 85cc03c447395..4a2948f1fa652 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -28,7 +28,7 @@ class CppUTestConan(ConanFile): } default_options = { "shared": False, - "fPIC": False, + "fPIC": True, "verbose": False, "use_std_c_lib": "ON", "use_std_cpp_lib": "ON", From 1f5621264a321957c573cc891fc45e45fb00df00 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Thu, 28 Jan 2021 11:29:49 +0000 Subject: [PATCH 23/51] Code review feedback: Set pkg_config name --- recipes/cpputest/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 4a2948f1fa652..8e7ade51567a0 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -94,5 +94,6 @@ def package_info(self): self.cpp_info.filenames["cmake_find_package_multi"] = "CppUTest" self.cpp_info.names["cmake_find_package"] = "CppUTest" self.cpp_info.names["cmake_find_package_multi"] = "CppUTest" + self.cpp_info.names["pkg_config"] = "cpputest" self.cpp_info.libs = tools.collect_libs(self) From 505c09be781ed7aa8f9167ce0b9984827464abc2 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Thu, 28 Jan 2021 11:32:37 +0000 Subject: [PATCH 24/51] Code review feedback: Remove unnecessary setting of self.cpp_info.filenames --- recipes/cpputest/all/conanfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 8e7ade51567a0..17bf8e0805aa5 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -90,8 +90,6 @@ def package(self): tools.rmdir(os.path.join(self.package_folder, "lib", "CppUTest", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "CppUTest" - self.cpp_info.filenames["cmake_find_package_multi"] = "CppUTest" self.cpp_info.names["cmake_find_package"] = "CppUTest" self.cpp_info.names["cmake_find_package_multi"] = "CppUTest" self.cpp_info.names["pkg_config"] = "cpputest" From b8899f8f8a3ed23e70dba4094fdd7fb96a6f3903 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sat, 30 Jan 2021 12:12:33 +0000 Subject: [PATCH 25/51] Attempt to fix Windows linker errors LNK2019: unresolved external symbol __imp_timeGetTime --- recipes/cpputest/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 17bf8e0805aa5..ddd1ec6d53d24 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -95,3 +95,5 @@ def package_info(self): self.cpp_info.names["pkg_config"] = "cpputest" self.cpp_info.libs = tools.collect_libs(self) + if self.settings.os == "Windows": + self.cpp_info.system_libs = ["winmm"] From b83b8da0f8daed0f898b6d40b6af2790ecfeee20 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sat, 30 Jan 2021 13:08:09 +0000 Subject: [PATCH 26/51] Further attempt to fix Windows linker errors LNK2019: unresolved external symbol __imp_timeGetTime --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index ddd1ec6d53d24..e334e497c5d89 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -96,4 +96,4 @@ def package_info(self): self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": - self.cpp_info.system_libs = ["winmm"] + self.cpp_info.system_libs.extend(["winmm"]) From 767a0f5c6df3cf20fc58e9201bd9fa3e6e2bde39 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sat, 30 Jan 2021 14:28:58 +0000 Subject: [PATCH 27/51] Code review feedback: conditionally remove C++ settings Co-authored-by: Chris Mc --- recipes/cpputest/all/conanfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index e334e497c5d89..fbf749b3418cc 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -53,8 +53,9 @@ def config_options(self): del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + if not self.option.use_std_cpp_lib: + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd def source(self): tools.get(**self.conan_data["sources"][self.version]) From 33fd6c93e9151bef432cf34a71e75929b0e6a91b Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sat, 30 Jan 2021 14:32:22 +0000 Subject: [PATCH 28/51] Further attempt to fix Windows linker errors LNK2019: unresolved external symbol __imp_timeGetTime Fix taken from https://github.com/iimachines/webrtc-build/issues/2#issuecomment-503535704 Thanks to @prince-chrismc for pointing it out. --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index fbf749b3418cc..86e4578680030 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -97,4 +97,4 @@ def package_info(self): self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": - self.cpp_info.system_libs.extend(["winmm"]) + self.cpp_info.system_libs.extend(["secur32.lib", "winmm.lib", "dmoguids.lib", "wmcodecdspuuid.lib", "msdmo.lib", "Strmiids.lib"]) From 73ad7709b16d700ae949dfb6d27708e98b472b7d Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sat, 30 Jan 2021 14:35:56 +0000 Subject: [PATCH 29/51] Fix typo in configure() --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 86e4578680030..f94ddf5ccc639 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -53,7 +53,7 @@ def config_options(self): del self.options.fPIC def configure(self): - if not self.option.use_std_cpp_lib: + if not self.options.use_std_cpp_lib: del self.settings.compiler.libcxx del self.settings.compiler.cppstd From 5a3afcc1fec00512ba866274eec7cd9c6fc42d10 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sat, 30 Jan 2021 14:55:07 +0000 Subject: [PATCH 30/51] Remove ".lib" from library names, in further attempt to fix missing __imp_timeGetTime symbol --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index f94ddf5ccc639..874b161a4c447 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -97,4 +97,4 @@ def package_info(self): self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": - self.cpp_info.system_libs.extend(["secur32.lib", "winmm.lib", "dmoguids.lib", "wmcodecdspuuid.lib", "msdmo.lib", "Strmiids.lib"]) + self.cpp_info.system_libs.extend(["secur32", "winmm", "dmoguids", "wmcodecdspuuid", "msdmo", "Strmiids"]) From 669e1e0a38033302a6c803f37b5a346a09d44afd Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sun, 31 Jan 2021 13:05:34 +0000 Subject: [PATCH 31/51] Remove verbose option - it doesn't affect the output library --- recipes/cpputest/all/conanfile.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 874b161a4c447..7875366905a1a 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -18,7 +18,6 @@ class CppUTestConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "verbose": [True, False], "use_std_c_lib": ["ON", "OFF"], "use_std_cpp_lib": ["ON", "OFF"], "use_cpp11": ["ON", "OFF"], @@ -29,7 +28,6 @@ class CppUTestConan(ConanFile): default_options = { "shared": False, "fPIC": True, - "verbose": False, "use_std_c_lib": "ON", "use_std_cpp_lib": "ON", "use_cpp11": "ON", @@ -71,7 +69,6 @@ def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) - self._cmake.verbose = self.options.verbose self._cmake.definitions["STD_C"] = self.options.use_std_c_lib self._cmake.definitions["STD_CPP"] = self.options.use_std_cpp_lib self._cmake.definitions["C++11"] = self.options.use_cpp11 From b4e90e802a074ede8768dfb743d8e739ab51d9a2 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sun, 31 Jan 2021 14:33:00 +0000 Subject: [PATCH 32/51] Make tests pass if extensions are disabled --- .../cpputest/all/test_package/CMakeLists.txt | 9 +++++++-- .../cpputest/all/test_package/conanfile.py | 7 +++++-- .../test_package_with_extensions.cpp | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 recipes/cpputest/all/test_package/test_package_with_extensions.cpp diff --git a/recipes/cpputest/all/test_package/CMakeLists.txt b/recipes/cpputest/all/test_package/CMakeLists.txt index 1bcc37e4efce8..c5a16224ccbb3 100644 --- a/recipes/cpputest/all/test_package/CMakeLists.txt +++ b/recipes/cpputest/all/test_package/CMakeLists.txt @@ -6,5 +6,10 @@ conan_basic_setup() find_package(CppUTest REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CppUTest CppUTestExt) +add_executable(test_package test_package.cpp) +target_link_libraries(test_package CppUTest) + +if(WITH_EXTENSIONS) + add_executable(test_package_with_extensions test_package_with_extensions.cpp) + target_link_libraries(test_package_with_extensions CppUTest CppUTestExt) +endif() diff --git a/recipes/cpputest/all/test_package/conanfile.py b/recipes/cpputest/all/test_package/conanfile.py index 84ee68733e516..84119e9fe5a65 100644 --- a/recipes/cpputest/all/test_package/conanfile.py +++ b/recipes/cpputest/all/test_package/conanfile.py @@ -8,10 +8,13 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) + cmake.definitions["WITH_EXTENSIONS"] = self.options["cpputest"].extensions 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) + self.run(os.path.join("bin", "test_package"), run_environment=True) + + if self.options["cpputest"].extensions: + self.run(os.path.join("bin", "test_package_with_extensions"), run_environment=True) diff --git a/recipes/cpputest/all/test_package/test_package_with_extensions.cpp b/recipes/cpputest/all/test_package/test_package_with_extensions.cpp new file mode 100644 index 0000000000000..df94dae2d50a1 --- /dev/null +++ b/recipes/cpputest/all/test_package/test_package_with_extensions.cpp @@ -0,0 +1,19 @@ +#include +#include +#include +#include // Only found if extensions enabled + +TEST_GROUP(FirstTestGroup) +{ +}; + +TEST(FirstTestGroup, FirstTest) +{ + CHECK_TRUE(true); +} + +int main(int argc, const char** argv) +{ + CommandLineTestRunner runner(argc, argv, TestRegistry::getCurrentRegistry()); + return runner.runAllTestsMain(); +} From 11b570c47288187e2ae06184b27967e0215fcaff Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sun, 31 Jan 2021 15:07:51 +0000 Subject: [PATCH 33/51] Invert if condition, to reduce nesting of code --- recipes/cpputest/all/test_package/conanfile.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/recipes/cpputest/all/test_package/conanfile.py b/recipes/cpputest/all/test_package/conanfile.py index 84119e9fe5a65..6d48a65a860af 100644 --- a/recipes/cpputest/all/test_package/conanfile.py +++ b/recipes/cpputest/all/test_package/conanfile.py @@ -13,8 +13,10 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if tools.cross_building(self.settings): + return - if self.options["cpputest"].extensions: - self.run(os.path.join("bin", "test_package_with_extensions"), run_environment=True) + self.run(os.path.join("bin", "test_package"), run_environment=True) + + if self.options["cpputest"].extensions: + self.run(os.path.join("bin", "test_package_with_extensions"), run_environment=True) From e65a2ef3aa48577aeb930c1266e21876313985db Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sun, 31 Jan 2021 15:13:05 +0000 Subject: [PATCH 34/51] Further attempt at fixing missing symbols on Windows --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 7875366905a1a..011163d5cabf9 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -94,4 +94,4 @@ def package_info(self): self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": - self.cpp_info.system_libs.extend(["secur32", "winmm", "dmoguids", "wmcodecdspuuid", "msdmo", "Strmiids"]) + self.cpp_info.system_libs.extend(["Winmm"]) From 5369177314ce1481bf5d46097286da7735cf4fd2 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sun, 31 Jan 2021 16:30:34 +0000 Subject: [PATCH 35/51] Another attempt at fixing missing symbols on Windows --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 011163d5cabf9..76ac38be226aa 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -94,4 +94,4 @@ def package_info(self): self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": - self.cpp_info.system_libs.extend(["Winmm"]) + self.cpp_info.components["cpputest"].system_libs.extend(["Winmm"]) From 6b43b8523574afe5a5d199e38e9c26e485f1d799 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sun, 31 Jan 2021 22:56:10 +0000 Subject: [PATCH 36/51] Revert back to the way of specifying winmm in b83b8da0f8daed0f898b6d40b6af2790ecfeee20 As this matches the --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 76ac38be226aa..36b65eccd0208 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -94,4 +94,4 @@ def package_info(self): self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": - self.cpp_info.components["cpputest"].system_libs.extend(["Winmm"]) + self.cpp_info.system_libs.extend(["winmm"]) From 3a0a038109ac2501ce2b4a7fb7e607094104d45b Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 3 Feb 2021 12:22:01 +0000 Subject: [PATCH 37/51] Fix windows linker errors --- recipes/cpputest/all/test_package/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/cpputest/all/test_package/CMakeLists.txt b/recipes/cpputest/all/test_package/CMakeLists.txt index c5a16224ccbb3..17f3b0852d0ef 100644 --- a/recipes/cpputest/all/test_package/CMakeLists.txt +++ b/recipes/cpputest/all/test_package/CMakeLists.txt @@ -7,9 +7,9 @@ conan_basic_setup() find_package(CppUTest REQUIRED CONFIG) add_executable(test_package test_package.cpp) -target_link_libraries(test_package CppUTest) +target_link_libraries(test_package CppUTest::CppUTest) if(WITH_EXTENSIONS) add_executable(test_package_with_extensions test_package_with_extensions.cpp) - target_link_libraries(test_package_with_extensions CppUTest CppUTestExt) + target_link_libraries(test_package_with_extensions CppUTest::CppUTest CppUTestExt) endif() From 375033577a22e9d0a4e2fd89731c1b7ea2b33e1d Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 3 Feb 2021 15:35:42 +0000 Subject: [PATCH 38/51] Delete fPIC option if shared --- recipes/cpputest/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 36b65eccd0208..08be70bc3fbad 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -51,6 +51,8 @@ def config_options(self): del self.options.fPIC def configure(self): + if self.options.shared: + del self.options.fPIC if not self.options.use_std_cpp_lib: del self.settings.compiler.libcxx del self.settings.compiler.cppstd From 4c8c23e575503b09ece26b589d3f8f44f9598489 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 3 Feb 2021 15:47:16 +0000 Subject: [PATCH 39/51] Shared libraries are not supported, so remove that option --- recipes/cpputest/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 08be70bc3fbad..8d01d60d10774 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -16,7 +16,7 @@ class CppUTestConan(ConanFile): generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], + "shared": [False], "fPIC": [True, False], "use_std_c_lib": ["ON", "OFF"], "use_std_cpp_lib": ["ON", "OFF"], From e1de550baa760b506b811bdc0a4fe2cf96a817b4 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 3 Feb 2021 16:14:55 +0000 Subject: [PATCH 40/51] Completely remove shared option, as shared builds not supported --- recipes/cpputest/all/conanfile.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 8d01d60d10774..514c31787b8b8 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -16,7 +16,6 @@ class CppUTestConan(ConanFile): generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [False], "fPIC": [True, False], "use_std_c_lib": ["ON", "OFF"], "use_std_cpp_lib": ["ON", "OFF"], @@ -26,7 +25,6 @@ class CppUTestConan(ConanFile): "longlong": ["ON", "OFF"], } default_options = { - "shared": False, "fPIC": True, "use_std_c_lib": "ON", "use_std_cpp_lib": "ON", @@ -51,8 +49,6 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.options.shared: - del self.options.fPIC if not self.options.use_std_cpp_lib: del self.settings.compiler.libcxx del self.settings.compiler.cppstd From 79662489af7ca98f30fbafa5a71a984012cfd77f Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 3 Feb 2021 16:37:55 +0000 Subject: [PATCH 41/51] Code-review feedback: Remove commented-out lines --- recipes/cpputest/all/conanfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 514c31787b8b8..fb4d576be909b 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -58,8 +58,6 @@ def source(self): os.rename(self.name + "-" + self.version, self._source_subfolder) def build(self): - # tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - # "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") cmake = self._configure_cmake() cmake.build() From 33014fd515e7774521a2904b82b5cf9e14479901 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Wed, 3 Feb 2021 16:40:00 +0000 Subject: [PATCH 42/51] Code-review feedback: Add pthread dependency on some platforms --- recipes/cpputest/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index fb4d576be909b..beb886b0efa3d 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -91,3 +91,5 @@ def package_info(self): self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["winmm"]) + elif self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.system_libs = ["pthread"] From 98104daad867ef0a6fa17dfc9364f8f0ddc33cb9 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Thu, 4 Feb 2021 10:13:05 +0000 Subject: [PATCH 43/51] Add target CppUTest::CppUTestExt --- recipes/cpputest/all/conanfile.py | 10 +++++++++- recipes/cpputest/all/test_package/CMakeLists.txt | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index beb886b0efa3d..ee78302bfd650 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -88,7 +88,15 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "CppUTest" self.cpp_info.names["pkg_config"] = "cpputest" - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.components["CppUTest"].names["cmake_find_package"] = "CppUTest" + self.cpp_info.components["CppUTest"].names["cmake_find_package_multi"] = "CppUTest" + self.cpp_info.components["CppUTest"].libs = ["CppUTest"] + + if self.options.extensions: + self.cpp_info.components["CppUTestExt"].names["cmake_find_package"] = "CppUTestExt" + self.cpp_info.components["CppUTestExt"].names["cmake_find_package_multi"] = "CppUTestExt" + self.cpp_info.components["CppUTestExt"].libs = ["CppUTestExt"] + if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["winmm"]) elif self.settings.os in ("Linux", "FreeBSD"): diff --git a/recipes/cpputest/all/test_package/CMakeLists.txt b/recipes/cpputest/all/test_package/CMakeLists.txt index 17f3b0852d0ef..f484e394eeb98 100644 --- a/recipes/cpputest/all/test_package/CMakeLists.txt +++ b/recipes/cpputest/all/test_package/CMakeLists.txt @@ -11,5 +11,5 @@ target_link_libraries(test_package CppUTest::CppUTest) if(WITH_EXTENSIONS) add_executable(test_package_with_extensions test_package_with_extensions.cpp) - target_link_libraries(test_package_with_extensions CppUTest::CppUTest CppUTestExt) + target_link_libraries(test_package_with_extensions CppUTest::CppUTest CppUTest::CppUTestExt) endif() From 6a90c312d8c14da74426a2f2f689ca0de6233931 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Thu, 4 Feb 2021 10:15:07 +0000 Subject: [PATCH 44/51] Make CppUTest::CppUTestExt depend on CppUTest::CppUTest --- recipes/cpputest/all/conanfile.py | 1 + recipes/cpputest/all/test_package/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index ee78302bfd650..5d57f91cc8ed9 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -96,6 +96,7 @@ def package_info(self): self.cpp_info.components["CppUTestExt"].names["cmake_find_package"] = "CppUTestExt" self.cpp_info.components["CppUTestExt"].names["cmake_find_package_multi"] = "CppUTestExt" self.cpp_info.components["CppUTestExt"].libs = ["CppUTestExt"] + self.cpp_info.components["CppUTestExt"].requires = ["CppUTest"] if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["winmm"]) diff --git a/recipes/cpputest/all/test_package/CMakeLists.txt b/recipes/cpputest/all/test_package/CMakeLists.txt index f484e394eeb98..fca24bcb4b699 100644 --- a/recipes/cpputest/all/test_package/CMakeLists.txt +++ b/recipes/cpputest/all/test_package/CMakeLists.txt @@ -11,5 +11,6 @@ target_link_libraries(test_package CppUTest::CppUTest) if(WITH_EXTENSIONS) add_executable(test_package_with_extensions test_package_with_extensions.cpp) - target_link_libraries(test_package_with_extensions CppUTest::CppUTest CppUTest::CppUTestExt) + # Note: CppUTest::CppUTestExt adds dependency on CppUTest::CppUTest + target_link_libraries(test_package_with_extensions CppUTest::CppUTestExt) endif() From 5b91652a4509a725c7e3d28d4ec7041c5c9e43f9 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Thu, 4 Feb 2021 10:20:47 +0000 Subject: [PATCH 45/51] Port remaining package_info() code to components --- recipes/cpputest/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 5d57f91cc8ed9..2550b2dde7fcd 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -99,6 +99,6 @@ def package_info(self): self.cpp_info.components["CppUTestExt"].requires = ["CppUTest"] if self.settings.os == "Windows": - self.cpp_info.system_libs.extend(["winmm"]) + self.cpp_info.components["CppUTest"].system_libs.extend(["winmm"]) elif self.settings.os in ("Linux", "FreeBSD"): - self.cpp_info.system_libs = ["pthread"] + self.cpp_info.components["CppUTest"].system_libs = ["pthread"] From 67cbd747b55ec905c4dea1f60340b1c2a77075ca Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Thu, 4 Feb 2021 10:31:35 +0000 Subject: [PATCH 46/51] Rename option extensions to with_extensions --- recipes/cpputest/all/conanfile.py | 8 ++++---- recipes/cpputest/all/test_package/conanfile.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 2550b2dde7fcd..5d62b7afb6df0 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -21,7 +21,7 @@ class CppUTestConan(ConanFile): "use_std_cpp_lib": ["ON", "OFF"], "use_cpp11": ["ON", "OFF"], "detect_mem_leaks": ["ON", "OFF"], - "extensions": ["ON", "OFF"], + "with_extensions": ["ON", "OFF"], "longlong": ["ON", "OFF"], } default_options = { @@ -30,7 +30,7 @@ class CppUTestConan(ConanFile): "use_std_cpp_lib": "ON", "use_cpp11": "ON", "detect_mem_leaks": "ON", - "extensions": "ON", + "with_extensions": "ON", "longlong": "ON", } @@ -69,7 +69,7 @@ def _configure_cmake(self): self._cmake.definitions["STD_CPP"] = self.options.use_std_cpp_lib self._cmake.definitions["C++11"] = self.options.use_cpp11 self._cmake.definitions["MEMORY_LEAK_DETECTION"] = self.options.detect_mem_leaks - self._cmake.definitions["EXTENSIONS"] = self.options.extensions + self._cmake.definitions["EXTENSIONS"] = self.options.with_extensions self._cmake.definitions["LONGLONG"] = self.options.longlong self._cmake.definitions["COVERAGE"] = "OFF" self._cmake.definitions["TESTS"] = "OFF" @@ -92,7 +92,7 @@ def package_info(self): self.cpp_info.components["CppUTest"].names["cmake_find_package_multi"] = "CppUTest" self.cpp_info.components["CppUTest"].libs = ["CppUTest"] - if self.options.extensions: + if self.options.with_extensions: self.cpp_info.components["CppUTestExt"].names["cmake_find_package"] = "CppUTestExt" self.cpp_info.components["CppUTestExt"].names["cmake_find_package_multi"] = "CppUTestExt" self.cpp_info.components["CppUTestExt"].libs = ["CppUTestExt"] diff --git a/recipes/cpputest/all/test_package/conanfile.py b/recipes/cpputest/all/test_package/conanfile.py index 6d48a65a860af..90fb643538593 100644 --- a/recipes/cpputest/all/test_package/conanfile.py +++ b/recipes/cpputest/all/test_package/conanfile.py @@ -8,7 +8,7 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) - cmake.definitions["WITH_EXTENSIONS"] = self.options["cpputest"].extensions + cmake.definitions["WITH_EXTENSIONS"] = self.options["cpputest"].with_extensions cmake.configure() cmake.build() @@ -18,5 +18,5 @@ def test(self): self.run(os.path.join("bin", "test_package"), run_environment=True) - if self.options["cpputest"].extensions: + if self.options["cpputest"].with_extensions: self.run(os.path.join("bin", "test_package_with_extensions"), run_environment=True) From 95d10acd9d42f13d57c6c1330257b63be159a890 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Thu, 4 Feb 2021 10:34:32 +0000 Subject: [PATCH 47/51] Rename option longlong to with_longlong --- recipes/cpputest/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 5d62b7afb6df0..5498372636da3 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -22,7 +22,7 @@ class CppUTestConan(ConanFile): "use_cpp11": ["ON", "OFF"], "detect_mem_leaks": ["ON", "OFF"], "with_extensions": ["ON", "OFF"], - "longlong": ["ON", "OFF"], + "with_longlong": ["ON", "OFF"], } default_options = { "fPIC": True, @@ -31,7 +31,7 @@ class CppUTestConan(ConanFile): "use_cpp11": "ON", "detect_mem_leaks": "ON", "with_extensions": "ON", - "longlong": "ON", + "with_longlong": "ON", } _cmake = None @@ -70,7 +70,7 @@ def _configure_cmake(self): self._cmake.definitions["C++11"] = self.options.use_cpp11 self._cmake.definitions["MEMORY_LEAK_DETECTION"] = self.options.detect_mem_leaks self._cmake.definitions["EXTENSIONS"] = self.options.with_extensions - self._cmake.definitions["LONGLONG"] = self.options.longlong + self._cmake.definitions["LONGLONG"] = self.options.with_longlong self._cmake.definitions["COVERAGE"] = "OFF" self._cmake.definitions["TESTS"] = "OFF" self._cmake.configure(build_folder=self._build_subfolder) From a53aff07b0800e69c42fabcc6c38b3d75077d993 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Thu, 4 Feb 2021 10:36:06 +0000 Subject: [PATCH 48/51] Rename option detect_mem_leaks to detect_memory_leaks --- recipes/cpputest/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 5498372636da3..474f64a522f60 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -20,7 +20,7 @@ class CppUTestConan(ConanFile): "use_std_c_lib": ["ON", "OFF"], "use_std_cpp_lib": ["ON", "OFF"], "use_cpp11": ["ON", "OFF"], - "detect_mem_leaks": ["ON", "OFF"], + "detect_memory_leaks": ["ON", "OFF"], "with_extensions": ["ON", "OFF"], "with_longlong": ["ON", "OFF"], } @@ -29,7 +29,7 @@ class CppUTestConan(ConanFile): "use_std_c_lib": "ON", "use_std_cpp_lib": "ON", "use_cpp11": "ON", - "detect_mem_leaks": "ON", + "detect_memory_leaks": "ON", "with_extensions": "ON", "with_longlong": "ON", } @@ -68,7 +68,7 @@ def _configure_cmake(self): self._cmake.definitions["STD_C"] = self.options.use_std_c_lib self._cmake.definitions["STD_CPP"] = self.options.use_std_cpp_lib self._cmake.definitions["C++11"] = self.options.use_cpp11 - self._cmake.definitions["MEMORY_LEAK_DETECTION"] = self.options.detect_mem_leaks + self._cmake.definitions["MEMORY_LEAK_DETECTION"] = self.options.detect_memory_leaks self._cmake.definitions["EXTENSIONS"] = self.options.with_extensions self._cmake.definitions["LONGLONG"] = self.options.with_longlong self._cmake.definitions["COVERAGE"] = "OFF" From ba70c3178380d872bfaba520d60c741d81077175 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Thu, 4 Feb 2021 21:30:28 +0000 Subject: [PATCH 49/51] Remove all options except fPIC and with_extensions --- recipes/cpputest/all/conanfile.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 474f64a522f60..10af785d3e928 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -17,21 +17,11 @@ class CppUTestConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], - "use_std_c_lib": ["ON", "OFF"], - "use_std_cpp_lib": ["ON", "OFF"], - "use_cpp11": ["ON", "OFF"], - "detect_memory_leaks": ["ON", "OFF"], "with_extensions": ["ON", "OFF"], - "with_longlong": ["ON", "OFF"], } default_options = { "fPIC": True, - "use_std_c_lib": "ON", - "use_std_cpp_lib": "ON", - "use_cpp11": "ON", - "detect_memory_leaks": "ON", "with_extensions": "ON", - "with_longlong": "ON", } _cmake = None @@ -49,9 +39,7 @@ def config_options(self): del self.options.fPIC def configure(self): - if not self.options.use_std_cpp_lib: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + pass def source(self): tools.get(**self.conan_data["sources"][self.version]) @@ -65,12 +53,12 @@ def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) - self._cmake.definitions["STD_C"] = self.options.use_std_c_lib - self._cmake.definitions["STD_CPP"] = self.options.use_std_cpp_lib - self._cmake.definitions["C++11"] = self.options.use_cpp11 - self._cmake.definitions["MEMORY_LEAK_DETECTION"] = self.options.detect_memory_leaks + self._cmake.definitions["STD_C"] = "ON" + self._cmake.definitions["STD_CPP"] = "ON" + self._cmake.definitions["C++11"] = "ON" + self._cmake.definitions["MEMORY_LEAK_DETECTION"] = "ON" self._cmake.definitions["EXTENSIONS"] = self.options.with_extensions - self._cmake.definitions["LONGLONG"] = self.options.with_longlong + self._cmake.definitions["LONGLONG"] = "ON" self._cmake.definitions["COVERAGE"] = "OFF" self._cmake.definitions["TESTS"] = "OFF" self._cmake.configure(build_folder=self._build_subfolder) From a20a050281c6c7c642b2b57ac89332e5cd23756d Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Fri, 5 Feb 2021 10:07:49 +0000 Subject: [PATCH 50/51] Remove empty method configure() --- recipes/cpputest/all/conanfile.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 10af785d3e928..8585037565f6c 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -38,9 +38,6 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - def configure(self): - pass - def source(self): tools.get(**self.conan_data["sources"][self.version]) os.rename(self.name + "-" + self.version, self._source_subfolder) From 9108346e5cc91624a9954ee21c76fe8e4c2ec74c Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Fri, 5 Feb 2021 15:50:42 +0000 Subject: [PATCH 51/51] Code review suggestion: "with_extensions" now uses [True, False] Co-authored-by: Uilian Ries --- recipes/cpputest/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index 8585037565f6c..aeb890323643c 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -17,11 +17,11 @@ class CppUTestConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], - "with_extensions": ["ON", "OFF"], + "with_extensions": [True, False], } default_options = { "fPIC": True, - "with_extensions": "ON", + "with_extensions": True, } _cmake = None