ROOT/심화: 두 판 사이의 차이

1,394 바이트 추가됨 ,  2023년 2월 25일 (토)
편집 요약 없음
편집 요약 없음
편집 요약 없음
15번째 줄: 15번째 줄:


TStyle* SetStyle(){// Add my own options here:
TStyle* SetStyle(){// Add my own options here:
     TStyle* mcStyle = new TStyle("AXStyle","ALPEx Style");
     TStyle* mcStyle = new TStyle("mcStyle","Style");
     Style_t font = 42;
     Style_t font = 42;
     Float_t labelfontsize = 0.02;
     Float_t labelfontsize = 0.02;
51번째 줄: 51번째 줄:
      
      


     gROOT->SetStyle("AXStyle");
     gROOT->SetStyle("mcStyle");


     const Int_t NRGBs = 5;
     const Int_t NRGBs = 5;
69번째 줄: 69번째 줄:
== Load pre-compiled library in root interpreter ==
== Load pre-compiled library in root interpreter ==
<syntaxhighlight lang="c++">
<syntaxhighlight lang="c++">
TString libFilename = "libMyLibraryName";
TString libFilename = "libMyLibName";
      
      
TString DirName = TString(gSystem->GetWorkingDirectory());
TString DirName = TString(gSystem->GetWorkingDirectory());
90번째 줄: 90번째 줄:
<syntaxhighlight lang="cmake">
<syntaxhighlight lang="cmake">
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.2)
project(myproject)
# by default build optimized code with debug symbols
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE DEBUG)
  # set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
  # set(CMAKE_BUILD_TYPE Release)
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# require C++11-capable compiler
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
    message(WARNING "Compiler with incomplete C++11 support detected: functionality limited")
    set(OLD_CXX true)
  endif()
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
  message("clang, undefined dynamic_lookup")
  set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
endif()
find_package(ROOT)
set(CMAKE_CXX_STANDARD 11)
if(ROOT_cxx17_FOUND)
  set(CMAKE_CXX_STANDARD 17)
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
elseif(ROOT_cxx14_FOUND)
  set(CMAKE_CXX_STANDARD 14)
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
elseif(ROOT_cxx11_FOUND)
  set(CMAKE_CXX_STANDARD 11)
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
message(STATUS "Using C++${CMAKE_CXX_STANDARD}")
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hpp)
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cpp)
add_library(MyLibName SHARED ${sources})
include_directories(include)
target_link_libraries(MyLibName PUBLIC ROOT::Core ROOT::Hist ROOT::Graf)
</syntaxhighlight>
</syntaxhighlight>
[[분류:작성중]]
[[분류:작성중]]