mirror of
https://github.com/OpenCMT/uLib.git
synced 2025-12-06 07:21:31 +01:00
[uLib Geometry]
non working version! + adds ProgrammableAccessor + renaming of some Image structures ...
This commit is contained in:
81
CMake/FindEigen3.cmake
Normal file
81
CMake/FindEigen3.cmake
Normal file
@@ -0,0 +1,81 @@
|
||||
# - Try to find Eigen3 lib
|
||||
#
|
||||
# This module supports requiring a minimum version, e.g. you can do
|
||||
# find_package(Eigen3 3.1.2)
|
||||
# to require version 3.1.2 or newer of Eigen3.
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# EIGEN3_FOUND - system has eigen lib with correct version
|
||||
# EIGEN3_INCLUDE_DIR - the eigen include directory
|
||||
# EIGEN3_VERSION - eigen version
|
||||
|
||||
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
|
||||
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
|
||||
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
||||
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
|
||||
|
||||
if(NOT Eigen3_FIND_VERSION)
|
||||
if(NOT Eigen3_FIND_VERSION_MAJOR)
|
||||
set(Eigen3_FIND_VERSION_MAJOR 2)
|
||||
endif(NOT Eigen3_FIND_VERSION_MAJOR)
|
||||
if(NOT Eigen3_FIND_VERSION_MINOR)
|
||||
set(Eigen3_FIND_VERSION_MINOR 91)
|
||||
endif(NOT Eigen3_FIND_VERSION_MINOR)
|
||||
if(NOT Eigen3_FIND_VERSION_PATCH)
|
||||
set(Eigen3_FIND_VERSION_PATCH 0)
|
||||
endif(NOT Eigen3_FIND_VERSION_PATCH)
|
||||
|
||||
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
|
||||
endif(NOT Eigen3_FIND_VERSION)
|
||||
|
||||
macro(_eigen3_check_version)
|
||||
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
|
||||
|
||||
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
|
||||
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
|
||||
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
|
||||
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
|
||||
|
||||
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
|
||||
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||
set(EIGEN3_VERSION_OK FALSE)
|
||||
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||
set(EIGEN3_VERSION_OK TRUE)
|
||||
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||
|
||||
if(NOT EIGEN3_VERSION_OK)
|
||||
|
||||
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
|
||||
"but at least version ${Eigen3_FIND_VERSION} is required")
|
||||
endif(NOT EIGEN3_VERSION_OK)
|
||||
endmacro(_eigen3_check_version)
|
||||
|
||||
if (EIGEN3_INCLUDE_DIR)
|
||||
|
||||
# in cache already
|
||||
_eigen3_check_version()
|
||||
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
|
||||
|
||||
else (EIGEN3_INCLUDE_DIR)
|
||||
|
||||
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
|
||||
PATHS
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
${KDE4_INCLUDE_DIR}
|
||||
PATH_SUFFIXES eigen3 eigen
|
||||
)
|
||||
|
||||
if(EIGEN3_INCLUDE_DIR)
|
||||
_eigen3_check_version()
|
||||
endif(EIGEN3_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
|
||||
|
||||
mark_as_advanced(EIGEN3_INCLUDE_DIR)
|
||||
|
||||
endif(EIGEN3_INCLUDE_DIR)
|
||||
|
||||
63
CMake/FindGEANT4.cmake
Normal file
63
CMake/FindGEANT4.cmake
Normal file
@@ -0,0 +1,63 @@
|
||||
# - Try to find GEANT4
|
||||
# Once done this will define
|
||||
#
|
||||
# GEANT4_FOUND - system has GEANT4
|
||||
# GEANT4_INCLUDE_DIR - the GEANT4 include directory
|
||||
# GEANT4_LIBRARIES - The libraries needed to use GEANT4
|
||||
# GEANT4_DEFINITIONS - Compiler switches required for using GEANT4
|
||||
#
|
||||
|
||||
if (GEANT4_INCLUDE_DIR AND GEANT4_LIBRARY_DIR)
|
||||
SET (GEANT4_INCLUDE_DIR GEANT4_INCLUDE_DIR-NOTFOUND)
|
||||
SET (GEANT4_LIB_DIR GEANT4_LIB_DIR-NOTFOUND)
|
||||
SET (GEANT4_PLISTS_LIB_DIR GEANT4_PLISTS_LIB_DIR-NOTFOUND)
|
||||
SET (GEANT4_DIR GEANT4_DIR-NOTFOUND)
|
||||
endif (GEANT4_INCLUDE_DIR AND GEANT4_LIBRARY_DIR)
|
||||
|
||||
MESSAGE(STATUS "Looking for GEANT4...")
|
||||
|
||||
FIND_PATH(GEANT4_DIR NAMES env.sh PATHS
|
||||
${SIMPATH}/transport/geant4
|
||||
${SIMPATH}/transport/geant4/source
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_PATH(GEANT4_INCLUDE_DIR NAMES G4Event.hh PATHS
|
||||
${SIMPATH}/transport/geant4/include
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
SET(GEANT4_INCLUDE_DIR
|
||||
${SIMPATH}/transport/geant4/include
|
||||
${SIMPATH}/transport/geant4/source/interfaces/common/include
|
||||
${SIMPATH}/transport/geant4/physics_lists/hadronic/Packaging/include
|
||||
${SIMPATH}/transport/geant4/physics_lists/hadronic/QGSP/include
|
||||
)
|
||||
|
||||
FIND_PATH(GEANT4_LIB_DIR NAMES libG4baryons.so libG4baryons.dylib PATHS
|
||||
${SIMPATH}/transport/geant4/lib/Linux-g++
|
||||
${SIMPATH}/transport/geant4/lib/Linux-icc
|
||||
${SIMPATH}/transport/geant4/lib
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
IF (GEANT4_LIB_DIR)
|
||||
SET(GEANT4_LIBRARY_DIR ${GEANT4_LIB_DIR})
|
||||
ENDIF (GEANT4_LIB_DIR)
|
||||
|
||||
if (GEANT4_INCLUDE_DIR AND GEANT4_LIBRARY_DIR)
|
||||
set(GEANT4_FOUND TRUE)
|
||||
endif (GEANT4_INCLUDE_DIR AND GEANT4_LIBRARY_DIR)
|
||||
|
||||
if (GEANT4_FOUND)
|
||||
if (NOT GEANT4_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Looking for GEANT4... - found ${GEANT4_LIBRARY_DIR}")
|
||||
# message(STATUS "Found ${GEANT4_LIBRARY_DIR}")
|
||||
endif (NOT GEANT4_FIND_QUIETLY)
|
||||
SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${GEANT4_LIBRARY_DIR})
|
||||
else (GEANT4_FOUND)
|
||||
if (GEANT4_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Looking for GEANT4... - Not found")
|
||||
endif (GEANT4_FIND_REQUIRED)
|
||||
endif (GEANT4_FOUND)
|
||||
|
||||
97
CMake/FindGEANT4VMC.cmake
Normal file
97
CMake/FindGEANT4VMC.cmake
Normal file
@@ -0,0 +1,97 @@
|
||||
# - Try to find GEANT4VMC
|
||||
# Once done this will define
|
||||
#
|
||||
# GEANT4VMC_FOUND - system has GEANT3
|
||||
# GEANT4VMC_INCLUDE_DIR - the GEANT3 include directory
|
||||
# GEANT4VMC_LIBRARIES - The libraries needed to use GEANT3
|
||||
# GEANT4VMC_DEFINITIONS - Compiler switches required for using GEANT3
|
||||
#
|
||||
|
||||
if (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR)
|
||||
SET (GEANT4VMC_INCLUDE_DIR GEANT4VMC_INCLUDE_DIR-NOTFOUND)
|
||||
SET (GEANT4VMC_LIB_DIR GEANT4VMC_LIB_DIR-NOTFOUND)
|
||||
SET (GEANT4VMC_PLISTS_LIB_DIR GEANT4VMC_PLISTS_LIB_DIR-NOTFOUND)
|
||||
endif (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR)
|
||||
|
||||
MESSAGE(STATUS "Looking for GEANT4VMC...")
|
||||
|
||||
FIND_PATH(GEANT4VMC_INCLUDE_DIR NAMES TG4G3Units.h PATHS
|
||||
${SIMPATH}/transport/geant4_vmc/include
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
set(GEANT4VMC_INCLUDE_DIR
|
||||
${SIMPATH}/transport/geant4_vmc/source/global/include
|
||||
${SIMPATH}/transport/geant4_vmc/source/geometry/include
|
||||
${SIMPATH}/transport/geant4_vmc/source/digits+hits/include
|
||||
${SIMPATH}/transport/geant4_vmc/source/physics/include
|
||||
${SIMPATH}/transport/geant4_vmc/source/event/include
|
||||
${SIMPATH}/transport/geant4_vmc/source/run/include
|
||||
${SIMPATH}/transport/geant4_vmc/source/interfaces/include
|
||||
${SIMPATH}/transport/geant4_vmc/source/visualization/include
|
||||
${SIMPATH}/transport/geant4_vmc/include
|
||||
${SIMPATH}/transport/vgm/packages/BaseVGM/include
|
||||
${SIMPATH}/transport/vgm/packages/ClhepVGM/include
|
||||
${SIMPATH}/transport/vgm/packages/Geant4GM/include
|
||||
${SIMPATH}/transport/vgm/packages/RootGM/include
|
||||
${SIMPATH}/transport/vgm/packages/VGM/include
|
||||
${SIMPATH}/transport/vgm/packages/XmlVGM/include
|
||||
)
|
||||
|
||||
|
||||
FIND_PATH(GEANT4VMC_LIBRARY_DIR NAMES libgeant4vmc.so libgeant4vmc.dylib PATHS
|
||||
${SIMPATH}/transport/geant4_vmc/lib/tgt_linux
|
||||
${SIMPATH}/transport/geant4_vmc/lib/tgt_linuxicc
|
||||
${SIMPATH}/transport/geant4_vmc/lib/tgt_linuxx8664gcc
|
||||
${SIMPATH}/transport/geant4_vmc/lib
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
# check for existence of header file, which is needed in CbmRunConfiguration
|
||||
# The file is only present in old versions of VMC
|
||||
FIND_FILE(GEANT4_MODULAR_PHYSICS_LIST TG4ModularPhysicsList.h PATHS
|
||||
${GEANT4VMC_INCLUDE_DIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR)
|
||||
if (NOT GEANT4VMC_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Looking for GEANT4VMC... - found ${GEANT4VMC_LIBRARY_DIR}")
|
||||
endif (NOT GEANT4VMC_FIND_QUIETLY)
|
||||
else (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR)
|
||||
if (GEANT4VMC_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Looking for GEANT4VMC... - Not found ")
|
||||
endif (GEANT4VMC_FIND_REQUIRED)
|
||||
endif (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR)
|
||||
|
||||
|
||||
MESSAGE(STATUS "Looking for VGM...")
|
||||
|
||||
FIND_PATH(VGM_LIBRARY_DIR NAMES libBaseVGM.so libBaseVGM.dylib PATHS
|
||||
${SIMPATH}/transport/vgm/lib/Linux-g++
|
||||
${SIMPATH}/transport/vgm.2.08.04/lib/Linux-g++
|
||||
${SIMPATH}/transport/vgm/lib/Linux-icc
|
||||
${SIMPATH}/transport/vgm/lib
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if (VGM_LIBRARY_DIR)
|
||||
if (NOT GEANT4VMC_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Looking for VGM... - found ${VGM_LIBRARY_DIR}")
|
||||
endif (NOT GEANT4VMC_FIND_QUIETLY)
|
||||
else (VGM_LIBRARY_DIR)
|
||||
if (GEANT4VMC_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Looking for VGM... - Not found ")
|
||||
endif (GEANT4VMC_FIND_REQUIRED)
|
||||
endif (VGM_LIBRARY_DIR)
|
||||
|
||||
|
||||
if (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR AND VGM_LIBRARY_DIR)
|
||||
set(GEANT4VMC_FOUND TRUE)
|
||||
endif (GEANT4VMC_INCLUDE_DIR AND GEANT4VMC_LIBRARY_DIR AND VGM_LIBRARY_DIR)
|
||||
|
||||
if (GEANT4VMC_FOUND)
|
||||
SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${GEANT4VMC_LIBRARY_DIR}
|
||||
${VGM_LIBRARY_DIR})
|
||||
endif (GEANT4VMC_FOUND)
|
||||
|
||||
279
CMake/FindROOT.cmake
Normal file
279
CMake/FindROOT.cmake
Normal file
@@ -0,0 +1,279 @@
|
||||
# - Find ROOT instalation
|
||||
# This module tries to find the ROOT installation on your system.
|
||||
# It tries to find the root-config script which gives you all the needed information.
|
||||
# If the system variable ROOTSYS is set this is straight forward.
|
||||
# If not the module uses the pathes given in ROOT_CONFIG_SEARCHPATH.
|
||||
# If you need an other path you should add this path to this varaible.
|
||||
# The root-config script is then used to detect basically everything else.
|
||||
# This module defines a number of key variables and macros.
|
||||
|
||||
# F.Uhlig@gsi.de (fairroot.gsi.de)
|
||||
|
||||
|
||||
MESSAGE(STATUS "Looking for Root...")
|
||||
|
||||
SET(ROOT_CONFIG_SEARCHPATH
|
||||
/usr/local/bin
|
||||
${SIMPATH}/tools/root/bin
|
||||
$ENV{ROOTSYS}/bin
|
||||
)
|
||||
|
||||
SET(ROOT_DEFINITIONS "")
|
||||
|
||||
SET(ROOT_INSTALLED_VERSION_TOO_OLD FALSE)
|
||||
|
||||
SET(ROOT_CONFIG_EXECUTABLE ROOT_CONFIG_EXECUTABLE-NOTFOUND)
|
||||
|
||||
FIND_PROGRAM(ROOT_CONFIG_EXECUTABLE NAMES root-config PATHS
|
||||
${ROOT_CONFIG_SEARCHPATH}
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
IF (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
|
||||
MESSAGE( FATAL_ERROR "ROOT not installed in the searchpath and ROOTSYS is not set. Please
|
||||
set ROOTSYS or add the path to your ROOT installation in the Macro FindROOT.cmake in the
|
||||
subdirectory cmake/modules.")
|
||||
ELSE (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
|
||||
STRING(REGEX REPLACE "(^.*)/bin/root-config" "\\1" test ${ROOT_CONFIG_EXECUTABLE})
|
||||
SET( ENV{ROOTSYS} ${test})
|
||||
set( ROOTSYS ${test})
|
||||
ENDIF (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
|
||||
|
||||
|
||||
IF (ROOT_CONFIG_EXECUTABLE)
|
||||
|
||||
SET(ROOT_FOUND FALSE)
|
||||
|
||||
EXEC_PROGRAM(${ROOT_CONFIG_EXECUTABLE} ARGS "--version" OUTPUT_VARIABLE ROOTVERSION)
|
||||
|
||||
MESSAGE(STATUS "Looking for Root... - found $ENV{ROOTSYS}/bin/root")
|
||||
MESSAGE(STATUS "Looking for Root... - version ${ROOTVERSION} ")
|
||||
|
||||
# we need at least version 5.00/00
|
||||
IF (NOT ROOT_MIN_VERSION)
|
||||
SET(ROOT_MIN_VERSION "5.00/00")
|
||||
ENDIF (NOT ROOT_MIN_VERSION)
|
||||
|
||||
# now parse the parts of the user given version string into variables
|
||||
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+" "\\1" req_root_major_vers "${ROOT_MIN_VERSION}")
|
||||
STRING(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" req_root_minor_vers "${ROOT_MIN_VERSION}")
|
||||
STRING(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+)" "\\1" req_root_patch_vers "${ROOT_MIN_VERSION}")
|
||||
|
||||
# and now the version string given by qmake
|
||||
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+.*" "\\1" found_root_major_vers "${ROOTVERSION}")
|
||||
STRING(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" found_root_minor_vers "${ROOTVERSION}")
|
||||
STRING(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+).*" "\\1" found_root_patch_vers "${ROOTVERSION}")
|
||||
|
||||
IF (found_root_major_vers LESS 5)
|
||||
MESSAGE( FATAL_ERROR "Invalid ROOT version \"${ROOTERSION}\", at least major version 4 is required, e.g. \"5.00/00\"")
|
||||
ENDIF (found_root_major_vers LESS 5)
|
||||
|
||||
# compute an overall version number which can be compared at once
|
||||
MATH(EXPR req_vers "${req_root_major_vers}*10000 + ${req_root_minor_vers}*100 + ${req_root_patch_vers}")
|
||||
MATH(EXPR found_vers "${found_root_major_vers}*10000 + ${found_root_minor_vers}*100 + ${found_root_patch_vers}")
|
||||
|
||||
IF (found_vers LESS req_vers)
|
||||
SET(ROOT_FOUND FALSE)
|
||||
SET(ROOT_INSTALLED_VERSION_TOO_OLD TRUE)
|
||||
ELSE (found_vers LESS req_vers)
|
||||
SET(ROOT_FOUND TRUE)
|
||||
ENDIF (found_vers LESS req_vers)
|
||||
|
||||
ENDIF (ROOT_CONFIG_EXECUTABLE)
|
||||
|
||||
|
||||
IF (ROOT_FOUND)
|
||||
|
||||
# ask root-config for the library dir
|
||||
# Set ROOT_LIBRARY_DIR
|
||||
|
||||
EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
|
||||
ARGS "--libdir"
|
||||
OUTPUT_VARIABLE ROOT_LIBRARY_DIR_TMP )
|
||||
|
||||
IF(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
|
||||
SET(ROOT_LIBRARY_DIR ${ROOT_LIBRARY_DIR_TMP} )
|
||||
ELSE(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
|
||||
MESSAGE("Warning: ROOT_CONFIG_EXECUTABLE reported ${ROOT_LIBRARY_DIR_TMP} as library path,")
|
||||
MESSAGE("Warning: but ${ROOT_LIBRARY_DIR_TMP} does NOT exist, ROOT must NOT be installed correctly.")
|
||||
ENDIF(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
|
||||
|
||||
# ask root-config for the binary dir
|
||||
EXEC_PROGRAM(${ROOT_CONFIG_EXECUTABLE}
|
||||
ARGS "--bindir"
|
||||
OUTPUT_VARIABLE root_bins )
|
||||
SET(ROOT_BINARY_DIR ${root_bins})
|
||||
|
||||
# ask root-config for the include dir
|
||||
EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
|
||||
ARGS "--incdir"
|
||||
OUTPUT_VARIABLE root_headers )
|
||||
SET(ROOT_INCLUDE_DIR ${root_headers})
|
||||
# CACHE INTERNAL "")
|
||||
|
||||
# ask root-config for the library varaibles
|
||||
EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
|
||||
# ARGS "--noldflags --noauxlibs --libs"
|
||||
ARGS "--glibs"
|
||||
OUTPUT_VARIABLE root_flags )
|
||||
|
||||
# STRING(REGEX MATCHALL "([^ ])+" root_libs_all ${root_flags})
|
||||
# STRING(REGEX MATCHALL "-L([^ ])+" root_library ${root_flags})
|
||||
# REMOVE_FROM_LIST(root_flags "${root_libs_all}" "${root_library}")
|
||||
|
||||
SET(ROOT_LIBRARIES ${root_flags})
|
||||
|
||||
# Make variables changeble to the advanced user
|
||||
MARK_AS_ADVANCED( ROOT_LIBRARY_DIR ROOT_INCLUDE_DIR ROOT_DEFINITIONS)
|
||||
|
||||
# Set ROOT_INCLUDES
|
||||
SET( ROOT_INCLUDES ${ROOT_INCLUDE_DIR})
|
||||
|
||||
SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${ROOT_LIBRARY_DIR})
|
||||
|
||||
#######################################
|
||||
#
|
||||
# Check the executables of ROOT
|
||||
# ( rootcint )
|
||||
#
|
||||
#######################################
|
||||
|
||||
FIND_PROGRAM(ROOT_CINT_EXECUTABLE
|
||||
NAMES rootcint
|
||||
PATHS ${ROOT_BINARY_DIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
ENDIF (ROOT_FOUND)
|
||||
|
||||
|
||||
|
||||
###########################################
|
||||
#
|
||||
# Macros for building ROOT dictionary
|
||||
#
|
||||
###########################################
|
||||
|
||||
MACRO (ROOT_GENERATE_DICTIONARY_OLD )
|
||||
|
||||
set(INFILES "")
|
||||
|
||||
foreach (_current_FILE ${ARGN})
|
||||
|
||||
IF (${_current_FILE} MATCHES "^.*\\.h$")
|
||||
IF (${_current_FILE} MATCHES "^.*Link.*$")
|
||||
set(LINKDEF_FILE ${_current_FILE})
|
||||
ELSE (${_current_FILE} MATCHES "^.*Link.*$")
|
||||
set(INFILES ${INFILES} ${_current_FILE})
|
||||
ENDIF (${_current_FILE} MATCHES "^.*Link.*$")
|
||||
ELSE (${_current_FILE} MATCHES "^.*\\.h$")
|
||||
IF (${_current_FILE} MATCHES "^.*\\.cxx$")
|
||||
set(OUTFILE ${_current_FILE})
|
||||
ELSE (${_current_FILE} MATCHES "^.*\\.cxx$")
|
||||
set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE})
|
||||
ENDIF (${_current_FILE} MATCHES "^.*\\.cxx$")
|
||||
ENDIF (${_current_FILE} MATCHES "^.*\\.h$")
|
||||
|
||||
endforeach (_current_FILE ${ARGN})
|
||||
|
||||
# MESSAGE("INFILES: ${INFILES}")
|
||||
# MESSAGE("OutFILE: ${OUTFILE}")
|
||||
# MESSAGE("LINKDEF_FILE: ${LINKDEF_FILE}")
|
||||
# MESSAGE("INCLUDE_DIRS: ${INCLUDE_DIRS}")
|
||||
|
||||
STRING(REGEX REPLACE "(^.*).cxx" "\\1.h" bla "${OUTFILE}")
|
||||
# MESSAGE("BLA: ${bla}")
|
||||
SET (OUTFILES ${OUTFILE} ${bla})
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES}
|
||||
COMMAND ${ROOT_CINT_EXECUTABLE}
|
||||
ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES})
|
||||
|
||||
# MESSAGE("ROOT_CINT_EXECUTABLE has created the dictionary ${OUTFILE}")
|
||||
|
||||
ENDMACRO (ROOT_GENERATE_DICTIONARY_OLD)
|
||||
|
||||
###########################################
|
||||
#
|
||||
# Macros for building ROOT dictionary
|
||||
#
|
||||
###########################################
|
||||
|
||||
MACRO (ROOT_GENERATE_DICTIONARY INFILES LINKDEF_FILE OUTFILE INCLUDE_DIRS_IN)
|
||||
|
||||
set(INCLUDE_DIRS)
|
||||
|
||||
foreach (_current_FILE ${INCLUDE_DIRS_IN})
|
||||
set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE})
|
||||
endforeach (_current_FILE ${INCLUDE_DIRS_IN})
|
||||
|
||||
|
||||
# MESSAGE("INFILES: ${INFILES}")
|
||||
# MESSAGE("OutFILE: ${OUTFILE}")
|
||||
# MESSAGE("LINKDEF_FILE: ${LINKDEF_FILE}")
|
||||
# MESSAGE("INCLUDE_DIRS: ${INCLUDE_DIRS}")
|
||||
|
||||
STRING(REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" bla "${OUTFILE}")
|
||||
# MESSAGE("BLA: ${bla}")
|
||||
SET (OUTFILES ${OUTFILE} ${bla})
|
||||
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES}
|
||||
COMMAND LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR} ROOTSYS=${ROOTSYS} ${ROOT_CINT_EXECUTABLE}
|
||||
ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES} ${LINKDEF_FILE})
|
||||
else (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
if (CMAKE_SYSTEM_NAME MATCHES Darwin)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES}
|
||||
COMMAND DYLD_LIBRARY_PATH=${ROOT_LIBRARY_DIR} ROOTSYS=${ROOTSYS} ${ROOT_CINT_EXECUTABLE}
|
||||
ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES} ${LINKDEF_FILE})
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES Darwin)
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
|
||||
ENDMACRO (ROOT_GENERATE_DICTIONARY)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MACRO (GENERATE_ROOT_TEST_SCRIPT SCRIPT_FULL_NAME)
|
||||
|
||||
get_filename_component(path_name ${SCRIPT_FULL_NAME} PATH)
|
||||
get_filename_component(file_extension ${SCRIPT_FULL_NAME} EXT)
|
||||
get_filename_component(file_name ${SCRIPT_FULL_NAME} NAME_WE)
|
||||
set(shell_script_name "${file_name}.sh")
|
||||
|
||||
#MESSAGE("PATH: ${path_name}")
|
||||
#MESSAGE("Ext: ${file_extension}")
|
||||
#MESSAGE("Name: ${file_name}")
|
||||
#MESSAGE("Shell Name: ${shell_script_name}")
|
||||
|
||||
string(REPLACE ${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_BINARY_DIR} new_path ${path_name}
|
||||
)
|
||||
|
||||
#MESSAGE("New PATH: ${new_path}")
|
||||
|
||||
file(MAKE_DIRECTORY ${new_path}/data)
|
||||
|
||||
CONVERT_LIST_TO_STRING(${LD_LIBRARY_PATH})
|
||||
set(MY_LD_LIBRARY_PATH ${output})
|
||||
set(my_script_name ${SCRIPT_FULL_NAME})
|
||||
|
||||
if(CMAKE_SYSTEM MATCHES Darwin)
|
||||
configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/root_macro_macos.sh.in
|
||||
${new_path}/${shell_script_name}
|
||||
)
|
||||
else(CMAKE_SYSTEM MATCHES Darwin)
|
||||
configure_file(${PROJECT_SOURCE_DIR}/cmake/scripts/root_macro.sh.in
|
||||
${new_path}/${shell_script_name}
|
||||
)
|
||||
endif(CMAKE_SYSTEM MATCHES Darwin)
|
||||
|
||||
EXEC_PROGRAM(/bin/chmod ARGS "u+x ${new_path}/${shell_script_name}")
|
||||
|
||||
ENDMACRO (GENERATE_ROOT_TEST_SCRIPT)
|
||||
164
CMake/FindROOTv6.cmake
Normal file
164
CMake/FindROOTv6.cmake
Normal file
@@ -0,0 +1,164 @@
|
||||
# - Finds ROOT instalation
|
||||
# This module sets up ROOT information
|
||||
# It defines:
|
||||
# ROOT_FOUND If the ROOT is found
|
||||
# ROOT_INCLUDE_DIR PATH to the include directory
|
||||
# ROOT_LIBRARIES Most common libraries
|
||||
# ROOT_LIBRARY_DIR PATH to the library directory
|
||||
#
|
||||
# Updated by K. Smith (ksmith37@nd.edu) to properly handle
|
||||
# dependncies in ROOT_GENERATE_DICTIONARY
|
||||
|
||||
set(ROOT_ROOTSYS $ENV{ROOTSYS} CACHE PATH "path of root installation")
|
||||
|
||||
|
||||
unset(ROOT_CONFIG_EXECUTABLE CACHE)
|
||||
find_program(ROOT_CONFIG_EXECUTABLE root-config
|
||||
PATHS ${ROOT_ROOTSYS}/bin NO_DEFAULT_PATH)
|
||||
|
||||
if(NOT ROOT_CONFIG_EXECUTABLE)
|
||||
set(ROOT_FOUND FALSE)
|
||||
else()
|
||||
set(ROOT_FOUND TRUE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix
|
||||
OUTPUT_VARIABLE ROOTSYS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE ROOT_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --incdir
|
||||
OUTPUT_VARIABLE ROOT_INCLUDE_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${ROOT_CONFIG_EXECUTABLE} --libs
|
||||
OUTPUT_VARIABLE ROOT_LIBRARIES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
#set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof)
|
||||
#set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lProofPlayer -lMLP -lSpectrum -lEve -lRGL -lGed -lXMLParser -lPhysics)
|
||||
set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ROOT DEFAULT_MSG ROOT_CONFIG_EXECUTABLE
|
||||
ROOTSYS ROOT_VERSION ROOT_INCLUDE_DIR ROOT_LIBRARIES ROOT_LIBRARY_DIR)
|
||||
|
||||
mark_as_advanced(ROOT_CONFIG_EXECUTABLE)
|
||||
|
||||
include(CMakeParseArguments)
|
||||
unset(ROOT_CINT_EXECUTABLE CACHE)
|
||||
find_program(ROOT_CINT_EXECUTABLE rootcint PATHS ${ROOT_ROOTSYS}/bin NO_DEFAULT_PATH )
|
||||
mark_as_advanced(ROOT_CINT_EXECUTABLE)
|
||||
|
||||
|
||||
unset(ROOT_GENREFLEX_EXECUTABLE CACHE)
|
||||
find_program(ROOT_GENREFLEX_EXECUTABLE genreflex PATHS ${ROOT_ROOTSYS}/bin NO_DEFAULT_PATH)
|
||||
mark_as_advanced(ROOT_GENREFLEX_EXECUTABLE)
|
||||
|
||||
find_package(GCCXML)
|
||||
|
||||
include(uLibDebugMacro)
|
||||
#----------------------------------------------------------------------------
|
||||
# function ROOT_GENERATE_DICTIONARY( dictionary
|
||||
# header1 header2 ...
|
||||
# LINKDEF linkdef1 ...
|
||||
# OPTIONS opt1...)
|
||||
function(ROOT_GENERATE_DICTIONARY dictionary)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "" "" "LINKDEF;OPTIONS" "" ${ARGN})
|
||||
message(" -- generating rootcint dictionary --------------------------------------- ")
|
||||
#---Get the list of include directories------------------
|
||||
get_directory_property(incdirs INCLUDE_DIRECTORIES)
|
||||
set(includedirs)
|
||||
foreach( d ${incdirs})
|
||||
set(includedirs ${includedirs} -I${d})
|
||||
endforeach()
|
||||
#---Get the list of header files-------------------------
|
||||
set(headerfiles)
|
||||
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
|
||||
find_file(headerFile ${fp} PATHS ${incdirs})
|
||||
set(headerfiles ${headerfiles} ${headerFile})
|
||||
debug(headerFile)
|
||||
unset(headerFile CACHE)
|
||||
endforeach()
|
||||
#---Get LinkDef.h file------------------------------------
|
||||
set(linkdefs)
|
||||
foreach( f ${ARG_LINKDEF})
|
||||
find_file(linkFile ${f} PATHS ${incdirs})
|
||||
set(linkdefs ${linkdefs} ${linkFile})
|
||||
debug(linkdefs)
|
||||
unset(linkFile CACHE)
|
||||
endforeach()
|
||||
#---call rootcint------------------------------------------
|
||||
add_custom_command(OUTPUT ${dictionary}.cxx ${dictionary}.h
|
||||
COMMAND ${ROOT_CINT_EXECUTABLE} -cint -f ${dictionary}.cxx
|
||||
-c -p ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs}
|
||||
DEPENDS ${headerfiles} ${linkdefs} VERBATIM)
|
||||
message(" -- ---------------------------------------------------------------------- ")
|
||||
endfunction()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# function REFLEX_GENERATE_DICTIONARY(dictionary
|
||||
# header1 header2 ...
|
||||
# SELECTION selectionfile ...
|
||||
# OPTIONS opt1...)
|
||||
function(REFLEX_GENERATE_DICTIONARY dictionary)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG "" "" "SELECTION;OPTIONS" "" ${ARGN})
|
||||
#---Get the list of header files-------------------------
|
||||
set(headerfiles)
|
||||
foreach(fp ${ARG_UNPARSED_ARGUMENTS})
|
||||
file(GLOB files ${fp})
|
||||
if(files)
|
||||
foreach(f ${files})
|
||||
set(headerfiles ${headerfiles} ${f})
|
||||
endforeach()
|
||||
else()
|
||||
set(headerfiles ${headerfiles} ${fp})
|
||||
endif()
|
||||
endforeach()
|
||||
#---Get Selection file------------------------------------
|
||||
if(IS_ABSOLUTE ${ARG_SELECTION})
|
||||
set(selectionfile ${ARG_SELECTION})
|
||||
else()
|
||||
set(selectionfile ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_SELECTION})
|
||||
endif()
|
||||
#---Get the list of include directories------------------
|
||||
get_directory_property(incdirs INCLUDE_DIRECTORIES)
|
||||
set(includedirs)
|
||||
foreach( d ${incdirs})
|
||||
set(includedirs ${includedirs} -I${d})
|
||||
endforeach()
|
||||
#---Get preprocessor definitions--------------------------
|
||||
get_directory_property(defs COMPILE_DEFINITIONS)
|
||||
foreach( d ${defs})
|
||||
set(definitions ${definitions} -D${d})
|
||||
endforeach()
|
||||
#---Nanes and others---------------------------------------
|
||||
set(gensrcdict ${dictionary}.cpp)
|
||||
if(MSVC)
|
||||
set(gccxmlopts "--gccxmlopt=\"--gccxml-compiler cl\"")
|
||||
else()
|
||||
#set(gccxmlopts "--gccxmlopt=\'--gccxml-cxxflags -m64 \'")
|
||||
set(gccxmlopts)
|
||||
endif()
|
||||
#set(rootmapname ${dictionary}Dict.rootmap)
|
||||
#set(rootmapopts --rootmap=${rootmapname} --rootmap-lib=${libprefix}${dictionary}Dict)
|
||||
#---Check GCCXML and get path-----------------------------
|
||||
if(GCCXML)
|
||||
get_filename_component(gccxmlpath ${GCCXML} PATH)
|
||||
else()
|
||||
message(WARNING "GCCXML not found. Install and setup your environment to find 'gccxml' executable")
|
||||
endif()
|
||||
#---Actual command----------------------------------------
|
||||
add_custom_command(OUTPUT ${gensrcdict} ${rootmapname}
|
||||
COMMAND ${GENREFLEX_EXECUTABLE} ${headerfiles} -o ${gensrcdict} ${gccxmlopts} ${rootmapopts} --select=${selectionfile}
|
||||
--gccxmlpath=${gccxmlpath} ${ARG_OPTIONS} ${includedirs} ${definitions}
|
||||
DEPENDS ${headerfiles} ${selectionfile})
|
||||
endfunction()
|
||||
|
||||
23
CMake/FindReadLine.cmake
Normal file
23
CMake/FindReadLine.cmake
Normal file
@@ -0,0 +1,23 @@
|
||||
# Base Io build system
|
||||
# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
|
||||
#
|
||||
# Find libreadline.
|
||||
|
||||
FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h readline/history.h)
|
||||
|
||||
SET(READLINE_NAMES ${READLINE_NAMES} readline libreadline history libhistory)
|
||||
FIND_LIBRARY(READLINE_LIBRARY NAMES ${READLINE_NAMES} PATH)
|
||||
|
||||
IF(READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
|
||||
SET(READLINE_FOUND TRUE)
|
||||
ENDIF(READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
|
||||
|
||||
IF(READLINE_FOUND)
|
||||
IF(NOT Readline_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Readline: ${READLINE_LIBRARY}")
|
||||
ENDIF (NOT Readline_FIND_QUIETLY)
|
||||
ELSE(READLINE_FOUND)
|
||||
IF(Readline_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find readline")
|
||||
ENDIF(Readline_FIND_REQUIRED)
|
||||
ENDIF (READLINE_FOUND)
|
||||
141
CMake/FindVTK.cmake
Normal file
141
CMake/FindVTK.cmake
Normal file
@@ -0,0 +1,141 @@
|
||||
# - Find a VTK installation or build tree.
|
||||
# The following variables are set if VTK is found. If VTK is not
|
||||
# found, VTK_FOUND is set to false.
|
||||
# VTK_FOUND - Set to true when VTK is found.
|
||||
# VTK_USE_FILE - CMake file to use VTK.
|
||||
# VTK_MAJOR_VERSION - The VTK major version number.
|
||||
# VTK_MINOR_VERSION - The VTK minor version number
|
||||
# (odd non-release).
|
||||
# VTK_BUILD_VERSION - The VTK patch level
|
||||
# (meaningless for odd minor).
|
||||
# VTK_INCLUDE_DIRS - Include directories for VTK
|
||||
# VTK_LIBRARY_DIRS - Link directories for VTK libraries
|
||||
# VTK_KITS - List of VTK kits, in CAPS
|
||||
# (COMMON,IO,) etc.
|
||||
# VTK_LANGUAGES - List of wrapped languages, in CAPS
|
||||
# (TCL, PYHTON,) etc.
|
||||
# The following cache entries must be set by the user to locate VTK:
|
||||
# VTK_DIR - The directory containing VTKConfig.cmake.
|
||||
# This is either the root of the build tree,
|
||||
# or the lib/vtk directory. This is the
|
||||
# only cache entry.
|
||||
# The following variables are set for backward compatibility and
|
||||
# should not be used in new code:
|
||||
# USE_VTK_FILE - The full path to the UseVTK.cmake file.
|
||||
# This is provided for backward
|
||||
# compatibility. Use VTK_USE_FILE
|
||||
# instead.
|
||||
#
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2001-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# Assume not found.
|
||||
SET(VTK_FOUND 0)
|
||||
|
||||
# VTK 4.0 did not provide VTKConfig.cmake.
|
||||
IF("${VTK_FIND_VERSION}" VERSION_LESS 4.1)
|
||||
SET(_VTK_40_ALLOW 1)
|
||||
IF(VTK_FIND_VERSION)
|
||||
SET(_VTK_40_ONLY 1)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Construct consitent error messages for use below.
|
||||
SET(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.")
|
||||
IF(_VTK_40_ALLOW)
|
||||
SET(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.")
|
||||
ENDIF()
|
||||
SET(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}")
|
||||
|
||||
# Check whether VTK 4.0 has already been found.
|
||||
IF(_VTK_40_ALLOW AND VTK_DIR)
|
||||
IF(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
|
||||
SET(VTK_FOUND 1)
|
||||
INCLUDE(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings.
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Use the Config mode of the find_package() command to find VTKConfig.
|
||||
# If this succeeds (possibly because VTK_DIR is already set), the
|
||||
# command will have already loaded VTKConfig.cmake and set VTK_FOUND.
|
||||
IF(NOT _VTK_40_ONLY AND NOT VTK_FOUND)
|
||||
FIND_PACKAGE(VTK QUIET NO_MODULE)
|
||||
ENDIF()
|
||||
|
||||
# Special search for VTK 4.0.
|
||||
IF(_VTK_40_ALLOW AND NOT VTK_DIR)
|
||||
# Old scripts may set these directories in the CMakeCache.txt file.
|
||||
# They can tell us where to find VTKConfig.cmake.
|
||||
SET(VTK_DIR_SEARCH_LEGACY "")
|
||||
IF(VTK_BINARY_PATH AND USE_BUILT_VTK)
|
||||
SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH})
|
||||
ENDIF(VTK_BINARY_PATH AND USE_BUILT_VTK)
|
||||
IF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK)
|
||||
SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY}
|
||||
${VTK_INSTALL_PATH}/lib/vtk)
|
||||
ENDIF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK)
|
||||
|
||||
# Look for UseVTK.cmake in build trees or under <prefix>/include/vtk.
|
||||
FIND_PATH(VTK_DIR
|
||||
NAMES UseVTK.cmake
|
||||
PATH_SUFFIXES vtk-4.0 vtk
|
||||
HINTS $ENV{VTK_DIR}
|
||||
|
||||
PATHS
|
||||
|
||||
# Support legacy cache files.
|
||||
${VTK_DIR_SEARCH_LEGACY}
|
||||
|
||||
# Read from the CMakeSetup registry entries. It is likely that
|
||||
# VTK will have been recently built.
|
||||
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
|
||||
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
|
||||
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
|
||||
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
|
||||
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
|
||||
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
|
||||
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
|
||||
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
|
||||
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
|
||||
[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
|
||||
|
||||
# Help the user find it if we cannot.
|
||||
DOC "The ${VTK_DIR_DESCRIPTION}"
|
||||
)
|
||||
|
||||
IF(VTK_DIR)
|
||||
IF(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
|
||||
SET(VTK_FOUND 1)
|
||||
INCLUDE(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings.
|
||||
ELSE()
|
||||
# We found the wrong version. Pretend we did not find it.
|
||||
SET(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
IF(VTK_FOUND)
|
||||
# Set USE_VTK_FILE for backward-compatability.
|
||||
SET(USE_VTK_FILE ${VTK_USE_FILE})
|
||||
ELSE(VTK_FOUND)
|
||||
# VTK not found, explain to the user how to specify its location.
|
||||
IF(VTK_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR ${VTK_DIR_MESSAGE})
|
||||
ELSE(VTK_FIND_REQUIRED)
|
||||
IF(NOT VTK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS ${VTK_DIR_MESSAGE})
|
||||
ENDIF(NOT VTK_FIND_QUIETLY)
|
||||
ENDIF(VTK_FIND_REQUIRED)
|
||||
ENDIF(VTK_FOUND)
|
||||
62
CMake/FinduLib.cmake
Normal file
62
CMake/FinduLib.cmake
Normal file
@@ -0,0 +1,62 @@
|
||||
# - Finds ROOT instalation
|
||||
# This module sets up ROOT information
|
||||
# It defines:
|
||||
# ULIB_FOUND If the uLib is found
|
||||
# ULIB_INCLUDE_DIRS PATH to the include directory
|
||||
# ULIB_LIBRARIES Most common libraries
|
||||
# ULIB_LIBRARY_DIRS PATH to the library directory
|
||||
#
|
||||
|
||||
include(uLibFindDependencies)
|
||||
include(uLibDebugMacro)
|
||||
|
||||
## CONFIG FIND -------------------------------------------------------------- ##
|
||||
|
||||
set(CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}/lib/cmake")
|
||||
unset(ULIB_CONFIG)
|
||||
find_package(ULIB ${ULIB_PACKAGE_VERSION} CONFIG
|
||||
NAMES uLib
|
||||
PATH_SUFFIXES ${ULIB_PACKAGE_NAME}
|
||||
)
|
||||
|
||||
debug(ULIB_CONFIG)
|
||||
debug(ULIB_CONSIDERED_CONFIGS)
|
||||
debug(ULIB_CONSIDERED_VERSIONS)
|
||||
debug(ULIB_INCLUDE_DIRS)
|
||||
debug(ULIB_LIBRARIES)
|
||||
|
||||
if(ULIB_CONFIG)
|
||||
set(ULIB_FOUND true)
|
||||
endif()
|
||||
|
||||
## MODULE FIND -------------------------------------------------------------- ##
|
||||
|
||||
#find_path(uLib_INCLUDE_DIR
|
||||
# NAMES ulib.h
|
||||
# PATH_SUFFIXES mutom-0.2
|
||||
#)
|
||||
#debug(uLib_INCLUDE_DIR)
|
||||
|
||||
#find_file(uLib_USE_FILE
|
||||
# NAMES uLib_exported_targets.cmake
|
||||
# PATHS lib lib64
|
||||
# PATH_SUFFIXES mutom-0.2
|
||||
#)
|
||||
#debug(uLib_USE_FILE)
|
||||
|
||||
#find_library(uLib_LIBRARY
|
||||
# NAMES libmutomCore.so
|
||||
# PATH_SUFFIXES mutom-0.2
|
||||
# )
|
||||
#debug(uLib_LIBRARY)
|
||||
|
||||
##set( uLib_PROCESS_INCLUDES uLib_INCLUDE_DIR ULIB_INCLUDE_DIRS )
|
||||
##set( uLib_PROCESS_LIBS uLib_LIBRARY ULIB_LIBRARIES )
|
||||
##libfind_process(uLib)
|
||||
|
||||
#set( ULIB_INCLUDE_DIRS ${uLib_INCLUDE_DIR} )
|
||||
#set( ULIB_LIBRARIES ${uLib_LIBRARY} )
|
||||
#include(FindPackageHandleStandardArgs)
|
||||
#find_package_handle_standard_args(uLib DEFAULT_MSG
|
||||
# uLib_LIBRARY uLib_INCLUDE_DIR)
|
||||
#mark_as_advanced(uLib_INCLUDE_DIR uLib_LIBRARY)
|
||||
11
CMake/clean-all.cmake
Normal file
11
CMake/clean-all.cmake
Normal file
@@ -0,0 +1,11 @@
|
||||
set(cmake_generated ${CMAKE_BINARY_DIR}/CMakeCache.txt
|
||||
${CMAKE_BINARY_DIR}/cmake_install.cmake
|
||||
${CMAKE_BINARY_DIR}/Makefile
|
||||
${CMAKE_BINARY_DIR}/CMakeFiles
|
||||
)
|
||||
|
||||
foreach(file ${cmake_generated})
|
||||
if (EXISTS ${file})
|
||||
file(REMOVE_RECURSE ${file})
|
||||
endif()
|
||||
endforeach(file)
|
||||
47
CMake/rmake.in
Normal file
47
CMake/rmake.in
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# CONNECTION ---------------------------------------------------------------- ##
|
||||
USER=@REMOTE_BUILD_USER@
|
||||
MACHINES="@REMOTE_BUILD_MACHINES@"
|
||||
SSH=@REMOTE_BUILD_SSHBIN@
|
||||
PORT=@REMOTE_BUILD_SSHPORT@
|
||||
|
||||
# BUILD --------------------------------------------------------------------- ##
|
||||
|
||||
MAKE=@REMOTE_BUILD_MAKEBIN@
|
||||
BUILD_DIR=@REMOTE_BUILD_BULIDIR@
|
||||
SOURCE_DIR=@REMOTE_BUILD_SRCDIR@
|
||||
CURRENT_DIR=`pwd`
|
||||
ARGS=$@
|
||||
|
||||
|
||||
# FIND RELATIVE PATH -------------------------------------------------------- ##
|
||||
|
||||
function relpath {
|
||||
# both $1 and $2 are absolute paths
|
||||
# returns $2 relative to $1
|
||||
source=$1
|
||||
target=$2
|
||||
common_part=$source
|
||||
back=
|
||||
while [ "${target#$common_part}" = "${target}" ]; do
|
||||
common_part=$(dirname $common_part)
|
||||
back="../${back}"
|
||||
done
|
||||
echo ${back}${target#$common_part/}
|
||||
}
|
||||
|
||||
CURRENT_SRCDIR=$(cd -- ${CURRENT_DIR}/$(relpath $BUILD_DIR/ $SOURCE_DIR/)/ && pwd)
|
||||
|
||||
|
||||
|
||||
for m in ${MACHINES}; do
|
||||
echo "building into machine: ${m}"
|
||||
echo "remote commands: --------------------------------------------------------------------------------------------------------------"
|
||||
echo "source dir = ${SOURCE_DIR}"
|
||||
echo "build dir = ${BUILD_DIR}"
|
||||
echo "repath to LOCAL MACHINE source dir = ${CURRENT_SRCDIR}"
|
||||
echo "${SSH} -p ${PORT} ${USER}@${m} ${MAKE} -C ${BUILD_DIR} ${ARGS} 3>&1 1>&2 2>&3 | sed -e 's|${SOURCE_DIR}|${CURRENT_SRCDIR}|g' 3>&1 1>&2 2>&3"
|
||||
echo " ------------------------------------------------------------------------------------------------------------------------------"
|
||||
${SSH} -p ${PORT} ${USER}@${m} "${MAKE} -C ${BUILD_DIR} ${ARGS} 3>&1 1>&2 2>&3 | sed -e 's|${SOURCE_DIR}|${CURRENT_SRCDIR}|g'" 3>&1 1>&2 2>&3
|
||||
done
|
||||
64
CMake/uLibCommon.cmake
Normal file
64
CMake/uLibCommon.cmake
Normal file
@@ -0,0 +1,64 @@
|
||||
include(uLibMacros)
|
||||
include_guard(ULIB_COMMON_CMAKE)
|
||||
|
||||
include(uLibDebugMacro)
|
||||
|
||||
## DIRECTORIES -------------------------------------------------------------- ##
|
||||
|
||||
set(ULIB_PARENT_PATH "${PROJECT_SOURCE_DIR}")
|
||||
message(STATUS "Setting uLib parent path to: ${ULIB_PARENT_PATH}")
|
||||
|
||||
## Build directories ##
|
||||
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib CACHE PATH "build path for lib")
|
||||
mark_as_advanced(LIBRARY_OUTPUT_PATH)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "build path for binaries")
|
||||
mark_as_advanced(EXECUTABLE_OUTPUT_PATH)
|
||||
|
||||
## Install directories ##
|
||||
set(PACKAGE_INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
|
||||
set(PACKAGE_INSTALL_LIB_DIR lib/${PACKAGE_NAME} CACHE PATH "Installation directory for libraries")
|
||||
set(PACKAGE_INSTALL_INC_DIR include/${PACKAGE_NAME} CACHE PATH "Installation directory for headers")
|
||||
set(PACKAGE_INSTALL_DATA_DIR share/${PACKAGE_NAME} CACHE PATH "Installation directory for data files")
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set(DEF_INSTALL_CMAKE_DIR CMake)
|
||||
else()
|
||||
set(DEF_INSTALL_CMAKE_DIR lib/cmake/${PACKAGE_NAME})
|
||||
endif()
|
||||
set(PACKAGE_INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
|
||||
|
||||
# Make relative paths absolute (needed later on)
|
||||
foreach(p LIB BIN INC DATA CMAKE)
|
||||
set(var PACKAGE_INSTALL_${p}_DIR)
|
||||
if(NOT IS_ABSOLUTE "${${var}}")
|
||||
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||||
endif()
|
||||
mark_as_advanced(PACKAGE_INSTALL_${p}_DIR)
|
||||
debug(PACKAGE_INSTALL_${p}_DIR)
|
||||
endforeach()
|
||||
|
||||
# add the binary tree to the search path for include files
|
||||
# so that we will find config.h
|
||||
set(SRC_DIR ${PROJECT_SOURCE_DIR}/src)
|
||||
include_directories(${PROJECT_BINARY_DIR})
|
||||
include_directories(${SRC_DIR})
|
||||
|
||||
|
||||
## GLOBAL OPTIONS ----------------------------------------------------------- ##
|
||||
|
||||
# Set a default build type to RELEASE WITH DEBUG INFO if none was specified
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to 'Release' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
||||
# Set the possible values of build type for cmake-gui
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
|
||||
"MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_WARNING_OPTION "" CACHE STRING "Warning level -WAll to verbose all warnings")
|
||||
set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE STRING "Verbose compile output switch")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x ${CMAKE_CXX_WARNING_OPTION}")
|
||||
|
||||
|
||||
|
||||
|
||||
57
CMake/uLibConfigHeader.cmake
Normal file
57
CMake/uLibConfigHeader.cmake
Normal file
@@ -0,0 +1,57 @@
|
||||
include(uLibMacros)
|
||||
include_guard(ULIB_CONFIG_HEADER_CMAKE)
|
||||
|
||||
|
||||
## CONFIG ------------------------------------------------------------------- ##
|
||||
|
||||
message("/////////// CONFIG HEADER //////////////")
|
||||
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
## force to use PP variadics (FIX) ##
|
||||
set(BOOST_PP_VARIADICS ON)
|
||||
|
||||
message(STATUS "PROJECT NAME = ${PROJECT_NAME}")
|
||||
message(STATUS "PACKAGE VERSION = ${PACKAGE_VERSION}")
|
||||
message(STATUS "PACKAGE NAME = ${PACKAGE_NAME}")
|
||||
execute_process(COMMAND "svnversion"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE SVN_REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
|
||||
message(STATUS "SVN REVISION = ${SVN_REVISION}")
|
||||
|
||||
CHECK_INCLUDE_FILES(inittypes.h HAVE_INITTYPES_H)
|
||||
CHECK_INCLUDE_FILES(stdbool.h HAVE_STDBOOL_H)
|
||||
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
|
||||
CHECK_INCLUDE_FILES(stdlib.h HAVE_STDLIB_H)
|
||||
|
||||
CHECK_INCLUDE_FILES(dlfcn.h HAVE_DLFCN_H)
|
||||
CHECK_INCLUDE_FILES(malloc.h HAVE_MALLOC_H)
|
||||
CHECK_FUNCTION_EXISTS(malloc HAVE_MALLOC)
|
||||
CHECK_INCLUDE_FILES(memory.h HAVE_MEMORY_H)
|
||||
|
||||
CHECK_INCLUDE_FILES(math.h HAVE_MATH_H)
|
||||
CHECK_FUNCTION_EXISTS(fsetround HAVE_FSETROUND)
|
||||
CHECK_FUNCTION_EXISTS(floor HAVE_FLOOR)
|
||||
CHECK_FUNCTION_EXISTS(pow HAVE_POW)
|
||||
CHECK_FUNCTION_EXISTS(sqrt HAVE_SQRT)
|
||||
|
||||
CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
|
||||
CHECK_FUNCTION_EXISTS(strstr HAVE_STRSTR)
|
||||
CHECK_INCLUDE_FILES(strings.h HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILES(string.h HAVE_STRING_H)
|
||||
|
||||
CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
|
||||
|
||||
CHECK_INCLUDE_FILES(assert.h HAVE_ASSERT_H)
|
||||
|
||||
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/CMakeConfig.in.h"
|
||||
"${PROJECT_BINARY_DIR}/config.h"
|
||||
)
|
||||
54
CMake/uLibDebugMacro.cmake
Normal file
54
CMake/uLibDebugMacro.cmake
Normal file
@@ -0,0 +1,54 @@
|
||||
include(uLibMacros)
|
||||
include_guard(ULIB_DEBUG_MACRO_CMAKE)
|
||||
|
||||
|
||||
set(CMAKE_CONFIGURE_DEBUG_ENABLE ON CACHE BOOL "cmake configure debugger")
|
||||
set(CMAKE_CONFIGURE_DEBUG_LIST OFF CACHE BOOL "cmake debugger show list enable")
|
||||
mark_as_advanced(
|
||||
CMAKE_CONFIGURE_DEBUG_ENABLE
|
||||
CMAKE_CONFIGURE_DEBUG_LIST
|
||||
)
|
||||
|
||||
macro(debug str)
|
||||
if(CMAKE_CONFIGURE_DEBUG_ENABLE)
|
||||
set(var ${${str}})
|
||||
list(LENGTH var len)
|
||||
if((${len} GREATER 1) AND CMAKE_CONFIGURE_DEBUG_LIST)
|
||||
message(STATUS "[DEBUG] [${str}] list: ")
|
||||
foreach(item ${var})
|
||||
message(STATUS " -> ${item}")
|
||||
endforeach()
|
||||
else()
|
||||
message(STATUS "[DEBUG] [${str}] ${var}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(debug_list str)
|
||||
if(CMAKE_CONFIGURE_DEBUG_ENABLE)
|
||||
set(var ${${str}})
|
||||
list(LENGTH var len)
|
||||
if((${len} GREATER 1))
|
||||
message(STATUS "[DEBUG] [${str}] list: ")
|
||||
foreach(item ${var})
|
||||
message(STATUS " -> ${item}")
|
||||
endforeach()
|
||||
else()
|
||||
message(STATUS "[DEBUG] [${str}] ${var}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(debug_package str)
|
||||
if(CMAKE_CONFIGURE_DEBUG_ENABLE)
|
||||
set(have ${str}_FOUND)
|
||||
if(${have})
|
||||
debug("${str}_INCLUDE_DIRS")
|
||||
debug("${str}_LIBRARIES")
|
||||
debug("${str}_LIBRARY_DIRS")
|
||||
debug("${str}_DEFINITIONS")
|
||||
else(${have})
|
||||
message(WARNING "package ${str} not found")
|
||||
endif(${have})
|
||||
endif(CMAKE_CONFIGURE_DEBUG_ENABLE)
|
||||
endmacro()
|
||||
122
CMake/uLibFindDependencies.cmake
Normal file
122
CMake/uLibFindDependencies.cmake
Normal file
@@ -0,0 +1,122 @@
|
||||
include(uLibMacros)
|
||||
include_guard(ULIB_FIND_DEPENDENCIES_CMAKE)
|
||||
|
||||
include(uLibDebugMacro)
|
||||
|
||||
################################################################################
|
||||
## PKG FIND ##
|
||||
message("/////////// LOOKING FOR EXTERNAL PACKAGES //////////////")
|
||||
|
||||
## BOOST ##
|
||||
message(STATUS "## BOOST ##")
|
||||
set(Boost_USE_STATIC_LIBS OFF)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
|
||||
find_package(Boost 1.45.0 COMPONENTS serialization signals program_options REQUIRED)
|
||||
if(Boost_FOUND)
|
||||
set(HAVE_BOOST true)
|
||||
endif(Boost_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
|
||||
## OPEN MP ##
|
||||
message(STATUS "## OPEN MP ##")
|
||||
find_package(OpenMP)
|
||||
option(OpenMP_ACTIVE "Activate OpenMP parallel compilation" ON)
|
||||
if(OPENMP_FOUND AND OpenMP_ACTIVE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
||||
endif(OPENMP_FOUND AND OpenMP_ACTIVE)
|
||||
|
||||
## EIGEN ##
|
||||
message(STATUS "## EIGEN ##")
|
||||
# option(USE_EIGEN ON) ## REQUIRED
|
||||
find_package(Eigen3 REQUIRED)
|
||||
debug(EIGEN3_INCLUDE_DIR)
|
||||
include_directories(${EIGEN3_INCLUDE_DIR})
|
||||
|
||||
## ROOT ##
|
||||
message(STATUS "## ROOT ##")
|
||||
option(ULIB_USE_ROOT "Activate use of Root integration" ON)
|
||||
### <<<--- ROOT IS REQUIRED FOR THE MOMENT ###
|
||||
#if(ULIB_USE_ROOT)
|
||||
include(FindROOTv6)
|
||||
find_package(ROOT REQUIRED)
|
||||
if(ROOT_FOUND)
|
||||
set(HAVE_ROOT true)
|
||||
include_directories(${ROOT_INCLUDE_DIR})
|
||||
link_directories(${ROOT_LIBRARY_DIR})
|
||||
debug(ROOT_INCLUDE_DIR)
|
||||
debug(ROOT_LIBRARY_DIR)
|
||||
debug(ROOT_LIBRARIES)
|
||||
else()
|
||||
message(WARNING "Root not found")
|
||||
endif(ROOT_FOUND)
|
||||
#endif(ULIB_USE_ROOT)
|
||||
|
||||
|
||||
## VTK ##
|
||||
option(ULIB_USE_VTK "Activate use of Vtk Visual Pipelines" ON)
|
||||
if(ULIB_USE_VTK)
|
||||
message(STATUS "## VTK ##")
|
||||
message(STATUS "Looking for VTK...")
|
||||
set(VTK_DIR "PATH/TO/VTK/BUILD/DIRECTORY")
|
||||
mark_as_advanced(VTK_DIR)
|
||||
find_package(VTK REQUIRED)
|
||||
include(${VTK_USE_FILE})
|
||||
#message(STATUS "VTK included libraries: ${VTK_LIBRARIES}")
|
||||
debug(VTK_USE_FILE)
|
||||
debug(VTK_INCLUDE_DIRS)
|
||||
debug(VTK_LIBRARY_DIRS)
|
||||
debug(VTK_LIBRARIES)
|
||||
# get_directory_property(compile_def COMPILE_DEFINITIONS)
|
||||
# debug(compile_def)
|
||||
endif(ULIB_USE_VTK)
|
||||
|
||||
|
||||
## GEANT ##
|
||||
option(ULIB_USE_GEANT4 "Activate use of GEANT Integration" ON)
|
||||
message(STATUS "## GEANT 4 ##")
|
||||
#include(FindGEANT4) # disabled using system finder
|
||||
find_package(Geant4)
|
||||
set(GEANT4_FOUND Geant4_DIR)
|
||||
if(GEANT4_FOUND AND ULIB_USE_GEANT4)
|
||||
message(STATUS "Looking for Geant4... - Geant4 found in ${Geant4_DIR}")
|
||||
set(HAVE_GEANT4 true)
|
||||
include_directories(${Geant4_INCLUDE_DIRS}) # Add -I type paths
|
||||
add_definitions(${Geant4_DEFINITIONS}) # Add -D type defs
|
||||
debug_package(Geant4)
|
||||
endif(GEANT4_FOUND AND ULIB_USE_GEANT4)
|
||||
|
||||
## QT4 ##
|
||||
option(ULIB_USE_QT4 "Activate use of Qt Framework" ON)
|
||||
if(ULIB_USE_QT4)
|
||||
message(STATUS "## QT4 ##")
|
||||
find_package(Qt4)
|
||||
# include_directories(${Qt4_INCLUDE_DIRS})
|
||||
# debug(Qt4_INCLUDE_DIRS)
|
||||
endif(ULIB_USE_QT4)
|
||||
|
||||
## QT5 ##
|
||||
option(ULIB_USE_QT5 "Activate use of Qt Framework" ON)
|
||||
if(ULIB_USE_QT5)
|
||||
message(STATUS "## QT5 ##")
|
||||
find_package(Qt5Widgets)
|
||||
# include_directories(${Qt5_INCLUDE_DIRS})
|
||||
# debug(Qt5_INCLUDE_DIRS)
|
||||
endif(ULIB_USE_QT5)
|
||||
|
||||
## READLINE ##
|
||||
message(STATUS "## READLINE ##")
|
||||
find_package(ReadLine)
|
||||
include_directories(${READLINE_INCLUDE_DIR})
|
||||
debug(READLINE_INCLUDE_DIR)
|
||||
|
||||
## STD MATH REQUIRED ##
|
||||
#message(STATUS "## STD MATH ##")
|
||||
set(CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_INCLUDES math.h)
|
||||
set(CMAKE_REQUIRED_LIBRARIES CMAKE_REQUIRED_LIBRARIES m)
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
47
CMake/uLibGenerateRMake.cmake
Normal file
47
CMake/uLibGenerateRMake.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
|
||||
include(uLibMacros)
|
||||
include(uLibDebugMacro)
|
||||
|
||||
## MAKE REMOTE -------------------------------------------------------------- ##
|
||||
|
||||
#set(BUILD_REMOTE_MACHINES "10.62.19.4" CACHE STRING "remote build in cloud machine")
|
||||
#set(BUILD_REMOTE_USER "rigoni" CACHE STRING "remote build user")
|
||||
#set(BUILD_REMOTE_CMD "${SSH_COMMAND} ${BUILD_REMOTE_USER}@${BUILD_REMOTE_MACHINES} \"make -C \"")
|
||||
#add_custom_target(cloud COMMAND ${SSH_COMMAND})
|
||||
|
||||
|
||||
|
||||
set(REMOTE_BUILD_USER "$ENV{USER}" CACHE STRING "ssh remote build user name")
|
||||
|
||||
execute_process(COMMAND hostname -I OUTPUT_VARIABLE HOSTNAME_IP)
|
||||
set(REMOTE_BUILD_MACHINES ${HOSTNAME_IP} CACHE STRING "ssh remote build machines")
|
||||
|
||||
find_file(SSH_EXECUTABLE ssh PATHS /bin/local/bin /usr/bin /bin)
|
||||
set(REMOTE_BUILD_SSHBIN ${SSH_EXECUTABLE} CACHE FILEPATH "ssh remote build command path")
|
||||
set(REMOTE_BUILD_SSHPORT 22 CACHE STRING "ssh remote build port")
|
||||
|
||||
find_file(MAKE_EXECUTABLE make PATHS /usr/local/bin /usr/bin /bin)
|
||||
set(REMOTE_BUILD_MAKEBIN ${MAKE_EXECUTABLE} CACHE FILEPATH "ssh remote build make path")
|
||||
set(REMOTE_BUILD_BULIDIR ${PROJECT_BINARY_DIR} CACHE PATH "ssh remote build build path")
|
||||
set(REMOTE_BUILD_SRCDIR ${PROJECT_SOURCE_DIR} CACHE PATH "ssh remote build source path")
|
||||
|
||||
message("remote build ----------------------------------------------------------")
|
||||
debug(REMOTE_BUILD_USER)
|
||||
debug(REMOTE_BUILD_MACHINES)
|
||||
debug(REMOTE_BUILD_SSHBIN)
|
||||
debug(REMOTE_BUILD_SSHPORT)
|
||||
debug(REMOTE_BUILD_MAKEBIN)
|
||||
message("-----------------------------------------------------------------------")
|
||||
|
||||
|
||||
find_file(RMAKE_IN_FILE rmake.in PATHS ${CMAKE_MODULE_PATH})
|
||||
configure_file(
|
||||
"${RMAKE_IN_FILE}"
|
||||
"${PROJECT_BINARY_DIR}/CMake/rmake" @ONLY
|
||||
)
|
||||
|
||||
file(COPY "${PROJECT_BINARY_DIR}/CMake/rmake"
|
||||
DESTINATION "${PROJECT_BINARY_DIR}"
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
|
||||
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
12
CMake/uLibMacros.cmake
Normal file
12
CMake/uLibMacros.cmake
Normal file
@@ -0,0 +1,12 @@
|
||||
#if(ULIB_MACROS_CMAKE)
|
||||
# return()
|
||||
#endif()
|
||||
#set(ULIB_MACROS_CMAKE 1)
|
||||
|
||||
|
||||
function(include_guard var)
|
||||
if(${var})
|
||||
return()
|
||||
endif()
|
||||
set(${var} 1)
|
||||
endfunction()
|
||||
186
CMake/uLibTargetMacros.cmake
Normal file
186
CMake/uLibTargetMacros.cmake
Normal file
@@ -0,0 +1,186 @@
|
||||
|
||||
include(uLibMacros)
|
||||
include_guard(ULIB_TARGET_MACRO_CMAKE)
|
||||
|
||||
## adds library target
|
||||
macro(uLib_add_library name)
|
||||
add_library(${name} ${ARGN})
|
||||
if(NOT ULIB_INSTALL_NO_LIBRARIES)
|
||||
set_property(GLOBAL APPEND PROPERTY ULIB_TARGETS ${name})
|
||||
endif(NOT ULIB_INSTALL_NO_LIBRARIES)
|
||||
endmacro(uLib_add_library)
|
||||
|
||||
################################################################################
|
||||
## Add SHARED library target ##
|
||||
|
||||
# HEADERS and SOURCES must be defined as list of library headers and sources
|
||||
macro(uLib_add_shared_library name)
|
||||
if(COMMAND cmake_policy)
|
||||
# cmake_policy( SET CMP0022 NEW )
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
set(mname ${PACKAGE_LIBPREFIX}${name})
|
||||
|
||||
if(SOURCES)
|
||||
uLib_add_library(${mname} SHARED ${SOURCES})
|
||||
set(shared ${ULIB_SHARED_LIBRARIES})
|
||||
list(APPEND shared ${mname})
|
||||
set(ULIB_SHARED_LIBRARIES ${shared} PARENT_SCOPE)
|
||||
source_group("${project_name}\\${name}" FILES ${SOURCES})
|
||||
set_target_properties(${mname} PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_SOVERSION}
|
||||
INTERFACE_LINK_LIBRARIES "${LIBRARIES}"
|
||||
LINK_INTERFACE_LIBRARIES "${LIBRARIES}" ## <- ok for cmake from 2.12 ?
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES "${LIBRARIES}" ## <- breaks cmake after 2.11 ?
|
||||
# PUBLIC_HEADER ""
|
||||
)
|
||||
debug(LIBRARIES)
|
||||
|
||||
install(TARGETS ${mname}
|
||||
EXPORT "${PROJECT_NAME}Targets"
|
||||
RUNTIME DESTINATION ${PACKAGE_INSTALL_BIN_DIR} COMPONENT bin
|
||||
LIBRARY DESTINATION ${PACKAGE_INSTALL_LIB_DIR} COMPONENT lib
|
||||
# PUBLIC_HEADER DESTINATION ${PACKAGE_INSTALL_INC_DIR} COMPONENT dev
|
||||
)
|
||||
endif(SOURCES)
|
||||
|
||||
if(HEADERS)
|
||||
foreach(header ${HEADERS})
|
||||
install(FILES ${header} DESTINATION ${PACKAGE_INSTALL_INC_DIR}/${name})
|
||||
endforeach(header)
|
||||
endif(HEADERS)
|
||||
|
||||
endmacro(uLib_add_shared_library)
|
||||
|
||||
|
||||
################################################################################
|
||||
## Add Target ##
|
||||
|
||||
macro(uLib_add_target name)
|
||||
debug(${name})
|
||||
add_executable(${name} ${ARGN})
|
||||
set_property(GLOBAL APPEND PROPERTY ULIB_TARGETS ${name})
|
||||
|
||||
set(exported ${ULIB_EXPORTED_TARGETS})
|
||||
list(APPEND exported ${name})
|
||||
set(ULIB_EXPORTED_TARGETS ${exported} PARENT_SCOPE)
|
||||
|
||||
install(TARGETS ${name}
|
||||
EXPORT "${PROJECT_NAME}Targets"
|
||||
RUNTIME DESTINATION ${PACKAGE_INSTALL_BIN_DIR} COMPONENT bin
|
||||
)
|
||||
ENDMACRO(uLib_add_target)
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
## TESTS ##
|
||||
|
||||
# TESTS and LIBRARIES must be defined
|
||||
macro(uLib_add_tests name)
|
||||
foreach(tn ${TESTS})
|
||||
add_executable(${tn} EXCLUDE_FROM_ALL ${tn}.cpp)
|
||||
add_test(${tn} ${PACKAGE_INSTALL_BIN_DIR}/${tn})
|
||||
|
||||
# adds dependencies to all selected modules in uLib
|
||||
# foreach(module ${ULIB_SELECTED_MODULES})
|
||||
# add_dependencies(${tn} ${project_name}${module})
|
||||
# endforeach(module)
|
||||
|
||||
# adds libraries dependencies
|
||||
foreach(library ${LIBRARIES})
|
||||
target_link_libraries(${tn} ${library})
|
||||
endforeach(library)
|
||||
|
||||
endforeach(tn)
|
||||
|
||||
# custom target to compile all tests
|
||||
add_custom_target(all-${name}-tests)
|
||||
add_dependencies(all-${name}-tests ${TESTS})
|
||||
endmacro(uLib_add_tests name)
|
||||
|
||||
|
||||
################################################################################
|
||||
## UTILS ##
|
||||
|
||||
# UTILS and LIBRARIES must be defined
|
||||
macro(uLib_add_utils name)
|
||||
foreach(tn ${UTILS})
|
||||
add_executable(${tn} ${tn}.cpp)
|
||||
install(TARGETS ${tn} RUNTIME DESTINATION bin)
|
||||
|
||||
# adds dependencies to all selected modules in uLib
|
||||
# foreach(module ${ULIB_SELECTED_MODULES})
|
||||
# add_dependencies(${tn} ${project_name}${module})
|
||||
# endforeach(module)
|
||||
|
||||
# adds libraries dependencies
|
||||
foreach(library ${LIBRARIES})
|
||||
target_link_libraries(${tn} ${library})
|
||||
endforeach(library)
|
||||
|
||||
endforeach(tn)
|
||||
|
||||
# custom target to compile all tests
|
||||
add_custom_target(all-${name})
|
||||
add_dependencies(all-${name} ${UTILS})
|
||||
|
||||
endmacro(uLib_add_utils name)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function(get_gcc_compile_flags target out_flags)
|
||||
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" name)
|
||||
set(flags "${${name}} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_COMPILER_ARG1}")
|
||||
get_target_property(value ${target} COMPILE_FLAGS)
|
||||
if (value)
|
||||
list(APPEND flags ${value})
|
||||
endif()
|
||||
get_target_property(value ${target} TYPE)
|
||||
get_target_property(value ${target} COMPILE_DEFINITIONS)
|
||||
if (value)
|
||||
foreach(item ${value})
|
||||
list(APPEND flags "-D${item}")
|
||||
endforeach()
|
||||
endif()
|
||||
STRING(TOUPPER "COMPILE_DEFINITIONS_${CMAKE_BUILD_TYPE}" name)
|
||||
get_target_property(value ${target} ${name})
|
||||
if (value)
|
||||
foreach(item ${value})
|
||||
list(APPEND flags "-D${item}")
|
||||
endforeach()
|
||||
endif()
|
||||
get_directory_property(value DEFINITIONS)
|
||||
if (value)
|
||||
list(APPEND flags ${value})
|
||||
endif()
|
||||
get_directory_property(value INCLUDE_DIRECTORIES)
|
||||
if (value)
|
||||
foreach(item ${value})
|
||||
list(APPEND flags "-I${item}")
|
||||
endforeach()
|
||||
endif()
|
||||
set(${out_flags} ${flags} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(get_gcc_link_flags target out_flags)
|
||||
set(flags)
|
||||
get_target_property(value ${target} LINK_FLAGS_RELEASE)
|
||||
if (value)
|
||||
message(STATUS "-> ${flags}")
|
||||
list(APPEND flags ${value})
|
||||
endif()
|
||||
get_directory_property(value LINK_DIRECTORIES)
|
||||
if (value)
|
||||
message(STATUS "-> ${flags}")
|
||||
foreach(item ${value})
|
||||
list(APPEND flags "-L${item}")
|
||||
endforeach()
|
||||
endif()
|
||||
message(STATUS "-> ${flags}")
|
||||
set(${out_flags} ${flags} PARENT_SCOPE)
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user