some tuning, specializations, basic testing

This commit is contained in:
Blue 2022-09-16 00:34:39 +03:00
parent 5f90a21fe6
commit 047f96b54a
Signed by: blue
GPG key ID: 9B203B252A63EE38
17 changed files with 370 additions and 508 deletions

View file

@ -4,6 +4,11 @@ project(storage VERSION 0.0.1 LANGUAGES CXX)
cmake_policy(SET CMP0076 NEW)
cmake_policy(SET CMP0079 NEW)
option(BUILD_STATIC "Builds library as static library" ON)
option(BUILD_TESTS "Builds tests" ON)
include(GNUInstallDirs)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
@ -22,14 +27,36 @@ if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif ()
add_executable(storage
main.cpp
exception.cpp
set(SOURCES
exceptions.cpp
table.cpp
database.cpp
)
set(HEADERS
database.h
exceptions.h
table.h
table.hpp
serializer.h
serializer.hpp
serializer_uint8.hpp
serializer_uint16.hpp
serializer_uint32.hpp
serializer_uint64.hpp
)
if (BUILD_STATIC)
add_library(storage STATIC ${SOURCES})
else ()
add_library(storage SHARED ${SOURCES})
endif()
if (BUILD_TESTS)
add_subdirectory(test)
endif ()
set_target_properties(storage PROPERTIES PUBLIC_HEADER "${HEADERS}")
target_include_directories(storage PRIVATE ${CMAKE_SOURCE_DIR})
target_include_directories(storage PRIVATE ${Qt${QT_VERSION_MAJOR}_INCLUDE_DIRS})
@ -41,4 +68,9 @@ target_link_libraries(storage
)
target_link_libraries(storage PRIVATE lmdb)
install(TARGETS storage RUNTIME DESTINATION bin)
install(TARGETS storage
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/storage
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/storage
)