Commit be1d864c authored by Vratislav Chudoba's avatar Vratislav Chudoba

LinkDef files renamed.

Build of TELoss.so library using cmake added.
parent d0bbe594
...@@ -8,7 +8,7 @@ ACULDATALIBS := -lCore -lRIO -lTree -lNet -lThread -lHist -lMatrix -lMathCore -l ...@@ -8,7 +8,7 @@ ACULDATALIBS := -lCore -lRIO -lTree -lNet -lThread -lHist -lMatrix -lMathCore -l
ACULDATA_HEADERS += \ ACULDATA_HEADERS += \
$(ACULDATA)/AculCalibration.h \ $(ACULDATA)/AculCalibration.h \
$(ACULDATA)/AculCalibCsI.h \ $(ACULDATA)/AculCalibCsI.h \
$(ACULDATA)/linkdef.h $(ACULDATA)/AculDataLinkDef.h
ACULDATACPP_SRCS += \ ACULDATACPP_SRCS += \
$(ACULDATA)/AculCalibration.cpp \ $(ACULDATA)/AculCalibration.cpp \
......
#ifdef __CINT__ #ifdef __CLING__
#pragma link off all globals; #pragma link off all globals;
#pragma link off all classes; #pragma link off all classes;
#pragma link off all functions; #pragma link off all functions;
...@@ -9,6 +9,4 @@ ...@@ -9,6 +9,4 @@
#pragma link C++ class AculCalibCsI; #pragma link C++ class AculCalibCsI;
//#pragma link C++ class ConfigDictionary; //#pragma link C++ class ConfigDictionary;
#endif
#endif \ No newline at end of file
cmake_minimum_required(VERSION 3.0)
project(AculUtils)
# Find ROOT package
find_package(ROOT REQUIRED)
# 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 "target_link_libraries(TELoss): ${ROOT_LIBRARIES}")
# include_directories(TELoss)
# Add the TELoss directory
add_subdirectory(TELoss)
# Add the "TELoss" directory to the include path
# include_directories(TELoss)
# Add the source files
# set(SOURCES
# TELoss/TELoss.cpp
# TELoss/TELoss.h
# TELoss/linkdef.h
# )
# # Add the Fortran source file
# set(FORTRAN_SOURCES
# TELoss/ELOSS.f90
# )
# Set the output directory for the dictionary files
# set(GEN_DICT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/TELoss)
set(GEN_DICT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
message(STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")
message(STATUS "GEN_DICT_OUTPUT_DIR: ${GEN_DICT_OUTPUT_DIR}")
# Generate dictionary for TELoss class
# #working
# ROOT_GENERATE_DICTIONARY(G__TELoss ${CMAKE_CURRENT_SOURCE_DIR}/TELoss/TELoss.h
# LINKDEF TELoss/TELossLinkDef.h)
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
# ROOT_GENERATE_DICTIONARY(G__TELoss TELoss/TELoss.h LINKDEF TELoss/linkdef.h OPTIONS -I${CMAKE_CURRENT_SOURCE_DIR}/TELoss -o ${CMAKE_CURRENT_BINARY_DIR}/TELoss)
# ROOT_GENERATE_DICTIONARY(G__TELoss ${CMAKE_CURRENT_SOURCE_DIR}/TELoss/TELoss.h
# LINKDEF TELoss/TELossLinkDef.h
# OPTIONS -I${CMAKE_CURRENT_SOURCE_DIR}/TELoss -o ${GEN_DICT_OUTPUT_DIR})
# ROOT_GENERATE_DICTIONARY(G__TELoss ${CMAKE_CURRENT_SOURCE_DIR}/TELoss/TELoss.h
# # MODULE TELoss
# # LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/TELoss/TELossLinkDef.h
# LINKDEF TELoss/TELossLinkDef.h
# OPTIONS -o ${GEN_DICT_OUTPUT_DIR})
# Add the dictionary source file to the sources list
# list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/G__TELoss.cxx)
# list(APPEND SOURCES ${GEN_DICT_OUTPUT_DIR}/G__TELoss.cxx)
message(STATUS "SOURCES: ${SOURCES}")
# Add an executable target for the C++ class
# add_library(TELoss SHARED TELoss/TELoss.cpp TELoss/TELoss.h TELoss/linkdef.h TELoss/ELOSS.f90 ${GEN_DICT_OUTPUT_DIR}/G__TELoss.cxx)
#working
# add_library(TELoss SHARED TELoss/TELoss.cpp TELoss/TELoss.h TELoss/TELossLinkDef.h TELoss/ELOSS.f90 G__TELoss.cxx)
# add_library(TELoss SHARED ${SOURCES} ${FORTRAN_SOURCES})
# Link ROOT libraries
# target_link_libraries(TELoss ${ROOT_LIBRARIES})
# target_link_libraries(TELoss PUBLIC ROOT::Core)
# Set compiler flags for Fortran source
# enable_language(Fortran)
# set_source_files_properties(${FORTRAN_SOURCES} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
1) set path in makefile according to your operating system I. Use with GNU make
1) set path in makefile according to your operating system
2) type in terminal: 2) type in terminal:
...@@ -7,3 +9,13 @@ ...@@ -7,3 +9,13 @@
make install make install
3) add the install folder to LD_LIBRARY_PATH 3) add the install folder to LD_LIBRARY_PATH
II. Use with cmake (TELoss.so build only in this commit)
1) mkdir build
2) cd build
3) cmake ..
4) make
\ No newline at end of file
# CMakeLists.txt in the TELoss directory
include_directories(TELoss)
# Get the list of include directories
get_property(INCLUDE_DIRS DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
# Print the include directories
message(STATUS "Include directories: ${INCLUDE_DIRS}")
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")
# Add the source files specific to the TELoss module
set(SOURCES
TELoss.cpp
TELoss.h
TELossLinkDef.h
)
# Add the Fortran source file
set(FORTRAN_SOURCES
ELOSS.f90
)
# Generate dictionary for TELoss class
ROOT_GENERATE_DICTIONARY(G__TELoss ${CMAKE_CURRENT_SOURCE_DIR}/TELoss.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/TELossLinkDef.h)
#working
# ROOT_GENERATE_DICTIONARY(G__TELoss ${CMAKE_CURRENT_SOURCE_DIR}/TELoss/TELoss.h
# LINKDEF TELoss/TELossLinkDef.h)
# Add the dictionary source file to the sources list
list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/G__TELoss.cxx)
# Create a library target for the TELoss module
add_library(TELoss SHARED ${SOURCES} ${FORTRAN_SOURCES})
# Link against ROOT libraries
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)
...@@ -9,7 +9,7 @@ TELOSSLIBS := -lCore -lMathCore -lMatrix -lHist -lgfortran ...@@ -9,7 +9,7 @@ TELOSSLIBS := -lCore -lMathCore -lMatrix -lHist -lgfortran
TELOSS_HEADERS += \ TELOSS_HEADERS += \
$(TELOSS)/TELoss.h \ $(TELOSS)/TELoss.h \
$(TELOSS)/linkdef.h $(TELOSS)/TELossLinkDef.h
TELOSSCPP_SRCS += \ TELOSSCPP_SRCS += \
$(TELOSS)/TELoss.cpp \ $(TELOSS)/TELoss.cpp \
......
#ifdef __CINT__ #ifdef __CLING__
#pragma link off all globals; #pragma link off all globals;
#pragma link off all classes; #pragma link off all classes;
#pragma link off all functions; #pragma link off all functions;
#pragma link C++ class TELoss; #pragma link C++ class TELoss;
#endif #endif
\ No newline at end of file
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