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