integration_example.cmake

This example presents how to integrate DocWire SDK with your project using CMake

########################################

cmake_minimum_required(VERSION 3.15)
project(integration_example LANGUAGES CXX)
 
if (VCPKG_TARGET_TRIPLET STREQUAL "x64-linux")
     message(FATAL_ERROR "DocWire SDK requires dynamic linking. Use triplet x64-linux-dynamic instead of x64-linux")
endif()
if (VCPKG_TARGET_TRIPLET STREQUAL "x64-windows-static")
     (FATAL_ERROR "DocWire SDK requires dynamic linking. Use triplet x64-windows instead of x64-windows-static")
endif()
if (VCPKG_TARGET_TRIPLET STREQUAL "x64-osx")
     (FATAL_ERROR "DocWire SDK requires dynamic linking. Use triplet x64-osx-dynamic instead of x64-osx")
endif()
if (VCPKG_TARGET_TRIPLET STREQUAL "arm64-osx")
     (FATAL_ERROR "DocWire SDK requires dynamic linking. Use triplet arm64-osx-dynamic instead of arm64-osx")
endif()
 
add_executable(integration_example integration_example.cpp)
 
find_package(docwire CONFIG REQUIRED)
# Choose SDK libraries that you need to use
target_link_libraries(integration_example PRIVATE docwire_core docwire_content_type docwire_office_formats docwire_mail)
 
if (WIN32 AND VCPKG_APPLOCAL_DEPS)
      DLL files are copied to application directory on Windows (see VCPKG_APPLOCAL_DEPS) but resources are not
     (COPY ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/libmagic/misc/magic.mgc DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/share/libmagic/misc)
     (COPY ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/flan-t5-large-ct2-int8 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/share)
     (COPY ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/tessdata-fast DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/share)
endif()
posted on 2025-07-04 21:21  北京开发  阅读(6)  评论(0)    收藏  举报