Hi,

First of all sorry but I didn't get any previous mail before this, hence my 
lack of response. I actually had to ask Libby to help me some moments ago 
before I now just received your email.

Secondly, I have tried to post this issue on both the ROOT and Geant4 forums 
and have not received any feedback so far.

The application I'm building is for in-house use so it won't be distributed. 
The application I have built in Geant4 has a class (i.e. 
analysis.cc<http://analysis.cc>) that uses a number of function header like 
TH2D.h, TROOT etc to setup a means to extract data produced in my Geant4 
application. For example I have created an instance of 
analysis.cc<http://analysis.cc> in my events class such that after each even I 
can collect the number of particles produced. Now what I have in my 
CMakeList.txt is structured such that the Geant4 application can function 
weather ROOT is installed or not. I have attached my CMakeList.txt file for you 
to kindly look through.

The error I get as I may have mentioned before in my previous email occurs when 
I run the Geant4 application. Since the error makes mention of the LLVM being 
exposed to cling my little knowledge on the subject inclines me to thinking 
that some how the way I have the Libraries linked to my application might be 
the issue (however, I may be wrong). Also I have been able to build, compile 
and run this Geant4 application with no error if I remove ROOT from my build. 
On the other-hand I have also used ROOT independently of Geant4 to process 
data. Please let me know if you have more question as I still don't have the 
email you sent before the current one. Thank you.

Dim Odera
Nuclear Engineering
UMass Lowell

On Dec 7, 2017, at 4:24 PM, R0b0t1 <[email protected]<mailto:[email protected]>> 
wrote:

Mr. Odera,

On Thu, Dec 7, 2017 at 8:30 AM, Dim, Odera U 
<[email protected]<mailto:[email protected]>> wrote:
Hi CMake Experts,

Please I use CMake to build my Geant4 applications with no issues. However,
recently I needed to build ROOT into my Geant4 application for the purpose
of extracting and processing simulation data. I have followed the many
instructions which exist online both on the Genat4 and ROOT sides but none
seems to produce the required results. The issue i'm having I believe is
related to the linkage of both Geant4 and ROOT libraries top the generated
executable during compilation. I am able to configure and generate build
files with a CMakeLists with no errors. Compilation also seems to also
complete with no errors but when I run the application I get an error which
specifies that LLVM are exposed to Cling and so I need to hide them. In my
CMakeLists (which I can provide to you) I do not explicitly link Cling to my
executable all I do is link the executable to ROOT libraries
(${ROOT_LIBRARIES}). Please, could you help me with this issue or do you
know a way that I could link libraries and not expose LLVM to Cling? Thank
you.


If you want help you really should try to answer some of the questions
I asked in my previous email. It happens that I have some experience
with the packages you are trying to use, but you seem to be using them
in a configuration I am not familiar with (i.e. you generated a
standalone demo that you want to distribute?).

It is important I know where you got the packages, how you built them,
and even better, what precisely you are trying to do with them; it
sounds almost like this is a question more suited to ROOT/Geant4
developers than this mailing list.

Cheers,
    R0b0t1
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project(JCC71)

#----------------------------------------------------------------------------
# Find Geant4 package, activating all available UI and Vis drivers by default
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_UIVIS "Build application with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
  find_package(Geant4 REQUIRED ui_all vis_all)
else()
  find_package(Geant4 REQUIRED COMPONENTS)
endif()

list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})

find_package(ROOT REQUIRED)


#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
# Setup include directory for this project
#

include(${Geant4_USE_FILE})

if(ROOT_FOUND)
add_definitions(-DG4ANALYSIS_USE_ROOT)
#include(${ROOT_USE_FILE})
include_directories(${PROJECT_SOURCE_DIR}/include ${ROOT_INCLUDE_DIRS} )
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
else()
include_directories(${PROJECT_SOURCE_DIR}/include )
endif()


#----------------------------------------------------------------------------
# Locate sources and headers for this project
# NB: headers are included so they will show up in IDEs
#
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)

#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(JCC71 JCC71.cc ${sources} ${headers})


if(ROOT_FOUND)
target_link_libraries(JCC71 ${Geant4_LIBRARIES})
target_link_libraries(JCC71 ${ROOT_LIBRARIES})
else()
target_link_libraries(JCC71 ${Geant4_LIBRARIES})
endif()



#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build B1. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(JCC71_SCRIPTS
  vis.mac
  init_vis.mac
  )

foreach(_script ${JCC71_SCRIPTS})
  configure_file(
    ${PROJECT_SOURCE_DIR}/${_script}
    ${PROJECT_BINARY_DIR}/${_script}
    COPYONLY
    )
endforeach()

#----------------------------------------------------------------------------
# For internal Geant4 use - but has no effect if you build this
# example standalone
#
# add_custom_target(JCC71 DEPENDS JCC71)

#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS JCC71 DESTINATION bin)



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to