Geant4 installation options on Windows

Hello, I had to format my computer so I’ve to installa Geant4 again.
To use an application that one researcher gave me to modify, I need

  1. HepMC (I’ve to try to solve the problem explained here Problem in building - #4 by faca87
  2. He said me to set

I looked here Building and Installing from Source — Geant4 Installation Guide 10.7 documentation

a. -DGEANT4_USE_GDML=ON it looks like that I don’t need special path for it, true?

At present, this is only supported on Unix systems.

so, isn’t it possible to use it on Windows machine? (Windows isn’t UNIX based)

c. -DWITH_GEANT4_UIVIS I can’t find nothing about it…but, is it for the visualization? So can I replace it by using QT?

@bmorgan maybe you can help me…

Thank you

for GDML, you need xerces-c. this is how I did this:

##GMDL support
extract, e.g., to C:\Users\wel\Geant4\xerces-c-3.2.3-source
create build folder: C:\Users\wel\Geant4\xerces-c-3.2.3-build
#open powershell
cmake -DCMAKE_INSTALL_PREFIX=C:\Users\wel\Geant4\xerces-c\xerces-c-3.2.3 C:\Users\wel\Geant4\xerces-c\xerces-c-3.2.3-source
cmake --build . --config Release
cmake --build . --config Release --target install

to build geant, I did this:

cd C:\Users\wel\Geant4\geant4_10_07-build
cmake -DCMAKE_INSTALL_PREFIX=C:\Users\wel\Geant4\geant4_10_07 -DGEANT4_BUILD_MULTITHREADED=ON -DCMAKE_PREFIX_PATH="C:\Qt\5.15.2\msvc2019_64;C:\Users\wel\Geant4\xerces-c\xerces-c-3.2.3" -DGEANT4_USE_GDML=ON -DGEANT4_USE_QT=ON -DGEANT4_INSTALL_DATA=OFF -DGEANT4_BUILD_MSVC_MP=ON -DGEANT4_INSTALL_DATADIR="C:\Users\wel\Geant4\data" C:\Users\wel\Geant4\geant4_10_07_files\geant4_10_07-source
cmake --build . --config Release
cmake --build . --config Release --target install

of course, adapt paths and make sure you have installed Qt :slight_smile:

That’s an oversight in the docs (which we’ll fix), MT should work on Windows from 10.7, so fine to enable it.

Thank you the both @weller and @bmorgan currently I’m installing QT …then I will try!

@weller then, did you install xerces before to install geant, true?
Thank you

this is correct. also, don’t be afraid to try things out and learn from experience :slight_smile:

@weller thank you! I installed xerces!

@bmorgan I was installing HepMC using ROOTIO, but I had a problem due to compatibility between ROOT (installed by binary) and visual studio. In the ROOT forum, said me to install ROOT from the master …so now I’m trying to install ROOT from the master (using the sources)…

Anyway, I’m installing QT but it’s long time that I read

looking on internet, I see maybe there is a bug on conan

so can I install QT without conan to use QT in geant4? @weller, did you select conan during QT installation?

Last question
-DWITH_GEANT4_UIVIS I can’t find nothing about it…but, is it for the visualization? So can I replace it by using QT?

when I did the install, version 6 was not yet available. I would install without, and see if things work afterwards, and if they dont: reinstall and try again :wink:

Thank you @weller

I selected all this

I hope it is enough…
I was looking my old installation of QT (QT6 yet)
Use QT with Geant in Windows - #7 by faca87 there wans’t the conan option…

I just selected MSVC 2019 64-bit, sources and Qt Debug Information Files, and the Qt Creator, and I use Qt Creator to code and compile (probably thereby using MSVC)

Thank you @weller then…do you think this is enogh


Hi Fausto

There is no such option. It will simply say “option not used” or some such.

The Installation Guide lists the meaningful options. I don’t use Windows myself but I believe Windows has OpenGL already installed, so you can build with -DGEANT4_USE_OPENGL_WIN32=ON and you should get something when you run, say, exampleB1.

As for Qt, yes, great, but we have not yet built with Qt6. Please try it, but if it does work please build against the latest version of Qt5.


“does” should read “doesn’t”.

Thank you @allison the I aborted the installation and I’m installing again QT using

I hope it’s enough

Regarding of the the Geant4 UIVIS…sorry, I’m Looking again the email and he wrote

then it’s -DWITH_ and not -DGEANT4, this is the e-mail

but I can’t find `-DWITH_GEANT4_UIVIS too…