| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- # Find system packages
- # Required packages
- find_package(PkgConfig REQUIRED)
- # Upstream smartbotic-database client library — provides target smartbotic::db-client
- find_package(smartbotic-db-client CONFIG REQUIRED)
- find_package(Threads REQUIRED)
- find_package(OpenSSL REQUIRED)
- find_package(CURL REQUIRED)
- find_package(ZLIB REQUIRED)
- # nlohmann-json
- find_package(nlohmann_json 3.11 QUIET)
- if(NOT nlohmann_json_FOUND)
- pkg_check_modules(nlohmann_json REQUIRED IMPORTED_TARGET nlohmann_json)
- add_library(nlohmann_json::nlohmann_json ALIAS PkgConfig::nlohmann_json)
- endif()
- # spdlog
- find_package(spdlog QUIET)
- if(NOT spdlog_FOUND)
- pkg_check_modules(spdlog REQUIRED IMPORTED_TARGET spdlog)
- add_library(spdlog::spdlog ALIAS PkgConfig::spdlog)
- endif()
- # gRPC and Protobuf
- find_package(gRPC CONFIG QUIET)
- if(NOT gRPC_FOUND)
- pkg_check_modules(grpc++ REQUIRED IMPORTED_TARGET grpc++)
- add_library(gRPC::grpc++ ALIAS PkgConfig::grpc++)
- endif()
- find_package(Protobuf REQUIRED)
- # libwebsockets
- pkg_check_modules(websockets REQUIRED IMPORTED_TARGET libwebsockets)
- add_library(websockets ALIAS PkgConfig::websockets)
- # MySQL/MariaDB client
- pkg_check_modules(mariadb QUIET IMPORTED_TARGET libmariadb)
- if(mariadb_FOUND)
- add_library(mysql_client ALIAS PkgConfig::mariadb)
- set(MYSQL_CLIENT_FOUND TRUE CACHE BOOL "MySQL client library found")
- message(STATUS "Found MariaDB client library")
- else()
- pkg_check_modules(mysqlclient QUIET IMPORTED_TARGET mysqlclient)
- if(mysqlclient_FOUND)
- add_library(mysql_client ALIAS PkgConfig::mysqlclient)
- set(MYSQL_CLIENT_FOUND TRUE CACHE BOOL "MySQL client library found")
- message(STATUS "Found MySQL client library")
- else()
- # Not every distribution ships a .pc file for the client. Void, for one,
- # installs mysql_config and no pkg-config module at all - so both checks
- # above miss and the mysql-query node disappears from the build with only
- # a STATUS line to say so. A runner built that way registers a node list
- # silently missing mysql-query, and a workflow using it fails with
- # "unknown node type" on that host and works on every other.
- find_program(MYSQL_CONFIG_EXECUTABLE NAMES mariadb_config mysql_config)
- if(MYSQL_CONFIG_EXECUTABLE)
- execute_process(COMMAND ${MYSQL_CONFIG_EXECUTABLE} --cflags
- OUTPUT_VARIABLE _mysql_cflags
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process(COMMAND ${MYSQL_CONFIG_EXECUTABLE} --libs
- OUTPUT_VARIABLE _mysql_libs
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- separate_arguments(_mysql_cflags NATIVE_COMMAND "${_mysql_cflags}")
- separate_arguments(_mysql_libs NATIVE_COMMAND "${_mysql_libs}")
- add_library(mysql_client INTERFACE)
- target_compile_options(mysql_client INTERFACE ${_mysql_cflags})
- target_link_libraries(mysql_client INTERFACE ${_mysql_libs})
- set(MYSQL_CLIENT_FOUND TRUE CACHE BOOL "MySQL client library found")
- message(STATUS "Found MySQL client library via ${MYSQL_CONFIG_EXECUTABLE}")
- else()
- set(MYSQL_CLIENT_FOUND FALSE CACHE BOOL "MySQL client library found")
- message(STATUS "MySQL/MariaDB client library not found - MySQL node support disabled")
- endif()
- endif()
- endif()
- # PostgreSQL client (libpq)
- pkg_check_modules(libpq QUIET IMPORTED_TARGET libpq)
- if(libpq_FOUND)
- add_library(postgresql_client ALIAS PkgConfig::libpq)
- set(POSTGRESQL_CLIENT_FOUND TRUE CACHE BOOL "PostgreSQL client library found")
- message(STATUS "Found PostgreSQL client library (libpq)")
- else()
- set(POSTGRESQL_CLIENT_FOUND FALSE CACHE BOOL "PostgreSQL client library found")
- message(STATUS "PostgreSQL client library not found - PostgreSQL node support disabled")
- endif()
- # Magick++ and libexif - the image node's engine.
- #
- # REQUIRED on purpose. Every optional dependency in this file that silently
- # disabled a node has cost us a debugging session: a runner built without the
- # MySQL client registers a node list quietly missing mysql-query, and the
- # failure surfaces much later as an unknown node type on one host only. The
- # image node is not optional to this deployment - 35photo2anime runs through it
- # - so a build that cannot provide it should say so now rather than produce a
- # runner that fails at the first photo.
- pkg_check_modules(Magick REQUIRED IMPORTED_TARGET Magick++)
- add_library(magick_client ALIAS PkgConfig::Magick)
- message(STATUS "Found Magick++ ${Magick_VERSION}")
- pkg_check_modules(exif REQUIRED IMPORTED_TARGET libexif)
- add_library(exif_client ALIAS PkgConfig::exif)
- message(STATUS "Found libexif ${exif_VERSION}")
|