diff --git a/AculData/AculData.mk b/AculData/AculData.mk index 7ca96d4ad2355f37af78c1bd6664413306d48f6f..7b38e9a2bec00247854b21f395df02e39e299ef4 100755 --- a/AculData/AculData.mk +++ b/AculData/AculData.mk @@ -8,7 +8,7 @@ ACULDATALIBS := -lCore -lRIO -lTree -lNet -lThread -lHist -lMatrix -lMathCore -l ACULDATA_HEADERS += \ $(ACULDATA)/AculCalibration.h \ $(ACULDATA)/AculCalibCsI.h \ -$(ACULDATA)/linkdef.h +$(ACULDATA)/AculDataLinkDef.h ACULDATACPP_SRCS += \ $(ACULDATA)/AculCalibration.cpp \ diff --git a/AculData/linkdef.h b/AculData/AculDataLinkDef.h similarity index 88% rename from AculData/linkdef.h rename to AculData/AculDataLinkDef.h index 42dc2a35a578e5edf6e6b5f023f9eeeae0b28fed..c66de3989f0a6f07ea2f20dbe4af33e834635250 100755 --- a/AculData/linkdef.h +++ b/AculData/AculDataLinkDef.h @@ -1,4 +1,4 @@ -#ifdef __CINT__ +#ifdef __CLING__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; @@ -9,6 +9,4 @@ #pragma link C++ class AculCalibCsI; //#pragma link C++ class ConfigDictionary; - -#endif - +#endif \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..12a3f320af8649b8c59b96b92b82624e92adbb02 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,80 @@ +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) diff --git a/README b/README index 828d0707f5782044c9f0c17294c577dc0ec163b9..5cfa9ef73248454cf876f2805defc8f0f0b178ff 100755 --- a/README +++ b/README @@ -1,4 +1,6 @@ - 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: @@ -7,3 +9,13 @@ make install 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 diff --git a/TELoss/CMakeLists.txt b/TELoss/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..dae8f498a15b200661b1170c12737c45f7404589 --- /dev/null +++ b/TELoss/CMakeLists.txt @@ -0,0 +1,44 @@ +# 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) diff --git a/TELoss/TELoss.mk b/TELoss/TELoss.mk index c018c54465623154f24d1c841c6991ee8daec455..fcd55cc21e7d0ad19a59efb7586852a6c8f0d4b3 100755 --- a/TELoss/TELoss.mk +++ b/TELoss/TELoss.mk @@ -9,7 +9,7 @@ TELOSSLIBS := -lCore -lMathCore -lMatrix -lHist -lgfortran TELOSS_HEADERS += \ $(TELOSS)/TELoss.h \ -$(TELOSS)/linkdef.h +$(TELOSS)/TELossLinkDef.h TELOSSCPP_SRCS += \ $(TELOSS)/TELoss.cpp \ diff --git a/TELoss/linkdef.h b/TELoss/TELossLinkDef.h similarity index 80% rename from TELoss/linkdef.h rename to TELoss/TELossLinkDef.h index b5518a369c9b8a03a4bf6008687d5081818e967b..dbf30f76433916bfea75c1ad8df29326a63b599d 100755 --- a/TELoss/linkdef.h +++ b/TELoss/TELossLinkDef.h @@ -1,9 +1,8 @@ -#ifdef __CINT__ +#ifdef __CLING__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class TELoss; - #endif \ No newline at end of file