diff --git a/CMakeLists.txt b/CMakeLists.txt index ef3981b..000fe07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,7 @@ set(CMAKE_CXX_STANDARD 17) option(BUILD_STD "Build the BLT standard utilities." ON) option(BUILD_PROFILING "Build the BLT profiler extension" ON) +option(BUILD_NBT "Build the BLT NBT + eNBT extension" ON) option(BUILD_TESTS "Build the BLT test set" OFF) if(${BUILD_STD}) @@ -20,6 +21,12 @@ else() set(PROFILING_FILES "") endif() +if(${BUILD_NBT}) + file(GLOB_RECURSE NBT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/blt/nbt/*.cpp") +else() + set(NBT_FILES "") +endif() + #include parallel hashmaps if the user decided to download the submodule. if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap/CMakeLists.txt) set(USE_PHMAPS) @@ -33,8 +40,9 @@ message("Profiler Files ${PROFILING_FILES}") message("Source: ${CMAKE_SOURCE_DIR}") message("Current Source: ${CMAKE_CURRENT_SOURCE_DIR}") -add_library(BLT ${STD_FILES} ${PROFILING_FILES}) +add_library(BLT ${STD_FILES} ${PROFILING_FILES} ${NBT_FILES}) target_include_directories(BLT PUBLIC include/) + if(${USE_PHMAPS}) target_link_libraries(BLT phmap) endif() diff --git a/cmake-build-release/.cmake/api/v1/reply/cache-v2-0591e263fdd0b7d4f035.json b/cmake-build-release/.cmake/api/v1/reply/cache-v2-0591e263fdd0b7d4f035.json deleted file mode 100644 index 3eb6edc..0000000 --- a/cmake-build-release/.cmake/api/v1/reply/cache-v2-0591e263fdd0b7d4f035.json +++ /dev/null @@ -1,1375 +0,0 @@ -{ - "entries" : - [ - { - "name" : "BLT_BINARY_DIR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "/home/brett/Documents/code/c++/BLT/cmake-build-release" - }, - { - "name" : "BLT_IS_TOP_LEVEL", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "ON" - }, - { - "name" : "BLT_SOURCE_DIR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "/home/brett/Documents/code/c++/BLT" - }, - { - "name" : "BLT_TESTS_BINARY_DIR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "/home/brett/Documents/code/c++/BLT/cmake-build-release" - }, - { - "name" : "BLT_TESTS_IS_TOP_LEVEL", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "ON" - }, - { - "name" : "BLT_TESTS_SOURCE_DIR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "/home/brett/Documents/code/c++/BLT" - }, - { - "name" : "BUILD_PROFILING", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Build the BLT profiler extension" - } - ], - "type" : "BOOL", - "value" : "ON" - }, - { - "name" : "BUILD_STD", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Build the BLT standard utilities." - } - ], - "type" : "BOOL", - "value" : "ON" - }, - { - "name" : "BUILD_TESTS", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Build the BLT test set" - } - ], - "type" : "BOOL", - "value" : "ON" - }, - { - "name" : "CMAKE_ADDR2LINE", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Path to a program." - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/addr2line" - }, - { - "name" : "CMAKE_AR", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Path to a program." - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/ar" - }, - { - "name" : "CMAKE_BUILD_TYPE", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ..." - } - ], - "type" : "STRING", - "value" : "Release" - }, - { - "name" : "CMAKE_CACHEFILE_DIR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "This is the directory where this CMakeCache.txt was created" - } - ], - "type" : "INTERNAL", - "value" : "/home/brett/Documents/code/c++/BLT/cmake-build-release" - }, - { - "name" : "CMAKE_CACHE_MAJOR_VERSION", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Major version of cmake used to create the current loaded cache" - } - ], - "type" : "INTERNAL", - "value" : "3" - }, - { - "name" : "CMAKE_CACHE_MINOR_VERSION", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Minor version of cmake used to create the current loaded cache" - } - ], - "type" : "INTERNAL", - "value" : "24" - }, - { - "name" : "CMAKE_CACHE_PATCH_VERSION", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Patch version of cmake used to create the current loaded cache" - } - ], - "type" : "INTERNAL", - "value" : "2" - }, - { - "name" : "CMAKE_COLOR_DIAGNOSTICS", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Enable colored diagnostics throughout." - } - ], - "type" : "BOOL", - "value" : "ON" - }, - { - "name" : "CMAKE_COMMAND", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Path to CMake executable." - } - ], - "type" : "INTERNAL", - "value" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake" - }, - { - "name" : "CMAKE_CPACK_COMMAND", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Path to cpack program executable." - } - ], - "type" : "INTERNAL", - "value" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cpack" - }, - { - "name" : "CMAKE_CTEST_COMMAND", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Path to ctest program executable." - } - ], - "type" : "INTERNAL", - "value" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/ctest" - }, - { - "name" : "CMAKE_CXX_COMPILER", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "CXX compiler" - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/c++" - }, - { - "name" : "CMAKE_CXX_COMPILER_AR", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/gcc-ar-12" - }, - { - "name" : "CMAKE_CXX_COMPILER_RANLIB", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/gcc-ranlib-12" - }, - { - "name" : "CMAKE_CXX_FLAGS", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the CXX compiler during all build types." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_CXX_FLAGS_DEBUG", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the CXX compiler during DEBUG builds." - } - ], - "type" : "STRING", - "value" : "-g" - }, - { - "name" : "CMAKE_CXX_FLAGS_MINSIZEREL", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the CXX compiler during MINSIZEREL builds." - } - ], - "type" : "STRING", - "value" : "-Os -DNDEBUG" - }, - { - "name" : "CMAKE_CXX_FLAGS_RELEASE", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the CXX compiler during RELEASE builds." - } - ], - "type" : "STRING", - "value" : "-O3 -DNDEBUG" - }, - { - "name" : "CMAKE_CXX_FLAGS_RELWITHDEBINFO", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the CXX compiler during RELWITHDEBINFO builds." - } - ], - "type" : "STRING", - "value" : "-O2 -g -DNDEBUG" - }, - { - "name" : "CMAKE_C_COMPILER", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "C compiler" - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/cc" - }, - { - "name" : "CMAKE_C_COMPILER_AR", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/gcc-ar-12" - }, - { - "name" : "CMAKE_C_COMPILER_RANLIB", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/gcc-ranlib-12" - }, - { - "name" : "CMAKE_C_FLAGS", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the C compiler during all build types." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_C_FLAGS_DEBUG", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the C compiler during DEBUG builds." - } - ], - "type" : "STRING", - "value" : "-g" - }, - { - "name" : "CMAKE_C_FLAGS_MINSIZEREL", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the C compiler during MINSIZEREL builds." - } - ], - "type" : "STRING", - "value" : "-Os -DNDEBUG" - }, - { - "name" : "CMAKE_C_FLAGS_RELEASE", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the C compiler during RELEASE builds." - } - ], - "type" : "STRING", - "value" : "-O3 -DNDEBUG" - }, - { - "name" : "CMAKE_C_FLAGS_RELWITHDEBINFO", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the C compiler during RELWITHDEBINFO builds." - } - ], - "type" : "STRING", - "value" : "-O2 -g -DNDEBUG" - }, - { - "name" : "CMAKE_DLLTOOL", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Path to a program." - } - ], - "type" : "FILEPATH", - "value" : "CMAKE_DLLTOOL-NOTFOUND" - }, - { - "name" : "CMAKE_EXECUTABLE_FORMAT", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Executable file format" - } - ], - "type" : "INTERNAL", - "value" : "ELF" - }, - { - "name" : "CMAKE_EXE_LINKER_FLAGS", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during all build types." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_EXE_LINKER_FLAGS_DEBUG", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during DEBUG builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_EXE_LINKER_FLAGS_MINSIZEREL", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during MINSIZEREL builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_EXE_LINKER_FLAGS_RELEASE", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during RELEASE builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during RELWITHDEBINFO builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_EXPORT_COMPILE_COMMANDS", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Enable/Disable output of compile commands during generation." - } - ], - "type" : "BOOL", - "value" : "" - }, - { - "name" : "CMAKE_EXTRA_GENERATOR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Name of external makefile project generator." - } - ], - "type" : "INTERNAL", - "value" : "" - }, - { - "name" : "CMAKE_FIND_PACKAGE_REDIRECTS_DIR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake." - } - ], - "type" : "STATIC", - "value" : "/home/brett/Documents/code/c++/BLT/cmake-build-release/CMakeFiles/pkgRedirects" - }, - { - "name" : "CMAKE_GENERATOR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Name of generator." - } - ], - "type" : "INTERNAL", - "value" : "Ninja" - }, - { - "name" : "CMAKE_GENERATOR_INSTANCE", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Generator instance identifier." - } - ], - "type" : "INTERNAL", - "value" : "" - }, - { - "name" : "CMAKE_GENERATOR_PLATFORM", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Name of generator platform." - } - ], - "type" : "INTERNAL", - "value" : "" - }, - { - "name" : "CMAKE_GENERATOR_TOOLSET", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Name of generator toolset." - } - ], - "type" : "INTERNAL", - "value" : "" - }, - { - "name" : "CMAKE_HOME_DIRECTORY", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Source directory with the top level CMakeLists.txt file for this project" - } - ], - "type" : "INTERNAL", - "value" : "/home/brett/Documents/code/c++/BLT" - }, - { - "name" : "CMAKE_INSTALL_PREFIX", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Install path prefix, prepended onto install directories." - } - ], - "type" : "PATH", - "value" : "/usr/local" - }, - { - "name" : "CMAKE_INSTALL_SO_NO_EXE", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Install .so files without execute permission." - } - ], - "type" : "INTERNAL", - "value" : "1" - }, - { - "name" : "CMAKE_LINKER", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Path to a program." - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/ld" - }, - { - "name" : "CMAKE_MAKE_PROGRAM", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "No help, variable specified on the command line." - } - ], - "type" : "UNINITIALIZED", - "value" : "/opt/netbrains/clion/clion-2022.1.3/bin/ninja/linux/ninja" - }, - { - "name" : "CMAKE_MODULE_LINKER_FLAGS", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of modules during all build types." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_MODULE_LINKER_FLAGS_DEBUG", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of modules during DEBUG builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of modules during MINSIZEREL builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_MODULE_LINKER_FLAGS_RELEASE", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of modules during RELEASE builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of modules during RELWITHDEBINFO builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_NM", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Path to a program." - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/nm" - }, - { - "name" : "CMAKE_NUMBER_OF_MAKEFILES", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "number of local generators" - } - ], - "type" : "INTERNAL", - "value" : "2" - }, - { - "name" : "CMAKE_OBJCOPY", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Path to a program." - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/objcopy" - }, - { - "name" : "CMAKE_OBJDUMP", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Path to a program." - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/objdump" - }, - { - "name" : "CMAKE_PLATFORM_INFO_INITIALIZED", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Platform information initialized" - } - ], - "type" : "INTERNAL", - "value" : "1" - }, - { - "name" : "CMAKE_PROJECT_DESCRIPTION", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "" - }, - { - "name" : "CMAKE_PROJECT_HOMEPAGE_URL", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "" - }, - { - "name" : "CMAKE_PROJECT_NAME", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "BLT_TESTS" - }, - { - "name" : "CMAKE_PROJECT_VERSION_MAJOR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "1" - }, - { - "name" : "CMAKE_PROJECT_VERSION_MINOR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "3" - }, - { - "name" : "CMAKE_PROJECT_VERSION_PATCH", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "8" - }, - { - "name" : "CMAKE_PROJECT_VERSION_TWEAK", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "" - }, - { - "name" : "CMAKE_RANLIB", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Path to a program." - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/ranlib" - }, - { - "name" : "CMAKE_READELF", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Path to a program." - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/readelf" - }, - { - "name" : "CMAKE_ROOT", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Path to CMake installation." - } - ], - "type" : "INTERNAL", - "value" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.24" - }, - { - "name" : "CMAKE_SHARED_LINKER_FLAGS", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of shared libraries during all build types." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_SHARED_LINKER_FLAGS_DEBUG", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of shared libraries during DEBUG builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of shared libraries during MINSIZEREL builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_SHARED_LINKER_FLAGS_RELEASE", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of shared libraries during RELEASE builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of shared libraries during RELWITHDEBINFO builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_SKIP_INSTALL_RPATH", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "If set, runtime paths are not added when installing shared libraries, but are added when building." - } - ], - "type" : "BOOL", - "value" : "NO" - }, - { - "name" : "CMAKE_SKIP_RPATH", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "If set, runtime paths are not added when using shared libraries." - } - ], - "type" : "BOOL", - "value" : "NO" - }, - { - "name" : "CMAKE_STATIC_LINKER_FLAGS", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of static libraries during all build types." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_STATIC_LINKER_FLAGS_DEBUG", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of static libraries during DEBUG builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of static libraries during MINSIZEREL builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_STATIC_LINKER_FLAGS_RELEASE", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of static libraries during RELEASE builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Flags used by the linker during the creation of static libraries during RELWITHDEBINFO builds." - } - ], - "type" : "STRING", - "value" : "" - }, - { - "name" : "CMAKE_STRIP", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "Path to a program." - } - ], - "type" : "FILEPATH", - "value" : "/usr/bin/strip" - }, - { - "name" : "CMAKE_UNAME", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "uname command" - } - ], - "type" : "INTERNAL", - "value" : "/usr/bin/uname" - }, - { - "name" : "CMAKE_VERBOSE_MAKEFILE", - "properties" : - [ - { - "name" : "ADVANCED", - "value" : "1" - }, - { - "name" : "HELPSTRING", - "value" : "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo." - } - ], - "type" : "BOOL", - "value" : "FALSE" - }, - { - "name" : "PHMAP_BUILD_EXAMPLES", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Whether or not to build the examples" - } - ], - "type" : "BOOL", - "value" : "OFF" - }, - { - "name" : "PHMAP_BUILD_TESTS", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Whether or not to build the tests" - } - ], - "type" : "BOOL", - "value" : "OFF" - }, - { - "name" : "PHMAP_INSTALL", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Enable installation" - } - ], - "type" : "BOOL", - "value" : "OFF" - }, - { - "name" : "_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "linker supports push/pop state" - } - ], - "type" : "INTERNAL", - "value" : "TRUE" - }, - { - "name" : "phmap_BINARY_DIR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "/home/brett/Documents/code/c++/BLT/cmake-build-release/libraries/parallel-hashmap" - }, - { - "name" : "phmap_IS_TOP_LEVEL", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "OFF" - }, - { - "name" : "phmap_SOURCE_DIR", - "properties" : - [ - { - "name" : "HELPSTRING", - "value" : "Value Computed by CMake" - } - ], - "type" : "STATIC", - "value" : "/home/brett/Documents/code/c++/BLT/libraries/parallel-hashmap" - } - ], - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } -} diff --git a/cmake-build-release/CMakeCache.txt b/cmake-build-release/CMakeCache.txt index 6f27097..c27606b 100644 --- a/cmake-build-release/CMakeCache.txt +++ b/cmake-build-release/CMakeCache.txt @@ -32,6 +32,9 @@ BLT_TESTS_IS_TOP_LEVEL:STATIC=ON //Value Computed by CMake BLT_TESTS_SOURCE_DIR:STATIC=/home/brett/Documents/code/c++/BLT +//Build the BLT NBT + eNBT extension +BUILD_NBT:BOOL=ON + //Build the BLT profiler extension BUILD_PROFILING:BOOL=ON diff --git a/include/blt/profiling/profiler.h b/include/blt/profiling/profiler.h index 289e4eb..def2bbd 100644 --- a/include/blt/profiling/profiler.h +++ b/include/blt/profiling/profiler.h @@ -8,17 +8,17 @@ #define BLT_PROFILER_H #include -#include -#include -#include -#include #include -#include +#include -namespace blt { +/** + * Defines several disableable macros (#define BLT_DISABLE_PROFILING). If you do not use these macros profiling will not be disableable + */ + +namespace blt::profiling { struct CapturePoint { - std::string_view name; - long point; + std::string name; + long point {}; }; struct CaptureInterval { @@ -26,70 +26,63 @@ namespace blt { long end; }; - /** - * @tparam HASHMAP_TYPE - */ - template class HASHMAP_TYPE> - class profile { - private: - // profiling intervals. - HASHMAP_TYPE intervals{}; - - // profiling points - std::vector> cyclicPointsHistory{}; - blt::flat_queue points{}; - blt::flat_queue cyclicPoints{}; - - std::mutex timerLock{}; - public: - profile() = default; - void finishCycle() { - cyclicPointsHistory.push_back(cyclicPoints); - // im not sure if this is the correct way to clear a queue, there is no function to do so. - cyclicPoints = {}; - } - void startInterval(const std::string_view& name) { - std::scoped_lock lock(timerLock); - CaptureInterval interval{}; - interval.start = System::getCurrentTimeNanoseconds(); - intervals[name] = interval; - } - void endInterval(const std::string_view& name) { - std::scoped_lock lock(timerLock); - intervals[name].end = System::getCurrentTimeNanoseconds(); - } - /** - * Records the current time for the purpose of reconstructing the execution time between points, in order to find the most common cause for performance issues. - * @param name a common name for the point which you are trying to profile. This name should be meaningful as it will be displayed in the output. - */ - void profilerPoint(const std::string_view& name) { - points.push(CapturePoint{name, System::getCurrentTimeNanoseconds()}); - } - /** - * Records the current time for the purpose of reconstructing the execution time between points, in order to find the most common cause for performance issues. - * Uses a separate tracking device that will be reset when finishCycle(); is called. - * @param name a common name for the point which you are trying to profile. This name should be meaningful as it will be displayed in the output. - */ - void profilerPointCyclic(const std::string_view& name) { - cyclicPoints.push(CapturePoint{name, System::getCurrentTimeNanoseconds()}); - } - - void print(){ - // TODO: - for (auto c : intervals){ - std::cout << c.first << " " << c.second.start << " " << c.second.end << ": " << std::to_string((c.second.end - c.second.start)/1000000) << "\n"; - } - } - }; - - class Profiler { - private: - - public: - + struct Profile { + std::unordered_map intervals; + blt::flat_queue points; }; - void createProfiler(Profiler* profiler); + void startInterval(const std::string& profileName, const std::string& intervalName); + void endInterval(const std::string& profileName, const std::string& intervalName); + + void point(const std::string& profileName, const std::string& pointName); + + CaptureInterval getInterval(const std::string& profileName, const std::string& intervalName); + Profile getProfile(const std::string& profileName); + + void printProfile(const std::string& profileName, int loggingLevel); + void printOrderedProfile(const std::string& profileName, int loggingLevel); + + void discardProfiles(); + void discardIntervals(const std::string& profileName); + void discardPoints(const std::string& profileName); } #endif //BLT_PROFILER_H + +#ifdef BLT_DISABLE_PROFILING + #define BLT_START_INTERVAL(profileName, intervalName) + #define BLT_END_INTERVAL(profileName, intervalName) + #define BLT_POINT(profileName, pointName) + #define BLT_PRINT_PROFILE(profileName) + #define BLT_PRINT_ORDERED(profileName) + + #define BLT_PRINT_PROFILE_TRACE(profileName) + #define BLT_PRINT_ORDERED_TRACE(profileName) + + #define BLT_PRINT_PROFILE_DEBUG(profileName) + #define BLT_PRINT_ORDERED_DEBUG(profileName) + + #define BLT_PRINT_PROFILE_INFO(profileName) + #define BLT_PRINT_ORDERED_INFO(profileName) + + #define BLT_PRINT_PROFILE_WARN(profileName) + #define BLT_PRINT_ORDERED_WARN(profileName) +#else + #define BLT_START_INTERVAL(profileName, intervalName) blt::profiling::startInterval(profileName, intervalName); + #define BLT_END_INTERVAL(profileName, intervalName) blt::profiling::endInterval(profileName, intervalName); + #define BLT_POINT(profileName, pointName) blt::profiling::point(profileName, pointName); + #define BLT_PRINT_PROFILE(profileName) blt::profiling::printProfile(profileName, -1); + #define BLT_PRINT_ORDERED(profileName) blt::profiling::printOrderedProfile(profileName, -1); + + #define BLT_PRINT_PROFILE_TRACE(profileName) blt::profiling::printProfile(profileName, 0); + #define BLT_PRINT_ORDERED_TRACE(profileName) blt::profiling::printOrderedProfile(profileName, 0); + + #define BLT_PRINT_PROFILE_DEBUG(profileName) blt::profiling::printProfile(profileName, 1); + #define BLT_PRINT_ORDERED_DEBUG(profileName) blt::profiling::printOrderedProfile(profileName, 1); + + #define BLT_PRINT_PROFILE_INFO(profileName) blt::profiling::printProfile(profileName, 2); + #define BLT_PRINT_ORDERED_INFO(profileName) blt::profiling::printOrderedProfile(profileName, 2); + + #define BLT_PRINT_PROFILE_WARN(profileName) blt::profiling::printProfile(profileName, 3); + #define BLT_PRINT_ORDERED_WARN(profileName) blt::profiling::printOrderedProfile(profileName, 3); +#endif \ No newline at end of file diff --git a/include/blt/std/logging.h b/include/blt/std/logging.h index fe34828..76dc320 100644 --- a/include/blt/std/logging.h +++ b/include/blt/std/logging.h @@ -20,6 +20,7 @@ namespace blt::logging { bool m_logToConsole = true; bool m_logToFile = true; const char* m_directory = "./"; + LOG_LEVEL minLevel = TRACE; explicit constexpr LOG_PROPERTIES(bool useColor, bool logToConsole, bool logToFile, const char* directory): m_useColor(useColor), m_logToConsole(logToConsole), m_logToFile(logToFile), m_directory(directory) {} @@ -32,11 +33,11 @@ namespace blt::logging { void logi(const std::string& str) const; // evil hack, todo: better way #ifdef BLT_DISABLE_LOGGING - void log(const std::string& str) { + void log(const std::string& str) const { } #else - void log(const std::string& str) { + void log(const std::string& str) const { logi(str); } #endif @@ -48,6 +49,11 @@ namespace blt::logging { static logger wlog{WARN}; static logger elog{ERROR}; static logger flog{FATAL}; + + /** + * Always in order of the enum! + */ + static logger loggerLevelDecode[6]{tlog, dlog, ilog, wlog, elog, flog}; static logger trace{TRACE}; static logger debug{DEBUG}; @@ -126,19 +132,12 @@ namespace blt::logging { } #ifdef BLT_DISABLE_LOGGING - #define BLT_TRACE(format, args...) - #define BLT_DEBUG(format, args...) - #define BLT_INFO(format, args...) - #define BLT_WARN(format, args...) - #define BLT_ERROR(format, args...) - #define BLT_FATAL(format, args...) - - #define BLT_TRACE_LN(format, args...) - #define BLT_DEBUG_LN(format, args...) - #define BLT_INFO_LN(format, args...) - #define BLT_WARN_LN(format, args...) - #define BLT_ERROR_LN(format, args...) - #define BLT_FATAL_LN(format, args...) + #define BLT_TRACE(format, ...) + #define BLT_DEBUG(format, ...) + #define BLT_INFO(format, ...) + #define BLT_WARN(format, ...) + #define BLT_ERROR(format, ...) + #define BLT_FATAL(format, ...) #else /*#define BLT_TRACE(format, ...) log(format, blt::logging::TRACE, false, ##__VA_ARGS__); #define BLT_DEBUG(format, ...) log(format, blt::logging::DEBUG, false, ##__VA_ARGS__); diff --git a/include/blt/std/queue.h b/include/blt/std/queue.h index b295d59..a447f47 100644 --- a/include/blt/std/queue.h +++ b/include/blt/std/queue.h @@ -117,7 +117,7 @@ namespace blt { public: void push(const T& t) { - if (m_insertIndex >= m_size) { + if (m_insertIndex+1 >= m_size) { expand(m_size * 2); } m_data[m_insertIndex++] = t; @@ -147,6 +147,14 @@ namespace blt { return m_insertIndex - m_headIndex; } + T* begin(){ + return m_data[m_headIndex]; + } + + T* end(){ + return m_data[m_insertIndex]; + } + ~flat_queue() { delete[](m_data); } diff --git a/src/blt/profiling/profiler.cpp b/src/blt/profiling/profiler.cpp index 86999cf..55ddeac 100644 --- a/src/blt/profiling/profiler.cpp +++ b/src/blt/profiling/profiler.cpp @@ -4,9 +4,60 @@ * See LICENSE file for license detail */ #include +#include +#include +#include +#include +#include -namespace blt { - void createProfiler(Profiler* profiler) { +namespace blt::profiling { + + // TODO: a better way + std::mutex profileLock{}; + std::unordered_map profiles; + + void startInterval(const std::string& profileName, const std::string& intervalName) { + std::scoped_lock lock(profileLock); + CaptureInterval interval{}; + interval.start = System::getCurrentTimeNanoseconds(); + profiles[profileName].intervals[intervalName] = interval; + } + + void endInterval(const std::string& profileName, const std::string& intervalName) { + std::scoped_lock lock(profileLock); + profiles[profileName].intervals[intervalName].end = System::getCurrentTimeNanoseconds(); + } + + void point(const std::string& profileName, const std::string& pointName) { + + } + + CaptureInterval getInterval(const std::string& profileName, const std::string& intervalName) { + return profiles[profileName].intervals[intervalName]; + } + + Profile getProfile(const std::string& profileName) { + return profiles[profileName]; + } + + void printProfile(const std::string& profileName, int loggingLevel) { + //auto& out = loggingLevel < 0 ? std::cout : logging::loggerLevelDecode[loggingLevel]; } + + void printOrderedProfile(const std::string& profileName, int loggingLevel) { + + } + + void discardProfiles() { + profiles = {}; + } + + void discardIntervals(const std::string& profileName) { + profiles[profileName].intervals = {}; + } + + void discardPoints(const std::string& profileName) { + profiles[profileName].points = {}; + } } \ No newline at end of file diff --git a/src/blt/std/logging.cpp b/src/blt/std/logging.cpp index 0e52299..e6f1274 100644 --- a/src/blt/std/logging.cpp +++ b/src/blt/std/logging.cpp @@ -94,6 +94,8 @@ namespace blt::logging { } inline void log(const std::string& str, bool hasEndingLinefeed, LOG_LEVEL level, int auto_line){ + if (level < BLT_LOGGING_PROPERTIES.minLevel) + return; std::string outputString = System::getTimeStringLog(); outputString += levelNames[level]; outputString += str;