From c71bc62dfc8f39112aa936e34f50cfc855f6af9e Mon Sep 17 00:00:00 2001 From: Michael Wild Date: Mon, 5 Jan 2009 16:12:52 +0100 Subject: [PATCH] Now also configure data/ and etc/ files Signed-off-by: Michael Wild --- ...nfigureScripts.cmake => FFConfigureFiles.cmake} | 32 ++++++++--- CMakeLists.txt | 52 +++++++---------- README | 2 + README.html | 10 +++- bin/CMakeLists.txt | 11 +++- bin/foamLog | 12 ++-- {bin => data}/CMakeLists.txt | 65 +++++++--------------- {bin => etc}/CMakeLists.txt | 62 ++++++--------------- etc/{controlDict => controlDict.in} | 6 +- 9 files changed, 106 insertions(+), 146 deletions(-) rename CMake/Modules/{configureScripts.cmake => FFConfigureFiles.cmake} (73%) copy {bin => data}/CMakeLists.txt (63%) copy {bin => etc}/CMakeLists.txt (63%) rename etc/{controlDict => controlDict.in} (99%) diff --git a/CMake/Modules/configureScripts.cmake b/CMake/Modules/FFConfigureFiles.cmake similarity index 73% rename from CMake/Modules/configureScripts.cmake rename to CMake/Modules/FFConfigureFiles.cmake index 8aecd9e0e..c0a6bab08 100644 --- a/CMake/Modules/configureScripts.cmake +++ b/CMake/Modules/FFConfigureFiles.cmake @@ -31,39 +31,53 @@ # - Configure utility scripts for build and install tree # -# CONFIGURE_SCRIPTS( destDir [script1 ...] [COPYONLY scriptn1 ...] ) +# FF_CONFIGURE_FILES( destDir [FILEPREFIX prefix] [script1 ...] [COPYONLY scriptn1 ...] ) # # Configures all scripts passed into # - ${CMAKE_BINARY_DIR}/${destDir}/ using build tree settings # - ${CMAKE_BINARY_DIR}/InstallFiles/${destDir}/ using install tree settings # using CONFIGURE_FILE with @ONLY. If a .in suffix is present, it will be removed. # +# The prefix given after FILEPREFIX is prepended to all file names if present. +# This argument can be repeated as often as required in the argument list. # Scripts after the COPYONLY are not configured. # # Variables which are adjusted to the different trees: # - FF_DATA_DIR: -# - build tree: ${CMAKE_SOURCE_DIR}/data +# - build tree: ${CMAKE_BINARY_DIR}/data # - install tree: ${FF_INSTALL_DATA_PATH} +# - FF_DOC_DIR: +# - build tree: ${CMAKE_BINARY_DIR}/doc +# - install tree: ${FF_INSTALL_DOC_PATH} -macro( CONFIGURE_SCRIPTS _destDir ) +macro( FF_CONFIGURE_FILES _destDir ) set( _mode @ONLY ) + set( _next_is_prefix FALSE ) + set( _prefix "" ) # loop over scripts foreach( _s ${ARGN} ) - if( _s STREQUAL COPYONLY ) + if( _s STREQUAL FILEPREFIX ) + set( _next_is_prefix TRUE ) + elseif( _next_is_prefix ) + set( _prefix ${_s} ) + set( _next_is_prefix FALSE ) + elseif( _s STREQUAL COPYONLY ) set( _mode COPYONLY ) - else( _s STREQUAL COPYONLY ) + else( _s STREQUAL FILEPREFIX ) # the configured name get_filename_component( _cs ${_s} NAME ) get_filename_component( _cp ${_s} PATH ) - string( REGEX REPLACE "\\.in$" "" _cs "${_cp}/${EXECUTABLE_PREFIX}${_cs}" ) + string( REGEX REPLACE "\\.in$" "" _cs "${_cp}/${_prefix}${_cs}" ) # configure the script for build tree - set( FF_DATA_DIR ${CMAKE_SOURCE_DIR}/data ) + set( FF_DATA_DIR ${CMAKE_BINARY_DIR}/data ) + set( FF_DOC_DIR ${CMAKE_BINARY_DIR}/doc ) configure_file( ${_s} ${CMAKE_BINARY_DIR}/${_destDir}/${_cs} ${_mode} ) # configure the script for install tree set( FF_DATA_DIR ${FF_INSTALL_DATA_PATH} ) + set( FF_DOC_DIR ${FF_INSTALL_DOC_PATH} ) configure_file( ${_s} ${CMAKE_BINARY_DIR}/InstallFiles/${_destDir}/${_cs} ${_mode} ) - endif( _s STREQUAL COPYONLY ) + endif( _s STREQUAL FILEPREFIX ) endforeach( _s ) -endmacro( CONFIGURE_SCRIPTS ) +endmacro( FF_CONFIGURE_FILES ) # ------------------------- vim: set sw=2 sts=2 et: --------------- end-of-file diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f0b25d1c..4637683d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,17 +73,34 @@ endif( APPLE AND FF_BUILD_FRAMEWORK ) set( FF_INSTALL_HEADER_PATH include/${CMAKE_PROJECT_NAME}/${FF_VERSION} CACHE STRING "Header installation path (absolute or relative to CMAKE_INSTALL_PREFIX, not for frameworks)" ) set( FF_INSTALL_CONFIG_PATH etc/${CMAKE_PROJECT_NAME}/${FF_VERSION} CACHE STRING "Configuration files installation path (absolute or relative to CMAKE_INSTALL_PREFIX)" ) set( FF_INSTALL_DATA_PATH share/${CMAKE_PROJECT_NAME}/${FF_VERSION} CACHE STRING "Data files installation path (absolute or relative to CMAKE_INSTALL_PREFIX)" ) +set( FF_INSTALL_DOC_PATH share/doc/${CMAKE_PROJECT_NAME}/${FF_VERSION} CACHE STRING "Documentation files installation path (absolute or relative to CMAKE_INSTALL_PREFIX)" ) set( FF_INSTALL_PVFOAMREADER_PATH lib/${CMAKE_PROJECT_NAME}/${FF_VERSION}/plugins/PVFoamReader CACHE STRING "ParaView2 OpenFOAM-reader plugin installation path" ) set( FF_INSTALL_PV3FOAMREADER_PATH lib/${CMAKE_PROJECT_NAME}/${FF_VERSION}/plugins/PV3FoamReader CACHE STRING "ParaView3 OpenFOAM-reader plugin installation path" ) set( FF_INSTALL_USERDFOAM_PATH lib/${CMAKE_PROJECT_NAME}/${FF_VERSION}/plugins/userd-foam CACHE STRING "Ensight OpenFOAM-reader plugin installation path" ) # make absolute paths -foreach( _p FF_INSTALL_BIN_PATH FF_INSTALL_LIB_PATH FF_INSTALL_HEADER_PATH FF_INSTALL_CONFIG_PATH FF_INSTALL_DATA_PATH ) +foreach( _p FF_INSTALL_BIN_PATH FF_INSTALL_LIB_PATH FF_INSTALL_HEADER_PATH + FF_INSTALL_CONFIG_PATH FF_INSTALL_DATA_PATH FF_INSTALL_DOC_PATH ) if( NOT IS_ABSOLUTE ${${_p}} ) set( ${_p} "${CMAKE_INSTALL_PREFIX}/${${_p}}" ) endif( NOT IS_ABSOLUTE ${${_p}} ) endforeach( _p ) +# select html documentation browser (try a few well known ones for default) +# have to loop, because find_program( HTML_DOC_BROWSER NAMES ... ) garbles things up +foreach( browser open kde-open gnome-open x-www-browser www-browser firefox epiphany konqueror w3m lynx open ) + find_program( HTML_DOC_BROWSER ${browser} + DOC "Program to open an HTML file" ) + if( HTML_DOC_BROWSER ) + set( FF_HTML_DOC_BROWSER_COMMAND "${HTML_DOC_BROWSER} %f" CACHE STRING "Command to open an HTML file" ) + break() + endif( HTML_DOC_BROWSER ) +endforeach( browser ) +if( NOT HTML_DOC_BROWSER ) + message( SEND_ERROR "Failed to find a program to open HTML pages with (a.k.a a browser). Point HTML_DOC_BROWSER to a suitable program." ) +endif( NOT HTML_DOC_BROWSER ) +mark_as_advanced( HTML_DOC_BROWSER FF_HTML_DOC_BROWSER_COMMAND ) + # set up the RPATH for installation set( CMAKE_INSTALL_RPATH ${FF_INSTALL_LIB_PATH} ) @@ -218,6 +235,8 @@ include_directories( ${CMAKE_BINARY_DIR}/include ) # descend into the sources... add_subdirectory( bin ) +add_subdirectory( etc ) +add_subdirectory( data ) add_subdirectory( src ) add_subdirectory( applications ) @@ -268,37 +287,6 @@ install( EXPORT FreeFOAMLibraryDepends COMPONENT dev ) -# install the config files -install( FILES - etc/controlDict - etc/cellModels - DESTINATION ${FF_INSTALL_CONFIG_PATH} - COMPONENT config - ) -install( DIRECTORY - etc/thermoData - DESTINATION ${FF_INSTALL_CONFIG_PATH} - COMPONENT config - ) - -# install the data files -install( FILES - data/templates/foamCommentStyles - data/templates/foamScript - data/templates/foamAppTemplate.C - data/templates/foamTemplate.C - data/templates/foamTemplate.H - data/templates/foamTemplateI.H - data/templates/foamTemplateIO.C - data/templates/foamUtilTemplate.cfg - data/templates/foamTemplateTemplate.C - data/templates/foamTemplateTemplate.H - data/templates/foamTemplateTemplateI.H - data/templates/foamTemplateTemplateIO.C - DESTINATION ${FF_INSTALL_DATA_PATH}/templates/ - COMPONENT data - ) - # pack things up include( FreeFOAMCPack ) diff --git a/README b/README index f10978ba2..4815d4ea2 100644 --- a/README +++ b/README @@ -351,6 +351,8 @@ Configuration reference +FF_INSTALL_CONFIG_PATH+:: Installation path of the configuration files. If not absolute, it is relative to +CMAKE_INSTALL_PREFIX+. ++FF_BUILD_FRAMEWORK+:: + If this is enabled, the libraries are built as frameworks. Only available on Mac OS X. +FF_INSTALL_HEADER_PATH+:: Installation path of the header files. If not absolute, it is relative to +CMAKE_INSTALL_PREFIX+. On Mac OS X, and if diff --git a/README.html b/README.html index d31e81672..5d62dafca 100644 --- a/README.html +++ b/README.html @@ -952,6 +952,14 @@ line arguments and then open the <something>.OpenFOAM file from w

