mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 18:29:01 +08:00
[simdjson] Add new port (fix #5418)
This commit is contained in:
parent
8641dfd9dd
commit
b758b9c359
3
ports/simdjson/CONTROL
Normal file
3
ports/simdjson/CONTROL
Normal file
@ -0,0 +1,3 @@
|
||||
Source: simdjson
|
||||
Version: 2019-03-03
|
||||
Description: A extremely fast JSON library that can parse gigabytes of JSON per second
|
70
ports/simdjson/fix-cmake.patch
Normal file
70
ports/simdjson/fix-cmake.patch
Normal file
@ -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)
|
43
ports/simdjson/portfile.cmake
Normal file
43
ports/simdjson/portfile.cmake
Normal file
@ -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})
|
Loading…
Reference in New Issue
Block a user