Основа проекта разрастается

This commit is contained in:
Andrei Astafev 2019-10-02 14:29:10 +03:00
parent e4f36cc072
commit 4deb7d3efb
10 changed files with 140 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
CMakeLists.txt.user* CMakeLists.txt.user*
_build _build
_output
*.autosave *.autosave

View File

@ -25,15 +25,19 @@ include(CMLibCommon)
find_package(PkgConfig) find_package(PkgConfig)
# Qt5 # Qt5
find_package(Qt5 COMPONENTS Core Network Gui Widgets DBus Concurrent Sql) find_package(Qt5 COMPONENTS Core Network Gui Widgets DBus Concurrent Sql REQUIRED)
# Автоматически генерируемый заголовочный файл # Автоматически генерируемый заголовочный файл
cmlib_config_hpp_generate() cmlib_config_hpp_generate()
configure_file(${CMAKE_SOURCE_DIR}/src/base/config_flags.hpp.in
${CMAKE_BINARY_DIR}/include/config_flags.hpp)
# Подключение внешних проектов # Подключение внешних проектов
include(ExternalProject) include(ExternalProject)
# Библиотеки # Библиотеки
add_subdirectory(src/base)
add_subdirectory(src/filesystem) add_subdirectory(src/filesystem)
# Примеры # Примеры
@ -49,4 +53,3 @@ add_breathe_target(
CONF_FILE ${CMAKE_SOURCE_DIR}/doc/html/conf.py.in CONF_FILE ${CMAKE_SOURCE_DIR}/doc/html/conf.py.in
COMMENT "Documentation in HTML format with Breathe generator" COMMENT "Documentation in HTML format with Breathe generator"
) )

@ -1 +1 @@
Subproject commit 3c3c71e69c09b0551de64c717b7e1a0074527a25 Subproject commit a81f6a48e03c767e3cc768813bf970e2188899d1

38
src/base/CMakeLists.txt Normal file
View File

@ -0,0 +1,38 @@
# Название основной цели и имя библиотеки в текущем каталоге
set(current_target base)
set(current_target_sources
${CMAKE_CURRENT_SOURCE_DIR}/config.cpp
)
# Список заголовочных файлов (используется для установки)
set(current_target_headers
${CMAKE_CURRENT_SOURCE_DIR}/config.hpp
)
add_common_library(TARGET ${current_target} SOURCES ${current_target_sources} ${current_target_headers})
common_target_properties(${current_target})
add_clang_tidy_check(${current_target} ${current_target_sources})
add_clang_analyze_check(${current_target} ${current_target_sources})
add_clazy_check(${current_target} ${current_target_sources})
add_pvs_check(${current_target})
add_uncrustify_format(${current_target} ${current_target_sources} ${current_target_headers})
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
add_custom_target(${current_target}-install-headers
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=headers -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
)
# Правила для установки
install(TARGETS ${current_target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(BUILD_SHARED_LIBS)
install(TARGETS ${current_target}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(FILES ${CMAKE_BINARY_DIR}/include/cmlib_config.hpp
${CMAKE_BINARY_DIR}/include/config_flags.hpp
${current_target_headers}
COMPONENT headers
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${current_target})
install(FILES ${CMAKE_BINARY_DIR}/${current_target}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

1
src/base/config.cpp Normal file
View File

@ -0,0 +1 @@
#include "config.hpp"

25
src/base/config.hpp Normal file
View File

@ -0,0 +1,25 @@
#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 );
}
};
#endif
#endif
#endif // MYX_BASE_CONFIG_HPP_

View File

@ -0,0 +1,7 @@
#ifndef @CMLIB_PROJECT_NAME_CANONICAL@_CONFIG_FLAGS_HPP_
#define @CMLIB_PROJECT_NAME_CANONICAL@_CONFIG_FLAGS_HPP_
// #cmakedefine
#endif /* @CMLIB_PROJECT_NAME_CANONICAL@_CONFIG_FLAGS_HPP_ */

View File

@ -0,0 +1,37 @@
# Название основной цели и имя библиотеки в текущем каталоге
set(current_target filesystem)
# Список файлов исходных текстов
set(current_target_sources
${CMAKE_CURRENT_SOURCE_DIR}/paths.cpp
)
# Список заголовочных файлов (используется для установки)
set(current_target_headers
${CMAKE_CURRENT_SOURCE_DIR}/paths.hpp
)
add_common_library(TARGET ${current_target} SOURCES ${current_target_sources})
common_target_properties(${current_target})
add_clang_tidy_check(${current_target} ${current_target_sources})
add_clang_analyze_check(${current_target} ${current_target_sources})
add_clazy_check(${current_target} ${current_target_sources})
add_pvs_check(${current_target})
add_uncrustify_format(${current_target} ${current_target_sources} ${current_target_headers})
# Цель, используемая только для установки заголовочных файлов без компиляции проекта
add_custom_target(${current_target}-install-headers
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=headers -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
)
# Правила для установки
install(TARGETS ${current_target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(BUILD_SHARED_LIBS)
install(TARGETS ${current_target}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(FILES ${current_target_headers}
COMPONENT headers
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${current_target})
install(FILES ${CMAKE_BINARY_DIR}/${current_target}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

9
src/filesystem/paths.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "paths.hpp"
namespace MF = myx::filesystem;
int32_t MF::init( int32_t i = 0 )
{
return( i );
}

16
src/filesystem/paths.hpp Normal file
View File

@ -0,0 +1,16 @@
#ifndef MYX_FILESYSTEM_PATHS_HPP_
#define MYX_FILESYSTEM_PATHS_HPP_
#include <cstdint>
namespace myx {
namespace filesystem {
int32_t init( int32_t i );
} // namespace filesystem
} // namespace myx
#endif // MYX_FILESYSTEM_PATHS_HPP_