+FF_BUILD_FRAMEWORK +
+
+

+ If this is enabled, the libraries are built as frameworks. Only available on Mac OS X. +

+
+
FF_INSTALL_HEADER_PATH
@@ -1110,7 +1118,7 @@ line arguments and then open the <something>.OpenFOAM file from w diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index 633fdf393..6f0907e19 100644 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -30,9 +30,10 @@ #------------------------------------------------------------------------------- # configure the utility scripts for build tree and the install tree -include( configureScripts ) +include( FFConfigureFiles ) -configure_scripts( bin +ff_configure_files( bin + FILEPREFIX ${EXECUTABLE_PREFIX} newSource.in newSourceTemplate.in @@ -52,7 +53,6 @@ configure_scripts( bin foamGraphResUVWP foamJob foamLog - foamLog.db foamNew foamPack foamPackBin @@ -70,6 +70,11 @@ configure_scripts( bin foamUpgradeTurbulenceProperties mpigammarun paraFoam + ) + +ff_configure_files( bin + COPYONLY + foamLog.db paraFoam.pvs ) diff --git a/bin/foamLog b/bin/foamLog index a2f68cc8a..56bf707ae 100755 --- a/bin/foamLog +++ b/bin/foamLog @@ -36,10 +36,10 @@ PROGDIR=`dirname $0` PROGNAME=`basename $0` -if [ -r $HOME/.${PROGNAME}.db ]; then - DBFILE=$HOME/.${PROGNAME}.db +if [ -r $HOME/.foamLog.db ]; then + DBFILE=$HOME/.foamLog.db else - DBFILE=$PROGDIR/$PROGNAME.db + DBFILE=$PROGDIR/foamLog.db fi @@ -85,8 +85,8 @@ separated with '/'. Column 1 is the name of the variable (cannot contain spaces), column 2 is the extended regular expression (egrep) to select the line and column 3 is the string (fgrep) to select the column inside the line. The value taken will be the first (non-space)word after this -column. The database will either be \$HOME/.${PROGNAME}.db or if not -found $PROGDIR/${PROGNAME}.db. +column. The database will either be \$HOME/.foamLog.db or if not +found $PROGDIR/foamLog.db. Option -s suppresses the default information and only prints the extracted variables. @@ -262,7 +262,7 @@ fi #-- Make logs dir in case directory and put awk file there. mkdir -p $CASEDIR/logs -AWKFILE=$CASEDIR/logs/$PROGNAME.awk +AWKFILE=$CASEDIR/logs/foamLog.awk myEcho "Using:" myEcho " log : $LOG" diff --git a/bin/CMakeLists.txt b/data/CMakeLists.txt similarity index 63% copy from bin/CMakeLists.txt copy to data/CMakeLists.txt index 633fdf393..6174c84ef 100644 --- a/bin/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -29,57 +29,30 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #------------------------------------------------------------------------------- -# configure the utility scripts for build tree and the install tree -include( configureScripts ) - -configure_scripts( bin - newSource.in - newSourceTemplate.in +# configure the utility data files for build tree and the install tree +include( FFConfigureFiles ) +ff_configure_files( data COPYONLY - createCMakeFiles - doxyFilt - foamAllHC - foamCheckJobs - foamCleanTutorials - foamClearPolyMesh - foamCopySettings - foamDistccd - foamEbrowse - foamEndJob - foamGraphExecTime - foamGraphResKE - foamGraphResUVWP - foamJob - foamLog - foamLog.db - foamNew - foamPack - foamPackBin - foamPackBinAll - foamPackDoxygen - foamPackGeneral - foamPackSource - foamPackThirdPartyBin - foamPackThirdPartyGeneral - foamPrintJobs - foamProcessInfo - foamRunTutorials - foamSolverSweeps - foamUpdateCaseFileHeader - foamUpgradeTurbulenceProperties - mpigammarun - paraFoam - paraFoam.pvs + templates/foamAppTemplate.C + templates/foamCommentStyles + templates/foamScript + templates/foamTemplate.C + templates/foamTemplate.H + templates/foamTemplateI.H + templates/foamTemplateIO.C + templates/foamTemplateTemplate.C + templates/foamTemplateTemplate.H + templates/foamTemplateTemplateI.H + templates/foamTemplateTemplateIO.C + templates/foamUtilTemplate.cfg ) -# install the utility scripts +# install the template files install( DIRECTORY - ${CMAKE_BINARY_DIR}/InstallFiles/bin - DESTINATION ${FF_INSTALL_BIN_PATH} - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT bin + ${CMAKE_BINARY_DIR}/InstallFiles/data/ # LEAVE THAT TRAILING / + DESTINATION ${FF_INSTALL_DATA_PATH} + COMPONENT data ) - # ------------------------- vim: set sw=2 sts=2 et: --------------- end-of-file diff --git a/bin/CMakeLists.txt b/etc/CMakeLists.txt similarity index 63% copy from bin/CMakeLists.txt copy to etc/CMakeLists.txt index 633fdf393..2783ef970 100644 --- a/bin/CMakeLists.txt +++ b/etc/CMakeLists.txt @@ -29,57 +29,29 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #------------------------------------------------------------------------------- -# configure the utility scripts for build tree and the install tree -include( configureScripts ) +# configure the utility config files for build tree and the install tree +include( FFConfigureFiles ) -configure_scripts( bin - newSource.in - newSourceTemplate.in +ff_configure_files( etc + controlDict.in COPYONLY - createCMakeFiles - doxyFilt - foamAllHC - foamCheckJobs - foamCleanTutorials - foamClearPolyMesh - foamCopySettings - foamDistccd - foamEbrowse - foamEndJob - foamGraphExecTime - foamGraphResKE - foamGraphResUVWP - foamJob - foamLog - foamLog.db - foamNew - foamPack - foamPackBin - foamPackBinAll - foamPackDoxygen - foamPackGeneral - foamPackSource - foamPackThirdPartyBin - foamPackThirdPartyGeneral - foamPrintJobs - foamProcessInfo - foamRunTutorials - foamSolverSweeps - foamUpdateCaseFileHeader - foamUpgradeTurbulenceProperties - mpigammarun - paraFoam - paraFoam.pvs + cellModels + thermoData/BurcatCpData + thermoData/therm.dat ) -# install the utility scripts +# install the config files +install( FILES + ${CMAKE_BINARY_DIR}/InstallFiles/etc/controlDict + ${CMAKE_BINARY_DIR}/InstallFiles/etc/cellModels + DESTINATION ${FF_INSTALL_CONFIG_PATH} + COMPONENT config + ) install( DIRECTORY - ${CMAKE_BINARY_DIR}/InstallFiles/bin - DESTINATION ${FF_INSTALL_BIN_PATH} - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT bin + ${CMAKE_BINARY_DIR}/InstallFiles/etc/thermoData + DESTINATION ${FF_INSTALL_CONFIG_PATH} + COMPONENT config ) - # ------------------------- vim: set sw=2 sts=2 et: --------------- end-of-file diff --git a/etc/controlDict b/etc/controlDict.in similarity index 99% rename from etc/controlDict rename to etc/controlDict.in index e0a2f080b..2c09ed549 100644 --- a/etc/controlDict +++ b/etc/controlDict.in @@ -18,12 +18,10 @@ FoamFile Documentation { - docBrowser "kde-open %f"; + docBrowser "@FF_HTML_DOC_BROWSER_COMMAND@"; doxyDocDirs ( - "$WM_PROJECT_USER_DIR/Doxygen/html" - "~OpenFOAM/Doxygen/html" - "$WM_PROJECT_DIR/doc/Doxygen/html" + "@FF_DOC_DIR@/Doxygen/html" ); doxySourceFileExts ( -- 2.11.4.GIT