Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Some modernization and this should fix #68, #29 #89

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Add options
flagarde committed Jul 17, 2020
commit 3691b4495884ea87a85c3fa7050442d1959b0807
40 changes: 22 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -68,10 +68,14 @@ SET( CMAKE_CXX_STANDARD_REQUIRED ON )

# lcio.jar
option( INSTALL_JAR "Set to OFF to skip build/install lcio.jar" OFF )
option( INSTALL_APPS "Set to OFF to skip build/install of apps" ON )

option( BUILD_APPS "Set to OFF to skip build/install of apps" ON )
# allow C++ only builds
OPTION( LCIO_GENERATE_HEADERS "Set to OFF to use pre-generated headers (no java needed)" OFF)
option( LCIO_GENERATE_HEADERS "Set to OFF to use pre-generated headers (no java needed)" OFF)
option( BUILD_ROOTDICT "Set to ON to build ROOT dictionary" OFF )
option( BUILD_FORTRAN "Set to OFF to skip build/install Fortran codes" ON )
option( BUILD_F77_TESTJOBS "Set to ON to build LCIO F77 testjobs" OFF )
option( INSTALL_DOC "Set to OFF to skip build/install Documentation" OFF )
option( BUILD_LCIO_EXAMPLES "Set to ON to build LCIO examples" ON )

IF( INSTALL_JAR )
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_BUILD_TOOL} jar)" )
@@ -95,7 +99,6 @@ endif()


# ROOT
OPTION( BUILD_ROOTDICT "Set to ON to build ROOT dictionary" OFF )
IF( BUILD_ROOTDICT )
FIND_PACKAGE( ROOT 6.04 REQUIRED ) # look for ROOT versions >= 5.27.06
ENDIF()
@@ -124,11 +127,11 @@ ENDIF()


# UNIX SHELL (needed for calling LCIO_ENV_INIT script)
FIND_PROGRAM( SH sh ${CYGWIN_INSTALL_PATH}/bin /bin /usr/bin /usr/local/bin /sbin )
MARK_AS_ADVANCED( SH )
IF( NOT SH )
MESSAGE( FATAL_ERROR "unix shell not found" )
ENDIF()
#FIND_PROGRAM( SH sh ${CYGWIN_INSTALL_PATH}/bin /bin /usr/bin /usr/local/bin /sbin )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove this? It is required

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find anywhere where you use the sh program

#MARK_AS_ADVANCED( SH )
#IF( NOT SH )
# MESSAGE( FATAL_ERROR "unix shell not found" )
#ENDIF()



@@ -271,38 +274,39 @@ endif()
# replaced by standard cmake variable BUILD_TESTING
#OPTION( BUILD_LCIO_TESTS "Set to ON to build LCIO tests under src/cpp/src/TESTS" OFF )

OPTION( BUILD_LCIO_EXAMPLES "Set to ON to build LCIO examples" ON )


# lcio library
ADD_SUBDIRECTORY( ./src/cpp lcio )



# fortran examples
OPTION( BUILD_F77_TESTJOBS "Set to ON to build LCIO F77 testjobs" OFF )
IF( BUILD_F77_TESTJOBS )
ADD_SUBDIRECTORY( ./src/f77 f77 )
ENDIF()


# directory containing lcio tests
ADD_SUBDIRECTORY( ./tests )
if( BUILD_TESTING )
ADD_SUBDIRECTORY( ./tests )
endif()


### DOCUMENTATION ###########################################################

OPTION( INSTALL_DOC "Set to OFF to skip build/install Documentation" OFF )
IF( INSTALL_DOC )
ADD_SUBDIRECTORY( ./doc )
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_BUILD_TOOL} doc)" )
ENDIF()
if( INSTALL_DOC )
ADD_SUBDIRECTORY( ./doc )
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_BUILD_TOOL} doc)" )
endif()



# display some variables and write them to cache
DISPLAY_STD_VARIABLES()

MESSAGE( STATUS "BUILD_LCIO_EXAMPLES = ${BUILD_LCIO_EXAMPLES}" )
message( STATUS "BUILD_APPS = ${BUILD_APPS}" )
message( STATUS "BUILD_FORTRAN = ${BUILD_FORTRAN}" )
MESSAGE( STATUS "BUILD_F77_TESTJOBS = ${BUILD_F77_TESTJOBS}" )
MESSAGE( STATUS "BUILD_ROOTDICT = ${BUILD_ROOTDICT}" )
MESSAGE( STATUS "INSTALL_JAR = ${INSTALL_JAR}" )
83 changes: 43 additions & 40 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -3,33 +3,44 @@
# @author Frank Gaede, DESY
# @author Jan Engels, DESY
#################################

