2019-10-02 10:47:26 +00:00
|
|
|
|
# Минимальная версия Cmake
|
|
|
|
|
cmake_minimum_required(VERSION 3.3)
|
|
|
|
|
cmake_policy(VERSION 3.0.2..3.7)
|
|
|
|
|
|
|
|
|
|
# Название проекта
|
|
|
|
|
project(myx VERSION 0.3.0 LANGUAGES C CXX)
|
|
|
|
|
|
|
|
|
|
set(CPACK_GENERATOR "TXZ;DEB")
|
|
|
|
|
set(CPACK_PACKAGE_CONTACT "dev@246060.ru")
|
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Mixed functions")
|
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_SECTION "misc")
|
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
|
|
|
|
|
|
|
|
|
# В каталоге cmake/lib находятся файлы с библиотечными функциями
|
|
|
|
|
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/cmlib)
|
|
|
|
|
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/cmlib)
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "CMake library directory not exists")
|
|
|
|
|
endif()
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/find)
|
|
|
|
|
|
|
|
|
|
include(CMLibCommon)
|
|
|
|
|
|
2019-10-04 06:39:20 +00:00
|
|
|
|
option(BUILD_EXAMPLES "Build examples" OFF)
|
|
|
|
|
|
2019-10-02 10:47:26 +00:00
|
|
|
|
# Поиск библиотек с помощью pkgconfig
|
|
|
|
|
find_package(PkgConfig)
|
|
|
|
|
|
|
|
|
|
# Qt5
|
2019-10-02 11:29:10 +00:00
|
|
|
|
find_package(Qt5 COMPONENTS Core Network Gui Widgets DBus Concurrent Sql REQUIRED)
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
2019-10-02 12:22:47 +00:00
|
|
|
|
pkg_check_modules(FMT fmt>=5.3.0)
|
|
|
|
|
pkg_check_modules(SPDLOG spdlog>=1.3.1)
|
|
|
|
|
|
2019-10-02 10:47:26 +00:00
|
|
|
|
# Автоматически генерируемый заголовочный файл
|
|
|
|
|
cmlib_config_hpp_generate()
|
|
|
|
|
|
2019-10-02 11:29:10 +00:00
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/src/base/config_flags.hpp.in
|
|
|
|
|
${CMAKE_BINARY_DIR}/include/config_flags.hpp)
|
|
|
|
|
|
2019-10-02 10:47:26 +00:00
|
|
|
|
# Подключение внешних проектов
|
|
|
|
|
include(ExternalProject)
|
|
|
|
|
|
|
|
|
|
# Библиотеки
|
2019-10-02 11:29:10 +00:00
|
|
|
|
add_subdirectory(src/base)
|
2019-10-02 10:47:26 +00:00
|
|
|
|
add_subdirectory(src/filesystem)
|
2019-10-02 12:22:47 +00:00
|
|
|
|
add_subdirectory(src/log)
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
|
|
|
|
# Примеры
|
2019-10-04 06:39:20 +00:00
|
|
|
|
if (BUILD_EXAMPLES)
|
|
|
|
|
add_subdirectory(examples/filesystem)
|
|
|
|
|
add_subdirectory(examples/log)
|
|
|
|
|
endif()
|
2019-10-02 10:47:26 +00:00
|
|
|
|
|
2019-10-05 10:21:42 +00:00
|
|
|
|
ExternalProject_Add(whereami
|
|
|
|
|
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/whereami
|
|
|
|
|
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
|
|
|
|
DOWNLOAD_COMMAND ""
|
|
|
|
|
CONFIGURE_COMMAND ${CMAKE_COMMAND} -"G${CMAKE_GENERATOR}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=OFF <SOURCE_DIR>
|
|
|
|
|
)
|
|
|
|
|
|
2019-10-02 10:47:26 +00:00
|
|
|
|
add_breathe_target(
|
|
|
|
|
TARGET_NAME doc-breathe
|
|
|
|
|
SOURCE_DIR ${CMAKE_SOURCE_DIR}/doc/html
|
|
|
|
|
DOXY_FILE ${CMAKE_SOURCE_DIR}/doc/html/Doxyfile.in
|
|
|
|
|
CONF_FILE ${CMAKE_SOURCE_DIR}/doc/html/conf.py.in
|
2019-10-05 13:56:59 +00:00
|
|
|
|
CACHE_DIR ${CMAKE_BINARY_DIR}/_doctrees
|
|
|
|
|
BUILD_DIR ${CMAKE_BINARY_DIR}/doc/breathe
|
|
|
|
|
HTML_DIR ${CMAKE_BINARY_DIR}/doc/breathe
|
2019-10-02 10:47:26 +00:00
|
|
|
|
COMMENT "Documentation in HTML format with Breathe generator"
|
|
|
|
|
)
|
2019-10-05 13:56:59 +00:00
|
|
|
|
|
|
|
|
|
add_doxygen_target(
|
|
|
|
|
TARGET_NAME doc-doxygen
|
|
|
|
|
DOXY_FILE ${CMAKE_SOURCE_DIR}/doc/html/Doxyfile.in
|
|
|
|
|
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/doc
|
|
|
|
|
HTML YES
|
|
|
|
|
LATEX YES
|
|
|
|
|
)
|