#[[************************************************************************** * dtranslatebot Discord Translate Bot * Copyright (C) 2023-2024 Syping * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * This software is provided as-is, no warranties are given to you, we are not * responsible for anything with use of the software, you are self responsible. ****************************************************************************]] cmake_minimum_required(VERSION 3.16) project(dtranslatebot VERSION 0.1 LANGUAGES CXX) include(GNUInstallDirs) # dtranslatebot Source files set(DTRANSLATEBOT_HEADERS src/database_core.h src/database_file.h src/message_queue.h src/regex.h src/settings.h src/settings_types.h src/slashcommands.h src/submit_queue.h src/translator_core.h src/translator_libretranslate.h src/webhook_push.h ) set(DTRANSLATEBOT_SOURCES src/database_core.cpp src/database_file.cpp src/main.cpp src/message_queue.cpp src/settings.cpp src/slashcommands.cpp src/submit_queue.cpp src/translator_core.cpp src/translator_libretranslate.cpp src/webhook_push.cpp ) # dtranslatebot Module Path list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # Boost C++ Libraries option(WITH_BOOST "Build with Boost C++ Libraries" OFF) if (WITH_BOOST) find_package(Boost COMPONENTS regex) if (Boost_regex_FOUND) list(APPEND DTRANSLATEBOT_LIBRARIES Boost::regex ) set(DTRANSLATEBOT_USE_BOOST_REGEX TRUE) endif() endif() # D++ Discord API Library for Bots find_package(DPP REQUIRED) # pthread Support set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) # dtranslatebot Target + Installs add_executable(dtranslatebot ${DTRANSLATEBOT_HEADERS} ${DTRANSLATEBOT_SOURCES}) target_compile_definitions(dtranslatebot PRIVATE $<$:DTRANSLATEBOT_USE_BOOST_REGEX> ) if (MSVC AND MSVC_VERSION GREATER_EQUAL 1914) target_compile_options(dtranslatebot PRIVATE $<$:/Zc:__cplusplus>) endif() target_link_libraries(dtranslatebot PRIVATE Threads::Threads ${DPP_LIBRARIES} ${DTRANSLATEBOT_LIBRARIES}) target_include_directories(dtranslatebot PRIVATE ${DPP_INCLUDE_DIR}) set_target_properties(dtranslatebot PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON ) install(TARGETS dtranslatebot DESTINATION "${CMAKE_INSTALL_BINDIR}")