mirror of
https://github.com/sesps/EventBuilder_Skeleton.git
synced 2024-11-25 11:38:51 -05:00
Switch to cmake build system for better ROOT integration
This commit is contained in:
parent
99e82910fc
commit
898887d361
20
CMakeLists.txt
Normal file
20
CMakeLists.txt
Normal file
|
@ -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)
|
217
premake5.lua
217
premake5.lua
|
@ -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"
|
|
25
src/CMakeLists.txt
Normal file
25
src/CMakeLists.txt
Normal file
|
@ -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})
|
38
src/evb/CMakeLists.txt
Normal file
38
src/evb/CMakeLists.txt
Normal file
|
@ -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})
|
|
@ -119,6 +119,8 @@ namespace EventBuilder {
|
||||||
converter.SetScalerInput(m_scalerfile);
|
converter.SetScalerInput(m_scalerfile);
|
||||||
converter.SetProgressCallbackFunc(m_progressCallback);
|
converter.SetProgressCallbackFunc(m_progressCallback);
|
||||||
converter.SetProgressFraction(m_progressFraction);
|
converter.SetProgressFraction(m_progressFraction);
|
||||||
|
|
||||||
|
int result;
|
||||||
|
|
||||||
EVB_INFO("Beginning conversion...");
|
EVB_INFO("Beginning conversion...");
|
||||||
for(int i=m_rmin; i<=m_rmax; i++)
|
for(int i=m_rmin; i<=m_rmax; i++)
|
||||||
|
@ -132,9 +134,9 @@ namespace EventBuilder {
|
||||||
unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir;
|
unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir;
|
||||||
wipe_command = "rm -r "+unpack_dir+"*.BIN";
|
wipe_command = "rm -r "+unpack_dir+"*.BIN";
|
||||||
|
|
||||||
system(unpack_command.c_str());
|
result = system(unpack_command.c_str());
|
||||||
converter.Convert2RawRoot(rawfile);
|
converter.Convert2RawRoot(rawfile);
|
||||||
system(wipe_command.c_str());
|
result = system(wipe_command.c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
EVB_INFO("Conversion complete.");
|
EVB_INFO("Conversion complete.");
|
||||||
|
@ -176,6 +178,7 @@ namespace EventBuilder {
|
||||||
converter.SetProgressCallbackFunc(m_progressCallback);
|
converter.SetProgressCallbackFunc(m_progressCallback);
|
||||||
converter.SetProgressFraction(m_progressFraction);
|
converter.SetProgressFraction(m_progressFraction);
|
||||||
|
|
||||||
|
int result;
|
||||||
EVB_INFO("Beginning conversion...");
|
EVB_INFO("Beginning conversion...");
|
||||||
|
|
||||||
int count=0;
|
int count=0;
|
||||||
|
@ -191,9 +194,9 @@ namespace EventBuilder {
|
||||||
unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir;
|
unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir;
|
||||||
wipe_command = "rm -r "+unpack_dir+"*.BIN";
|
wipe_command = "rm -r "+unpack_dir+"*.BIN";
|
||||||
|
|
||||||
system(unpack_command.c_str());
|
result = system(unpack_command.c_str());
|
||||||
converter.Convert2SortedRoot(sortfile, m_SlowWindow);
|
converter.Convert2SortedRoot(sortfile, m_SlowWindow);
|
||||||
system(wipe_command.c_str());
|
result = system(wipe_command.c_str());
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if(count==0)
|
if(count==0)
|
||||||
|
|
17
src/evbdict/CMakeLists.txt
Normal file
17
src/evbdict/CMakeLists.txt
Normal file
|
@ -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
|
||||||
|
)
|
23
src/guidict/CMakeLists.txt
Normal file
23
src/guidict/CMakeLists.txt
Normal file
|
@ -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
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user