Правка структуры проекта
This commit is contained in:
parent
07110430c9
commit
8bbf5e6c6f
@ -35,17 +35,17 @@ pkg_check_modules(SPDLOG spdlog>=1.3.1)
|
|||||||
# Автоматически генерируемый заголовочный файл
|
# Автоматически генерируемый заголовочный файл
|
||||||
cmlib_config_hpp_generate()
|
cmlib_config_hpp_generate()
|
||||||
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/src/base/config_flags.hpp.in
|
configure_file(${CMAKE_SOURCE_DIR}/src/myx/base/config_flags.hpp.in
|
||||||
${CMAKE_BINARY_DIR}/include/config_flags.hpp)
|
${CMAKE_BINARY_DIR}/include/config_flags.hpp)
|
||||||
|
|
||||||
# Подключение внешних проектов
|
# Подключение внешних проектов
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
|
||||||
# Библиотеки
|
# Библиотеки
|
||||||
add_subdirectory(src/base)
|
add_subdirectory(src/myx/base)
|
||||||
add_subdirectory(src/filesystem)
|
add_subdirectory(src/myx/filesystem)
|
||||||
add_subdirectory(src/log)
|
add_subdirectory(src/myx/log)
|
||||||
add_subdirectory(src/qt)
|
add_subdirectory(src/myx/qt)
|
||||||
|
|
||||||
# Примеры
|
# Примеры
|
||||||
if (BUILD_EXAMPLES)
|
if (BUILD_EXAMPLES)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "filesystem/paths.hpp"
|
#include <myx/filesystem/paths.hpp>
|
||||||
|
|
||||||
namespace MF = myx::filesystem;
|
namespace MF = myx::filesystem;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "log/spdlog.hpp"
|
#include <myx/log/spdlog.hpp>
|
||||||
|
|
||||||
namespace ML = myx::log;
|
namespace ML = myx::log;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "log/spdlog.hpp"
|
#include <myx/log/spdlog.hpp>
|
||||||
#include "log/spdlog_qt.hpp"
|
#include <myx/log/spdlog_qt.hpp>
|
||||||
|
|
||||||
namespace ML = myx::log;
|
namespace ML = myx::log;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "qt/translators.hpp"
|
#include <myx/qt/translators.hpp>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
#ifndef MYX_BASE_CONFIG_HPP_
|
|
||||||
#define MYX_BASE_CONFIG_HPP_
|
|
||||||
|
|
||||||
#include "cmlib_config.hpp"
|
|
||||||
#include "config_flags.hpp"
|
|
||||||
|
|
||||||
#if ( defined ( TARGET_LSB_ID_AstraLinuxSE ) && defined ( TARGET_LSB_CODENAME_smolensk ) )
|
|
||||||
|
|
||||||
#define override
|
|
||||||
|
|
||||||
#if QT_VERSION <= 0x050700
|
|
||||||
#include <QtGlobal>
|
|
||||||
template< typename ... Args >
|
|
||||||
struct QOverload
|
|
||||||
{
|
|
||||||
template< typename C, typename R >
|
|
||||||
static constexpr auto of( R ( C::* pmf )( Args... ) )->decltype( pmf )
|
|
||||||
{
|
|
||||||
return( pmf );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// this adds const to non-const objects (like std::as_const)
|
|
||||||
template < typename T >
|
|
||||||
Q_DECL_CONSTEXPR typename std::add_const< T >::type& qAsConst( T& t ) noexcept { return( t ); }
|
|
||||||
// prevent rvalue arguments:
|
|
||||||
template < typename T >
|
|
||||||
void qAsConst( const T&& ) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
#endif // if QT_VERSION <= 0x050700
|
|
||||||
#endif // if ( defined ( TARGET_LSB_ID_AstraLinuxSE ) && defined ( TARGET_LSB_CODENAME_smolensk ) )
|
|
||||||
|
|
||||||
#endif // MYX_BASE_CONFIG_HPP_
|
|
7
src/myx/base/config.hpp
Normal file
7
src/myx/base/config.hpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef MYX_BASE_CONFIG_HPP_
|
||||||
|
#define MYX_BASE_CONFIG_HPP_
|
||||||
|
|
||||||
|
#include "cmlib_config.hpp"
|
||||||
|
#include "config_flags.hpp"
|
||||||
|
|
||||||
|
#endif // MYX_BASE_CONFIG_HPP_
|
@ -27,7 +27,7 @@ add_uncrustify_format(${current_target} ${current_target_sources} ${current_targ
|
|||||||
target_include_directories(${current_target} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS})
|
target_include_directories(${current_target} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS})
|
||||||
target_include_directories(${current_target} SYSTEM PUBLIC ${FMT_INCLUDE_DIRS})
|
target_include_directories(${current_target} SYSTEM PUBLIC ${FMT_INCLUDE_DIRS})
|
||||||
target_include_directories(${current_target} SYSTEM PUBLIC ${SPDLOG_INCLUDE_DIRS})
|
target_include_directories(${current_target} SYSTEM PUBLIC ${SPDLOG_INCLUDE_DIRS})
|
||||||
target_include_directories(${current_target} PRIVATE ${CMAKE_SOURCE_DIR}/src/base)
|
target_include_directories(${current_target} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||||
target_include_directories(${current_target} PRIVATE ${CMAKE_BINARY_DIR}/include)
|
target_include_directories(${current_target} PRIVATE ${CMAKE_BINARY_DIR}/include)
|
||||||
|
|
||||||
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
|
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
|
@ -1,5 +1,5 @@
|
|||||||
#include "paths.hpp"
|
#include "paths.hpp"
|
||||||
#include "config.hpp"
|
#include <myx/base/config.hpp>
|
||||||
#include "whereami++.h"
|
#include "whereami++.h"
|
||||||
|
|
||||||
#include <paths.h>
|
#include <paths.h>
|
@ -25,7 +25,7 @@ add_uncrustify_format(${current_target} ${current_target_sources} ${current_targ
|
|||||||
target_include_directories(${current_target} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS})
|
target_include_directories(${current_target} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS})
|
||||||
target_include_directories(${current_target} SYSTEM PUBLIC ${FMT_INCLUDE_DIRS})
|
target_include_directories(${current_target} SYSTEM PUBLIC ${FMT_INCLUDE_DIRS})
|
||||||
target_include_directories(${current_target} SYSTEM PUBLIC ${SPDLOG_INCLUDE_DIRS})
|
target_include_directories(${current_target} SYSTEM PUBLIC ${SPDLOG_INCLUDE_DIRS})
|
||||||
target_include_directories(${current_target} PRIVATE ${CMAKE_SOURCE_DIR}/src/base)
|
target_include_directories(${current_target} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||||
|
|
||||||
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
|
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
|
||||||
add_custom_target(${current_target}-install-headers
|
add_custom_target(${current_target}-install-headers
|
@ -1,5 +1,5 @@
|
|||||||
#include "spdlog.hpp"
|
#include "spdlog.hpp"
|
||||||
#include "config.hpp"
|
#include <myx/base/config.hpp>
|
||||||
|
|
||||||
namespace myx {
|
namespace myx {
|
||||||
|
|
@ -2,16 +2,14 @@
|
|||||||
set(current_target qt)
|
set(current_target qt)
|
||||||
|
|
||||||
# Список файлов исходных текстов
|
# Список файлов исходных текстов
|
||||||
set(current_target_sources
|
set(current_target_sources ${CMAKE_CURRENT_SOURCE_DIR}/translators.cpp)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/translators.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Список заголовочных файлов (используется для установки)
|
# Список заголовочных файлов (используется для установки)
|
||||||
set(current_target_headers
|
set(current_target_headers ${CMAKE_CURRENT_SOURCE_DIR}/backports.hpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/translators.hpp
|
${CMAKE_CURRENT_SOURCE_DIR}/translators.hpp)
|
||||||
)
|
|
||||||
|
|
||||||
add_common_library(TARGET ${current_target} OUTPUT_NAME myx-${current_target}
|
add_common_library(TARGET ${current_target}
|
||||||
|
OUTPUT_NAME myx-${current_target}
|
||||||
SOURCES ${current_target_sources})
|
SOURCES ${current_target_sources})
|
||||||
common_target_properties(${current_target})
|
common_target_properties(${current_target})
|
||||||
add_clang_tidy_check(${current_target} ${current_target_sources})
|
add_clang_tidy_check(${current_target} ${current_target_sources})
|
||||||
@ -23,13 +21,15 @@ add_uncrustify_format(${current_target} ${current_target_sources} ${current_targ
|
|||||||
target_include_directories(${current_target} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS})
|
target_include_directories(${current_target} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS})
|
||||||
target_include_directories(${current_target} SYSTEM PUBLIC ${FMT_INCLUDE_DIRS})
|
target_include_directories(${current_target} SYSTEM PUBLIC ${FMT_INCLUDE_DIRS})
|
||||||
target_include_directories(${current_target} SYSTEM PUBLIC ${SPDLOG_INCLUDE_DIRS})
|
target_include_directories(${current_target} SYSTEM PUBLIC ${SPDLOG_INCLUDE_DIRS})
|
||||||
target_include_directories(${current_target} PRIVATE ${CMAKE_SOURCE_DIR}/src/base)
|
target_include_directories(${current_target} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||||
|
|
||||||
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
|
# Цель, используемая только для установки заголовочных файлов без компиляции
|
||||||
|
# проекта
|
||||||
add_custom_target(${current_target}-install-headers
|
add_custom_target(${current_target}-install-headers
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
-DCMAKE_INSTALL_COMPONENT=headers -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
-DCMAKE_INSTALL_COMPONENT=headers
|
||||||
)
|
-P
|
||||||
|
"${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||||
|
|
||||||
# Правила для установки
|
# Правила для установки
|
||||||
install(TARGETS ${current_target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(TARGETS ${current_target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
@ -39,5 +39,5 @@ endif()
|
|||||||
install(FILES ${current_target_headers}
|
install(FILES ${current_target_headers}
|
||||||
COMPONENT headers
|
COMPONENT headers
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${current_target})
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${current_target})
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/${current_target}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
install(FILES ${CMAKE_BINARY_DIR}/${current_target}.pc
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
@ -1,4 +1,4 @@
|
|||||||
#include "config.hpp"
|
#include <myx/base/config.hpp>
|
||||||
#include "translators.hpp"
|
#include "translators.hpp"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef MYX_LOG_QT_TRANSLATORS_HPP_
|
#ifndef MYX_LOG_QT_TRANSLATORS_HPP_
|
||||||
#define MYX_LOG_QT_TRANSLATORS_HPP_
|
#define MYX_LOG_QT_TRANSLATORS_HPP_
|
||||||
|
|
||||||
|
#include <myx/qt/backports.hpp>
|
||||||
|
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
namespace myx {
|
namespace myx {
|
Loading…
Reference in New Issue
Block a user