diff --git a/CMakeLists.txt b/CMakeLists.txt index 93cec82..838c590 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,22 +31,18 @@ FetchContent_Declare(clopts ) FetchContent_MakeAvailable(clopts) -# Find all the modules +message(STATUS "Looking for files") file(GLOB_RECURSE modules src/*.cppm) -# Create the executable target -add_executable(ffmpegraph) -# Main file -target_sources(ffmpegraph - PUBLIC - src/main.cpp -) -# The modules -target_sources(ffmpegraph - PUBLIC - FILE_SET CXX_MODULES FILES - ${modules} +file(GLOB_RECURSE headers src/*.hpp) +file(GLOB_RECURSE impls src/*.cpp) + +message(STATUS "Create target") +add_executable(ffmpegraph ${impls}) +target_sources(ffmpegraph PUBLIC + FILE_SET CXX_MODULES FILES ${modules} + FILE_SET HEADERS FILES ${headers} ) -#Compile flags + target_compile_options(ffmpegraph PRIVATE -Wall -Wextra # Standard screaming -Wconversion -Wsign-conversion # Scream about accidentally converting stuff @@ -55,13 +51,12 @@ target_compile_options(ffmpegraph PRIVATE $<$:-O0 -g3 -glldb> $<$:-O3 -march=native> ) -# color shit out + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options(ffmpegraph PRIVATE -fdiagnostics-color=always) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(ffmpegraph PRIVATE -fcolor-diagnostics) endif() -# Link against exernal libraries target_link_libraries(ffmpegraph PRIVATE raylib m) target_include_directories(ffmpegraph PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/libs/clopts/include") diff --git a/src/Application.cppm b/src/Application.cppm index b07a86d..6a7510c 100644 --- a/src/Application.cppm +++ b/src/Application.cppm @@ -1,6 +1,9 @@ module; +#include "macros.hpp" + #include #include +#include #include #include #include @@ -9,7 +12,6 @@ module; #include #include #include -#include export module Application; import Node; import Base; @@ -30,7 +32,7 @@ protected: void OnLeftClick(); void OnKeyPressed(i32 key); void Render(); - void ExecuteGraph(); + Result<> ExecuteGraph(); std::deque message_queue; std::string title; bool should_close; @@ -38,6 +40,14 @@ protected: Node *selected_node = nullptr; OutputPort *selected_port = nullptr; Button run_button; + enum class State { + DEFAULT, + CONNECTING, + EDITING, + ADDING, + } current_state = State::DEFAULT; + + std::vector