mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: consistent handling of compile/link flags for fileMonitor and setSet
This commit is contained in:
@ -1,15 +1,20 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
if [ -f /usr/include/readline/readline.h ]
|
||||
unset COMP_FLAGS LINK_FLAGS
|
||||
|
||||
#
|
||||
# use readline if available
|
||||
# unless otherwise specified (with NO_READLINE)
|
||||
#
|
||||
# eg, ./Allwmake NO_READLINE
|
||||
#
|
||||
|
||||
if [ -f /usr/include/readline/readline.h -a "${1%NO_READLINE}" = "$1" ]
|
||||
then
|
||||
echo "Found readline/readline.h -- enabling readline support."
|
||||
export READLINE=1
|
||||
export READLINELINK="-lreadline -lncurses"
|
||||
else
|
||||
# no readline/readline.h -- disabling readline support
|
||||
export READLINE=0
|
||||
unset READLINELINK
|
||||
echo "Found <readline/readline.h> -- enabling readline support."
|
||||
export COMP_FLAGS="-DHAS_READLINE"
|
||||
export LINK_FLAGS="-lreadline -lncurses"
|
||||
fi
|
||||
|
||||
wmake
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
/* NB: trailing zero after define improves robustness */
|
||||
|
||||
EXE_INC = \
|
||||
-DREADLINE=$(READLINE)0 \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
$(COMP_FLAGS)
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
$(READLINELINK)
|
||||
$(LINK_FLAGS)
|
||||
|
||||
@ -49,7 +49,7 @@ Description
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#if READLINE != 0
|
||||
#ifdef HAS_READLINE
|
||||
# include <readline/readline.h>
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
@ -59,29 +59,10 @@ using namespace Foam;
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
#if READLINE != 0
|
||||
#ifdef HAS_READLINE
|
||||
static const char* historyFile = ".setSet";
|
||||
#endif
|
||||
|
||||
Istream& selectStream(Istream* is0Ptr, Istream* is1Ptr)
|
||||
{
|
||||
if (is0Ptr)
|
||||
{
|
||||
return *is0Ptr;
|
||||
}
|
||||
else if (is1Ptr)
|
||||
{
|
||||
return *is1Ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("selectStream(Istream*, Istream*)")
|
||||
<< "No valid stream opened" << abort(FatalError);
|
||||
|
||||
return *is0Ptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Write set to VTK readable files
|
||||
void writeVTK
|
||||
@ -867,7 +848,7 @@ int main(int argc, char *argv[])
|
||||
printAllSets(mesh, Info);
|
||||
|
||||
// Read history if interactive
|
||||
# if READLINE != 0
|
||||
# ifdef HAS_READLINE
|
||||
if (!batch && !read_history(historyFile))
|
||||
{
|
||||
Info<< "Successfully read history from " << historyFile << endl;
|
||||
@ -949,7 +930,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
# if READLINE != 0
|
||||
# ifdef HAS_READLINE
|
||||
{
|
||||
char* linePtr = readline("readline>");
|
||||
|
||||
|
||||
@ -1,17 +1,20 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
unset COMP_FLAGS LINK_FLAGS
|
||||
|
||||
#
|
||||
# use <sys/inotify.h> if available (Linux)
|
||||
# unless otherwise specified (with FOAM_USE_STAT)
|
||||
# unless otherwise specified (with USE_STAT)
|
||||
#
|
||||
# eg, ./Allwmake FOAM_USE_STAT
|
||||
# eg, ./Allwmake USE_STAT
|
||||
#
|
||||
if [ -f /usr/include/sys/inotify.h -a "${1%USE_STAT}" = "$1" ]
|
||||
then
|
||||
unset FOAM_FILE_MONITOR
|
||||
echo "Found <sys/inotify.h> -- using inotify for file monitoring."
|
||||
unset COMP_FLAGS
|
||||
else
|
||||
export FOAM_FILE_MONITOR="-DFOAM_USE_STAT"
|
||||
export COMP_FLAGS="-DFOAM_USE_STAT"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
EXE_INC = $(FOAM_FILE_MONITOR)
|
||||
EXE_INC = $(COMP_FLAGS)
|
||||
|
||||
Reference in New Issue
Block a user