mirror of
https://github.com/BlackMATov/flat.hpp.git
synced 2025-12-12 17:26:14 +07:00
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
build/*
|
||||
install/*
|
||||
.clangd/*
|
||||
.vscode/*
|
||||
CMakeLists.txt.user
|
||||
|
||||
11
.vscode/launch.json
vendored
Normal file
11
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [{
|
||||
"name": "LLDB Debug",
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"program": "${command:cmake.launchTargetPath}",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}"
|
||||
}]
|
||||
}
|
||||
29
.vscode/settings.json
vendored
Normal file
29
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"[cpp]": {
|
||||
"files.encoding": "utf8",
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.trimTrailingWhitespace": true
|
||||
},
|
||||
"[cmake]": {
|
||||
"files.encoding": "utf8",
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.trimTrailingWhitespace": true
|
||||
},
|
||||
"[python]": {
|
||||
"files.encoding": "utf8",
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.trimTrailingWhitespace": true
|
||||
},
|
||||
"clangd.arguments": [
|
||||
"--all-scopes-completion",
|
||||
"--background-index",
|
||||
"--clang-tidy",
|
||||
"--compile-commands-dir=${workspaceFolder}/.clangd",
|
||||
"--completion-style=detailed",
|
||||
"--header-insertion=never"
|
||||
],
|
||||
"cmake.copyCompileCommands": "${workspaceFolder}/.clangd/compile_commands.json"
|
||||
}
|
||||
@@ -1,25 +1,83 @@
|
||||
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
||||
|
||||
if(NOT DEFINED PROJECT_NAME)
|
||||
set(BUILD_AS_STANDALONE ON)
|
||||
else()
|
||||
set(BUILD_AS_STANDALONE OFF)
|
||||
endif()
|
||||
project(flat.hpp
|
||||
VERSION "0.0.1"
|
||||
DESCRIPTION "Library of flat vector-like based associative containers"
|
||||
HOMEPAGE_URL "https://github.com/blackmatov/flat.hpp")
|
||||
|
||||
project(flat.hpp)
|
||||
#
|
||||
# LIBRARY
|
||||
#
|
||||
|
||||
add_library(${PROJECT_NAME} INTERFACE)
|
||||
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
|
||||
target_include_directories(${PROJECT_NAME} INTERFACE headers)
|
||||
add_library(flat.hpp::flat.hpp ALIAS ${PROJECT_NAME})
|
||||
|
||||
target_compile_features(${PROJECT_NAME} INTERFACE
|
||||
cxx_std_17)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/headers>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
|
||||
#
|
||||
# BUILD_AS_STANDALONE
|
||||
# INSTALL
|
||||
#
|
||||
|
||||
if(NOT ${BUILD_AS_STANDALONE})
|
||||
return()
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(FLAT_HPP_INSTALL_CONFIG_DIR
|
||||
"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
||||
|
||||
set(FLAT_HPP_INSTALL_CONFIG_INPUT
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in")
|
||||
|
||||
set(FLAT_HPP_INSTALL_GENERATED_CONFIG_CMAKE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/generated/${PROJECT_NAME}-config.cmake")
|
||||
|
||||
set(FLAT_HPP_INSTALL_GENERATED_CONFIG_VERSION_CMAKE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/generated/${PROJECT_NAME}-config-version.cmake")
|
||||
|
||||
configure_package_config_file(
|
||||
"${FLAT_HPP_INSTALL_CONFIG_INPUT}"
|
||||
"${FLAT_HPP_INSTALL_GENERATED_CONFIG_CMAKE}"
|
||||
INSTALL_DESTINATION "${FLAT_HPP_INSTALL_CONFIG_DIR}"
|
||||
NO_SET_AND_CHECK_MACRO
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${FLAT_HPP_INSTALL_GENERATED_CONFIG_VERSION_CMAKE}"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
ARCH_INDEPENDENT)
|
||||
|
||||
install(
|
||||
TARGETS ${PROJECT_NAME}
|
||||
EXPORT ${PROJECT_NAME}-targets
|
||||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
install(
|
||||
DIRECTORY headers/${PROJECT_NAME}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
install(
|
||||
EXPORT ${PROJECT_NAME}-targets
|
||||
FILE ${PROJECT_NAME}-targets.cmake
|
||||
NAMESPACE ${PROJECT_NAME}::
|
||||
DESTINATION "${FLAT_HPP_INSTALL_CONFIG_DIR}")
|
||||
|
||||
install(
|
||||
FILES "${FLAT_HPP_INSTALL_GENERATED_CONFIG_CMAKE}"
|
||||
"${FLAT_HPP_INSTALL_GENERATED_CONFIG_VERSION_CMAKE}"
|
||||
DESTINATION "${FLAT_HPP_INSTALL_CONFIG_DIR}")
|
||||
endif()
|
||||
|
||||
#
|
||||
# DEVELOPER
|
||||
#
|
||||
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
option(BUILD_WITH_COVERAGE "Build with coverage" OFF)
|
||||
option(BUILD_WITH_SANITIZERS "Build with sanitizers" OFF)
|
||||
|
||||
@@ -34,3 +92,4 @@ include(EnableUBSan)
|
||||
|
||||
add_subdirectory(vendors)
|
||||
add_subdirectory(untests)
|
||||
endif()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -41,7 +41,7 @@ Also, you can add the root repository directory to your [cmake](https://cmake.or
|
||||
|
||||
```cmake
|
||||
add_subdirectory(external/flat.hpp)
|
||||
target_link_libraries(your_project_target PUBLIC flat.hpp)
|
||||
target_link_libraries(your_project_target PUBLIC flat.hpp::flat.hpp)
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
3
cmake/Config.cmake.in
Normal file
3
cmake/Config.cmake.in
Normal file
@@ -0,0 +1,3 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/flat.hpp-targets.cmake")
|
||||
@@ -1,14 +1,15 @@
|
||||
# https://clang.llvm.org/docs/AddressSanitizer.html
|
||||
|
||||
add_library(enable_asan INTERFACE)
|
||||
add_library(${PROJECT_NAME}.enable_asan INTERFACE)
|
||||
add_library(${PROJECT_NAME}::enable_asan ALIAS ${PROJECT_NAME}.enable_asan)
|
||||
|
||||
target_compile_options(enable_asan INTERFACE
|
||||
target_compile_options(${PROJECT_NAME}.enable_asan INTERFACE
|
||||
-fsanitize=address
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize-address-use-after-scope
|
||||
-fsanitize-address-use-after-return=always)
|
||||
|
||||
target_link_options(enable_asan INTERFACE
|
||||
target_link_options(${PROJECT_NAME}.enable_asan INTERFACE
|
||||
-fsanitize=address
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize-address-use-after-scope
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
|
||||
|
||||
add_library(enable_gcov INTERFACE)
|
||||
add_library(${PROJECT_NAME}.enable_gcov INTERFACE)
|
||||
add_library(${PROJECT_NAME}::enable_gcov ALIAS ${PROJECT_NAME}.enable_gcov)
|
||||
|
||||
target_compile_options(enable_gcov INTERFACE
|
||||
target_compile_options(${PROJECT_NAME}.enable_gcov INTERFACE
|
||||
--coverage)
|
||||
|
||||
target_link_options(enable_gcov INTERFACE
|
||||
target_link_options(${PROJECT_NAME}.enable_gcov INTERFACE
|
||||
--coverage)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
|
||||
|
||||
add_library(enable_ubsan INTERFACE)
|
||||
add_library(${PROJECT_NAME}.enable_ubsan INTERFACE)
|
||||
add_library(${PROJECT_NAME}::enable_ubsan ALIAS ${PROJECT_NAME}.enable_ubsan)
|
||||
|
||||
target_compile_options(enable_ubsan INTERFACE
|
||||
target_compile_options(${PROJECT_NAME}.enable_ubsan INTERFACE
|
||||
-fsanitize=undefined
|
||||
-fno-omit-frame-pointer)
|
||||
|
||||
target_link_options(enable_ubsan INTERFACE
|
||||
target_link_options(${PROJECT_NAME}.enable_ubsan INTERFACE
|
||||
-fsanitize=undefined
|
||||
-fno-omit-frame-pointer)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "flat_map.hpp"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -4,7 +4,7 @@ file(GLOB_RECURSE UNTESTS_SOURCES "*.cpp" "*.hpp")
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${UNTESTS_SOURCES})
|
||||
|
||||
add_executable(${PROJECT_NAME} ${UNTESTS_SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE flat.hpp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE flat.hpp::flat.hpp)
|
||||
|
||||
#
|
||||
# setup defines
|
||||
@@ -23,14 +23,14 @@ setup_defines_for_target(${PROJECT_NAME})
|
||||
#
|
||||
|
||||
function(setup_libraries_for_target TARGET)
|
||||
target_link_libraries(${TARGET} PRIVATE doctest_with_main)
|
||||
target_link_libraries(${TARGET} PRIVATE doctest::doctest_with_main)
|
||||
|
||||
if(${BUILD_WITH_COVERAGE})
|
||||
target_link_libraries(${TARGET} PRIVATE enable_gcov)
|
||||
target_link_libraries(${TARGET} PRIVATE flat.hpp::enable_gcov)
|
||||
endif()
|
||||
|
||||
if(${BUILD_WITH_SANITIZERS})
|
||||
target_link_libraries(${TARGET} PRIVATE enable_asan enable_ubsan)
|
||||
target_link_libraries(${TARGET} PRIVATE flat.hpp::enable_asan flat.hpp::enable_ubsan)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <flat.hpp/flat.hpp>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <flat.hpp/flat_map.hpp>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <flat.hpp/flat_multimap.hpp>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <flat.hpp/flat_multiset.hpp>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <flat.hpp/flat_set.hpp>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/flat.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2019-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2019-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
Reference in New Issue
Block a user