package MEMPHYS
version v7r0

#use OpenScientist du 28/03/2006 Slash/BatchLab/OnXLab
#message from COIN to use full OpenGL
set COIN_FULL_INDIRECT_RENDERING "1"


branches run

#//////////////////////////////////////////////////
#/// Uses needed to build this package ////////////
#//////////////////////////////////////////////////

#use ROOT v4r* -no_auto_imports

use G4Lab v8r*

use OnXLab v1r*

#//////////////////////////////////////////////////
#/// Over Geant4 kernel and AIDA interfaces only //
#//////////////////////////////////////////////////

build_strategy no_prototypes
include_path none

include_dirs $(MEMPHYSROOT)


application test -group=debug -s=../source test.cxx

# Over Geant4 and AIDA only :
library MEMPHYSCore ${G4Lab_libopts} -s=../source *.cxx

#JEC 17/11/05 add the G4readout_incs to manage G4DigiManager
macro MEMPHYSCore_cppflags "${G4Lab_Geant4_incs} ${G4readout_incs} ${G4particles_incs} ${G4processes_incs}"
macro MEMPHYSCore_shlibflags "${G4Lab_Geant4_linkopts} ${LibCore_linkopts} ${dld_linkopts} ${cxxstd_linkopts}"
macro MEMPHYSCore_linkopts "-L${MEMPHYSROOT}/$(Platform_bin) -lMEMPHYSCore" WIN32 "${MEMPHYSROOT}\$(Platform_bin)\MEMPHYSCore.lib"

#//////////////////////////////////////////////////
#/// DLD callbacks ////////////////////////////////
#//////////////////////////////////////////////////

# Must not use Geant4 singletons if having not Geant4 shared libs.
macro MEMPHYS_kind "dll"
library MEMPHYS -import=OpenInventor -s=../source/Callbacks Callbacks.cxx InventorCallbacks.cxx
macro MEMPHYS_cppflags "${G4Lab_Geant4_incs}"
macro MEMPHYS_shlibflags "${LibCore_linkopts} ${HEPVisPlotter_linkopts} ${HEPVisDetector_linkopts} ${HEPVisGeometry_linkopts} ${HEPVisUtils_linkopts} ${freetype_linkopts} ${jpeg_linkopts} ${dvi2bitmap_linkopts} ${OpenInventor_linkopts} ${OpenGL_linkopts} ${Xext_linkopts} ${X11_linkopts} ${dld_linkopts} ${cxxstd_linkopts}"

#//////////////////////////////////////////////////
#/// Application "a la Geant4 examples" ///////////
#//////////////////////////////////////////////////

# Over Geant4 and AIDA only :
application MEMPHYS_batch -import=expat ../applications/MEMPHYS_batch.cxx use_linkopts='"${MEMPHYSCore_linkopts} ${G4physics_lists_hadronic_linkopts} ${G4Lab_Geant4_linkopts} ${aida_config_libs} ${LibCore_linkopts} ${math_linkopts} ${dld_linkopts}"'
macro MEMPHYS_batch_cppflags "${MEMPHYSCore_cppflags} ${G4physics_lists_hadronic_incs}"

# Over AIDA only :
application MEMPHYS_analysis ../applications/MEMPHYS_analysis.cxx use_linkopts='"$(aida_config_libs)"'

# Over G4Lab :
application MEMPHYS_session -import=OpenInventor -import=expat ../applications/MEMPHYS_session.cxx ../applications/HitsCollectionAccessor.cxx use_linkopts='"${MEMPHYSCore_linkopts} ${G4physics_lists_hadronic_linkopts}  ${G4LabUIOnX_linkopts} ${G4LabCore_linkopts} ${G4Lab_Geant4_linkopts} ${G4LabHDUMMY_linkopts} ${HEPVisPlotter_linkopts} ${HEPVisDetector_linkopts} ${HEPVisGeometry_linkopts} ${HEPVisUtils_linkopts} ${freetype_linkopts} ${jpeg_linkopts} ${dvi2bitmap_linkopts} ${OpenInventor_linkopts} ${OnXCore_linkopts} ${LibXML_linkopts} ${expat_linkopts} ${LibZip_linkopts} ${zlib_linkopts} ${LibCore_linkopts} ${dld_linkopts} ${cxxstd_linkopts} ${Windows_linkopts} ${OpenGL_linkopts} ${Xext_linkopts} ${X11_linkopts} "' 
macro MEMPHYS_session_cppflags "${G4Lab_Geant4_incs} ${MEMPHYS_batch_cppflags}"


#//////////////////////////////////////////////////
#/// Things using ROOT ////////////////////////////
#//////////////////////////////////////////////////
use ROOT v1r* Interfaces

# Example of ROOT program to work on a MEMPHYS.root file :
#application MEMPHYS_analysis_ROOT -group=ROOT ../applications/MEMPHYS_analysis_ROOT.cxx use_linkopts='"${ROOT_Tree_linkopts} ${ROOT_Hist_linkopts} ${ROOT_Matrix_linkopts} ${ROOT_Core_linkopts} ${ROOT_Cint_linkopts} ${dld_linkopts} ${math_linkopts}"'

# Declare AIDA to rootcint.
# See scripts/ROOT/aida.C for a usage example.

macro AIDA_cintflags "-I${AIDAROOT}/src/cpp"
macro AIDA_LinkDef_h "../source/ROOT/LinkDef.h"
document rootcint MEMPHYS_rootcint_AIDA -group=ROOT ${AIDAROOT}/src/cpp/AIDA/AIDA.h

library MEMPHYSAIDADict -group=ROOT -import=ROOT ${dict}/AIDADict.cpp
macro MEMPHYSAIDADict_shlibflags "$(aida_config_libs) ${ROOT_Core_linkopts} ${ROOT_Cint_linkopts}"

#//////////////////////////////////////////////////
#//////////////////////////////////////////////////
#//////////////////////////////////////////////////

private
macro build_library_links "true" WIN32 ""
macro remove_library_links "true" WIN32 ""

# WIN32 : /GR to enable RTTI and dynamic cast.
# WIN32 : /GX to enable exception handling (for STL).
macro_append cppflags "" WIN32 " /GX /GR" 

# DEBUG :
#macro_append cflags  " -g" WIN32 " /ZI /Od"
#macro_append cppflags  " -g" WIN32 " /ZI /Od"
#macro_append cpplinkflags  " -g" WIN32 " /DEBUG"

# OPTIMIZE :
macro_append cflags  " -O" WIN32 " /O2"
macro_append cppflags  " -O" WIN32 " /O2"
macro_append cpplinkflags  " -O" WIN32 ""
public

#//////////////////////////////////////////////////
#// Run time //////////////////////////////////////
#//////////////////////////////////////////////////

apply_pattern Platform_paths


