Closed cereus93 closed 7 years ago
It's been a while since I have fiddled with this, but if I remember correctly everything seemed to work a lot smoother when I used GEANT4 9.6. See what Chris thinks.
@cereus93 With regards to the example, is is most likely due to the path to the CAD file being hard-coded. Try running it one level up from the build directory:
./build/cadmesh_example
I have been meaning to fix this by specifying the path to the CAD file on the command line.
@cereus93 I have just made a for you to try. The example now takes the CAD filename on the command line. Give it a try and let me know how it goes.
Thanks for your help!
With using ./build/cadmesh_example
everything works fine in version CADMesh-1.0.rc4.
Version CADMesh-1.0.rc5 is a good improvement, but if you want to build the example you get an error message, because cadmesh can not be found. To solve this you have to do changes in the CMakeList.txt.
find_package(cadmesh)
include_directories(${CADMESH_INCLUDE_DIRS})
and
target_link_libraries(cadmesh_example ${cadmesh_LIBRARIES})
are there as comments but the lines are needed to build the example. If the CMakeList.txt is changed everything works fine.
Since this is not closed I am going to make explicit of what should be done.
The CMakeList.txt needs to be changed to
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(cadmesh_example)
# GEANT4 core
find_package(Geant4 REQUIRED ui_all vis_all)
include(${Geant4_USE_FILE})
include_directories(${PROJECT_SOURCE_DIR}/include)
# Include CADMesh in your project.
find_package(cadmesh)
include_directories(${CADMESH_INCLUDE_DIRS})
# User code
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
add_executable(cadmesh_example cadmesh_example.cc ${sources} ${headers})
target_link_libraries(cadmesh_example ${Geant4_LIBRARIES})
target_link_libraries(cadmesh_example cadmesh)
target_link_libraries(cadmesh_example ${cadmesh_LIBRARIES})
And then the user needs to run from $CADMesh/examples/basic/build
cmake .. -Dcadmesh_DIR:PATH=$CADMeshInstall/lib/cmake/cadmesh-./
make -j<number of processors>
Your cmake file will not automatically find the lib/cmake/cadmesh-.
folder even if the library is exported correctly.
Fixing the CMakeLists.txt and changing the path name in the example given in the README.md should close and solve this.
Thanks @stevenwalton. The root of the problem seems to be the original intent of the example to be compilable without having to install CADMesh, and also server as an example project once it has been installed.
What I will do is:
Hi, I would like to use CADMesh 1.0.rc4 together with geant4 10.01. Geant4 works fine and also building and installation of CADMesh, but I can not execute the basic CADMesh example. When I run the example I get a segementation fault (core dumped) in the function CADMesh::TesselatedMesh(int) in libcadmesh.so.
I have no ideas what to do. It would be nice to get a hint.
I am using: