cmake-simdjson.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index ba4ea84..d5eedcb 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -47,50 +47,7 @@ if (TARGET simdjson::simdjson)
  6. target_link_libraries(fastgltf PRIVATE simdjson::simdjson)
  7. else()
  8. # Try to find simdjson through a find_package call.
  9. - find_package(simdjson CONFIG)
  10. - if (simdjson_FOUND)
  11. - message(STATUS "fastgltf: Found simdjson config")
  12. - target_link_libraries(fastgltf PUBLIC simdjson::simdjson)
  13. - else()
  14. - # Download and configure simdjson
  15. - set(SIMDJSON_TARGET_VERSION "3.7.0")
  16. - set(SIMDJSON_DL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/simdjson")
  17. - file(MAKE_DIRECTORY ${SIMDJSON_DL_DIR})
  18. -
  19. - set(SIMDJSON_HEADER_FILE "${SIMDJSON_DL_DIR}/simdjson.h")
  20. - set(SIMDJSON_SOURCE_FILE "${SIMDJSON_DL_DIR}/simdjson.cpp")
  21. -
  22. - macro(download_simdjson)
  23. - file(DOWNLOAD "https://raw.githubusercontent.com/simdjson/simdjson/v${SIMDJSON_TARGET_VERSION}/singleheader/simdjson.h" ${SIMDJSON_HEADER_FILE})
  24. - file(DOWNLOAD "https://raw.githubusercontent.com/simdjson/simdjson/v${SIMDJSON_TARGET_VERSION}/singleheader/simdjson.cpp" ${SIMDJSON_SOURCE_FILE})
  25. - endmacro()
  26. -
  27. - if (EXISTS ${SIMDJSON_HEADER_FILE})
  28. - # Look for the SIMDJSON_VERSION define in the header to check the version.
  29. - file(STRINGS ${SIMDJSON_HEADER_FILE} SIMDJSON_HEADER_VERSION_LINE REGEX "^#define SIMDJSON_VERSION ")
  30. - string(REGEX MATCHALL "[0-9.]+" SIMDJSON_HEADER_VERSION "${SIMDJSON_HEADER_VERSION_LINE}")
  31. - message(STATUS "fastgltf: Found simdjson (Version ${SIMDJSON_HEADER_VERSION})")
  32. -
  33. - if (SIMDJSON_HEADER_VERSION STREQUAL "")
  34. - message(FATAL_ERROR "fastgltf: Failed to download simdjson")
  35. - endif()
  36. -
  37. - if (SIMDJSON_HEADER_VERSION VERSION_LESS SIMDJSON_TARGET_VERSION)
  38. - message(STATUS "fastgltf: simdjson outdated, downloading...")
  39. - download_simdjson()
  40. - endif()
  41. - else()
  42. - message(STATUS "fastgltf: Did not find simdjson, downloading...")
  43. - download_simdjson()
  44. -
  45. - if (NOT EXISTS "${SIMDJSON_HEADER_FILE}")
  46. - message(FATAL_ERROR "fastgltf: Failed to download simdjson.")
  47. - endif()
  48. - endif()
  49. -
  50. - fastgltf_add_source_directory(TARGET fastgltf FOLDER ${SIMDJSON_DL_DIR})
  51. - target_include_directories(fastgltf PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/deps/simdjson> $<INSTALL_INTERFACE:include>)
  52. - endif()
  53. +
  54. endif()
  55. if (SIMDJSON_TARGET_VERSION)