diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0ad02d1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+cmake-build*/
+build/
+out/
+./cmake-build*/
+./build/
+./out/
diff --git a/.gitmodules b/.gitmodules
index 70a5151..84854ac 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "lib/blt-with-graphics"]
path = lib/blt-with-graphics
url = https://git.tpgc.me/tri11paragon/BLT-With-Graphics-Template
+[submodule "lib/blt-gp"]
+ path = lib/blt-gp
+ url = https://github.com/Tri11Paragon/blt-gp
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/editor.xml b/.idea/editor.xml
new file mode 100644
index 0000000..ce3f490
--- /dev/null
+++ b/.idea/editor.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/image-gp-2.iml b/.idea/image-gp-2.iml
new file mode 100644
index 0000000..f08604b
--- /dev/null
+++ b/.idea/image-gp-2.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..0b76fe5
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..393b4e5
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..90401cc
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c1afea3..33855b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.30)
-project(image-gp-2 VERSION 0.0.1)
+project(image-gp-2 VERSION 0.0.2)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
@@ -8,16 +8,17 @@ option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
set(CMAKE_CXX_STANDARD 17)
add_subdirectory(lib/blt-with-graphics)
+add_subdirectory(lib/blt-gp)
include_directories(include/)
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
add_executable(image-gp-2 ${PROJECT_BUILD_FILES})
-target_compile_options(image-gp-2 PRIVATE -Wall -Wextra -Weverything -Wpedantic -Wno-comment)
-target_link_options(image-gp-2 PRIVATE -Wall -Wextra -Weverything -Wpedantic -Wno-comment)
+target_compile_options(image-gp-2 PRIVATE -Wall -Wextra -Wpedantic -Wno-comment)
+target_link_options(image-gp-2 PRIVATE -Wall -Wextra -Wpedantic -Wno-comment)
-target_link_libraries(image-gp-2 PRIVATE BLT_WITH_GRAPHICS)
+target_link_libraries(image-gp-2 PRIVATE BLT_WITH_GRAPHICS blt-gp)
if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(image-gp-2 PRIVATE -fsanitize=address)
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..28b1fea
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,55 @@
+{ pkgs ? (import {
+ config.allowUnfree = true;
+ config.segger-jlink.acceptLicense = true;
+}), customPkgs ? (import /home/brett/my-nixpkgs {
+ config.allowUnfree = true;
+ config.segger-jlink.acceptLicense = true;
+}), ... }:
+pkgs.mkShell
+{
+ buildInputs = with pkgs; [
+ cmake
+ gcc
+ clang
+ emscripten
+ ninja
+ customPkgs.jetbrains.clion
+ #clion = import ~/my-nixpkgs/pkgs/applications/editors/jetbrains {};
+ renderdoc
+ valgrind
+ ];
+ propagatedBuildInputs = with pkgs; [
+ xorg.libX11
+ xorg.libX11.dev
+ xorg.libXcursor
+ xorg.libXcursor.dev
+ xorg.libXext
+ xorg.libXext.dev
+ xorg.libXinerama
+ xorg.libXinerama.dev
+ xorg.libXrandr
+ xorg.libXrandr.dev
+ xorg.libXrender
+ xorg.libXrender.dev
+ xorg.libxcb
+ xorg.libxcb.dev
+ xorg.libXi
+ xorg.libXi.dev
+ harfbuzz
+ harfbuzz.dev
+ zlib
+ zlib.dev
+ bzip2
+ bzip2.dev
+ pngpp
+ brotli
+ brotli.dev
+ pulseaudio.dev
+ git
+ libGL
+ libGL.dev
+ glfw
+ opencv
+ ];
+ LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib";
+}
diff --git a/include/operations.h b/include/operations.h
new file mode 100644
index 0000000..7f44fb6
--- /dev/null
+++ b/include/operations.h
@@ -0,0 +1,63 @@
+#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 .
+ */
+
+#include
+
+#ifndef OPERATIONS_H
+#define OPERATIONS_H
+
+template
+auto& make_add()
+{
+ static blt::gp::operation_t add{
+ [](const T a, const T b) -> T {
+ return a + b;
+ },
+ "add"
+ };
+ return add;
+}
+
+template
+auto& make_sub()
+{
+ static blt::gp::operation_t sub([](const T a, const T b) -> T {
+ return a - b;
+ }, "sub");
+ return sub;
+}
+
+template
+auto& make_mul()
+{
+ static blt::gp::operation_t mul([](const T a, const T b) -> T {
+ return a * b;
+ }, "mul");
+ return mul;
+}
+
+template
+auto& make_prot_div()
+{
+ static blt::gp::operation_t pro_div([](const T a, const T b) -> T {
+ return b == static_cast(0) ? static_cast(0) : a / b;
+ }, "div");
+ return pro_div;
+}
+
+#endif //OPERATIONS_H
diff --git a/lib/blt-gp b/lib/blt-gp
new file mode 160000
index 0000000..88957ce
--- /dev/null
+++ b/lib/blt-gp
@@ -0,0 +1 @@
+Subproject commit 88957ce8056f48aa451f8ff93c532c20759d9792
diff --git a/src/main.cpp b/src/main.cpp
index 6f2b004..046a37e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,43 @@
#include
+#include
+#include
+#include
+
+using namespace blt;
+
+gp::gp_program program{
+ []() {
+ return std::random_device()();
+ }
+};
+
+void setup_operations()
+{
+ static gp::operation_t op_sin([](const float a) {
+ return std::sin(a);
+ }, "sin");
+ static gp::operation_t op_cos([](const float a) {
+ return std::cos(a);
+ }, "cos");
+ static gp::operation_t op_exp([](const float a) {
+ return std::exp(a);
+ }, "exp");
+ static gp::operation_t op_log([](const float a) {
+ return a <= 0.0f ? 0.0f : std::log(a);
+ }, "log");
+ static auto lit = gp::operation_t([this]() {
+ return program.get_random().get_float(-1.0f, 1.0f);
+ }, "lit").set_ephemeral();
+
+ // static gp:: operation_t op_x([](const context& context)
+ // {
+ // return context.x;
+ // }, "x");
+
+ gp::operator_builder builder{};
+ builder.build(make_add(), make_sub(), make_mul(), make_prot_div(), op_sin, op_cos, op_exp, op_log, lit);
+ program.set_operations(builder.grab());
+}
int main()
-{
- std::cout << "Hello World!" << std::endl;
-}
+{}