Skip to content
Snippets Groups Projects
Commit e9f295c2 authored by Marilena Bandieramonte's avatar Marilena Bandieramonte
Browse files
parents c5bee4f4 38f1df79
No related branches found
No related tags found
1 merge request!20Change in GeoModelG4 to support Ether and HyperUranium handling in new geometry tags.
......@@ -20,11 +20,12 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
# Set up how the project handle some of its dependenices. Either by picking them
# up from the environment, or building them itself.
include( SetupJSON )
include( SetupXercesC )
# Find the base GeoModel packages, which must be installed on the target system already
find_package( GeoModelCore REQUIRED 4.0.0 ) #TODO: the version should be se in the root folder
find_package( GeoModelIO REQUIRED 4.0.0 ) #TODO: the version should be se in the root folder
# FullSimLight needs GeoModelG4, so we set the cache variable to be used to set its standalone build
set(GEOMODEL_BUILD_GEOMODELG4 TRUE)
# FullSimLight needs GeoModelG4, so we trigger its build
set( GEOMODEL_BUILD_GEOMODELG4_FROM_FULLSIMLIGHT ON CACHE BOOL "GeoModelG4 build triggered by FullSimLigh when built individually" FORCE )
add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/../GeoModelG4 build_GeoModelG4 )
# Set a flag to steer the of the subpackages
set( ${PROJECT_NAME}_INDIVIDUAL_BUILD ON )
......
......@@ -4,7 +4,7 @@ project( "GeoModelG4" VERSION 1.1.0 LANGUAGES CXX )
message("CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
if( (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) OR GEOMODEL_BUILD_GEOMODELG4 )
if( (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) OR GEOMODEL_BUILD_GEOMODELG4_FROM_FULLSIMLIGHT )
# I am top-level project.
# Make the root module directory visible to CMake.
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake )
......@@ -16,9 +16,6 @@ if( (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) OR GEOMODEL_BUILD_GEOMODELG4
include( configure_cpp_options )
set( CMAKE_FIND_FRAMEWORK "LAST" CACHE STRING
"Framework finding behaviour on macOS" )
# Set up how the project handle some of its dependenices. Either by picking them
# up from the environment, or building them itself.^[[?12;4$y
include( SetupJSON )
# Find the base GeoModel packages, which must be installed on the target system already
find_package( GeoModelCore REQUIRED 4.0.0 ) #TODO: the version should be se in the root folder
# Set a flag to steer the of the subpackages
......
......@@ -11,9 +11,6 @@ option( GEOMODEL_USE_BUILTIN_XERCESC
# Now do what was requested.
if( GEOMODEL_USE_BUILTIN_XERCESC )
# Tell the user what's happening.
message( STATUS "Building XercesC as part of the project" )
# Tell the user what's happening.
if( COLOR_DEFS )
message( STATUS "${BoldMagenta}'GEOMODEL_USE_BUILTIN_XERCESC' was set to 'true' ==> Building XercesC as part of the project${ColourReset}" )
......@@ -24,11 +21,11 @@ if( GEOMODEL_USE_BUILTIN_XERCESC )
# The include directory and library that will be produced.
set( XercesC_INCLUDE_DIR
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall/${CMAKE_INSTALL_INCLUDEDIR}" )
set( XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}" )
set( XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}" FORCE )
set( XercesC_LIBRARY
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall/lib/${CMAKE_SHARED_LIBRARY_PREFIX}xerces-c${CMAKE_SHARED_LIBRARY_SUFFIX}" )
set( XercesC_LIBRARIES "${XercesC_LIBRARY}" )
set( XercesC_VERSION "3.1.3" )
set( XercesC_VERSION "3.2.3" )
# Create the include directory already, otherwise CMake refuses to
# create the imported target.
......@@ -40,7 +37,8 @@ if( GEOMODEL_USE_BUILTIN_XERCESC )
PREFIX "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCBuild"
INSTALL_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/XercesCInstall"
URL "https://cern.ch/lcgpackages/tarFiles/sources/xerces-c-${XercesC_VERSION}.tar.gz"
URL_MD5 "70320ab0e3269e47d978a6ca0c0e1e2d"
#URL_MD5 "70320ab0e3269e47d978a6ca0c0e1e2d"
URL_MD5 "87b994ba2cf95b43143335e390282a80"
CONFIGURE_COMMAND
${CMAKE_COMMAND} -E env CXXFLAGS=-std=c++${CMAKE_CXX_STANDARD}
<SOURCE_DIR>/configure --disable-static --prefix=<INSTALL_DIR>
......
# How to build FullSimLight
# Standard build
FullSimLight can be built as part of the GeoModel build, by enabling the related configuration flag `GEOMODEL_BUILD_FULLSIMLIGHT`:
```bash
cmake -DGEOMODEL_BUILD_FULLSIMLIGHT=1 ../GeoModel
make -j
make install
```
That will compile the base GeoModel packages (*i.e.*, `GeoModelCore`, `GeoModelIO`, and `GeoModelTools`), the GeoModel<->Geant4 interface package `GeoModelG4`, and the application `FullSimLight`.
This will install all the base libraries and the `fullSimLight` executable in the standard installation path (*e.g.*, `/usr/local` on macOS). If you want to have a local installation, see below.
# Local installation
You can install FullSimLight in a local folder as well. This let you remove everything by simply deleting the local folder, and lets you have multiple versions of the packages installed.
You can install iFullSimLight locally by using the `CMAKE_INSTALL_PREFIX` option. In the example below, we instruct CMake to install everything inside a local folder named `install` besides the `build` folder where we are launching CMake from:
```bash
cmake -DGEOMODEL_BUILD_FULLSIMLIGHT=1 -DCMAKE_INSTALL_PREFIX=../install ../GeoModel
make -j
make install
```
At the end, you will find all the libraries and executables installed in:
```bash
ls ../install
```
## How to use a custom version of Xerces-C
The Geant4 GDML format depends on teh Xerces-C library. Therefore, different Geant4 releases can use different versions of the Xerecs-C library.
If you want to build FullSimLight with a custom, locally installed Xerces-C library, you can pass the `XercesC_INCLUDE_DIR` and `XercesC_LIBRARY` variable to CMake while configuring the build of FullSimLight:
```bash
cmake -DGEOMODEL_BUILD_FULLSIMLIGHT=1 -DXercesC_INCLUDE_DIR=<path-to-local-XercesC-installation>/include -DXercesC_LIBRARY=<path-to-local-XercesC-installation>/lib/libxerces-c.dylib ../GeoModel/
```
!!! note
When setting the path of the local installation of Xerces-C, please be sure to use a full path or a local path related to the `$PWD` environment variable For example, those are valid examples:
```bash
-DXercesC_INCLUDE_DIR=/opt/myXercesC/include # using a full 'full path'
-DXercesC_INCLUDE_DIR=$PWD/../myXercesC/include # using a 'relative path', relative to the current build folder
```
!!! note
If you installed Geant4 on myour machine with a package manager (*e.g.*, Homebrew on macOS) the version used by the Geant4 package built by the package manager could be hardcoded in the package configuration itself. That could cause the output of warning messages by CMake, of which thev one below is an example:
```bash
Value of 'XercesC_INCLUDE_DIR' is already set and does not match value set at Geant4 build-time
```
Normally, those warnings do not harm the build. But please judge by yourself if the difference isn the Xerces-C library can affect the project you are working on.
## Combining different configuration/build options
You can also combine different configuration options. For example, here below we build FullsimLight by using the built-in `nlohmann-json` library together with the custom Xerces-C library, and we install the outcome in a local `../install` folder:
```bash
cmake -DCMAKE_INSTALL_PREFIX=../install -DGEOMODEL_USE_BUILTIN_JSON=1 -DGEOMODEL_BUILD_FULLSIMLIGHT=1 -DXercesC_INCLUDE_DIR=<path-to-local-XercesC-installation>/include -DXercesC_LIBRARY=<path-to-local-XercesC-installation>/lib/libxerces-c.dylib ../GeoModel/
```
......@@ -19,6 +19,7 @@ nav:
- 'Dump the geometry with `dump-geo`': 'how/how_dump_geo.md'
- 'Load a geometry from a file': 'how/how_load_geo.md'
- 'Describe a geometry with a file': 'how/how_describe_geo_file.md'
- 'Build FullSimLight': 'how/how_build_fullsimlight.md'
- Papers & Presentations:
- 'Public': 'papers/public.md'
- 'Internal': 'papers/internal.md'
......@@ -41,4 +42,4 @@ markdown_extensions:
base_path: docs
plugins:
- search
#- git-revision-date #TODO: teh mkdocs docker image apparently lacks the git exec, so this cannot be used. Update the image!
\ No newline at end of file
#- git-revision-date #TODO: teh mkdocs docker image apparently lacks the git exec, so this cannot be used. Update the image!
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment