diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3bcdb52 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.16) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_POSITION_INDEPENDENT_CODE On) + +if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_BUILD_TYPE "Release") + message("Building release") +else() + message("Building debug") +endif() + +project(EventBuilder_Skeleton) + +find_package(ROOT REQUIRED COMPONENTS Gui) + +set(EVB_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bin) +set(EVB_LIBRARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib) + +add_subdirectory(src) \ No newline at end of file diff --git a/premake5.lua b/premake5.lua deleted file mode 100644 index 7fe2348..0000000 --- a/premake5.lua +++ /dev/null @@ -1,217 +0,0 @@ -workspace "EVB" - architecture "x64" - configurations { - "Release", - "Debug" - } - -ROOTIncludeDir = "/usr/include/root/" -ROOTLibDir = "/usr/lib64/root/" - -project "EVBDict" - kind "SharedLib" - language "C++" - cppdialect "c++11" - targetdir "./lib/" - objdir "./objs/" - - prebuildcommands { - "rootcint -f src/evbdict/evb_dict.cxx src/evbdict/DataStructs.h src/evbdict/LinkDef_evb.h", - "{COPY} src/evbdict/*.pcm ./lib/" - } - - postbuildcommands { - "{COPY} src/evbdict/DataStructs.h ./include/" - } - - files { - "src/evbdict/DataStructs.h", - "src/evbdict/*.cpp", - "src/evbdict/*.cxx" - } - - includedirs { - "./", - "src/evbdict", - } - - sysincludedirs { - ROOTIncludeDir - } - - libdirs { - ROOTLibDir - } - - links { - "Gui", "Core", "Imt", "RIO", "Net", "Hist", - "Graf", "Graf3d", "Gpad", "ROOTDataFrame", "ROOTVecOps", - "Tree", "TreePlayer", "Rint", "Postscript", "Matrix", - "Physics", "MathCore", "Thread", "MultiProc", "m", "dl" - } - - filter "system:macosx or linux" - linkoptions { - "-pthread", - "-rdynamic" - } - - filter "configurations:Debug" - symbols "On" - - filter "configurations:Release" - optimize "On" - -project "EventBuilderCore" - kind "StaticLib" - language "C++" - cppdialect "c++11" - targetdir "./lib/" - objdir "./objs/" - pchheader "EventBuilder.h" - pchsource "./src/EventBuilder.cpp" - - files { - "src/evbdict/DataStructs.h", - "src/evb/*.cpp", - "src/evb/*.h" - } - - defines "ETC_DIR_PATH=\"./etc/\"" - - includedirs { - "./", - "src/", - "vendor/spdlog/include", - "src/evb", - "src/evbdict", - "src/guidict" - } - - sysincludedirs { - ROOTIncludeDir - } - - libdirs { - ROOTLibDir, - } - - links { - "EVBDict", "Gui", "Core", "Imt", "RIO", "Net", "Hist", - "Graf", "Graf3d", "Gpad", "ROOTDataFrame", "ROOTVecOps", - "Tree", "TreePlayer", "Rint", "Postscript", "Matrix", - "Physics", "MathCore", "Thread", "MultiProc", "m", "dl" - } - - filter "system:macosx or linux" - linkoptions { - "-pthread", - "-rdynamic" - } - - filter "configurations:Debug" - symbols "On" - - filter "configurations:Release" - optimize "On" - -project "EventBuilderGui" - kind "ConsoleApp" - language "C++" - cppdialect "c++11" - targetdir "./bin/" - objdir "./objs/" - - prebuildcommands { - "rootcint -f src/guidict/gui_dict.cxx src/guidict/EVBMainFrame.h src/guidict/FileViewFrame.h src/guidict/LinkDef_Gui.h", - "{COPY} src/guidict/*.pcm ./bin/" - } - - files { - "src/guidict/FileViewFrame.h", - "src/guidict/EVBMainFrame.h", - "src/guidict/*.cpp", - "src/guidict/gui_dict.cxx", - "src/gui_main.cpp" - } - - includedirs { - "./", - "vendor/spdlog/include", - "src/evb", - "src/evbdict", - "src/guidict" - } - - sysincludedirs { - ROOTIncludeDir - } - - libdirs { - ROOTLibDir, - } - - links { - "EventBuilderCore", "EVBDict", "Gui", "Core", "Imt", "RIO", "Net", "Hist", - "Graf", "Graf3d", "Gpad", "ROOTDataFrame", "ROOTVecOps", - "Tree", "TreePlayer", "Rint", "Postscript", "Matrix", - "Physics", "MathCore", "Thread", "MultiProc", "m", "dl" - } - - filter "system:macosx or linux" - linkoptions { - "-pthread", - "-rdynamic" - } - - filter "configurations:Debug" - symbols "On" - - filter "configurations:Release" - optimize "On" - -project "EventBuilder" - kind "ConsoleApp" - language "C++" - cppdialect "c++11" - targetdir "./bin/" - objdir "./objs/" - - files { - "src/main.cpp" - } - - includedirs { - "src/", - "vendor/spdlog/include", - "src/evb", - "src/evbdict", - "src/guidict" - } - - sysincludedirs { - ROOTIncludeDir - } - - libdirs { - ROOTLibDir, - } - - links { - "EventBuilderCore", "EVBDict", "Gui", "Core", "Imt", "RIO", "Net", "Hist", - "Graf", "Graf3d", "Gpad", "ROOTDataFrame", "ROOTVecOps", - "Tree", "TreePlayer", "Rint", "Postscript", "Matrix", - "Physics", "MathCore", "Thread", "MultiProc", "m", "dl" - } - - filter "system:macosx or linux" - linkoptions { - "-pthread", - "-rdynamic" - } - - filter "configurations:Debug" - symbols "On" - - filter "configurations:Release" - optimize "On" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..c3a7cf1 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,25 @@ +add_subdirectory(evbdict) +add_subdirectory(guidict) +add_subdirectory(evb) + + +add_executable(EventBuilder) +target_include_directories(EventBuilder SYSTEM PUBLIC ../vendor/spdlog/include ${ROOT_INCLUDE_DIRS} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_sources(EventBuilder PRIVATE main.cpp) +target_link_libraries(EventBuilder + EVBDict + EventBuilderCore + ${ROOT_LIBRARIES} +) +set_target_properties(EventBuilder PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${EVB_BINARY_DIR}) + +add_executable(EventBuilderGui) +target_include_directories(EventBuilderGui SYSTEM PUBLIC ../vendor/spdlog/include ${ROOT_INCLUDE_DIRS} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_sources(EventBuilderGui PRIVATE gui_main.cpp) +target_link_libraries(EventBuilderGui + EVBDict + GuiDict + EventBuilderCore + ${ROOT_LIBRARIES} +) +set_target_properties(EventBuilderGui PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${EVB_BINARY_DIR}) \ No newline at end of file diff --git a/src/evb/CMakeLists.txt b/src/evb/CMakeLists.txt new file mode 100644 index 0000000..78386dc --- /dev/null +++ b/src/evb/CMakeLists.txt @@ -0,0 +1,38 @@ +add_library(EventBuilderCore STATIC) +target_include_directories(EventBuilderCore SYSTEM PUBLIC ../../vendor/spdlog/include ${ROOT_INCLUDE_DIRS} + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ +) + +target_precompile_headers(EventBuilderCore PRIVATE ../EventBuilder.h) + +target_sources(EventBuilderCore PRIVATE + CompassRun.h + FlagHandler.cpp + Stopwatch.cpp + FlagHandler.h + OrderChecker.cpp + Stopwatch.h + OrderChecker.h + CompassFile.cpp + EVBApp.cpp + ProgressCallback.h + ShiftMap.cpp + CompassFile.h + EVBApp.h + Logger.cpp + RunCollector.cpp + ShiftMap.h + CompassHit.h + Logger.h + RunCollector.h + SlowSort.cpp + CompassRun.cpp + SlowSort.h +) + +target_link_libraries(EventBuilderCore PUBLIC + EVBDict + ${ROOT_LIBRARIES} +) + +set_target_properties(EventBuilderCore PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${EVB_LIBRARY_DIR}) \ No newline at end of file diff --git a/src/evb/EVBApp.cpp b/src/evb/EVBApp.cpp index 3704673..1925863 100644 --- a/src/evb/EVBApp.cpp +++ b/src/evb/EVBApp.cpp @@ -119,6 +119,8 @@ namespace EventBuilder { converter.SetScalerInput(m_scalerfile); converter.SetProgressCallbackFunc(m_progressCallback); converter.SetProgressFraction(m_progressFraction); + + int result; EVB_INFO("Beginning conversion..."); for(int i=m_rmin; i<=m_rmax; i++) @@ -132,9 +134,9 @@ namespace EventBuilder { unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir; wipe_command = "rm -r "+unpack_dir+"*.BIN"; - system(unpack_command.c_str()); + result = system(unpack_command.c_str()); converter.Convert2RawRoot(rawfile); - system(wipe_command.c_str()); + result = system(wipe_command.c_str()); } EVB_INFO("Conversion complete."); @@ -176,6 +178,7 @@ namespace EventBuilder { converter.SetProgressCallbackFunc(m_progressCallback); converter.SetProgressFraction(m_progressFraction); + int result; EVB_INFO("Beginning conversion..."); int count=0; @@ -191,9 +194,9 @@ namespace EventBuilder { unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir; wipe_command = "rm -r "+unpack_dir+"*.BIN"; - system(unpack_command.c_str()); + result = system(unpack_command.c_str()); converter.Convert2SortedRoot(sortfile, m_SlowWindow); - system(wipe_command.c_str()); + result = system(wipe_command.c_str()); count++; } if(count==0) diff --git a/src/evbdict/CMakeLists.txt b/src/evbdict/CMakeLists.txt new file mode 100644 index 0000000..b7fac64 --- /dev/null +++ b/src/evbdict/CMakeLists.txt @@ -0,0 +1,17 @@ +add_library(EVBDict SHARED) + +target_include_directories(EVBDict SYSTEM PUBLIC ${ROOT_INCLUDE_DIRS} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +ROOT_GENERATE_DICTIONARY(evbdict DataStructs.h LINKDEF LinkDef_evb.h MODULE EVBDict) + +target_sources(EVBDict PRIVATE + DataStructs.h + DataStructs.cpp +) +target_link_libraries(EVBDict ${ROOT_LIBRARIES}) +set_target_properties(EVBDict PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${EVB_LIBRARY_DIR}) + +add_custom_command(TARGET EVBDict POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/libEVBDict_rdict.pcm + ${EVB_LIBRARY_DIR}/libEVBDict_rdict.pcm +) \ No newline at end of file diff --git a/src/guidict/CMakeLists.txt b/src/guidict/CMakeLists.txt new file mode 100644 index 0000000..f434e36 --- /dev/null +++ b/src/guidict/CMakeLists.txt @@ -0,0 +1,23 @@ +add_library(GuiDict SHARED) + +target_include_directories(GuiDict SYSTEM PUBLIC ../../vendor/spdlog/include/ ${ROOT_INCLUDE_DIRS} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +ROOT_GENERATE_DICTIONARY(guidict EVBMainFrame.h FileViewFrame.h LINKDEF LinkDef_Gui.h MODULE GuiDict) + +target_sources(GuiDict PRIVATE + FileViewFrame.h + FileViewFrame.cpp + EVBMainFrame.h + EVBMainFrame.cpp +) +target_link_libraries(GuiDict + EVBDict + EventBuilderCore + ${ROOT_LIBRARIES} +) +set_target_properties(GuiDict PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${EVB_LIBRARY_DIR}) + +add_custom_command(TARGET GuiDict POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/libGuiDict_rdict.pcm + ${EVB_LIBRARY_DIR}/libGuiDict_rdict.pcm +) \ No newline at end of file