Commit 840bb8e1 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Installation of targets compiled by means of cmake to build.

Minor changes of MakeFile.
Test of all compiled libraries.
parent 14282d78
...@@ -28,4 +28,9 @@ ROOT_STANDARD_LIBRARY_PACKAGE(AculCalib ...@@ -28,4 +28,9 @@ ROOT_STANDARD_LIBRARY_PACKAGE(AculCalib
AculCalibLinkDef.h AculCalibLinkDef.h
) )
ROOT_ADD_TEST_SUBDIRECTORY(test) # ROOT_ADD_TEST_SUBDIRECTORY(test)
\ No newline at end of file
# 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
...@@ -17,4 +17,9 @@ ROOT_STANDARD_LIBRARY_PACKAGE(AculData ...@@ -17,4 +17,9 @@ ROOT_STANDARD_LIBRARY_PACKAGE(AculData
AculDataLinkDef.h AculDataLinkDef.h
) )
ROOT_ADD_TEST_SUBDIRECTORY(test) # ROOT_ADD_TEST_SUBDIRECTORY(test)
\ No newline at end of file
# 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
...@@ -4,10 +4,42 @@ project(AculUtils) ...@@ -4,10 +4,42 @@ project(AculUtils)
# Find ROOT package # Find ROOT package
find_package(ROOT REQUIRED) 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 # Add include directories for ROOT
include_directories(${ROOT_INCLUDE_DIRS}) include_directories(${ROOT_INCLUDE_DIRS})
# Print the value of ROOT_INCLUDE_DIRS # Print the value of ROOT_INCLUDE_DIRS
message(STATUS "ROOT include directories: ${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 the subdirectories
add_subdirectory(TELoss) add_subdirectory(TELoss)
...@@ -15,13 +47,22 @@ add_subdirectory(AculCalib) ...@@ -15,13 +47,22 @@ add_subdirectory(AculCalib)
add_subdirectory(AculData) add_subdirectory(AculData)
add_subdirectory(Utilities) 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 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_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")
message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
message(STATUS "GEN_DICT_OUTPUT_DIR: ${GEN_DICT_OUTPUT_DIR}") message(STATUS "GEN_DICT_OUTPUT_DIR: ${GEN_DICT_OUTPUT_DIR}")
message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}")
# add_custom_target(clean_all # set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/* # 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 \ No newline at end of file
...@@ -22,12 +22,14 @@ II. Use with cmake ...@@ -22,12 +22,14 @@ II. Use with cmake
3) cmake .. 3) cmake ..
4) make 4) make install
III. Test of compiled libraries III. Test of compiled libraries
1) cd macros 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 testOfAculData.cxx
root -l testOfTELoss.cxx root -l testOfTELoss.cxx
\ No newline at end of file
...@@ -43,3 +43,8 @@ target_link_libraries(TELoss ${ROOT_LIBRARIES}) ...@@ -43,3 +43,8 @@ target_link_libraries(TELoss ${ROOT_LIBRARIES})
# Set compiler flags for Fortran source # Set compiler flags for Fortran source
enable_language(Fortran) enable_language(Fortran)
set_source_files_properties(${FORTRAN_SOURCES} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules) 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
...@@ -20,4 +20,9 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Utilities ...@@ -20,4 +20,9 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Utilities
UtilitiesLinkDef.h UtilitiesLinkDef.h
) )
ROOT_ADD_TEST_SUBDIRECTORY(test) # ROOT_ADD_TEST_SUBDIRECTORY(test)
\ No newline at end of file
# 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
{ {
TString pathToLibs = "../build/lib/";
// TString pathToLibs = "../";
TString pathToTELoss = "../build/TELoss/libTELoss.so"; TString pathToTELoss = pathToLibs + "libTELoss.so";
TString pathToAculData = "../build/AculData/libAculData.so"; TString pathToAculData = pathToLibs + "libAculData.so";
TString pathToUtilities = pathToLibs + "libUtilities.so";
TString pathToAculCalib = pathToLibs + "libAculCalib.so";
//libTELoss.so loading //libTELoss.so loading
Int_t teloss = gSystem->Load(pathToTELoss); Int_t teloss = gSystem->Load(pathToTELoss);
...@@ -12,5 +16,15 @@ ...@@ -12,5 +16,15 @@
Int_t aculdata = gSystem->Load(pathToAculData); Int_t aculdata = gSystem->Load(pathToAculData);
if (aculdata==0) Info("rootlogon.C", "Library %s was successfully loaded.", pathToAculData.Data()); if (aculdata==0) Info("rootlogon.C", "Library %s was successfully loaded.", pathToAculData.Data());
else Error("rootlogon.C", "Some error with %s loading", 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
...@@ -86,7 +86,7 @@ $(ACULCALIB)/AculCalibDict.cpp: ...@@ -86,7 +86,7 @@ $(ACULCALIB)/AculCalibDict.cpp:
-@echo 'Pre-building AculCalibDict.cpp and AculCalibDict.h files' -@echo 'Pre-building AculCalibDict.cpp and AculCalibDict.h files'
-rootcling -f $(ACULCALIB)/AculCalibDict.cpp -p $(ACULCALIB_HEADERS) -rootcling -f $(ACULCALIB)/AculCalibDict.cpp -p $(ACULCALIB_HEADERS)
-@echo 'Creating: link to AculCalibDict_rdict.pcm' -@echo 'Creating: link to AculCalibDict_rdict.pcm'
-ln -s $(ACULDATA)/AculCalibDict_rdict.pcm . -ln -s $(ACULCALIB)/AculCalibDict_rdict.pcm .
-@echo ' ' -@echo ' '
$(TELOSS)/TELossDict.cpp: $(TELOSS)/TELossDict.cpp:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment