Commit e3087837 authored by Lynn Garren's avatar Lynn Garren
Browse files

building libCLHEP the hard way

parent dd6ecc55
......@@ -45,6 +45,8 @@ ENABLE_TESTING()
# include search path
include_directories ("${PROJECT_BINARY_DIR}")
# add CLHEP/Random to search path so we find gaussTables.cdat
include_directories ("${CMAKE_SOURCE_DIR}/Random")
#build all libraries in a single directory to facilitate testing
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
......@@ -62,15 +64,18 @@ set( CLHEP_subdirs Units Utility Vector Evaluator GenericFunctions Geometry
Random Matrix RandomObjects Cast RefCount Exceptions )
clhep_copy_headers( ${CLHEP_subdirs} )
subdirs(Units)
subdirs(Utility)
subdirs(Vector)
subdirs(Evaluator)
subdirs(GenericFunctions)
subdirs(Geometry)
subdirs(Random)
subdirs(Matrix)
subdirs(RandomObjects)
subdirs(Cast)
subdirs(RefCount)
subdirs(Exceptions)
add_subdirectory(Units)
add_subdirectory(Utility)
add_subdirectory(Vector)
add_subdirectory(Evaluator)
add_subdirectory(GenericFunctions)
add_subdirectory(Geometry)
add_subdirectory(Random)
add_subdirectory(Matrix)
add_subdirectory(RandomObjects)
add_subdirectory(Cast)
add_subdirectory(RefCount)
add_subdirectory(Exceptions)
# we build libclhep from code already compiled
clhep_build_libclhep( ${CLHEP_subdirs} )
# This include has been moved to the top CMakeLists.txt
# add CLHEP/Random to search path so we find gaussTables.cdat
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/..")
#include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/..")
clhep_build_library( Random DoubConv.cc
DRand48Engine.cc
......
# since the CLHEP source code installation does not have the
# expected header paths, install headers in the build directory
# Build package libraries.
# Build the main libCLHEP source code list as we go.
#
# Recommended use:
# clhep_build_library( <package> <source code files> )
#
macro (clhep_build_library package )
set ( libCLHEP_${package}_SOURCES ${ARGN} )
# build up the source list for libCLHEP
set( CLHEP_${package}_list CACHE INTERNAL "${package} sources" FORCE )
foreach( file ${ARGN} )
set( CLHEP_${package}_list ${CLHEP_${package}_list} ${CMAKE_CURRENT_SOURCE_DIR}/${file}
CACHE INTERNAL "${package} sources" )
endforeach(file)
##message( STATUS "in ${package}, clheplib source list ${CLHEP_${package}_list}" )
# check for dependencies
set ( package_library_list )
if( ${PACKAGE}_DEPS )
foreach ( dep ${${PACKAGE}_DEPS} )
......@@ -32,3 +41,28 @@ macro (clhep_build_library package )
ARCHIVE DESTINATION lib
)
endmacro (clhep_build_library)
macro (clhep_build_libclhep )
foreach( pkg ${ARGN} )
##message( STATUS "${pkg} sources are ${CLHEP_${pkg}_list}" )
list(APPEND CLHEP_DEPS ${LIBRARY_OUTPUT_PATH}/libCLHEP-${pkg}-${VERSION}.a )
list(APPEND clhep_sources ${CLHEP_${pkg}_list} )
endforeach()
##message( STATUS "clheplib source list ${clhep_sources}" )
ADD_LIBRARY (CLHEP SHARED ${clhep_sources})
ADD_LIBRARY (CLHEPS STATIC ${clhep_sources})
SET_TARGET_PROPERTIES (CLHEP
PROPERTIES OUTPUT_NAME CLHEP-${VERSION}
CLEAN_DIRECT_OUTPUT 1
)
SET_TARGET_PROPERTIES (CLHEPS
PROPERTIES OUTPUT_NAME CLHEP-${VERSION}
CLEAN_DIRECT_OUTPUT 1
)
INSTALL (TARGETS CLHEP CLHEPS
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
endmacro (clhep_build_libclhep )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment