diff --git a/AculCalib/CMakeLists.txt b/AculCalib/CMakeLists.txt index 8264c513583d8e62954e99cdb97948522e646da7..b8602ca6a737ea3b0d5ab9b5fcdcf4beac520325 100644 --- a/AculCalib/CMakeLists.txt +++ b/AculCalib/CMakeLists.txt @@ -28,4 +28,9 @@ ROOT_STANDARD_LIBRARY_PACKAGE(AculCalib AculCalibLinkDef.h ) -ROOT_ADD_TEST_SUBDIRECTORY(test) \ No newline at end of file +# ROOT_ADD_TEST_SUBDIRECTORY(test) + +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/G__AculCalib.cxx DESTINATION ${CMAKE_BINARY_DIR}/include) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libAculCalib.rootmap DESTINATION ${CMAKE_BINARY_DIR}/lib) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libAculCalib_rdict.pcm DESTINATION ${CMAKE_BINARY_DIR}/lib) +install(TARGETS AculCalib LIBRARY DESTINATION ${CMAKE_BINARY_DIR}/lib ARCHIVE DESTINATION ${CMAKE_BINARY_DIR}/lib) \ No newline at end of file diff --git a/AculData/CMakeLists.txt b/AculData/CMakeLists.txt index b47d0c235e188347c42b84d38ac45a9089faa16f..905f0aa7c517d19e48cf90f54aac5e31b383f2a1 100644 --- a/AculData/CMakeLists.txt +++ b/AculData/CMakeLists.txt @@ -17,4 +17,9 @@ ROOT_STANDARD_LIBRARY_PACKAGE(AculData AculDataLinkDef.h ) -ROOT_ADD_TEST_SUBDIRECTORY(test) \ No newline at end of file +# ROOT_ADD_TEST_SUBDIRECTORY(test) + +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/G__AculData.cxx DESTINATION ${CMAKE_BINARY_DIR}/include) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libAculData.rootmap DESTINATION ${CMAKE_BINARY_DIR}/lib) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libAculData_rdict.pcm DESTINATION ${CMAKE_BINARY_DIR}/lib) +install(TARGETS AculData LIBRARY DESTINATION ${CMAKE_BINARY_DIR}/lib ARCHIVE DESTINATION ${CMAKE_BINARY_DIR}/lib) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b2e6407dc84ed4b9696a2427230dd2528148336..1f2ada667b0d1c2a1ab28ea013a4e4610379e909 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,10 +4,42 @@ project(AculUtils) # Find ROOT package find_package(ROOT REQUIRED) +# Set installation prefix +# set(CMAKE_INSTALL_PREFIX "..") + +# Set output directories for built targets +# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +message(STATUS "CMAKE_LIBRARY_OUTPUT_DIRECTORY is: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") + + +# file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # prevent mkdir races +# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +# set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# message(STATUS "ROOT Configuration \n +# System ${CMAKE_SYSTEM} +# Processor ${PROCESSOR} (${CMAKE_SYSTEM_PROCESSOR}) +# Build type ${CMAKE_BUILD_TYPE} +# Install path ${CMAKE_INSTALL_PREFIX} +# Compiler ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} +# Compiler flags: +# C ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${_BUILD_TYPE_UPPER}} +# C++ ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_BUILD_TYPE_UPPER}} +# Linker flags: +# Executable ${CMAKE_EXE_LINKER_FLAGS} +# Module ${CMAKE_MODULE_LINKER_FLAGS} +# Shared ${CMAKE_SHARED_LINKER_FLAGS}\n") + # Add include directories for ROOT include_directories(${ROOT_INCLUDE_DIRS}) # Print the value of ROOT_INCLUDE_DIRS message(STATUS "ROOT include directories: ${ROOT_INCLUDE_DIRS}") +message(STATUS "ROOT_GET_INSTALL_DIR: ${ROOT_GET_INSTALL_DIR}") +# ROOT_GET_INSTALL_DIR +ROOT_GET_INSTALL_DIR(shared_lib_install_dir) # Add the subdirectories add_subdirectory(TELoss) @@ -15,13 +47,22 @@ add_subdirectory(AculCalib) add_subdirectory(AculData) add_subdirectory(Utilities) + +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/G__AculData.cxx DESTINATION include) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libAculData.rootmap DESTINATION lib) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libAculData_rdict.pcm DESTINATION lib) +# install(TARGETS AculData LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + + # Set the output directory for the dictionary files -set(GEN_DICT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) +# set(GEN_DICT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) +# set(GEN_DICT_OUTPUT_DIR ${CMAKE_BINARY_DIR}) +message(STATUS "GEN_DICT_OUTPUT_DIR: ${GEN_DICT_OUTPUT_DIR}") message(STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}") message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") message(STATUS "GEN_DICT_OUTPUT_DIR: ${GEN_DICT_OUTPUT_DIR}") message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") -# add_custom_target(clean_all -# COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/* -# ) \ No newline at end of file +# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +# message(STATUS "CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") +# message(STATUS "shared_lib_install_dir: ${shared_lib_install_dir}") \ No newline at end of file diff --git a/README b/README index 55de3b8d0b7802caff590afae6b5b03929f19567..9fccaa3ffbe27c6eb50bcf692cc3826c2af6fb0b 100755 --- a/README +++ b/README @@ -22,12 +22,14 @@ II. Use with cmake 3) cmake .. -4) make +4) make install III. Test of compiled libraries 1) cd macros -2) rootlogon.C script will automatically load compiled libraries libTELoss.so and libAculData.so, then +2) modify libraries paths in rootlogon.C if needed + +3) rootlogon.C will automatically load compiled libraries libTELoss.so and libAculData.so, then root -l testOfAculData.cxx root -l testOfTELoss.cxx \ No newline at end of file diff --git a/TELoss/CMakeLists.txt b/TELoss/CMakeLists.txt index 2b3f945d21fb36b69681f9b3f9d7b9c50c0341b8..1a5901245b7093c6b93120b1c6029bc345cffd5f 100644 --- a/TELoss/CMakeLists.txt +++ b/TELoss/CMakeLists.txt @@ -43,3 +43,8 @@ target_link_libraries(TELoss ${ROOT_LIBRARIES}) # Set compiler flags for Fortran source enable_language(Fortran) set_source_files_properties(${FORTRAN_SOURCES} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules) + +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/G__AculData.cxx DESTINATION ${CMAKE_BINARY_DIR}/include) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libTELoss.rootmap DESTINATION ${CMAKE_BINARY_DIR}/lib) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libTELoss_rdict.pcm DESTINATION ${CMAKE_BINARY_DIR}/lib) +install(TARGETS TELoss LIBRARY DESTINATION ${CMAKE_BINARY_DIR}/lib ARCHIVE DESTINATION ${CMAKE_BINARY_DIR}/lib) \ No newline at end of file diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index 460ad7bf4ebb16e1dc03fa53179d6e20feb4faf5..9577ac20b30a50c5df91c35e76ea5b8b141d5937 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -20,4 +20,9 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Utilities UtilitiesLinkDef.h ) -ROOT_ADD_TEST_SUBDIRECTORY(test) \ No newline at end of file +# ROOT_ADD_TEST_SUBDIRECTORY(test) + +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/G__Utilities.cxx DESTINATION ${CMAKE_BINARY_DIR}/include) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libUtilities.rootmap DESTINATION ${CMAKE_BINARY_DIR}/lib) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libUtilities_rdict.pcm DESTINATION ${CMAKE_BINARY_DIR}/lib) +install(TARGETS Utilities LIBRARY DESTINATION ${CMAKE_BINARY_DIR}/lib ARCHIVE DESTINATION ${CMAKE_BINARY_DIR}/lib) \ No newline at end of file diff --git a/macros/rootlogon.C b/macros/rootlogon.C index efd6007f3c683e8137000df0b399a282e1a7c4db..b3fe8cbd2ba373c883001f6fa8b55b71e59e1116 100644 --- a/macros/rootlogon.C +++ b/macros/rootlogon.C @@ -1,7 +1,11 @@ { + TString pathToLibs = "../build/lib/"; + // TString pathToLibs = "../"; - TString pathToTELoss = "../build/TELoss/libTELoss.so"; - TString pathToAculData = "../build/AculData/libAculData.so"; + TString pathToTELoss = pathToLibs + "libTELoss.so"; + TString pathToAculData = pathToLibs + "libAculData.so"; + TString pathToUtilities = pathToLibs + "libUtilities.so"; + TString pathToAculCalib = pathToLibs + "libAculCalib.so"; //libTELoss.so loading Int_t teloss = gSystem->Load(pathToTELoss); @@ -12,5 +16,15 @@ Int_t aculdata = gSystem->Load(pathToAculData); if (aculdata==0) Info("rootlogon.C", "Library %s was successfully loaded.", pathToAculData.Data()); else Error("rootlogon.C", "Some error with %s loading", pathToAculData.Data()); + + //libUtilities.so loading + Int_t utilities = gSystem->Load(pathToUtilities); + if (utilities==0) Info("rootlogon.C", "Library %s was successfully loaded.", pathToUtilities.Data()); + else Error("rootlogon.C", "Some error with %s loading", pathToUtilities.Data()); + + //libAculCalib.so loading + Int_t aculcalib = gSystem->Load(pathToAculCalib); + if (aculcalib==0) Info("rootlogon.C", "Library %s was successfully loaded.", pathToAculCalib.Data()); + else Error("rootlogon.C", "Some error with %s loading", pathToAculCalib.Data()); } \ No newline at end of file diff --git a/makefile b/makefile index 1b720e3e6fff607b5c0c58fae512a6fcff2e3efd..4b3720b541035912ab3bbb6deb6eae3d0c8b582f 100755 --- a/makefile +++ b/makefile @@ -86,7 +86,7 @@ $(ACULCALIB)/AculCalibDict.cpp: -@echo 'Pre-building AculCalibDict.cpp and AculCalibDict.h files' -rootcling -f $(ACULCALIB)/AculCalibDict.cpp -p $(ACULCALIB_HEADERS) -@echo 'Creating: link to AculCalibDict_rdict.pcm' - -ln -s $(ACULDATA)/AculCalibDict_rdict.pcm . + -ln -s $(ACULCALIB)/AculCalibDict_rdict.pcm . -@echo ' ' $(TELOSS)/TELossDict.cpp: