diff --git a/CMakeLists.txt b/CMakeLists.txt index ba4ea84..d5eedcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,50 +47,7 @@ if (TARGET simdjson::simdjson) target_link_libraries(fastgltf PRIVATE simdjson::simdjson) else() # Try to find simdjson through a find_package call. - find_package(simdjson CONFIG) - if (simdjson_FOUND) - message(STATUS "fastgltf: Found simdjson config") - target_link_libraries(fastgltf PUBLIC simdjson::simdjson) - else() - # Download and configure simdjson - set(SIMDJSON_TARGET_VERSION "3.7.0") - set(SIMDJSON_DL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/simdjson") - file(MAKE_DIRECTORY ${SIMDJSON_DL_DIR}) - - set(SIMDJSON_HEADER_FILE "${SIMDJSON_DL_DIR}/simdjson.h") - set(SIMDJSON_SOURCE_FILE "${SIMDJSON_DL_DIR}/simdjson.cpp") - - macro(download_simdjson) - file(DOWNLOAD "https://raw.githubusercontent.com/simdjson/simdjson/v${SIMDJSON_TARGET_VERSION}/singleheader/simdjson.h" ${SIMDJSON_HEADER_FILE}) - file(DOWNLOAD "https://raw.githubusercontent.com/simdjson/simdjson/v${SIMDJSON_TARGET_VERSION}/singleheader/simdjson.cpp" ${SIMDJSON_SOURCE_FILE}) - endmacro() - - if (EXISTS ${SIMDJSON_HEADER_FILE}) - # Look for the SIMDJSON_VERSION define in the header to check the version. - file(STRINGS ${SIMDJSON_HEADER_FILE} SIMDJSON_HEADER_VERSION_LINE REGEX "^#define SIMDJSON_VERSION ") - string(REGEX MATCHALL "[0-9.]+" SIMDJSON_HEADER_VERSION "${SIMDJSON_HEADER_VERSION_LINE}") - message(STATUS "fastgltf: Found simdjson (Version ${SIMDJSON_HEADER_VERSION})") - - if (SIMDJSON_HEADER_VERSION STREQUAL "") - message(FATAL_ERROR "fastgltf: Failed to download simdjson") - endif() - - if (SIMDJSON_HEADER_VERSION VERSION_LESS SIMDJSON_TARGET_VERSION) - message(STATUS "fastgltf: simdjson outdated, downloading...") - download_simdjson() - endif() - else() - message(STATUS "fastgltf: Did not find simdjson, downloading...") - download_simdjson() - - if (NOT EXISTS "${SIMDJSON_HEADER_FILE}") - message(FATAL_ERROR "fastgltf: Failed to download simdjson.") - endif() - endif() - - fastgltf_add_source_directory(TARGET fastgltf FOLDER ${SIMDJSON_DL_DIR}) - target_include_directories(fastgltf PUBLIC $ $) - endif() + endif() if (SIMDJSON_TARGET_VERSION)