Browse Source

cppunit: add package (#5160)

* cppunit: add package

* disable android
star9029 11 months ago
parent
commit
bafe632556

+ 160 - 0
packages/c/cppunit/port/config-auto.h

@@ -0,0 +1,160 @@
+#ifndef _INCLUDE_CPPUNIT_CONFIG_AUTO_H
+#define _INCLUDE_CPPUNIT_CONFIG_AUTO_H 1
+ 
+/* include/cppunit/config-auto.h. Generated automatically at end of configure. */
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* define if library uses std::string::compare(string,pos,n) */
+/* #undef FUNC_STRING_COMPARE_STRING_FIRST */
+
+/* define if the library defines strstream */
+#ifndef CPPUNIT_HAVE_CLASS_STRSTREAM
+#define CPPUNIT_HAVE_CLASS_STRSTREAM 1
+#endif
+
+/* Define to 1 if you have the <cmath> header file. */
+#ifndef CPPUNIT_HAVE_CMATH
+#define CPPUNIT_HAVE_CMATH 1
+#endif
+
+/* define if the compiler supports basic C++11 syntax */
+#ifndef CPPUNIT_HAVE_CXX11
+#define CPPUNIT_HAVE_CXX11 1
+#endif
+
+/* Define if you have the GNU dld library. */
+/* #undef HAVE_DLD */
+
+/* Define to 1 if you have the `dlerror' function. */
+/* #undef HAVE_DLERROR */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* define if the compiler supports GCC C++ ABI name demangling */
+#ifndef CPPUNIT_HAVE_GCC_ABI_DEMANGLE
+#define CPPUNIT_HAVE_GCC_ABI_DEMANGLE 1
+#endif
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#ifndef CPPUNIT_HAVE_INTTYPES_H
+#define CPPUNIT_HAVE_INTTYPES_H 1
+#endif
+
+/* Define if you have the libdl library or equivalent. */
+/* #undef HAVE_LIBDL */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#ifndef CPPUNIT_HAVE_MEMORY_H
+#define CPPUNIT_HAVE_MEMORY_H 1
+#endif
+
+/* define if the compiler implements namespaces */
+#ifndef CPPUNIT_HAVE_NAMESPACES
+#define CPPUNIT_HAVE_NAMESPACES 1
+#endif
+
+/* Define if you have the shl_load function. */
+/* #undef HAVE_SHL_LOAD */
+
+/* define if the compiler has stringstream */
+#ifndef CPPUNIT_HAVE_SSTREAM
+#define CPPUNIT_HAVE_SSTREAM 1
+#endif
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#ifndef CPPUNIT_HAVE_STDINT_H
+#define CPPUNIT_HAVE_STDINT_H 1
+#endif
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#ifndef CPPUNIT_HAVE_STDLIB_H
+#define CPPUNIT_HAVE_STDLIB_H 1
+#endif
+
+/* Define to 1 if you have the <strings.h> header file. */
+#ifndef CPPUNIT_HAVE_STRINGS_H
+#define CPPUNIT_HAVE_STRINGS_H 1
+#endif
+
+/* Define to 1 if you have the <string.h> header file. */
+#ifndef CPPUNIT_HAVE_STRING_H
+#define CPPUNIT_HAVE_STRING_H 1
+#endif
+
+/* Define to 1 if you have the <strstream> header file. */
+#ifndef CPPUNIT_HAVE_STRSTREAM
+#define CPPUNIT_HAVE_STRSTREAM 1
+#endif
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#ifndef CPPUNIT_HAVE_SYS_STAT_H
+#define CPPUNIT_HAVE_SYS_STAT_H 1
+#endif
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#ifndef CPPUNIT_HAVE_SYS_TYPES_H
+#define CPPUNIT_HAVE_SYS_TYPES_H 1
+#endif
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#ifndef CPPUNIT_HAVE_UNISTD_H
+#define CPPUNIT_HAVE_UNISTD_H 1
+#endif
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#ifndef CPPUNIT_LT_OBJDIR
+#define CPPUNIT_LT_OBJDIR ".libs/"
+#endif
+
+/* Disable debugging information */
+#ifndef CPPUNIT_NDEBUG
+#define CPPUNIT_NDEBUG /**/
+#endif
+
+/* Name of package */
+#ifndef CPPUNIT_PACKAGE
+#define CPPUNIT_PACKAGE "cppunit"
+#endif
+
+/* Define to the address where bug reports for this package should be sent. */
+#ifndef CPPUNIT_PACKAGE_BUGREPORT
+#define CPPUNIT_PACKAGE_BUGREPORT ""
+#endif
+
+/* Define to the full name of this package. */
+#ifndef CPPUNIT_PACKAGE_NAME
+#define CPPUNIT_PACKAGE_NAME "cppunit"
+#endif
+
+/* Define to the full name and version of this package. */
+#ifndef CPPUNIT_PACKAGE_STRING
+#define CPPUNIT_PACKAGE_STRING "cppunit 1.15.1"
+#endif
+
+/* Define to the one symbol short name of this package. */
+#ifndef CPPUNIT_PACKAGE_TARNAME
+#define CPPUNIT_PACKAGE_TARNAME "cppunit"
+#endif
+
+/* Define to the home page for this package. */
+#ifndef CPPUNIT_PACKAGE_URL
+#define CPPUNIT_PACKAGE_URL ""
+#endif
+
+/* Define to the version of this package. */
+#ifndef CPPUNIT_PACKAGE_VERSION
+#define CPPUNIT_PACKAGE_VERSION "1.15.1"
+#endif
+
+/* Define to 1 if you have the ANSI C header files. */
+/* #undef STDC_HEADERS */
+
+/* Version number of package */
+#ifndef CPPUNIT_VERSION
+#define CPPUNIT_VERSION "1.15.1"
+#endif
+ 
+/* once: _INCLUDE_CPPUNIT_CONFIG_AUTO_H */
+#endif

+ 27 - 0
packages/c/cppunit/port/xmake.lua

@@ -0,0 +1,27 @@
+add_rules("mode.debug", "mode.release")
+
+set_languages("c++11")
+
+target("cppunit")
+    set_kind("$(kind)")
+    add_files("src/cppunit/*.cpp|DllMain.cpp")
+    add_includedirs("include", {public = true})
+    add_headerfiles("include/(cppunit/**.h)")
+
+    if is_kind("shared") then
+        add_defines("CPPUNIT_BUILD_DLL")
+        add_defines("CPPUNIT_DLL", {interface = true})
+    end
+
+    if is_plat("windows", "mingw", "msys", "cygwin") then
+        add_files("src/cppunit/DllMain.cpp")
+    end
+
+target("DllPlugInTester")
+    set_kind("binary")
+    add_files(
+        "src/DllPlugInTester/CommandLineParser.cpp",
+        "src/DllPlugInTester/DllPlugInTester.cpp"
+    )
+
+    add_deps("cppunit")

+ 42 - 0
packages/c/cppunit/xmake.lua

@@ -0,0 +1,42 @@
+package("cppunit")
+    set_homepage("https://freedesktop.org/wiki/Software/cppunit")
+    set_description("CppUnit is the C++ port of the famous JUnit framework for unit testing")
+    set_license("LGPL-2.1-or-later")
+
+    add_urls("http://dev-www.libreoffice.org/src/cppunit-$(version).tar.gz")
+
+    add_versions("1.15.1", "89c5c6665337f56fd2db36bc3805a5619709d51fb136e51937072f63fcc717a7")
+
+    if is_plat("mingw") and is_subhost("msys") then
+        add_extsources("pacman::cppunit")
+    elseif is_plat("linux") then
+        add_extsources("pacman::cppunit", "apt::libcppunit-dev")
+    elseif is_plat("macosx") then
+        add_extsources("brew::cppunit")
+    end
+
+    on_install("!android", function (package)
+        if package:is_plat("windows") and package:config("shared") then
+            package:add("defines", "CPPUNIT_DLL")
+        end
+
+        if is_host("windows") and not is_subhost("msys") then
+            os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
+            os.cp(path.join(package:scriptdir(), "port", "config-auto.h"), "include/cppunit/config-auto.h")
+            import("package.tools.xmake").install(package)
+        else
+            local configs = {"--enable-doxygen=no", "--enable-dot=no", "--enable-werror=no", "--enable-werror=no"}
+            table.insert(configs, "--enable-debug=" .. (package:is_debug() and "yes" or "no"))
+            table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
+            table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
+            import("package.tools.autoconf").install(package, configs)
+        end
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                CPPUNIT_NS::TestResult controller;
+            }
+        ]]}, {configs = {languages = "c++11"}, includes = "cppunit/TestResult.h"}))
+    end)