aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyd7349 <myd7349@gmail.com>2019-03-03 20:09:01 +0800
committermyd7349 <myd7349@gmail.com>2019-03-03 20:15:41 +0800
commitb758b9c3599041a79b5cf797fcc6c1b36fde1f81 (patch)
tree5f90fb77becd15842dc0843e4691c94e43dfc57e
parent8641dfd9dd6d3bf190515822060872a56ee37906 (diff)
downloadvcpkg-b758b9c3599041a79b5cf797fcc6c1b36fde1f81.tar.gz
vcpkg-b758b9c3599041a79b5cf797fcc6c1b36fde1f81.zip
[simdjson] Add new port (fix #5418)
-rw-r--r--ports/simdjson/CONTROL3
-rw-r--r--ports/simdjson/fix-cmake.patch70
-rw-r--r--ports/simdjson/portfile.cmake43
3 files changed, 116 insertions, 0 deletions
diff --git a/ports/simdjson/CONTROL b/ports/simdjson/CONTROL
new file mode 100644
index 000000000..4e7dcae80
--- /dev/null
+++ b/ports/simdjson/CONTROL
@@ -0,0 +1,3 @@
+Source: simdjson
+Version: 2019-03-03
+Description: A extremely fast JSON library that can parse gigabytes of JSON per second
diff --git a/ports/simdjson/fix-cmake.patch b/ports/simdjson/fix-cmake.patch
new file mode 100644
index 000000000..ebd8291b4
--- /dev/null
+++ b/ports/simdjson/fix-cmake.patch
@@ -0,0 +1,70 @@
+diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt
+index cb12222..ed728d8 100644
+--- a/benchmark/CMakeLists.txt
++++ b/benchmark/CMakeLists.txt
+@@ -1,7 +1,6 @@
+-target_include_directories(${SIMDJSON_LIB_NAME}
+- PUBLIC
+- ${PROJECT_SOURCE_DIR}/benchmark
+- ${PROJECT_SOURCE_DIR}/benchmark/linux
++target_include_directories(${SIMDJSON_LIB_NAME} INTERFACE
++ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/benchmark>
++ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/benchmark/linux>
+ )
+
+ add_cpp_benchmark(parse)
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index dd96ee8..20feac3 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -3,6 +3,7 @@ if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") # icc / icpc
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel")
+ endif()
+
++include(GNUInstallDirs)
+
+ # we default on a shared library.
+ if(SIMDJSON_BUILD_STATIC)
+@@ -26,11 +27,24 @@ set(SIMDJSON_SRC
+ )
+
+ add_library(${SIMDJSON_LIB_NAME} ${SIMDJSON_LIB_TYPE} ${SIMDJSON_SRC})
+-target_include_directories(${SIMDJSON_LIB_NAME}
+- PUBLIC ${PROJECT_SOURCE_DIR}/include
++
++target_include_directories(${SIMDJSON_LIB_NAME} PUBLIC
++ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
++ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
++)
++
++install(TARGETS ${SIMDJSON_LIB_NAME}
++ EXPORT ${SIMDJSON_LIB_NAME}-config
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ )
+
+-install(TARGETS ${SIMDJSON_LIB_NAME} DESTINATION lib)
++install(EXPORT ${SIMDJSON_LIB_NAME}-config
++ FILE unofficial-${SIMDJSON_LIB_NAME}-config.cmake
++ NAMESPACE unofficial::${SIMDJSON_LIB_NAME}::
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/unofficial-${SIMDJSON_LIB_NAME}
++)
+
+ if(NOT MSVC)
+ ## We output the library at the root of the current directory where cmake is invoked
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 86a89f9..c3dfa12 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -1,7 +1,7 @@
+ if(MSVC)
+-target_include_directories(${SIMDJSON_LIB_NAME}
+- PUBLIC ${PROJECT_SOURCE_DIR}/windows
+-)
++ target_include_directories(${SIMDJSON_LIB_NAME} INTERFACE
++ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/windows>
++ )
+ endif()
+
+ add_cpp_test(jsoncheck)
diff --git a/ports/simdjson/portfile.cmake b/ports/simdjson/portfile.cmake
new file mode 100644
index 000000000..edf2b24f0
--- /dev/null
+++ b/ports/simdjson/portfile.cmake
@@ -0,0 +1,43 @@
+include(vcpkg_common_functions)
+
+if(TARGET_TRIPLET MATCHES "^x86")
+ message(FATAL_ERROR "simdjson doesn't support x86 architecture.")
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO lemire/simdjson
+ REF 352dd5e7faf3000004c6ad5852c119ce3e679939
+ SHA512 29c578952d7aa117fe5808ceb2cb686895185d5f53bee3fff6636ac6fe6e50e1cc802499710eda4f233e3c5ff57ebf187ff6658fd5048a59cee8cfd8fca64c1d
+ HEAD_REF master
+ PATCHES
+ fix-cmake.patch
+)
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SIMDJSON_BUILD_STATIC)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DSIMDJSON_BUILD_STATIC=${SIMDJSON_BUILD_STATIC}
+)
+
+vcpkg_install_cmake()
+
+vcpkg_copy_pdbs()
+
+vcpkg_fixup_cmake_targets(
+ CONFIG_PATH lib/cmake/unofficial-${PORT}
+ TARGET_PATH share/unofficial-${PORT}
+)
+
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/include
+)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+#vcpkg_test_cmake(PACKAGE_NAME ${PORT})