1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-11-22 18:28:52 -05:00

Compare commits

...

5 Commits

11 changed files with 181 additions and 95 deletions

View File

@ -11,12 +11,6 @@ endif()
project(Specter) project(Specter)
option(BUILD_SPECPROJECT "Build SpecProject template" Off) set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})
set(SPECTER_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(SPECTER_LIBRARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib)
add_subdirectory(Specter) add_subdirectory(Specter)
if(BUILD_SPECPROJECT)
add_subdirectory(SpecProject)
endif()

View File

@ -4,8 +4,7 @@ Specter is a cross-platform Dear ImGui/ImPlot based data visualization tool desi
spectra, applying cuts and gates graphically to spectra, and has a customizable analysis system. Specter is focused on providing a clean, pretty UI with good performance required by demainding experimental setups. spectra, applying cuts and gates graphically to spectra, and has a customizable analysis system. Specter is focused on providing a clean, pretty UI with good performance required by demainding experimental setups.
The only external dependencies are OpenGL development headers, as OpenGL is the rendering API, and the The only external dependencies are OpenGL development headers, as OpenGL is the rendering API, and the
C++20 standard library. All other dependencies are included as git submodules in the vendor directory. The current state of the library is such that the only readily developed C++20 standard library. All other dependencies are included as git submodules in the vendor directory.
data source type is for CAEN's CoMPASS DAQ for use with their digitizer modules. There are tentative plans to extend the sources to other DAQ frameworks.
This project would not be possible with out the amazing online tutorials of [@TheCherno](https://github.com/TheCherno) and in particular his Hazel tutorials, which much of the application model and basically This project would not be possible with out the amazing online tutorials of [@TheCherno](https://github.com/TheCherno) and in particular his Hazel tutorials, which much of the application model and basically
all of the renderer is based off of ([Hazel](https://github.com/TheCherno/Hazel)). I highly recommend checking out his work to anyone who is interested in projects like this, or just learning more about C++. all of the renderer is based off of ([Hazel](https://github.com/TheCherno/Hazel)). I highly recommend checking out his work to anyone who is interested in projects like this, or just learning more about C++.
@ -20,11 +19,12 @@ Specter should be cloned from github using `git clone --recursive https://github
Specter uses CMake as its build system. If you are unfamiliar with CMake, building Specter is very straightforward. From within the Specter repository run the following commands: Specter uses CMake as its build system. If you are unfamiliar with CMake, building Specter is very straightforward. From within the Specter repository run the following commands:
- `mkdir build` - `mkdir build`
- `cd build && cmake .. && make -j 4 && cd ..` - `cd build && cmake .. && make -j 4 && make install`
By default, only the static library Specter is built. If you want to build the example project (SpecProject) as well, replace the previous CMake command with: This builds and installs the Specter library. By default, Specter is installed into the local repository in the lib directory. If you want to install Specter along global resource paths, you will need to modify
the Specter CMakeLists.txt.
- `cd build && cmake -DBUILD_SPECPROJECT=On .. && make -j 4 && cd ..` See the SpecProject README for information on how to build the example project (and link Specter to a user made project).
Note: On Linux distributions, typically Mesa OpenGL and X-window related header files are not installed by default. These can be installed using whatever package manager your distribution uses. Note: On Linux distributions, typically Mesa OpenGL and X-window related header files are not installed by default. These can be installed using whatever package manager your distribution uses.
For example, on Debian family distributions the necessary files can be installed using `sudo apt install libgl1 libgl1-mesa-dev libglu1-mesa libglu1-mesa-dev xorg-dev mesa-utils` which should fill out all of the For example, on Debian family distributions the necessary files can be installed using `sudo apt install libgl1 libgl1-mesa-dev libglu1-mesa libglu1-mesa-dev xorg-dev mesa-utils` which should fill out all of the
@ -32,10 +32,8 @@ dependencies. If this doesn't seem to work, check your distribution related docu
## Using Specter ## Using Specter
Specter is simply a library framework for making a GUI data analysis program. In the Specter repository there is an example of a project using Specter (SpecProject) designed around the SESPS analysis pipeline at Specter is simply a library framework for making a GUI data analysis program. In the Specter repository there is an example of a project using Specter (SpecProject) designed around the SESPS analysis pipeline at
Florida State University. This can be used as a template from which more complex projects can be built. Typically, one would install Specter, and then create a separate project for the actual program. To link Specter Florida State University. This can be used as a template from which more complex projects can be built. Typically, one would install Specter, and then create a separate project for the actual program. To link Specter using
and all the necessary include paths and library paths, add the Specter repository as a subdirectory to your CMake project and add Specter as a library to link to your project executable. CMake, one can use the `find_package()` command. If the standard install is run, you will also need to pass the `PATHS <your_path_to_Specter>` argument to the `find_package()` command. See SpecProject README and CMakeLists for more details.
If one wants to build the example project, set the CMake option BUILD_SPECPROJECT to On when running CMake for Specter. Otherwise, only the Specter library will be built.
Note that your project will need to copy the Assets folder (located in SpecProject) to the runtime location of your project executable. Note that your project will need to copy the Assets folder (located in SpecProject) to the runtime location of your project executable.

View File

@ -1,20 +1,30 @@
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 20)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_BUILD_TYPE "Debug")
message("Building debug")
else()
message("Building release")
endif()
project(SpecProject)
set(SPECPROJECT_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../bin)
set(SPECTER_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../lib/cmake)
#Use this to find Specter and its libraries. Specify the path to the Specter/lib & Specter/lib/cmake dir after the PATHS keyword (handles windows/linux usecases)
find_package(Specter REQUIRED PATHS ../lib ../lib/cmake)
add_executable(SpecProject) add_executable(SpecProject)
target_include_directories(SpecProject target_include_directories(SpecProject PUBLIC
SYSTEM PUBLIC ../Specter/vendor/asio/asio/include
PUBLIC ../Specter/vendor/imgui
../Specter/vendor/implot
../Specter/vendor/glad/include
../Specter/vendor/glfw/include
../Specter/vendor/glm
../Specter/vendor/IconFontCppHeaders
../Specter/vendor/spdlog/include
../Specter/src/
./src ./src
) )
target_sources(SpecProject PRIVATE target_sources(SpecProject PRIVATE
./src/main.cpp ./src/SPSApp.cpp
./src/MassMap.cpp ./src/MassMap.cpp
./src/MassMap.h ./src/MassMap.h
./src/SPSAnalysisStage.cpp ./src/SPSAnalysisStage.cpp
@ -23,12 +33,22 @@ target_sources(SpecProject PRIVATE
./src/SPSInputLayer.h ./src/SPSInputLayer.h
) )
target_link_libraries(SpecProject PRIVATE Specter) target_link_libraries(SpecProject PRIVATE Specter::Specter)
set_target_properties(SpecProject PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SPECTER_BINARY_DIR}) set_target_properties(SpecProject PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SPECPROJECT_BINARY_DIR})
add_custom_command(TARGET SpecProject if(NOT EXISTS "${SPECPROJECT_BINARY_DIR}/Assets")
if(MSVC)
add_custom_command(TARGET SpecProject
POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/Assets
${SPECPROJECT_BINARY_DIR}/Assets
)
else()
add_custom_command(TARGET SpecProject
POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_SOURCE_DIR}/Assets ${CMAKE_CURRENT_SOURCE_DIR}/Assets
${SPECTER_BINARY_DIR}/Assets ${SPECPROJECT_BINARY_DIR}/Assets
) )
endif()
endif()

11
SpecProject/README.md Normal file
View File

@ -0,0 +1,11 @@
# Example Project: SpecProject
SpecProject is an example project for use with Specter. It contains examples for making an analysis pipeline, extending the UI, and creating the executable entry point.
It also has an example CMakeLists.txt which demonstrates how to link a custom project to Specter.
## Building SpecProject
In this directory (the SpecProject directory) run the following commands:
- `mkdir build`
- `cd build && cmake .. && make -j 4`
This will build the SpecProject executable and install it to the Specter/bin directory. The executable should be run from the Specter/bin directory.

View File

@ -0,0 +1,9 @@
(?)
[ Copy "Hello, world!" to clipboard ]
### Window options ###
### Widgets ###
### Layout & Scrolling ###
### Popups & Modal windows ###
### Tables & Columns ###
### Filtering ###
### Inputs, Navigation & Focus ###

View File

@ -0,0 +1,29 @@
/*
main.cpp
Entry point for the example SpecProject. Also contains example of a simple user Specter::Application.
GWM -- Feb 2022
*/
#include "Specter.h"
#include "SPSAnalysisStage.h"
#include "SPSInputLayer.h"
//Including this inserts the predefined main function for Specter projects
//Can only be included once per project!
#include "Specter/Core/EntryPoint.h"
//User application class. Pushes user analysis stages.
class SPSApp : public Specter::Application
{
public:
SPSApp(const Specter::ApplicationArgs& args) :
Specter::Application(args)
{
PushLayer(new Specter::SPSInputLayer(m_manager));
//PushLayer(new Navigator::TestServerLayer());
PushAnalysisStage(new Specter::SPSAnalysisStage(m_manager));
}
};
//Define the creation function to make our user application
Specter::Application* Specter::CreateApplication(const ApplicationArgs& args) { return new SPSApp(args); }

View File

@ -1,49 +0,0 @@
/*
main.cpp
Entry point for the example NavProject. Also contains example of a simple user Navigator::Application.
GWM -- Feb 2022
*/
#include "Specter.h"
#include "SPSAnalysisStage.h"
#include "SPSInputLayer.h"
#include <filesystem>
//User application class. Pushes user analysis stages.
class SPSApp : public Specter::Application
{
public:
SPSApp(const Specter::ApplicationArgs& args) :
Specter::Application(args)
{
PushLayer(new Specter::SPSInputLayer(m_manager));
//PushLayer(new Navigator::TestServerLayer());
PushAnalysisStage(new Specter::SPSAnalysisStage(m_manager));
}
};
//Define the creation function to make our user application
Specter::Application* Specter::CreateApplication(const ApplicationArgs& args) { return new SPSApp(args); }
//Make sure to initialize log BEFORE creating application.
int main(int argc, const char** argv)
{
Specter::Logger::Init();
SPEC_INFO("Logger Initialized");
Specter::ApplicationArgs args;
args.name = "SPS Specter";
args.runtimePath = std::filesystem::current_path();
SPEC_PROFILE_BEGIN_SESSION("Startup", "navprofile_startup.json");
auto app = Specter::CreateApplication(args);
SPEC_PROFILE_END_SESSION();
SPEC_PROFILE_BEGIN_SESSION("Runtime", "navprofile_runtime.json");
app->Run();
SPEC_PROFILE_END_SESSION();
SPEC_PROFILE_BEGIN_SESSION("Shutdown", "navprofile_shutdown.json");
delete app;
SPEC_PROFILE_END_SESSION();
}

View File

@ -1,4 +1,5 @@
add_subdirectory(vendor/glad) add_subdirectory(vendor/glad)
set(GLFW_INSTALL Off CACHE BOOL "Generate installation target" )
add_subdirectory(vendor/glfw) add_subdirectory(vendor/glfw)
add_subdirectory(vendor/imgui) add_subdirectory(vendor/imgui)

View File

@ -0,0 +1,9 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Threads)
include("${CMAKE_CURRENT_LIST_DIR}/SpecterTargets.cmake")
check_required_components(Specter)

View File

@ -1,16 +1,24 @@
add_library(Specter STATIC) add_library(Specter STATIC)
target_include_directories(Specter target_include_directories(Specter
SYSTEM PUBLIC ../vendor/asio/asio/include SYSTEM PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../vendor/asio/asio/include> $<INSTALL_INTERFACE:Specter/vendor/asio/asio/include>
PUBLIC ../vendor/imgui PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../vendor/imgui> $<INSTALL_INTERFACE:Specter/vendor/imgui>
../vendor/implot $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../vendor/implot>
../vendor/glad/include $<INSTALL_INTERFACE:Specter/vendor/implot>
../vendor/glfw/include $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../vendor/glad/include>
../vendor/glm $<INSTALL_INTERFACE:Specter/vendor/glad/include>
../vendor/IconFontCppHeaders $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../vendor/glfw/include>
../vendor/spdlog/include $<INSTALL_INTERFACE:Specter/vendor/glfw/include>
../vendor/yaml-cpp/inlcude/yaml-cpp/ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../vendor/glm>
./ $<INSTALL_INTERFACE:Specter/vendor/glm>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../vendor/IconFontCppHeaders>
$<INSTALL_INTERFACE:Specter/vendor/IconFontCppHeaders>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../vendor/spdlog/include>
$<INSTALL_INTERFACE:Specter/vendor/spdlog/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../vendor/yaml-cpp/include/yaml-cpp/>
$<INSTALL_INTERFACE:Specter/vendor/yaml-cpp/include/yaml-cpp/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/./>
$<INSTALL_INTERFACE:Specter/src/>
) )
target_precompile_headers(Specter PRIVATE specpch.h) target_precompile_headers(Specter PRIVATE specpch.h)
@ -116,6 +124,7 @@ target_sources(Specter PRIVATE
Specter/Utils/Functions.cpp Specter/Utils/Functions.cpp
Specter/Utils/RandomGenerator.h Specter/Utils/RandomGenerator.h
Specter/Utils/ThreadSafeQueue.h Specter/Utils/ThreadSafeQueue.h
Specter/Core/EntryPoint.h
) )
#ImPlot sources #ImPlot sources
@ -156,4 +165,24 @@ endif()
#Some extra defs #Some extra defs
target_compile_definitions(Specter PRIVATE GLFW_INCLUDE_NONE YAML_CPP_STATIC_DEFINE IMGUI_IMPL_OPENGL_LOADER_GLAD IMPLOT_BACKEND_ENABLE_OPENGL3) target_compile_definitions(Specter PRIVATE GLFW_INCLUDE_NONE YAML_CPP_STATIC_DEFINE IMGUI_IMPL_OPENGL_LOADER_GLAD IMPLOT_BACKEND_ENABLE_OPENGL3)
set_target_properties(Specter PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${SPECTER_LIBRARY_DIR}) #set_target_properties(Specter PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${SPECTER_LIBRARY_DIR})
install(TARGETS Specter imgui glfw glad yaml-cpp DaqGrimoire
EXPORT SpecterTargets
LIBRARY DESTINATION lib/
ARCHIVE DESTINATION lib/
RUNTIME DESTINATION bin/
)
install(EXPORT SpecterTargets
FILE SpecterTargets.cmake
NAMESPACE Specter::
DESTINATION lib/cmake/Specter
)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/SpecterConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/SpecterConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Specter
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SpecterConfig.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Specter)

View File

@ -0,0 +1,35 @@
/*
EntryPoint.h
Predefined main function for Specter-based projects. Makes it so user doesn't have to know
about initializing the Logger, Profiling sessions, etc.
*/
#ifndef ENTRY_POINT_H
#define ENTRY_POINT_H
#include "Specter/Core/Application.h"
//Make sure to initialize log BEFORE creating application.
int main(int argc, const char** argv)
{
Specter::Logger::Init();
SPEC_INFO("Logger Initialized");
Specter::ApplicationArgs args;
args.name = "Specter";
args.runtimePath = std::filesystem::current_path();
SPEC_PROFILE_BEGIN_SESSION("Startup", "navprofile_startup.json");
auto app = Specter::CreateApplication(args);
SPEC_PROFILE_END_SESSION();
SPEC_PROFILE_BEGIN_SESSION("Runtime", "navprofile_runtime.json");
app->Run();
SPEC_PROFILE_END_SESSION();
SPEC_PROFILE_BEGIN_SESSION("Shutdown", "navprofile_shutdown.json");
delete app;
SPEC_PROFILE_END_SESSION();
}
#endif