diff --git a/CMakeLists.txt b/CMakeLists.txt index bd682e0..b839fcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,8 @@ option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF) option(BUILD_EXAMPLES "Build example programs. This will build with CTest" OFF) option(BUILD_GP_TESTS "Build test programs." OFF) option(DEBUG_LEVEL "Enable debug features which prints extra information to the console, might slow processing down. [0, 3)" 0) -option(TRACK_ALLOCATIONS "Track total allocations. Can be accessed with blt::gp::tracker" OFF) +option(BLT_GP_DEBUG_CHECK_TREES "Enable checking of trees after every operation" OFF) +option(BLT_GP_DEBUG_TRACK_ALLOCATIONS "Track total allocations. Can be accessed with blt::gp::tracker" OFF) set(CMAKE_CXX_STANDARD 17) diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..9d20b5e --- /dev/null +++ b/default.nix @@ -0,0 +1,36 @@ +{ pkgs ? (import { + config.allowUnfree = true; + config.segger-jlink.acceptLicense = true; +}), ... }: +pkgs.mkShell +{ + buildInputs = with pkgs; [ + cmake + gcc + clang + emscripten + ninja + renderdoc + valgrind + opentelemetry-cpp + opentelemetry-cpp.dev + ]; + nativeBuildInputs = with pkgs; [ + pkg-config + abseil-cpp + opentelemetry-cpp + opentelemetry-cpp.dev + ]; + propagatedBuildInputs = with pkgs; [ + gtest + gtest.dev + grpc + protobuf + curl + abseil-cpp + opentelemetry-cpp + opentelemetry-cpp.dev + opentelemetry-collector + ]; + LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib"; +} diff --git a/include/blt/gp/defines.h b/include/blt/gp/defines.h new file mode 100644 index 0000000..80b527a --- /dev/null +++ b/include/blt/gp/defines.h @@ -0,0 +1,48 @@ +#pragma once +/* + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef BLT_GP_DEFINES_H +#define BLT_GP_DEFINES_H + +#include + +#if BLT_DEBUG_LEVEL > 0 + #if defined(__has_include) &&__has_include() + #define BLT_DEBUG_OTEL_ENABLED 1 + #endif +#endif + +#if BLT_DEBUG_LEVEL > 1 + #define BLT_GP_DEBUG_TRACK_ALLOCATIONS +#endif + +#if BLT_DEBUG_LEVEL > 2 + #define BLT_GP_DEBUG_CHECK_TREES +#endif + +#ifdef BLT_GP_DEBUG_TRACK_ALLOCATIONS + #undef BLT_GP_DEBUG_TRACK_ALLOCATIONS + #define BLT_GP_DEBUG_TRACK_ALLOCATIONS +#endif + +#ifdef BLT_GP_DEBUG_CHECK_TREES + #undef BLT_GP_DEBUG_CHECK_TREES + #define BLT_GP_DEBUG_CHECK_TREES 1 +#endif + +#endif //BLT_GP_DEFINES_H diff --git a/include/blt/gp/fwdecl.h b/include/blt/gp/fwdecl.h index e13bec7..66cef46 100644 --- a/include/blt/gp/fwdecl.h +++ b/include/blt/gp/fwdecl.h @@ -20,7 +20,7 @@ #define BLT_GP_FWDECL_H #include -#include +#include #include #include #include diff --git a/lib/blt b/lib/blt index baa5952..3cdceda 160000 --- a/lib/blt +++ b/lib/blt @@ -1 +1 @@ -Subproject commit baa5952666594ce0d07a2b013e46c4bc343ba164 +Subproject commit 3cdceda227883bfd1bf8c41b466ef94c8271b501 diff --git a/src/transformers.cpp b/src/transformers.cpp index 511ad74..de7c1e7 100644 --- a/src/transformers.cpp +++ b/src/transformers.cpp @@ -24,6 +24,7 @@ #include #include + namespace blt::gp { #if BLT_DEBUG_LEVEL >= 2 || defined(BLT_TRACK_ALLOCATIONS)