SET( LCIO_CPPFORT_SRCS
./src/CPPFORT/HEPEVT.cc
./src/CPPFORT/lccah.cc
./src/CPPFORT/lcclu.cc
./src/CPPFORT/lccol.cc
./src/CPPFORT/lcevt.cc
./src/CPPFORT/lcgob.cc
./src/CPPFORT/lciof77apiext.cc
./src/CPPFORT/lcmcp.cc
./src/CPPFORT/lcobv.cc
./src/CPPFORT/lcpid.cc
./src/CPPFORT/lcrcp.cc
./src/CPPFORT/lcrdr.cc
./src/CPPFORT/lcrdrrep.cc
./src/CPPFORT/lcrel.cc
./src/CPPFORT/lcrhd.cc
./src/CPPFORT/lcrnv.cc
./src/CPPFORT/lcsch.cc
./src/CPPFORT/lcsth.cc
./src/CPPFORT/lctph.cc
./src/CPPFORT/lctrh.cc
./src/CPPFORT/lctrk.cc
./src/CPPFORT/lcvec.cc
./src/CPPFORT/lcvtx.cc
./src/CPPFORT/lcwrt.cc
)
if( BUILD_FORTRAN )
set( LCIO_CPPFORT_SRCS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake commands in upper case please. Look also in other places

./src/CPPFORT/HEPEVT.cc
./src/CPPFORT/lccah.cc
./src/CPPFORT/lcclu.cc
./src/CPPFORT/lccol.cc
./src/CPPFORT/lcevt.cc
./src/CPPFORT/lcgob.cc
./src/CPPFORT/lciof77apiext.cc
./src/CPPFORT/lcmcp.cc
./src/CPPFORT/lcobv.cc
./src/CPPFORT/lcpid.cc
./src/CPPFORT/lcrcp.cc
./src/CPPFORT/lcrdr.cc
./src/CPPFORT/lcrdrrep.cc
./src/CPPFORT/lcrel.cc
./src/CPPFORT/lcrhd.cc
./src/CPPFORT/lcrnv.cc
./src/CPPFORT/lcsch.cc
./src/CPPFORT/lcsth.cc
./src/CPPFORT/lctph.cc
./src/CPPFORT/lctrh.cc
./src/CPPFORT/lctrk.cc
./src/CPPFORT/lcvec.cc
./src/CPPFORT/lcvtx.cc
./src/CPPFORT/lcwrt.cc
)
#---- special flags for cfortran code : --------
SET_SOURCE_FILES_PROPERTIES(
${LCIO_CPPFORT_SRCS} PROPERTIES
COMPILE_FLAGS "-Df2cFortran -Wno-unused"
)
# ----------------------------------------------------------------------------
# ------- libraries lcio + lcioF77 -------------------------------------------
ADD_LIBRARY( lcioF77 STATIC ${LCIO_CPPFORT_SRCS} )
INSTALL( TARGETS lcioF77 DESTINATION lib )
TARGET_LINK_LIBRARIES( lcioF77 lcio )
endif()

SET( LCIO_IMPL_SRCS
./src/IMPL/AccessChecked.cc
@@ -226,7 +237,9 @@ if( LCIO_GENERATE_HEADERS )
SET( IO_AID_HEADERS_DEP_LIST ${AID_HEADERS_LIST};${CXX_HEADERS_LIST} )

# make source files depend on generated header files + aid files
SET_SOURCE_FILES_PROPERTIES( ${LCIO_CPPFORT_SRCS} PROPERTIES OBJECT_DEPENDS "${EVENT_AID_HEADERS_DEP_LIST};${IO_AID_HEADERS_DEP_LIST}" )
if( BUILD_FORTRAN)
SET_SOURCE_FILES_PROPERTIES( ${LCIO_CPPFORT_SRCS} PROPERTIES OBJECT_DEPENDS "${EVENT_AID_HEADERS_DEP_LIST};${IO_AID_HEADERS_DEP_LIST}" )
endif()
SET_SOURCE_FILES_PROPERTIES( ${LCIO_IMPL_SRCS} PROPERTIES OBJECT_DEPENDS "${EVENT_AID_HEADERS_DEP_LIST}" )
SET_SOURCE_FILES_PROPERTIES( ${LCIO_IOIMPL_SRCS} PROPERTIES OBJECT_DEPENDS "${IO_AID_HEADERS_DEP_LIST}" )
# ----------------------------------------------------------------------------
@@ -249,12 +262,7 @@ endif()
#ADD_DEFINITIONS( "-Wall -ansi -pedantic" )
#ADD_DEFINITIONS( "-Wno-long-long -fno-strict-aliasing" )

#---- special flags for cfortran code : --------
SET_SOURCE_FILES_PROPERTIES(
${LCIO_CPPFORT_SRCS} PROPERTIES
COMPILE_FLAGS "-Df2cFortran -Wno-unused"
)
# ----------------------------------------------------------------------------




@@ -281,9 +289,7 @@ INSTALL_DIRECTORY( ${LCIO_AID_HEADERS_OUTPUT_DIR}/ DESTINATION include )



# ------- libraries lcio + lcioF77 -------------------------------------------
ADD_LIBRARY( lcioF77 STATIC ${LCIO_CPPFORT_SRCS} )
INSTALL( TARGETS lcioF77 DESTINATION lib )


ADD_SHARED_LIBRARY( lcio
${LCIO_IMPL_SRCS}
@@ -296,9 +302,6 @@ INSTALL_SHARED_LIBRARY( lcio DESTINATION lib )

TARGET_LINK_LIBRARIES( lcio ${CMAKE_THREAD_LIBS_INIT} )
TARGET_LINK_LIBRARIES( lcio ${SIO_LIBRARIES} )
TARGET_LINK_LIBRARIES( lcioF77 lcio )

ADD_CUSTOM_TARGET( lib DEPENDS lcio lcioF77 )
# ----------------------------------------------------------------------------