Browse Source

Add mFAST v1.2.2 (#493)

* Initial mFAST package try

* Some fixes

* tinyxml2 9.0.0

* WIP

* WIP

* WIP

* WIP

* Test all targets

* Proper platforms
jj683 4 years ago
parent
commit
c36993936b
2 changed files with 82 additions and 0 deletions
  1. 43 0
      packages/m/mfast/patches/v1.2.2/tinyxml2.patch
  2. 39 0
      packages/m/mfast/xmake.lua

+ 43 - 0
packages/m/mfast/patches/v1.2.2/tinyxml2.patch

@@ -0,0 +1,43 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -62,7 +62,11 @@ endif(BUILD_PACKAGES)
+ 
+ find_package(Boost 1.56.0 REQUIRED)
+ include_directories(${Boost_INCLUDE_DIR})
+-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2)
++
++find_package(tinyxml2 REQUIRED)
++include_directories("${tinyxml2_DIR}/../../../include/")
++link_directories("${tinyxml2_DIR}/../../")
++
+ include_directories ("${PROJECT_SOURCE_DIR}/src")
+ 
+ add_definitions(-DSIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P})
+diff --git a/src/mfast/xml_parser/CMakeLists.txt b/src/mfast/xml_parser/CMakeLists.txt
+--- a/src/mfast/xml_parser/CMakeLists.txt
++++ b/src/mfast/xml_parser/CMakeLists.txt
+@@ -6,12 +6,10 @@ file (GLOB_RECURSE sources "*.cpp")     ## retrieve all source files in current
+ 
+ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
+ 
+-include_directories("${CMAKE_SOURCE_DIR}/tinyxml2")
+-
+-set(mfast_xml_parser_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../../../tinyxml2/tinyxml2.cpp ${sources} ${headers})
++set(mfast_xml_parser_SRCS ${sources} ${headers})
+ 
+ add_library(mfast_xml_parser_static STATIC ${mfast_xml_parser_SRCS})
+-target_link_libraries(mfast_xml_parser_static mfast_static)
++target_link_libraries(mfast_xml_parser_static mfast_static tinyxml2)
+ 
+ if (UNIX)
+   set_target_properties(mfast_xml_parser_static PROPERTIES OUTPUT_NAME mfast_xml_parser)
+@@ -39,7 +37,7 @@ if (BUILD_SHARED_LIBS)
+     set_target_properties(mfast_xml_parser PROPERTIES COMPILE_FLAGS -fvisibility=hidden)
+   endif()
+ 
+-  target_link_libraries(mfast_xml_parser mfast)
++  target_link_libraries(mfast_xml_parser mfast tinyxml2)
+   set_target_properties(mfast_xml_parser PROPERTIES
+                         LINKER_LANGUAGE CXX
+                         VERSION "${MFAST_VERSION}"

+ 39 - 0
packages/m/mfast/xmake.lua

@@ -0,0 +1,39 @@
+package("mfast")
+
+    set_homepage("https://github.com/objectcomputing/mFAST")
+    set_description("High performance C++ encoding/decoding library for FAST (FIX Adapted for STreaming) protocol.")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/objectcomputing/mFAST/archive/refs/tags/$(version).zip",
+             "https://github.com/objectcomputing/mFAST.git")
+    add_versions("v1.2.2", "bcfde8de2a621021841e330438f404041cd285bf10b4dc041f164876f3d8b692")
+
+    add_patches("v1.2.2", path.join(os.scriptdir(), "patches", "v1.2.2", "tinyxml2.patch"), "e0b92fa386ca9e0c1265391b9bb5505410cf82902d41126c786b7fe9a36f2b6b")
+
+    add_configs("sqlite", {description = "Build with SQLite support.", default = false, type = "boolean"})
+
+    add_deps("cmake")
+    add_deps("boost", {configs = {container = true, date_time = true, exception = true, iostreams = true, regex = true}})
+    add_deps("tinyxml2")
+
+    on_load(function (package)
+        if package:config("sqlite") then
+            package:add("deps", "sqlite3")
+        end
+    end)
+
+    on_install("linux", "macosx", "windows", function (package)
+        local configs = {"-DBUILD_TESTS=OFF",
+                         "-DBUILD_EXAMPLES=OFF",
+                         "-DBUILD_PACKAGES=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        if package:config("sqlite") then
+            table.insert(configs, "-DBUILD_SQLITE3=ON")
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cxxtypes("mfast::fast_decoder", {configs = {languages = "c++14"}, includes = "mfast/coder/fast_decoder.h"}))
+    end)