cmake_minimum_required(VERSION 3.16) project(synor_compute VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Options option(BUILD_SHARED_LIBS "Build shared library" ON) option(BUILD_TESTS "Build tests" ON) option(BUILD_EXAMPLES "Build examples" ON) # Find dependencies find_package(CURL REQUIRED) find_package(nlohmann_json 3.11 QUIET) # If nlohmann_json not found, fetch it if(NOT nlohmann_json_FOUND) include(FetchContent) FetchContent_Declare( json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz ) FetchContent_MakeAvailable(json) endif() # Library sources set(SYNOR_SOURCES src/synor_compute.cpp src/tensor.cpp src/client.cpp ) # Create library add_library(synor_compute ${SYNOR_SOURCES}) target_include_directories(synor_compute PUBLIC $ $ ) target_link_libraries(synor_compute PRIVATE CURL::libcurl nlohmann_json::nlohmann_json ) # Set library properties set_target_properties(synor_compute PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} ) # Installation include(GNUInstallDirs) install(TARGETS synor_compute EXPORT synor_compute-targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install(EXPORT synor_compute-targets FILE synor_compute-targets.cmake NAMESPACE synor:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/synor_compute )