diff --git a/CMakeLists.txt b/CMakeLists.txt index cc3b160..0283d15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/find) include(CMLibCommon) -option(MYXLIB_BUILD_COMPILED "Build compiled version of library" OFF) +option(MYXLIB_HEADER_ONLY "Build header only version of library" ON) option(MYXLIB_BUILD_EXAMPLES "Build examples" OFF) # Поиск библиотек с помощью pkgconfig @@ -64,4 +64,3 @@ endif() # Документация add_subdirectory(cmake/doc) - diff --git a/src/myx/base/CMakeLists.txt b/src/myx/base/CMakeLists.txt index b9c8109..4f739d5 100644 --- a/src/myx/base/CMakeLists.txt +++ b/src/myx/base/CMakeLists.txt @@ -9,6 +9,7 @@ set(TRGT_cpp # Список заголовочных файлов set(TRGT_hpp ${CMAKE_CURRENT_SOURCE_DIR}/config.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/config-inl.hpp ${CMAKE_CURRENT_SOURCE_DIR}/limits.hpp ${CMAKE_CURRENT_SOURCE_DIR}/enum_bitmask_operations.hpp) @@ -33,7 +34,7 @@ add_pvs_check(${TRGT}) # Создание цели для автоматического форматирования кода add_format_sources(${TRGT} ${TRGT_cpp} ${TRGT_headers}) -target_include_directories(${TRGT} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS}) +target_include_directories(${TRGT} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/src) cotire(${TRGT}) diff --git a/src/myx/base/config-inl.hpp b/src/myx/base/config-inl.hpp new file mode 100644 index 0000000..ca9896e --- /dev/null +++ b/src/myx/base/config-inl.hpp @@ -0,0 +1,10 @@ +#ifndef MYX_BASE_CONFIG_INL_HPP_ +#define MYX_BASE_CONFIG_INL_HPP_ + +#pragma once + +#ifndef MYXLIB_HEADER_ONLY +#include +#endif + +#endif // MYX_BASE_CONFIG_INL_HPP_ diff --git a/src/myx/base/config.hpp b/src/myx/base/config.hpp index a1b1fc5..0089691 100644 --- a/src/myx/base/config.hpp +++ b/src/myx/base/config.hpp @@ -1,6 +1,12 @@ #ifndef MYX_BASE_CONFIG_HPP_ #define MYX_BASE_CONFIG_HPP_ -#include "config_flags.hpp" +#pragma once + +#include + +#ifdef MYXLIB_HEADER_ONLY +#include "config-inl.hpp" +#endif #endif // MYX_BASE_CONFIG_HPP_ diff --git a/src/myx/filesystem/CMakeLists.txt b/src/myx/filesystem/CMakeLists.txt index de539f8..8493818 100644 --- a/src/myx/filesystem/CMakeLists.txt +++ b/src/myx/filesystem/CMakeLists.txt @@ -37,7 +37,6 @@ add_format_sources(${TRGT} ${TRGT_cpp} ${TRGT_headers}) target_include_directories(${TRGT} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS}) target_include_directories(${TRGT} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/src) -target_include_directories(${TRGT} PRIVATE ${CMAKE_BINARY_DIR}/include) cotire(${TRGT}) diff --git a/src/myx/math/CMakeLists.txt b/src/myx/math/CMakeLists.txt index 9672181..cdcd70b 100644 --- a/src/myx/math/CMakeLists.txt +++ b/src/myx/math/CMakeLists.txt @@ -44,9 +44,7 @@ add_pvs_check(${TRGT}) # Создание цели для автоматического форматирования кода add_format_sources(${TRGT} ${TRGT_sources} ${TRGT_headers}) -target_include_directories(${TRGT} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS}) target_include_directories(${TRGT} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/src) -target_include_directories(${TRGT} PRIVATE ${CMAKE_BINARY_DIR}/include) cotire(${TRGT}) diff --git a/src/myx/redis/CMakeLists.txt b/src/myx/redis/CMakeLists.txt index 578deff..6042023 100644 --- a/src/myx/redis/CMakeLists.txt +++ b/src/myx/redis/CMakeLists.txt @@ -43,7 +43,6 @@ add_format_sources(${TRGT} ${TRGT_cpp} ${TRGT_headers}) target_include_directories(${TRGT} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS}) target_include_directories(${TRGT} SYSTEM PUBLIC ${Qt5Network_INCLUDE_DIRS}) target_include_directories(${TRGT} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/src) -target_include_directories(${TRGT} PRIVATE ${CMAKE_BINARY_DIR}/include) cotire(${TRGT}) diff --git a/src/myx/redis/config.hpp b/src/myx/redis/config.hpp index f64ae2e..a1ef77f 100644 --- a/src/myx/redis/config.hpp +++ b/src/myx/redis/config.hpp @@ -9,6 +9,6 @@ // #define MYX_REDIS_EXPORT Q_DECL_IMPORT // #endif -#include "config_flags.hpp" +#include #endif // MYX_REDIS_CONFIG_HPP_