diff --git a/SpecProject/CMakeLists.txt b/SpecProject/CMakeLists.txt index a2e1374..457621e 100644 --- a/SpecProject/CMakeLists.txt +++ b/SpecProject/CMakeLists.txt @@ -12,9 +12,10 @@ 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 dir after the PATHS keyword -find_package(Specter REQUIRED PATHS ../lib) +#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) @@ -23,7 +24,7 @@ target_include_directories(SpecProject PUBLIC ) target_sources(SpecProject PRIVATE - ./src/main.cpp + ./src/SPSApp.cpp ./src/MassMap.cpp ./src/MassMap.h ./src/SPSAnalysisStage.cpp @@ -37,9 +38,17 @@ target_link_libraries(SpecProject PRIVATE Specter::Specter) set_target_properties(SpecProject PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SPECPROJECT_BINARY_DIR}) if(NOT EXISTS "${SPECPROJECT_BINARY_DIR}/Assets") - add_custom_command(TARGET SpecProject - POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink - ${CMAKE_CURRENT_SOURCE_DIR}/Assets - ${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 + ${CMAKE_CURRENT_SOURCE_DIR}/Assets + ${SPECPROJECT_BINARY_DIR}/Assets + ) + endif() endif() diff --git a/SpecProject/imgui_log.txt b/SpecProject/imgui_log.txt new file mode 100644 index 0000000..c9370eb --- /dev/null +++ b/SpecProject/imgui_log.txt @@ -0,0 +1,9 @@ +(?) +[ Copy "Hello, world!" to clipboard ] +### Window options ### +### Widgets ### +### Layout & Scrolling ### +### Popups & Modal windows ### +### Tables & Columns ### +### Filtering ### +### Inputs, Navigation & Focus ### diff --git a/SpecProject/src/SPSApp.cpp b/SpecProject/src/SPSApp.cpp new file mode 100644 index 0000000..dc632d9 --- /dev/null +++ b/SpecProject/src/SPSApp.cpp @@ -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); } \ No newline at end of file diff --git a/SpecProject/src/main.cpp b/SpecProject/src/main.cpp deleted file mode 100644 index 8fa06a0..0000000 --- a/SpecProject/src/main.cpp +++ /dev/null @@ -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 - -//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(); -} \ No newline at end of file diff --git a/Specter/src/CMakeLists.txt b/Specter/src/CMakeLists.txt index 98132a0..3c579cf 100644 --- a/Specter/src/CMakeLists.txt +++ b/Specter/src/CMakeLists.txt @@ -124,6 +124,7 @@ target_sources(Specter PRIVATE Specter/Utils/Functions.cpp Specter/Utils/RandomGenerator.h Specter/Utils/ThreadSafeQueue.h + Specter/Core/EntryPoint.h ) #ImPlot sources diff --git a/Specter/src/Specter/Core/EntryPoint.h b/Specter/src/Specter/Core/EntryPoint.h new file mode 100644 index 0000000..f744722 --- /dev/null +++ b/Specter/src/Specter/Core/EntryPoint.h @@ -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 \ No newline at end of file